RE: JavaMemoryModel: Executions I find profoundly troubling

From: Bill Pugh (
Date: Tue Jul 29 2003 - 01:38:07 EDT

At 4:34 PM -0700 7/28/03, Jerry Schwarz wrote:
>Hans is correct. You must take type safety issues into account.

I think we are all agreed on type safety.

Now Jerry might suggest that it would be OK to insert additional
redundant reads, so long as it can be shown that doing so would not
violate the Java type system, or access outside the bounds of an

However, there are also type-like systems that are part of a
program's design, but not part of the JVM. And we also need to be
careful about violating these.

Considering the following code fragment. Assume Cmd is some immutable
class denoting a command:

Cmd c = Global.nextCommand;
if (isSafe(c))

I believe it would be very dangerous to allow a compiler to transform this

if (isSafe(Global.nextCommand))

because this change could allow the execution of unsafe commands.

JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:47 EDT