[lworld] RFR: 8265423: [lworld] Provide experimental support for generating a single class file per primitive class

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Apr 27 12:24:57 UTC 2021


On Tue, 27 Apr 2021 08:45:18 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

> Use -XDunifiedValRefClass option to javac to get unified class file generation for primitive classes. Note: Javac will require some tweaks to consume such files, this is WIP.

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java line 2690:

> 2688:             if (referenceProjection != null) {
> 2689:                 if (referenceProjection.name != names.ref && referenceProjection.owner.kind == PCK) {
> 2690:                     referenceProjection.complete();

This change seems sneaky - what caused it?

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java line 848:

> 846:             databuf.appendChar(flags);
> 847:             icCount++;
> 848:             if (inner.isPrimitiveClass() && types.splitPrimitiveClass) {

the test `sym.isPrimitiveClass() && types.splitPrimitiveClass` is so common which I think would be better refactored into a separate predicate, to make the code clearer.

e.g. `Symbol.isSplitPrimitiveClass(Types)`

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

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



More information about the valhalla-dev mailing list