Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1429,6 +1429,14 @@ public boolean isSubClass(Symbol base, Types types) {
return false;
}

/**
* Does `this' symbolize a primitive class that would, under the translation
* scheme in effect be lowered into two class files on a bifurcased basis ??
*/
public boolean isSplitPrimitiveClass(Types types) {
return types.splitPrimitiveClass && this.isPrimitiveClass();
}

/** Complete the elaboration of this symbol's definition.
*/
public void complete() throws CompletionFailure {
@@ -845,7 +845,7 @@ void writeInnerClasses() {
!inner.name.isEmpty() ? poolWriter.putName(inner.name) : 0);
databuf.appendChar(flags);
icCount++;
if (inner.isPrimitiveClass() && types.splitPrimitiveClass) {
if (inner.isSplitPrimitiveClass(types)) {
databuf.appendChar(poolWriter.putClass(inner.type.referenceProjection()));
databuf.appendChar(
inner.owner.kind == TYP && !inner.name.isEmpty() ? poolWriter.putClass((ClassSymbol)inner.owner) : 0);
@@ -883,7 +883,7 @@ int writeRecordAttribute(ClassSymbol csym) {
int writeNestMembersIfNeeded(ClassSymbol csym) {
Set<ClassSymbol> nestedUnique = new LinkedHashSet<>();
if (csym.owner.kind == PCK) {
if (csym.isPrimitiveClass() && types.splitPrimitiveClass) {
if (csym.isSplitPrimitiveClass(types)) {
// reference projection is the host
} else if (csym.isReferenceProjection()) {
ClassSymbol valueProjection = csym.valueProjection();
@@ -899,7 +899,7 @@ int writeNestMembersIfNeeded(ClassSymbol csym) {
for (ClassSymbol s : nestedUnique) {
databuf.appendChar(poolWriter.putClass(s));
nmc++;
if (s.isPrimitiveClass() && types.splitPrimitiveClass && s.owner.kind != PCK) {
if (s.isSplitPrimitiveClass(types) && s.owner.kind != PCK) {
databuf.appendChar(poolWriter.putClass(s.type.referenceProjection()));
nmc++;
}
@@ -916,10 +916,10 @@ int writeNestMembersIfNeeded(ClassSymbol csym) {
* Write NestHost attribute (if needed)
*/
int writeNestHostIfNeeded(ClassSymbol csym) {
if (csym.owner.kind != PCK || (csym.isPrimitiveClass() && types.splitPrimitiveClass)) {
if (csym.owner.kind != PCK || csym.isSplitPrimitiveClass(types)) {
int alenIdx = writeAttr(names.NestHost);
ClassSymbol outerMost = csym.outermostClass();
if (outerMost.isPrimitiveClass() && types.splitPrimitiveClass) {
if (outerMost.isSplitPrimitiveClass(types)) {
databuf.appendChar(poolWriter.putClass(outerMost.type.referenceProjection()));
} else {
databuf.appendChar(poolWriter.putClass(outerMost));
@@ -1530,7 +1530,7 @@ public JavaFileObject writeClass(ClassSymbol c)
throws IOException, PoolOverflow, StringOverflow
{
JavaFileObject javaFileObject = writeClassInternal(c);
if (c.isPrimitiveClass() && types.splitPrimitiveClass) {
if (c.isSplitPrimitiveClass(types)) {
writeClassInternal(getReferenceProjection(c));
}
return javaFileObject;
@@ -1631,8 +1631,8 @@ public void writeClassFile(OutputStream out, ClassSymbol c)
databuf.reset();
poolbuf.reset();

Type supertype = c.isPrimitiveClass() && types.splitPrimitiveClass ? c.type.referenceProjection() : types.supertype(c.type);
List<Type> interfaces = c.isPrimitiveClass() && types.splitPrimitiveClass ? List.nil() : types.interfaces(c.type);
Type supertype = c.isSplitPrimitiveClass(types) ? c.type.referenceProjection() : types.supertype(c.type);
List<Type> interfaces = c.isSplitPrimitiveClass(types) ? List.nil() : types.interfaces(c.type);
List<Type> typarams = c.type.getTypeArguments();

int flags;