This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dynamically generated code and DWARF exception handling


Tom Tromey a écrit :

"jacob" == jacob navia <jacob@jacob.remcomp.fr> writes:



jacob> This application generates dynamically code and executes it, using a jacob> JIT, a Just In time Compiler. Everything is working OK until the C++ jacob> code generates a throw.

Fun!

I looked at this a little bit with libgcj.

In some ways for libgcj it is simpler than it is for C++, since in the
gcj context we know that the only objects thrown will be pointers.
So, if we were so inclined, we could give the JIT its own exception
handling approach and have little trampoline functions to handle the
boundary cases.


Well, there is no exception handling in the generated machine code, and we want not to have any exception handling but to let the C++ exception handling PASS THROUGH our stack frames to find its eventual catch. This means that we have to give the run time function that implements the throw some way of getting into the higher up frames without crashing. The problem is that any throw that encounters intermediate assembler frames will inevitably CRASH.

Unfortunately things are also worse for libgcj, in that we need to be
able to generate stack traces as well, and the trampoline function
approach won't work there.



????? Sorry I do not follow here


Still, if you know something about the uses of 'throw' in your
program, maybe this would work for you.

Longer term, yeah, gcc's unwinder needs a JIT API, and then the
various JITs need to be updated to use it. At least LLVM appears to
be headed this direction.


Very interesting but maybe you could be more specific?

I browsed that "llvm" and seems a huge project, as libgcj is. To go through all that code to find how they implement this, will be extremely difficult. If you could give me some hints as to where is the needle in those haystacks I would be really thankful.

Tom


jacob



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]