Re: Java_java_lang_VMClass_getDeclaredFields question
Etienne Gagnon <[email protected]> Wed, 19 Jan 2005 01:20:13 -0500
| Newsgroups | gmane.comp.java.vm.sablevm.devel |
|---|---|
| Organization | UQAM |
| Message-ID | <[email protected]> |
Grzegorz B. Prokopski wrote:
> If the lock you took via enter_object_monitor at the beginning was
> taken, then the monitor_acquired is set to true, so the
> exit_object_monitor should never fail, unless there's a serious
> problem within the JVM itself.
Wrong. The code between the monitor acquisition and release is
arbitrary, and I feel no need to analyze it deeply (for all similar
functions). Possibly, this code could call verifiable, yet inconsistent
Java code which would do a "MONITOR_EXIT" or something similar.
The correct thing to do is to attempt to release the monitor, and if a
problem is detected, throw the appropriate exception/error, as
documented in the Java & JVM specifications.
> I think that instead of goto: end; (which is the same as if we just
> continued, because monitor_acquired was set to false alread) in case
> of failure on unlock we should have fatal_error("impossible control
> flow"); or "internal error" or sth. similar.
I disagree. The code should be left as it is. The "spurious" goto, in
this function, is not spurious in other functions which acquire/release
monitors, so I highly recommend leaving the code untouched, for the sake
of consistency.
Actually, calling fatal_error would be in dire contradiction to the
specifications, and is to be avoided like plague. The very few call to
it are for things that cannot ever be triggered by verifiable (even if
weird) Java code.
> Good catch, Chris. This is how I see it, at least.
Bad catch, Greg. [Sorry, but it was too tempting ;-)]
> Have I missed anything?
It seems so. :-)
Have fun!
Etienne
--
Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/
SableVM: http://www.sablevm.org/
SableCC: http://www.sablecc.org/
_______________________________________________
SableVM-devel mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-devel
signature.asc
(application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB7fwdjyrJi4rH84gRAq6mAJ4x/zEgGIrIs+9SSSFm2CvLwV4wLwCeI768 rwQa/dW/TUmylW5niZK4m4k= =BSnO -----END PGP SIGNATURE-----