[lworld] RFR: 8244227: [lworld] Explore an implementation where the reference projection and value projection types are backed by a single class symbol

Srikanth Adayapalam sadayapalam at openjdk.java.net
Wed Mar 31 12:47:32 UTC 2021


On Wed, 31 Mar 2021 12:32:04 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

> This PR overhauls the existing implementation/representation of reference projection types  and the inline types so that both share the same underlying symbol, much like how an infinite family of parameterized types that originate from the same generic type are modelled using the same underlying symbol.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java line 373:

> 371:         JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
> 372:                 sym.name,
> 373:                 make.QualIdent(lambdaType.getReturnType().tsym).setType(lambdaType.getReturnType()),

Discussion item:This spot indicates one of the pain points in the new approach, There are lots of places where we construct fresh AST nodes from a symbol and in the process decorate the AST's type from what we see in the symbol. This is not a problem for parameterized types because the type arguments are erased by TransTypes anyway. But with Foo.ref and Foo.val sharing the same symbol, we will loose reference "projection'ness". I would like to discuss if there are mechanical ways to  detect and prevent such loss of type information. ATM, I am dependent on tests breaking to expose such problems and this is dependent heavily on coverage and coverage is still in infancy

-------------

PR: https://git.openjdk.java.net/valhalla/pull/375



More information about the valhalla-dev mailing list