This is the mail archive of the java@gcc.gnu.org mailing list for the Java 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: documentation on "sjlj exceptions", DWARF2, etc?


Adam Megacz wrote:

>It appears that I need to educate myself on gcc's ABI for C++
>exceptions. Can anybody refer me to a good source of documentation for
>DWARF2 and (more importantly) "sjlj exceptions" (I have no idea what
>the heck that means, by the way). 
>
DWARF2 exceptions involve unwinding the stack and locating "catch" 
blocks using DWARF2 bytecodes emitted by the compiler in a separate 
binary section. The DWARF2 unwind information is similar but not the 
same as the DWARF2 debugging info used by gcc/gdb on some targets.
Advantages: zero execution time overhead for try{} blocks, ie exceptions 
only cost when they are thrown.
Disadvantages: Requires platform-specific voodoo to throw exceptions 
from frames that wern't set up by GCC, ie signal handlers. This is 
neccessary for Java in order to map segfaults into 
NullPointerExceptions. This voodoo is currently only implemented in the 
MD_FALLBACK_FRAME_STATE_FOR macro on some linux platforms.

SJLJ exceptions involve using the setjmp()/longjmp() functions (see your 
glibc manual) to save and restore execution state, so basically setjmp() 
is called where each try{} block is entered and longjmp() is called to 
throw.
Advantages: Fairly simple and portable. Can throw from signal handler 
without issues.
Disadvantages: Extra code at each try, which must be executed even if 
exception doesn't actually get thrown.

Unfortunatly I don't think there is much documentation beyond than 
comments in gcc/unwind-dw2.c, etc.

>Info on something called "EH
>personalities" would also be appreciated; I see "EH" sprinkled
>throughout the mingw exception handling code...
>
As I understand it, the "EH personality functions" are what plugs the 
language-specific EH semantics into the generic GCC EH framework. Thus 
there is a C++ personality function in libsupc++, and a Java personality 
function in libjava (exception.cc).

regards

Bryce.



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