I have two JIT runs in the same process.
First one runs fine. During the second JIT run the exception is thrown, and process catches SEGV after it is thrown and before it is caught.
In debugger I see that crash occurs in the function 'classify_object_over_fdes' called from 'init_object' called from 'search_object' called from '_Unwind_Find_registered_FDE'. Crash occurs on invalid FDE object after several iterations over the valid FDE objects. So it looks like an invalid FDE object is attached to the valid ones. Also when I split two JIT runs into the separate processes nothing crashes.
As I understand, __deregister_frame has to be called during code removal. I can only see __register_frame call, and not __deregister_frame. Why?
Synopsys of the change: fixed the cleanup process of exception information in JIT. Now JIT deregisters registered by it FDE structures allowing consecutive JIT runs to succeed.
Note: tools like lli should delete ExecutionEngine object and not the module. Module is deleted by ExecutionEngine. Also I am not sure if this is proper for the module to be owned by ExecutionEngine. I think they should be independently owned.