diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
index f508422a1c4..1240e61ca01 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
@@ -101,6 +101,9 @@ public class Types {
     List<Warner> warnStack = List.nil();
     final Name capturedName;
 
+    /** enable alternate code generation to faciliate specialization experiments using type restrictions */
+    public boolean flattenWithTypeRestrictions;
+
     public final Warner noWarnings;
 
     // <editor-fold defaultstate="collapsed" desc="Instantiating">
@@ -126,6 +129,7 @@ public class Types {
         noWarnings = new Warner(null);
         Options options = Options.instance(context);
         allowValueBasedClasses = options.isSet("allowValueBasedClasses");
+        flattenWithTypeRestrictions = options.isSet("flattenWithTypeRestrictions");
     }
     // </editor-fold>
 
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
index a6fa8ed939f..0c8d8da190e 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
@@ -973,7 +973,14 @@ public class ClassWriter extends ClassFile {
             pw.println("---" + flagNames(v.flags()));
         }
         databuf.appendChar(poolWriter.putName(v.name));
-        databuf.appendChar(poolWriter.putDescriptor(v));
+        boolean emitRestrictedField = false;
+        if (types.flattenWithTypeRestrictions && v.type.isValue()) {
+            emitRestrictedField = true;
+            databuf.appendChar(poolWriter.putDescriptor(v.type.referenceProjection()));
+        } else {
+            databuf.appendChar(poolWriter.putDescriptor(v));
+        }
+
         int acountIdx = beginAttrs();
         int acount = 0;
         if (v.getConstValue() != null) {
@@ -982,6 +989,12 @@ public class ClassWriter extends ClassFile {
             endAttr(alenIdx);
             acount++;
         }
+        if (emitRestrictedField) {
+            int alenIdx = writeAttr(names.RestrictedField);
+            databuf.appendChar(poolWriter.putDescriptor(v));
+            endAttr(alenIdx);
+            acount++;
+        }
         acount += writeMemberAttrs(v, false);
         acount += writeExtraAttributes(v);
         endAttrs(acountIdx, acount);
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java
index c3ea306f550..e09044860f6 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.jvm;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Kinds.Kind;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
@@ -154,7 +155,13 @@ public class Items {
      *                      and private members).
      */
     Item makeMemberItem(Symbol member, boolean nonvirtual) {
-        return new MemberItem(member, nonvirtual);
+        if (this.types.flattenWithTypeRestrictions && member.kind == Kind.VAR && member.type.isValue()) {
+            VarSymbol m = (VarSymbol) member;
+            VarSymbol e = new VarSymbol(m.flags(), m.name, m.type.referenceProjection(), m.owner);
+            return new MemberItem(e, nonvirtual);
+        } else {
+            return new MemberItem(member, nonvirtual);
+        }
     }
 
     /** Make an item representing a literal.
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
index 28bcaad21e9..0d80b4f974a 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
@@ -151,6 +151,7 @@ public class Names {
     public final Name NestHost;
     public final Name NestMembers;
     public final Name Record;
+    public final Name RestrictedField;
     public final Name RuntimeInvisibleAnnotations;
     public final Name RuntimeInvisibleParameterAnnotations;
     public final Name RuntimeInvisibleTypeAnnotations;
@@ -337,6 +338,7 @@ public class Names {
         NestHost = fromString("NestHost");
         NestMembers = fromString("NestMembers");
         Record = fromString("Record");
+        RestrictedField = fromString("RestrictedField");
         RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
         RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
         RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java
index 3ab3fce1863..c0dbc4c5d20 100644
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java
@@ -61,6 +61,7 @@ public abstract class Attribute {
     public static final String NestHost                 = "NestHost";
     public static final String NestMembers              = "NestMembers";
     public static final String Record                   = "Record";
+    public static final String RestrictedField          = "RestrictedField";
     public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
@@ -137,6 +138,7 @@ public abstract class Attribute {
             standardAttributes.put(NestHost, NestHost_attribute.class);
             standardAttributes.put(NestMembers, NestMembers_attribute.class);
             standardAttributes.put(Record, Record_attribute.class);
+            standardAttributes.put(RestrictedField, RestrictedField_attribute.class);
             standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
             standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
             standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
@@ -204,6 +206,7 @@ public abstract class Attribute {
         R visitNestHost(NestHost_attribute attr, P p);
         R visitNestMembers(NestMembers_attribute attr, P p);
         R visitRecord(Record_attribute attr, P p);
+        R visitRestrictedField(RestrictedField_attribute attr, P p);
         R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
index badbf90e453..1c00e767551 100644
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
@@ -655,6 +655,12 @@ public class ClassWriter {
             return null;
         }
 
+        @Override
+        public Void visitRestrictedField(RestrictedField_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.restricted_type_index);
+            return null;
+        }
+
         @Override
         public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RestrictedField_attribute.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RestrictedField_attribute.java
index bc93603d23f..64cba648440 100644
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RestrictedField_attribute.java
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RestrictedField_attribute.java
@@ -25,5 +25,42 @@
 
 package com.sun.tools.classfile;
 
-public class RestrictedField_attribute {
-}
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.9.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+
+public class RestrictedField_attribute extends Attribute {
+    RestrictedField_attribute(ClassReader cr, int name_index, int length) throws IOException {
+        super(name_index, length);
+        restricted_type_index = cr.readUnsignedShort();
+    }
+    public RestrictedField_attribute(ConstantPool constant_pool, int restricted_type_index)
+            throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.RestrictedField), restricted_type_index);
+    }
+    public RestrictedField_attribute(int name_index, int restricted_type_index) {
+        super(name_index, 2);
+        this.restricted_type_index = restricted_type_index;
+    }
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitRestrictedField(this, data);
+    }
+
+    public String getRestrictedType(ConstantPool constant_pool) throws ConstantPoolException {
+        return constant_pool.getUTF8Value(restricted_type_index);
+    }
+
+//    public Type getRestrictedType() {
+//        return new Signature(signature_index);
+//    }
+
+
+    public final int restricted_type_index;
+}
\ No newline at end of file
diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
index 67dbaebe827..ac5744b01ef 100644
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -61,6 +61,7 @@ import com.sun.tools.classfile.ModuleTarget_attribute;
 import com.sun.tools.classfile.NestHost_attribute;
 import com.sun.tools.classfile.NestMembers_attribute;
 import com.sun.tools.classfile.Record_attribute;
+import com.sun.tools.classfile.RestrictedField_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
@@ -765,6 +766,22 @@ public class AttributeWriter extends BasicWriter
         return null;
     }
 
+    @Override
+    public Void visitRestrictedField(RestrictedField_attribute attr, Void p) {
+        print("RestrictedField: #" + attr.restricted_type_index);
+        tab();
+        println("// " + getRestrictedType(attr));
+        return null;
+    }
+
+    String getRestrictedType(RestrictedField_attribute info) {
+        try {
+            return info.getRestrictedType(constant_pool);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
     String getValue(Descriptor d) {
         try {
             return d.getValue(constant_pool);
