JavaMemoryModel: Final Semantics?

From: Yang, Yue (yyang@enterasys.com)
Date: Sun Mar 31 2002 - 21:26:58 EST


Bill and Jeremy,

Consider the following code:

class foo{
        final int a;

        public foo() {
                int r;

                a = 1;
                r = a;
        }
}
Do you allow r = 0?

It seems to me this is allowed by your "readFinal" definition. Because when
the read happens, "kF" of "this" does not contain a. So it could return
either 1 or the defaut value of a.

If so, this would violate local program data dependency. I think we probably
want to use a stronger guard "if v is in (kF Union knownFrozen_t)" in
"readFinal" to fix this problem.

Also:
* In the definition of "readFinal", "oF'" is not used any where. Why keeping
the statement "oF' = overwritten_v"?

* Since the local tuple is defined to be "<a, oF, kF>", would it be more
consistent if the 2nd and 3rd parameters be swapped in the return statements
of read instructions?

Thanks for your clarifications.

Jason Yue Yang
Firmware Engineer
Enterasys Networks
Phone:  801-887-9833

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



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