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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Apr 1 15:55:39 UTC 2021

On Thu, 1 Apr 2021 15:36:05 GMT, Maurizio Cimadamore <mcimadamore 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/code/Types.java line 2572:
>> 2570:             public Type visitClassType(ClassType t, Boolean recurse) {
>> 2571:                 // erasure(projection(primitive)) = projection(erasure(primitive))
>> 2572:                 Type erased = eraseClassType(t, recurse);
> Random non-code comment: this seems a case of erasure applied to early. The first time that happens in lworld, but in the old branch which featured generic specializations, at some point we decided to postpone type erasure, as we needed sharp generic types during code gen. This smells like more of the same - e.g. having to fight with erasure so that the info that we care about is preserved in some form.

There is also the issue that, no matter how delayed erasure is, at the moment we need to generate two different class artifacts, so, at some point the symbol duality is going to pop back up; that's understandable - hopefully we'll come up with a strategy which doesn't require javac to generate two artifacts - at which point javac can simply insert conversions when going from L to Q - and mostly be done with it (of course to generate such conversions it will need access to full type info - see above).


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

More information about the valhalla-dev mailing list