[LLVMdev] crash in JIT when running the inliner

Nuno Lopes nunoplopes at sapo.pt
Sun Aug 10 10:31:50 PDT 2008


Hi,

So I found what's problem that has been bugging me. The main problem is that 
the inliner deletes internal functions that are no longer called, even if 
there's still a reference to those functions in the JIT stub->function map 
(leaving dangling pointers behind).

Let me expand:
1) I JIT compile a few functions (with getPointerFunction()). As I'm using 
the JIT engine in lazy mode, this code contains a function call to a stub of 
function foo
2) I run the inliner optimization and it decides to inline all the calls to 
function foo
3) the inliner pass decides that the function can be removed because it is 
internal and there are no references left
4) I run one of the previously JITed functions (that contain a call to a 
stub of foo) and it crashes, because it tries to compile a function that no 
longer lives in memory

So, is this explanation clear enough for you to understand the problem?
Do you think this bug can be fixed (by making the inliner pass JIT-aware or 
by injecting dependencies in the call graph from the JIT stub map)?

Thank you,
Nuno 




More information about the llvm-dev mailing list