changeset 52843:34ee96ed26d7 lworld

[lworld] Withdraw vestigial code for ValueTypes attribute generation
author sadayapalam
date Wed, 21 Nov 2018 13:22:56 +0530
parents 61c22f976f36
children deea4d9fbd32
files src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java test/langtools/tools/javac/valhalla/lworld-values/MultiValues.java test/langtools/tools/javac/valhalla/lworld-values/QTypeTest.java
diffstat 5 files changed, 26 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Nov 16 10:38:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Nov 21 13:22:56 2018 +0530
@@ -1465,7 +1465,6 @@
                     }
                 }
             },
-            // ValueTypes attribute is not currently handled in the reader - javac does not care
         };
 
         for (AttributeReader r: readers)
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Nov 16 10:38:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Nov 21 13:22:56 2018 +0530
@@ -149,10 +149,6 @@
      */
     Map<DynamicMethod.BootstrapMethodsKey, DynamicMethod.BootstrapMethodsValue> bootstrapMethods;
 
-    /** The value classes to be written, as a set.
-     */
-    Set<ClassSymbol> valueTypes;
-
     /** The log to use for verbose output.
      */
     private final Log log;
@@ -325,7 +321,7 @@
 
         @Override
         protected void classReference(ClassSymbol c) {
-            enterInnerAndValueClass(c);
+            enterInner(c);
         }
 
         private void reset() {
@@ -451,7 +447,7 @@
                     poolbuf.appendChar(pool.put(typeSig(c.type)));
                 } else {
                     poolbuf.appendChar(pool.put(names.fromUtf(externalize(c.flatname))));
-                    enterInnerAndValueClass(c);
+                    enterInner(c);
                 }
             } else if (value instanceof NameAndType) {
                 NameAndType nt = (NameAndType)value;
@@ -486,7 +482,7 @@
                     if (c.owner.kind == TYP) pool.put(c.owner);
                     poolbuf.appendByte(CONSTANT_Class);
                     poolbuf.appendChar(pool.put(typeSig(c.type)));
-                    enterInnerAndValueClass(c);
+                    enterInner(c);
                 } else {
                     Assert.check(type.hasTag(ARRAY));
                     poolbuf.appendByte(CONSTANT_Class);
@@ -1061,7 +1057,7 @@
 
     /** Enter an inner class into the `innerClasses' set/queue.
      */
-    void enterInnerClass(ClassSymbol c) {
+    void enterInner(ClassSymbol c) {
         if (c.type.isCompound()) {
             throw new AssertionError("Unexpected intersection type: " + c.type);
         }
@@ -1076,7 +1072,7 @@
             c.owner.enclClass() != null &&
             (innerClasses == null || !innerClasses.contains(c))) {
 //          log.errWriter.println("enter inner " + c);//DEBUG
-            enterInnerClass(c.owner.enclClass());
+            enterInner(c.owner.enclClass());
             pool.put(c);
             if (c.name != names.empty)
                 pool.put(c.name);
@@ -1188,51 +1184,6 @@
         endAttr(alenIdx);
     }
 
-    /** Enter a value class into the `valueTypes' set.
-     */
-    void enterValueClass(ClassSymbol c) {
-        if (c.type.isCompound()) {
-            throw new AssertionError("Unexpected intersection type: " + c.type);
-        }
-        try {
-            c.complete();
-        } catch (CompletionFailure ex) {
-            System.err.println("error: " + c + ": " + ex.getMessage());
-            throw ex;
-        }
-        if (!c.type.hasTag(CLASS)) return; // arrays
-        if (pool != null && // pool might be null if called from xClassName
-                types.isValue(c.type) &&
-                (valueTypes == null || !valueTypes.contains(c))) {
-            if (c.owner.enclClass() != null)
-                enterValueClass(c.owner.enclClass());
-            pool.put(c);
-            if (c.name != names.empty)
-                pool.put(c.name);
-            if (valueTypes == null) {
-                valueTypes = new HashSet<>();
-                pool.put(names.ValueTypes);
-            }
-            valueTypes.add(c);
-        }
-    }
-
-    /** Write "value types" attribute.
-     */
-    void writeValueTypes() {
-        int alenIdx = writeAttr(names.ValueTypes);
-        databuf.appendChar(valueTypes.size());
-        for (ClassSymbol c : valueTypes) {
-            databuf.appendChar(pool.put(c));
-        }
-        endAttr(alenIdx);
-    }
-
-    void enterInnerAndValueClass(ClassSymbol c) {
-        enterInnerClass(c);
-        enterValueClass(c);
-    }
-
     /** Write field symbol, entering all references into constant pool.
      */
     void writeField(VarSymbol v) {
@@ -1824,7 +1775,6 @@
         innerClasses = null;
         innerClassesQueue = null;
         bootstrapMethods = new LinkedHashMap<>();
-        valueTypes = null;
 
         Type supertype = types.supertype(c.type);
         List<Type> interfaces = types.interfaces(c.type);
@@ -1865,14 +1815,14 @@
             case VAR: fieldsCount++; break;
             case MTH: if ((sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
                       break;
-            case TYP: enterInnerAndValueClass((ClassSymbol)sym); break;
+            case TYP: enterInner((ClassSymbol)sym); break;
             default : Assert.error();
             }
         }
 
         if (c.trans_local != null) {
             for (ClassSymbol local : c.trans_local) {
-                enterInnerAndValueClass(local);
+                enterInner(local);
             }
         }
 
@@ -1962,11 +1912,6 @@
             acount++;
         }
 
-        if (valueTypes != null) {
-            writeValueTypes();
-            acount++;
-        }
-
         endAttrs(acountIdx, acount);
 
         poolbuf.appendBytes(databuf.elems, 0, databuf.length);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Fri Nov 16 10:38:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Wed Nov 21 13:22:56 2018 +0530
@@ -148,7 +148,6 @@
     public final Name Enum;
     public final Name Exceptions;
     public final Name InnerClasses;
-    public final Name ValueTypes;
     public final Name LineNumberTable;
     public final Name LocalVariableTable;
     public final Name LocalVariableTypeTable;
@@ -322,7 +321,6 @@
         Enum = fromString("Enum");
         Exceptions = fromString("Exceptions");
         InnerClasses = fromString("InnerClasses");
-        ValueTypes = fromString("ValueTypes");
         LineNumberTable = fromString("LineNumberTable");
         LocalVariableTable = fromString("LocalVariableTable");
         LocalVariableTypeTable = fromString("LocalVariableTypeTable");
--- a/test/langtools/tools/javac/valhalla/lworld-values/MultiValues.java	Fri Nov 16 10:38:55 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-final value class V1 {
-    final int x = 10;
-}
-
-final value class V2 {
-    final int x = 10;
-}
-
-final value class V3 {
-    final int x = 10;
-}
-
-final value class V4 {
-    final int x = 10;
-}
-
-final value class V5 {
-    final int x = 10;
-}
-
-final value class V6 {
-    final int x = 10;
-}
--- a/test/langtools/tools/javac/valhalla/lworld-values/QTypeTest.java	Fri Nov 16 10:38:55 2018 -0800
+++ b/test/langtools/tools/javac/valhalla/lworld-values/QTypeTest.java	Wed Nov 21 13:22:56 2018 +0530
@@ -49,25 +49,25 @@
               "final value class QTypedValue",
               "  flags: (0x0130) ACC_FINAL, ACC_SUPER, ACC_VALUE",
               "  this_class: #8                          // QTypedValue",
-              "   #8 = Class              #17            // QTypedValue",
-              "   #9 = Class              #52            // \"QQTypedValue;\"",
-              "  #10 = Fieldref           #8.#53         // QTypedValue.f1:[QQTypedValue;",
-              "  #11 = Fieldref           #8.#54         // QTypedValue.f2:[QQTypedValue;",
-              "  #12 = Class              #22            // \"[[[QQTypedValue;\"",
-              "  #13 = Fieldref           #8.#55         // QTypedValue.f3:[[[QQTypedValue;",
-              "  #14 = Fieldref           #8.#56         // QTypedValue.f4:[[[QQTypedValue;",
-              "  #17 = Utf8               QTypedValue",
-              "  #19 = Utf8               [QQTypedValue;",
-              "  #22 = Utf8               [[[QQTypedValue;",
-              "  #29 = Utf8               (QQTypedValue;I)V",
-              "  #40 = Utf8               ()QQTypedValue;",
-              "  #44 = NameAndType        #39:#40        // $makeValue$:()QQTypedValue;",
-              "  #45 = NameAndType        #28:#29        // foo:(QQTypedValue;I)V",
-              "  #52 = Utf8               QQTypedValue;",
-              "  #53 = NameAndType        #16:#19        // f1:[QQTypedValue;",
-              "  #54 = NameAndType        #20:#19        // f2:[QQTypedValue;",
-              "  #55 = NameAndType        #21:#22        // f3:[[[QQTypedValue;",
-              "  #56 = NameAndType        #23:#22        // f4:[[[QQTypedValue;",
+              "   #8 = Class              #50            // QTypedValue",
+              "   #9 = Class              #51            // \"QQTypedValue;\"",
+              "  #10 = Fieldref           #8.#52         // QTypedValue.f1:[QQTypedValue;",
+              "  #11 = Fieldref           #8.#53         // QTypedValue.f2:[QQTypedValue;",
+              "  #12 = Class              #20            // \"[[[QQTypedValue;\"",
+              "  #13 = Fieldref           #8.#54         // QTypedValue.f3:[[[QQTypedValue;",
+              "  #14 = Fieldref           #8.#55         // QTypedValue.f4:[[[QQTypedValue;",
+              "  #17 = Utf8               [QQTypedValue;",
+              "  #20 = Utf8               [[[QQTypedValue;",
+              "  #27 = Utf8               (QQTypedValue;I)V",
+              "  #38 = Utf8               ()QQTypedValue;",
+              "  #42 = NameAndType        #37:#38        // $makeValue$:()QQTypedValue;",
+              "  #43 = NameAndType        #26:#27        // foo:(QQTypedValue;I)V",
+              "  #50 = Utf8               QTypedValue",
+              "  #51 = Utf8               QQTypedValue;",
+              "  #52 = NameAndType        #16:#17        // f1:[QQTypedValue;",
+              "  #53 = NameAndType        #18:#17        // f2:[QQTypedValue;",
+              "  #54 = NameAndType        #19:#20        // f3:[[[QQTypedValue;",
+              "  #55 = NameAndType        #21:#20        // f4:[[[QQTypedValue;",
               "  final QTypedValue[] f1;",
               "    descriptor: [QQTypedValue;",
               "    flags: (0x0010) ACC_FINAL",