java vs ia64 abi exceptions

Richard Henderson rth@redhat.com
Thu Mar 22 17:56:00 GMT 2001


On Thu, Mar 22, 2001 at 06:42:17PM -0700, Tom Tromey wrote:
> I'm not really sure what all this means. For instance I don't know
> what it means for a cleanup to throw.

 struct S { ~S() { throw 1; } }
 void foo()
 {
 S s;
 bar();
 }
If "bar" throws, then "s" will be destroyed with a cleanup.
That cleanup (S::~S) will throw, which will call terminate.
> If `monitorexit' is implemented as a cleanup

Almost certainly.
> ... as monitorexit is allowed to throw. However, compiled
> Java code should never call terminate.

Right. But the question is, do we ever get into this situation
in the C++ compiled java runtime? If so, we really ought to be
choosing exception models more explicitly (and earlier) than
seeing what types are given to "catch".
I'm guessing not, since it seems likely that you'd have run into
this before. But in implementing the Java personality routine
today I've run across several things that would be more space
efficient if we arranged the language-specific data areas 
differently.
So: what do you think of a "#pragma java_exceptions" or something
at the top of your files? This would
 (a) Prevent cleanups from being protected by std::terminate.
 (b) Error on exception specifications (since that's handled
 completely differently in Java)
 (c) Error if non-Java types are caught or thrown.
 (d) Install the java personality instead of the c++ personality,
r~


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /