PS - I realize my example is not "concrete" because I'm overlooking the
possible exception and synchronization.
In the absence of exceptions and synchronization, though, an external call
can still carry a message about its (original) place in the program order,
it can take arbitrarily long to complete, and it can interact with the
outside world in other ways.
If this motion were allowed, could any of these side-effects be used
individually or in combination to detect that a correctly-synchronized
program was not executing in a SC manner?
----- Original Message -----
From: "Joseph Bowbeer" <jozart@blarg.net>
To: "javamemorymodel-cs.umd.edu" <javamemorymodel@cs.umd.edu>; "Bill Pugh"
<pugh@cs.umd.edu>
Sent: Wednesday, April 14, 2004 4:41 PM
Subject: Re: JavaMemoryModel: Moving memory operations across external
actions
>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