hg: valhalla/valhalla/langtools: Summary: Implement semantic checks for value capable classes when run with -XDenableMinimalValueTypes

Srikanth srikanth.adayapalam at oracle.com
Mon Oct 3 08:00:17 UTC 2016


Some implementation notes on this commit: Mostly useful for langtools 
implementors, but could be
of academic interest to others.

In some sense, this commit takes the exact opposite approach to 
http://hg.openjdk.java.net/valhalla/valhalla/langtools/rev/5de3c2615ab6 
which eliminated the separate phase named TransValues from
the compiler pipeline and folded the semantic checks originally 
performed there into Attr and Enter.

The present patch reintroduces a separate pipeline stage dedicated to 
attributing value capable
classes. This attribution step and all the semantic checks there take 
place only when the compiler is invoked with -XDenableMinimalValueTypes.

The main motivation for this phase is to consolidate all the checks that 
happen for value capable classes into one place - thereby making it 
easier to port it to some other branch or withdraw and garbage collect 
them all together when we move to full fledged value types.

At the moment, I have felt it prudent to maintain the distinction 
between value classes and value capable classes. The annotation 
jvm.internal.value.DeriveValueType does not cause the flag
com.sun.tools.javac.code.Flags#VALUE to be set for example. Instead the 
new flag com.sun.tools.javac.code.Flags#VALUE_CAPABLE is set. This is to 
avoid any and all unwanted side effects of treating (the minimal) value 
capable classes as full blown value types. This also allows
to implement some relaxing of the semantic restrictions for minimal 
value types should the need
arise.

Much of this is subject to change. This should be seen as a quick and 
dirty implementation for
now.

Thanks.
Srikanth





On Monday 03 October 2016 01:09 PM, srikanth.adayapalam at oracle.com wrote:
> Changeset: 30469b6d88b6
> Author:    sadayapalam
> Date:      2016-10-03 13:09 +0530
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/langtools/rev/30469b6d88b6
>
> Summary: Implement semantic checks for value capable classes when run with -XDenableMinimalValueTypes
>
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.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/comp/ValueCapableClassAttr.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
> ! test/tools/javac/diags/CheckResourceKeys.java
> + test/tools/javac/valhalla/minimalvalues/CheckClone.java
> + test/tools/javac/valhalla/minimalvalues/CheckClone.out
> + test/tools/javac/valhalla/minimalvalues/CheckCyclicMembership.java
> + test/tools/javac/valhalla/minimalvalues/CheckCyclicMembership.out
> + test/tools/javac/valhalla/minimalvalues/CheckEquals.java
> + test/tools/javac/valhalla/minimalvalues/CheckEquals.out
> + test/tools/javac/valhalla/minimalvalues/CheckExtends.java
> + test/tools/javac/valhalla/minimalvalues/CheckExtends.out
> + test/tools/javac/valhalla/minimalvalues/CheckFinal.java
> + test/tools/javac/valhalla/minimalvalues/CheckFinal.out
> + test/tools/javac/valhalla/minimalvalues/CheckFinalize.java
> + test/tools/javac/valhalla/minimalvalues/CheckFinalize.out
> + test/tools/javac/valhalla/minimalvalues/CheckIdentityHash.java
> + test/tools/javac/valhalla/minimalvalues/CheckIdentityHash.out
> + test/tools/javac/valhalla/minimalvalues/CheckIdentityHash01.java
> + test/tools/javac/valhalla/minimalvalues/CheckIdentityHash01.out
> + test/tools/javac/valhalla/minimalvalues/CheckNullAssign.java
> + test/tools/javac/valhalla/minimalvalues/CheckNullAssign.out
> + test/tools/javac/valhalla/minimalvalues/CheckNullCastable.java
> + test/tools/javac/valhalla/minimalvalues/CheckNullCastable.out
> + test/tools/javac/valhalla/minimalvalues/CheckSync.java
> + test/tools/javac/valhalla/minimalvalues/CheckSync.out
> + test/tools/javac/valhalla/minimalvalues/CheckSynchronized.java
> + test/tools/javac/valhalla/minimalvalues/CheckSynchronized.out
> + test/tools/javac/valhalla/minimalvalues/ClassFileReaderTest.java
> + test/tools/javac/valhalla/minimalvalues/ClassFileReaderTest.out
> + test/tools/javac/valhalla/minimalvalues/Point.java
>



More information about the valhalla-dev mailing list