>Would a compiler ever want to reorder...
To make this more concrete, consider:
/* A read of a variable and a following call to external() */
int x = this.x;
System.out.println("After reading this.x");
/* A call to external() and a following write to a variable */
System.out.println("Before writing this.x");
this.x = x;
----- Original Message -----
From: "Bill Pugh" <pugh@cs.umd.edu>
To: "javamemorymodel-cs.umd.edu" <javamemorymodel@cs.umd.edu>
Sent: Wednesday, April 14, 2004 3:01 PM
Subject: JavaMemoryModel: Moving memory operations across external actions
Say that external() is a function that interacts
with the world outside of a JVM (e.g., it writes
to a socket). For simplicity's sake, assume it both
influences and is influenced by the outside world.
Would a compiler ever want to reorder
* a read of a variable and a following
call to external() ?
* a call to external() and a following
write to a variable?
In these cases, I talking about a normal,
non-volatile variable.
Bill
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:04 EDT