[lworld] RFR: 8266466: [lworld] Enhance javac to consume unified primitive class files generated under the option -XDunifiedValRefClass

Srikanth Adayapalam sadayapalam at openjdk.java.net
Fri May 21 11:39:15 UTC 2021

Post the integration of https://bugs.openjdk.java.net/browse/JDK-8244227,
the constructor of ClassType, takes a boolean isReferenceProjection as an additional
parameter. Till now, it was feasible to upfront decide at the time of constructing
a class type whether the proposed type is supposed to be a reference projection or not.

This is no longer possible under the unified class file generation scheme we are
moving to. When we see LFoo; in field/method signatures/descriptors, we don't know
whether the type is Foo.ref of a primitive class Foo or a plain old reference type.

Likewise when we see QFoo; we have an ambiguity whether this is the primitive class
type Foo or is Foo.val type of a ref-default primitive class Foo. Till a class is
fully built ("completed"), we don't know whether it is a primitive class and if so,
what its ref-val defaultness is.

Completing class Foo every time we see a type descriptor LFoo; or QFoo; is wasteful
of resources. Nor is it possible as it is, since it would call for the ClassReader's
code to be reentered even as some other class is being read in: So the proposed patch
implements an incremental piece meal augmentation of attributes.

I suggest the review be started with Type.java in ClassType#Flavor enumeration to gather
a high level picture of the abstractions put in place to characterize a class type in
an incremental basis. After Type.java, Attr.java, ClassReader.java and Symbol.java in
that order provide a good order for review.

Please note, while this patch puts together the infrastructure and layes the groundwork
for modelling ref-default classes and thereby enable VBC migration work, such work will
arrive separately at a later time.

As of now javac knows only about primitive class and their reference projections and
plain old reference types. There is no notion of ref-val defaultness yet, Nor a way
to declare them.


Commit messages:
 - Fix white space problems
 - 8266466: Enhance javac to consume unified class files generated for primitive classes

Changes: https://git.openjdk.java.net/valhalla/pull/421/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=421&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8266466
  Stats: 310 lines in 15 files changed: 247 ins; 8 del; 55 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/421.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/421/head:pull/421

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

More information about the valhalla-dev mailing list