Could someone refer me to documentation, or give me a brief
explanation as to why the following will not work--with the caveat
that I am still new to this, and have not gotten beyond generating and
running jitted code via the LLVM libraries:
Imagine three functions fa, fb, fc where fa, and fc are generated and
jitted with llvm. Function fb on the other hand has external C linkage
and is statically compiled along with the llvm generating code into
one executable.
- fc merely executes an unwind.
- fa uses invoke to call fb, passing its own arguments to it, which in
turn calls fc.
- At runtime fa is called (after jitting from a main(...) C routine),
with a pointer to an ExecutionEngine instance, and a Function pointer
to fc, both typed as Type::Int8Ty->getPointerTo() (at code generation
time).
- fa takes these arguments and invokes fb with them.
- fb being a non-generated C function, takes the passed in Function
pointer and engine instance, retrieves the jitted C pointer, and calls
it.
- As this pointer is a pointer to fc, the unwind is then executed.
Basically I have the call stack fa->fb->fc with fa, fc generated and
fb not generated. Given that I was using the intuitive model of a
setjump, longjump, I thought that fc's unwind would pass through fb
and end up at fa's invoke's exception block. However it cores even
though I've verified that each function is being executed. So I guess
either there is something fundamental I don't understand, or I have
another issue.
Although I'm assuming this problem is obvious to those in the know, I
can supply test code if desired.
Thanks in advance
Garrison