Jean-Philippe Lesot wrote:
> Sorry if my question is out of topic in this mailing list.
> I know quite well mechanismes inside a JVM but I don't know what a java
> compiler is allowed to do to optimize Java _bytecode_. Because array
> elements can't be volatile, it is not clear for me what is possible: (i) Is
> it possible for a java compiler to optimize two consecutive writes (e.g.
> IASTORE) at the same index in only one?
Certainly possible. Most modern JITs do this.
> (ii) It is possible for a java
> compiler to reorder writes in two different arrays?
> I need a way to prevent
> such optimizations without using method call but using classic array access.
> Is it possible in the present Java Memory Model? And in your proposition?
Insert a lock/unlock between the array refs.
> Thanks you for your help, and sorry for my English.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:36 EDT