[Bug 145] Java volatile and final access flags are ignored, except in reflection

[email protected] Sat, 16 Jul 2005 14:22:50 -0400
Newsgroups gmane.comp.java.vm.sablevm.bugs
Message-ID <[email protected]>
http://sablevm.org/bugs/show_bug.cgi?id=145





------- Additional Comments From [email protected]  2005-07-16 14:22 -------
I have a patch in my sandbox for the switch interpreter.  It isn't fully ready
yet, but it will work.  Actually I expect integrating all this into the trunk
and all three engines to be a much longer process.

I created 72 new instructions -- volatile and final versions of get/put
field/static.

Inside the body of the prepare_get/put, I check the access flag, and if volatile
or final I update the argument to the REPLACE that follows.

There is a further complication... volatiles require a memory barrier on every
access (conservatively), but for finals we only need a barrier for the first
load from a newly created object.  Thus my plan is to introduce a new bit into
object headers that marks if we need a barrier.  The get/put_final_field/static
instruction will still need to read that bit on each access (since, it may be
referring to different objects), but at least the barrier won't be necessary.

It's not clear to me how this can work with the inline-threaded engine, since
you need to update a get/put in the middle of a sequence.  Any insight?  I think
the direct-threaded engine is ok.



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.