RE: JavaMemoryModel: Unexpected weakness/divergence in old JVM spec of final fields

From: Jerry Schwarz (jerry.schwarz@oracle.com)
Date: Mon Jan 05 2004 - 12:53:11 EST


At 08:40 AM 1/5/2004, Bill Pugh wrote:

>OK, I would be happy with just disallowing classfiles that allow multiple
>writes to the same final field. It is certainly simpler than the alternatives.
>
>But could we get away with requiring that 1.5 verifiers reject such
>classfiles, given that the current 1.5 alpha verifier does not?

If you want to do this you need to be much more specific about exactly what
you want to reject. It's important that all verifiers follow the same rules.

For example, the rules should not reject

class X {
     final int x;
     X(int cond) { if ( cond > 0 ) { x = 1; } else { x = -1; } }
}

>If not, do we have to say what the semantics are for classfiles that
>violate this rule, or can we simply leave it undefined?

I think we should.

I earlier made a proposal that all assignments to final variables after the
first are unordered by the before relationship with any other operation.

> Bill
>-------------------------------
>JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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