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

8255733: [type-restrictions] Enhance Javac to help with generation of test files for type restrictions experiments #251

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -104,6 +104,9 @@ public class Types {
/** enable alternate code generation to faciliate specialization experiments using type restrictions */
public boolean flattenWithTypeRestrictions;

/** enable alternate code generation to faciliate specialization experiments, without restricted field attribute */
public boolean flattenWithErasure;

public final Warner noWarnings;

// <editor-fold defaultstate="collapsed" desc="Instantiating">
Expand All @@ -130,6 +133,7 @@ protected Types(Context context) {
Options options = Options.instance(context);
allowValueBasedClasses = options.isSet("allowValueBasedClasses");
flattenWithTypeRestrictions = options.isSet("flattenWithTypeRestrictions");
flattenWithErasure = options.isSet("flattenWithErasure");
}
// </editor-fold>

Expand Down
Expand Up @@ -974,8 +974,10 @@ void writeField(VarSymbol v) {
}
databuf.appendChar(poolWriter.putName(v.name));
boolean emitRestrictedField = false;
if (types.flattenWithTypeRestrictions && v.type.isValue()) {
emitRestrictedField = true;
if ((types.flattenWithTypeRestrictions || types.flattenWithErasure) && v.type.isValue()) {
if (types.flattenWithTypeRestrictions) {
emitRestrictedField = true;
}
databuf.appendChar(poolWriter.putDescriptor(v.type.referenceProjection()));
} else {
databuf.appendChar(poolWriter.putDescriptor(v));
Expand Down
Expand Up @@ -148,7 +148,7 @@ private LocalItem makeLocalItem(Type type, int reg) {
* @param member The represented symbol.
*/
Item makeStaticItem(Symbol member) {
if (this.types.flattenWithTypeRestrictions && member.kind == Kind.VAR && member.type.isValue()) {
if ((types.flattenWithTypeRestrictions || types.flattenWithErasure) && member.kind == Kind.VAR && member.type.isValue()) {
return new StaticItem(getFlattenedField(member));
} else {
return new StaticItem(member);
Expand All @@ -161,7 +161,7 @@ Item makeStaticItem(Symbol member) {
* and private members).
*/
Item makeMemberItem(Symbol member, boolean nonvirtual) {
if (this.types.flattenWithTypeRestrictions && member.kind == Kind.VAR && member.type.isValue()) {
if ((types.flattenWithTypeRestrictions || types.flattenWithErasure) && member.kind == Kind.VAR && member.type.isValue()) {
return new MemberItem(getFlattenedField(member), nonvirtual);
} else {
return new MemberItem(member, nonvirtual);
Expand Down