hg: valhalla/valhalla: 8207168:[LWorld] Withdraw support for __MakeDefault and add support for ValueType.default

Remi Forax forax at univ-mlv.fr
Fri Sep 14 22:29:26 UTC 2018


Hi Srikanth,
static member accesses are defined on raw type and you want the default value to be a non-erased type,
you currently use the inference to try to bridge the gap so it fails when using var.

  __ByValue class Foo<E> {
    E value;
    Foo(E value) { this.value = value; }
  }
  var foo = Foo.default; // doesn't compile

A way to fix that is to allow to '.default' to be applied on type and not on raw class
in that case var will work:
  var foo = Foo<String>.default;

We need something like that anyway if Foo is any-fied.

regards,
Rémi

----- Mail original -----
> De: "Srikanth" <srikanth.adayapalam at oracle.com>
> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Vendredi 14 Septembre 2018 08:13:49
> Objet: Re: hg: valhalla/valhalla: 8207168:[LWorld] Withdraw support for __MakeDefault and add support for
> ValueType.default

> Folks,
> 
> With this change set, javac does not accept the __MakeDefault
> ValueType(); syntax anymore.
> Instead use the newer and cleaner syntax. ex:
> 
>     Point p = Point.default;  // Point is a value type.
> 
> I have tried to be a good citizen and clean up all tests across
> components and verify them, but I couldn't quite figure out how to run
> the benchmarks.
> 
>     __MakeDefault has had a tortuous course and in its final form was
> resulting in quite a bit of code clutter and maintenance burden due to
> historic baggage and the present change represents a significant clean
> up of Javac implementation - (Thanks for Maurizio for spotting the
> opportunity for clean up and to John for suggesting that modeling
> default value creation naturally aligns with static member access.)
> 
> Javac at the moment will reject any use of .default suffix being applied
> to a non-value type. And lowers ValueType.default to defaultvalue
> bytecode instruction.
> 
> FYI,
> Thanks!
> Srikanth
> 
> 
> 
> On Friday 14 September 2018 11:31 AM, srikanth.adayapalam at oracle.com wrote:
>> Changeset: 418f9790c907
>> Author:    sadayapalam
>> Date:      2018-09-14 11:31 +0530
>> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/418f9790c907
>>
>> 8207168:[LWorld] Withdraw support for __MakeDefault and add support for
>> ValueType.default
>>
>> ! src/jdk.compiler/share/classes/com/sun/source/tree/NewClassTree.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/TransValues.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java
>> !
>> src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java
>> ! src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
>> ! test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/types/Value1.java
>> ! test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/types/Value2.java
>> ! test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/types/Value8.java
>> !
>> test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/util/HashMapIteratorCursor.java
>> !
>> test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/util/HashMapValueCursor.java
>> !
>> test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/util/HashMapValueEntry.java
>> !
>> test/benchmarks/src/main/java/oracle/micro/valhalla/lworld/util/HashMapValueTotal.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/MyValue1.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/MyValue2.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/MyValue3.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/MyValue4.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/SimpleValueType.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java
>> ! test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/Empty.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/IntValue.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/JumboValue.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/Long8Value.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ObjectMethods.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/Person.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/Point.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/QuickeningTest.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/Test8186715.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/TestValue1.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/TestValue2.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/TestValue3.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/TestValue4.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/VDefaultTest.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/VWithFieldTest.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueOops.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeArray.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeCreation.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeDensity.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeGenerator.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueWithJni.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/classfileparser/cfpTests.jcod
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/consistency/ValuePoint.java
>> ! test/hotspot/jtreg/runtime/valhalla/valuetypes/verifier/verifierTests.jcod
>> ! test/jdk/java/lang/invoke/VarHandles/Value.java
>> ! test/jdk/valhalla/valuetypes/Line.java
>> ! test/jdk/valhalla/valuetypes/NonFlattenValue.java
>> ! test/jdk/valhalla/valuetypes/Point.java
>> ! test/jdk/valhalla/valuetypes/ValueArray.java
>> ! test/jdk/valhalla/valuetypes/ValueBootstrapMethods.java
>> ! test/langtools/tools/javac/diags/examples.not-yet.txt
>> ! test/langtools/tools/javac/valhalla/lworld-values/CastNullCheckTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckCyclicMembership.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckFlattenableCycles.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckMakeDefault.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckMakeDefault.out
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckStaticFinalAssign.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckSync.java
>> !
>> test/langtools/tools/javac/valhalla/lworld-values/CheckValueFactoryWithReference.java
>> !
>> test/langtools/tools/javac/valhalla/lworld-values/CheckValueFactoryWithReference.out
>> ! test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest.out
>> ! test/langtools/tools/javac/valhalla/lworld-values/Point.java
>> !
>> test/langtools/tools/javac/valhalla/lworld-values/ValueBootstrapMethodsTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/ValueCreationTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/ValuesAsRefs.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldAccessorTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldNegativeTests.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfGenericType.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfImplicitThis.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldOperatorTest.java
>> ! test/langtools/tools/javac/valhalla/lworld-values/WithFieldRuntimeTest.java


More information about the valhalla-dev mailing list