hg: valhalla/valhalla/langtools: Fix: Synthesized java.lang.__Value type is not flagged as a value type.

Srikanth srikanth.adayapalam at oracle.com
Wed Feb 24 05:40:22 UTC 2016



On Wednesday 24 February 2016 01:20 AM, Remi Forax wrote:
> Hi Srikanth,
> i'm not sure it's a good idea to do that,
> __Value is not a value type per se, as java.lang.Enum is not an enum.

Hello Rémi,

Thanks for your feedback.

Quite a few things in this area are in flux.

See that the patch we are talking about concerns - as the name of the
method 
(com.sun.tools.javac.code.Symtab#synthesizeJavaLangValueClassIfMissing)
indicates - what javac should do when it does *not* find java.lang.__Value.

When it does find it properly in 
valhalla/jdk/src/java.base/share/classes/java/lang/__Value.java
see that the compiler will see the source file (or the equivalent class 
file) that has a class
declaration header that reads:

__ByValue final public class __Value {
...
}

This class is tagged as a value class as well as is final which is 
problematic.
So the patch is at worst ensuring consistent treatment in an error scenario
as in a normal scenario.

The most pressing need for the change was that in the absence of it, javac
can generate code for a value type constructor that uses aload0 instead 
vload 0
for example in:

public final __ByValue class X {
    X() {
        System.out.println("X::X");
    }
}

   X();
     Code:
        0: aload_0
        1: invokespecial #6                  // Method 
java/lang/__Value."<init>":()V

instead of

    Code:
        0: vload         0
        2: invokespecial #6                  // Method 
java/lang/__Value."<init>":()V

This is causing problems for me in another experiment I am working on.

Long story short, I agree this is something we need to watch for and 
decide what
is the right thing to do.

Thanks!
Srikanth




>
> Rémi
>
> ----- Mail original -----
>> De: "srikanth adayapalam" <srikanth.adayapalam at oracle.com>
>> À: valhalla-dev at openjdk.java.net
>> Envoyé: Mardi 23 Février 2016 05:36:51
>> Objet: hg: valhalla/valhalla/langtools: Fix: Synthesized java.lang.__Value	type is not flagged as a value type.
>>
>> Changeset: 863048d7a463
>> Author:    sadayapalam
>> Date:      2016-02-23 10:06 +0530
>> URL:
>> http://hg.openjdk.java.net/valhalla/valhalla/langtools/rev/863048d7a463
>>
>> Fix: Synthesized java.lang.__Value type is not flagged as a value type.
>>
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
>>
>>




More information about the valhalla-dev mailing list