[concurrency-interest] Volatile array and Wait
dholmes at dltech.com.au
Thu Oct 20 10:58:35 EDT 2005
Mike Skells writes:
> On the consideration of a no op ...
> volatile Object b = new Object;
> b = b; // volatile write
> Isnt the compiler/jit liable to remove the b=b statement, through
> the normal rules of elimination of redundent code, or is this
> explicitely barred for volatile variables
It can't remove the memory synchronization actions, even if it could
eliminate the "code".
> Similarly if a variable is never read, or never written, and is
> private then it can be eliminated cant it
Depends how absolute "never" is :) There are various ahead-of-time building
tools that purge unused fields and code from class files using whole-program
analysis - and presume no reflective (or jni) access :). Not sure a jit
would ever get involved with this though.
More information about the Concurrency-interest