java exception
Bryce McKinlay
mckinlay@redhat.com
Fri Jun 24 19:31:00 GMT 2005
Yang Chang wrote:
> I am trying to understand the GCJ implementation of Java exception
> mechanism. Currently, I am aware of that the GCJ compiler uses the
> return value of a "gen_reg_rtx(ptr_mode);" (in function
> "get_exception_pointer") to represent something which holds a
> reference to an _Unwind_Exception struct and such a reference is
> passed to function _Unwind_RaiseException in libjava. However, I
> couldn't figure out how the two things map each other. I mean, how the
> _Unwind_RaiseException or some other lower level functions assign the
> aforementioned reference to what that rtx represents? and what that
> rtx really represents?
The code you are looking at is used when generating an exception
_handler_. When the unwind mechanism gives control to the handler, the
exception object that was thrown needs to be passed to it somehow.
get_exception_pointer yields an RTL expression (in this case a REG, ie a
register) where a pointer to the _Unwind_Exception will be found. The
_Unwind_Exception will be put in that register by the unwinder before it
jumps into the handler. You'll want to look in gcc/unwind* and
libjava/exception.cc for the code for the unwinder itself.
Bryce
More information about the Java
mailing list