Hi, I want to implement a tool that probes a function with several input and records all the return output. The function might have more than 1 return value (by reference parameters). Does ExecutionEngine::runFunction() support function call with complex argument type? If not, I guess that I have to create a wrapper function, prepare all the data, and call the original function. Am I on the right track? Thanks a lot. Vu Le -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110111/40ee78b2/attachment.html>
On Tue, Jan 11, 2011 at 1:41 PM, Vu Le <vmle at ucdavis.edu> wrote:> Hi, > I want to implement a tool that probes a function with several input and > records all the return output. > The function might have more than 1 return value (by reference parameters). > > Does ExecutionEngine::runFunction() support function call with complex > argument type? > If not, I guess that I have to create a wrapper function, prepare all the > data, and call the original function. > Am I on the right track?For functions with complicated parameters and return values, runFunction will generate a wrapper function that calls the function with the right arguments. This is fairly expensive and leaks memory if called more than once for the same function. If the type of the function is known, you can just use getPointerToFunction, cast that, and call it from C. If it's not known but you want to call it many times with different arguments, you could generate a wrapper function responsible for unpacking your own datastructure describing the arguments and calling the function you are testing with those arguments. Seems like you are on the right track there. Reid
Hi Reid, If an argument is a pointer and the function changes the value it pointed to, do you know how to get that updated value after executing the wrapper function? Thanks. Vu On Tue, Jan 11, 2011 at 2:40 PM, Reid Kleckner <reid.kleckner at gmail.com>wrote:> On Tue, Jan 11, 2011 at 1:41 PM, Vu Le <vmle at ucdavis.edu> wrote: > > Hi, > > I want to implement a tool that probes a function with several input and > > records all the return output. > > The function might have more than 1 return value (by reference > parameters). > > > > Does ExecutionEngine::runFunction() support function call with complex > > argument type? > > If not, I guess that I have to create a wrapper function, prepare all the > > data, and call the original function. > > Am I on the right track? > > For functions with complicated parameters and return values, > runFunction will generate a wrapper function that calls the function > with the right arguments. This is fairly expensive and leaks memory > if called more than once for the same function. If the type of the > function is known, you can just use getPointerToFunction, cast that, > and call it from C. > > If it's not known but you want to call it many times with different > arguments, you could generate a wrapper function responsible for > unpacking your own datastructure describing the arguments and calling > the function you are testing with those arguments. Seems like you are > on the right track there. > > Reid >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110210/58a0e295/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Unit testing with random input using JIT
- [LLVMdev] Unit testing with random input using JIT
- [LLVMdev] Unit testing with random input using JIT
- [LLVMdev] JIT : Does it cache the compiled code of executed functions upon runFunction(..)?
- [LLVMdev] JIT : Does it cache the compiled code of executed functions upon runFunction(..)?