synchronization in gcj
Godmar Back
gback@cs.utah.edu
Fri Jan 15 09:32:00 GMT 1999
Jerry,
>
> If the exception handling is badly structured (in terms of mapping of
> bytecode ranges to handlers) then it is possible to miss execution of
> monitorexit before returning from the method. This bug is present in both
> bytecode produced by Sun's javac, and also IBM's jikes.
I didn't know about this. Can you give an example of or pointer to code
that javac or jikes mishandles?
The convention that monitor_exit be placed in exception handling code
is one that the compiler is supposed to guarantee, but the verifier won't
enforce it, will it?
About your argument that a robust runtimes should unlock all locks held
in a method --- I am not sure if that argument holds up. Isn't this like
saying that the run-time should silently fix errors made by the compiler?
And if the verifier does indeed *not* check the symmetry of exit and enter,
what's to prevent a programmer from creating bytecode like :
lock() {
MONITOR_ENTER
}
unlock() {
MONITOR_EXIT
}
If that bytecode passes the verifier, the run-time should run it, should
it not --- even in the face of exceptions.
- Godmar
More information about the Java
mailing list