hg: valhalla/valhalla/langtools: values do not support == or !=

Paul Govereau paul.govereau at oracle.com
Thu Jul 31 23:23:40 UTC 2014


You are right, the prototype is almost certainly wrong on this count.
My interpretation of the specification:

   http://cr.openjdk.java.net/~jrose/values/values-0.html

is that, either:

   v1 == v2  ==> v1.equals(v2)

or

   v1 == v2 ==> forall (f1,f2) in fields of (v1,v2), f1 == f2

The first one could be implemented trivially in javac, but it raises 
some questions about when the programmer/compiler is required to 
implement equals. The second one could also be implemented in javac, or 
at the JVM level by expanding the definition, or perhaps with vcmp. We 
don't have a vcmp yet, so this last option will have to wait a bit.

At the moment, == would generate an acmp, which will work fine, but is 
hiding a compatibility issue. I thought making == illegal was a better 
choice until we decide what should happen. Of course, it is easy to 
change if we prefer an acmp for now.

Paul

On 07/31/2014 05:16 PM, Remi Forax wrote:
>
> On 07/31/2014 10:18 PM, paul.govereau at oracle.com wrote:
>> Changeset: 532af9586535
>> Author:    pgovereau
>> Date:      2014-07-31 16:16 -0400
>> URL:
>> http://hg.openjdk.java.net/valhalla/valhalla/langtools/rev/532af9586535
>>
>> values do not support == or !=
>>
>> ! src/share/classes/com/sun/tools/javac/comp/TransValues.java
>> ! test/tools/javac/valhalla/values/CheckClone.java
>> + test/tools/javac/valhalla/values/CheckEquals.java
>> + test/tools/javac/valhalla/values/CheckEquals.out
>>
>
> Hi Paul,
> Are you sure about this one ?
> for me a == on a value type is allowed and emit a vcmp.
>
> Rémi
>



More information about the valhalla-dev mailing list