changeset 3524:85cc92a65da8 tip

Remove vnewarray + multivnewarray, add more tests and fixes
author dsimms
date Thu, 15 Dec 2016 12:23:21 +0100
parents ce7460995ffc
children
files src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ByteCodes.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java src/jdk.jdeps/share/classes/com/sun/tools/classfile/Opcode.java
diffstat 4 files changed, 2 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ByteCodes.java	Thu Dec 01 15:06:50 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ByteCodes.java	Thu Dec 15 12:23:21 2016 +0100
@@ -249,8 +249,6 @@
         vaload          = 205,
         vastore         = 206,
         vnew            = 207,
-        vnewarray       = 208,
-        multivnewarray  = 209,
         vreturn         = 210,
         vgetfield       = 211,
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Dec 01 15:06:50 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Dec 15 12:23:21 2016 +0100
@@ -474,16 +474,6 @@
         postop();
     }
 
-    public void emitMultivnewarray(int ndims, int type, Type arrayType) {
-        emitop(multivnewarray);
-        if (!alive) return;
-        emit2(type);
-        emit1(ndims);
-        state.pop(ndims);
-        state.push(arrayType);
-        postop();
-    }
-
     /** Emit newarray.
      */
     public void emitNewarray(int elemcode, Type arrayType) {
@@ -506,15 +496,6 @@
         postop();
     }
 
-    public void emitVnewarray(int od, Type arrayType) {
-        emitop(vnewarray);
-        if (!alive) return;
-        emit2(od);
-        state.pop(1);
-        state.push(arrayType);
-        postop();
-    }
-
     /** Emit an invokeinterface instruction.
      */
     public void emitInvokeinterface(int meth, Type mtype) {
@@ -2768,8 +2749,6 @@
             mnem[vaload] = "vaload";
             mnem[vastore] = "vastore";
             mnem[vnew] = "vnew";
-            mnem[vnewarray] = "vnewarray";
-            mnem[multivnewarray] = "multivnewarray";
             mnem[vreturn] = "vreturn";
             mnem[vgetfield] = "vgetfield";
             mnem[typed] = "typed";
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Dec 01 15:06:50 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Dec 15 12:23:21 2016 +0100
@@ -2123,9 +2123,7 @@
                 nerrs++;
             }
             int elemcode = Code.arraycode(erasedElementType);
-            if (types.isValue(erasedElementType)) {
-                code.emitVnewarray(makeRef(tree, erasedType), erasedType);
-            } else if (elemcode == 0 || (elemcode == 1 && ndims == 1)) {
+            if (elemcode == 0 || (elemcode == 1 && ndims == 1)) {
                 Type elem = types.elemtype(sigType);
                 if (elem.hasTag(TYPEVAR) && pool.needsGenericEntry(elem)) {
                     //temporary hack: treat this as a type-1 opcode
@@ -2133,16 +2131,7 @@
                 }
                 code.emitAnewarray(makeRef(tree.pos(), types.elemtype(sigType)), erasedType);
             } else if (elemcode == 1) {
-                // if the ultimate elements are values, use multivnewarray
-                Type u = erasedElementType;
-                while (types.isArray(u)) {
-                    u = types.elemtype(u);
-                }
-                if (!types.isValue(u)) {
-                    code.emitMultianewarray(ndims, makeRef(tree.pos(), sigType), erasedType);
-                } else {
-                    code.emitMultivnewarray(ndims, makeRef(tree.pos(), sigType), erasedType);
-                }
+                code.emitMultianewarray(ndims, makeRef(tree.pos(), sigType), erasedType);
             } else {
                 code.emitNewarray(elemcode, erasedType);
             }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Opcode.java	Thu Dec 01 15:06:50 2016 +0100
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Opcode.java	Thu Dec 15 12:23:21 2016 +0100
@@ -248,8 +248,6 @@
     VALOAD(205),
     VASTORE(206),
     VNEW(207, CPREF_W),
-    VNEWARRAY(208, CPREF_W),
-    MULTIVNEWARRAY(209, CPREF_W_UBYTE),
     VRETURN(210),
     VGETFIELD(211, CPREF_W),