changeset 49044:f45a11f58a22 lworld

[lworld] Changes to the experimental bytecode library to support L-World values.
author sadayapalam
date Wed, 07 Mar 2018 14:32:37 +0530
parents 85946f4dc33d
children 2a03abbb279e
files src/java.base/share/classes/jdk/experimental/bytecode/BasicClassBuilder.java src/java.base/share/classes/jdk/experimental/bytecode/CodeBuilder.java src/java.base/share/classes/jdk/experimental/bytecode/MacroCodeBuilder.java src/java.base/share/classes/jdk/experimental/bytecode/Opcode.java src/java.base/share/classes/jdk/experimental/bytecode/TypeTag.java src/java.base/share/classes/jdk/experimental/bytecode/TypedCodeBuilder.java
diffstat 6 files changed, 32 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/experimental/bytecode/BasicClassBuilder.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/BasicClassBuilder.java	Wed Mar 07 14:32:37 2018 +0530
@@ -597,8 +597,6 @@
                     return TypeTag.D;
                 case 'V':
                     return TypeTag.V;
-                case 'Q':
-                    return TypeTag.Q;
                 default:
                     throw new IllegalStateException("Bad type: " + s);
             }
--- a/src/java.base/share/classes/jdk/experimental/bytecode/CodeBuilder.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/CodeBuilder.java	Wed Mar 07 14:32:37 2018 +0530
@@ -76,8 +76,8 @@
         return thisBuilder();
     }
 
-    public C vwithfield(S owner, CharSequence name, T type) {
-        emitOp(Opcode.VWITHFIELD, type);
+    public C withfield(S owner, CharSequence name, T type) {
+        emitOp(Opcode.WITHFIELD, type);
         code.writeChar(poolHelper.putFieldRef(owner, name, type));
         return thisBuilder();
     }
@@ -123,8 +123,8 @@
         return thisBuilder();
     }
 
-    public C vdefault(S target) {
-        emitOp(Opcode.VDEFAULT, target);
+    public C defaultvalue(S target) {
+        emitOp(Opcode.DEFAULTVALUE, target);
         code.writeChar(poolHelper.putClass(target));
         return thisBuilder();
     }
@@ -163,18 +163,6 @@
         return thisBuilder();
     }
 
-    public C vbox(S target) {
-        emitOp(Opcode.VBOX, target);
-        code.writeChar(poolHelper.putClass(target));
-        return thisBuilder();
-    }
-
-    public C vunbox(S target) {
-        emitOp(Opcode.VUNBOX, target);
-        code.writeChar(poolHelper.putClass(target));
-        return thisBuilder();
-    }
-
     public C ldc(Object o) {
         emitOp(Opcode.LDC, o);
         code.writeByte(poolHelper.putValue(o));
@@ -261,10 +249,6 @@
         return emitOp(Opcode.RETURN);
     }
 
-    public C vreturn() {
-        return emitOp(Opcode.VRETURN);
-    }
-
     protected C emitWideIfNeeded(Opcode opcode, int n) {
         boolean wide = n > Byte.MAX_VALUE;
         if (wide) {
@@ -373,10 +357,6 @@
         }
     }
 
-    public C vload(int i) {
-        return emitWideIfNeeded(Opcode.VLOAD, i);
-    }
-
     public C aload(int i) {
         return emitWideIfNeeded(Opcode.ALOAD, i);
     }
@@ -477,10 +457,6 @@
         return emitOp(Opcode.DLOAD_3);
     }
 
-    public C vstore(int i) {
-        return emitWideIfNeeded(Opcode.VSTORE, i);
-    }
-
     public C astore(int i) {
         return emitWideIfNeeded(Opcode.ASTORE, i);
     }
@@ -599,10 +575,6 @@
         return emitOp(Opcode.DALOAD);
     }
 
-    public C vaload() {
-        return emitOp(Opcode.VALOAD);
-    }
-
     public C aaload() {
         return emitOp(Opcode.AALOAD);
     }
@@ -635,10 +607,6 @@
         return emitOp(Opcode.DASTORE);
     }
 
-    public C vastore() {
-        return emitOp(Opcode.VASTORE);
-    }
-
     public C aastore() {
         return emitOp(Opcode.AASTORE);
     }
@@ -1246,7 +1214,6 @@
                 case J:
                     stackmaps.writeByte(4);
                     break;
-                case Q:
                 case A:
                     if (t == typeHelper.nullType()) {
                         stackmaps.writeByte(5); //null
--- a/src/java.base/share/classes/jdk/experimental/bytecode/MacroCodeBuilder.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/MacroCodeBuilder.java	Wed Mar 07 14:32:37 2018 +0530
@@ -117,40 +117,32 @@
     }
 
     public C load(TypeTag type, int n) {
-        if (type == TypeTag.Q) {
-            return vload(n);
-        } else {
-            switch (n) {
-                case 0:
-                    return emitOp(Opcode.ILOAD_0.at(type, 4));
-                case 1:
-                    return emitOp(Opcode.ILOAD_1.at(type, 4));
-                case 2:
-                    return emitOp(Opcode.ILOAD_2.at(type, 4));
-                case 3:
-                    return emitOp(Opcode.ILOAD_3.at(type, 4));
-                default:
-                    return emitWideIfNeeded(Opcode.ILOAD.at(type), n);
-            }
+        switch (n) {
+            case 0:
+                return emitOp(Opcode.ILOAD_0.at(type, 4));
+            case 1:
+                return emitOp(Opcode.ILOAD_1.at(type, 4));
+            case 2:
+                return emitOp(Opcode.ILOAD_2.at(type, 4));
+            case 3:
+                return emitOp(Opcode.ILOAD_3.at(type, 4));
+            default:
+                return emitWideIfNeeded(Opcode.ILOAD.at(type), n);
         }
     }
 
     public C store(TypeTag type, int n) {
-        if (type == TypeTag.Q) {
-            return vstore(n);
-        } else {
-            switch (n) {
-                case 0:
-                    return emitOp(Opcode.ISTORE_0.at(type, 4));
-                case 1:
-                    return emitOp(Opcode.ISTORE_1.at(type, 4));
-                case 2:
-                    return emitOp(Opcode.ISTORE_2.at(type, 4));
-                case 3:
-                    return emitOp(Opcode.ISTORE_3.at(type, 4));
-                default:
-                    return emitWideIfNeeded(Opcode.ISTORE.at(type), n);
-            }
+        switch (n) {
+            case 0:
+                return emitOp(Opcode.ISTORE_0.at(type, 4));
+            case 1:
+                return emitOp(Opcode.ISTORE_1.at(type, 4));
+            case 2:
+                return emitOp(Opcode.ISTORE_2.at(type, 4));
+            case 3:
+                return emitOp(Opcode.ISTORE_3.at(type, 4));
+            default:
+                return emitWideIfNeeded(Opcode.ISTORE.at(type), n);
         }
     }
 
@@ -311,8 +303,6 @@
         switch (type) {
             case V:
                 return return_();
-            case Q:
-                return vreturn();
             default:
                 return emitOp(Opcode.IRETURN.at(type));
         }
--- a/src/java.base/share/classes/jdk/experimental/bytecode/Opcode.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/Opcode.java	Wed Mar 07 14:32:37 2018 +0530
@@ -231,15 +231,8 @@
     IF_NONNULL(199),
     GOTO_W(200),
     JSR_W(201),
-    VLOAD(203),
-    VSTORE(204),
-    VALOAD(205),
-    VASTORE(206),
-    VRETURN(207),
-    VDEFAULT(208),
-    VWITHFIELD(209),
-    VBOX(210),
-    VUNBOX(211),
+    DEFAULTVALUE(203),
+    WITHFIELD(204),
     TYPED(212);
 
     int code;
--- a/src/java.base/share/classes/jdk/experimental/bytecode/TypeTag.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/TypeTag.java	Wed Mar 07 14:32:37 2018 +0530
@@ -35,8 +35,7 @@
     A("A", 4, 1, -1),
     C("C", 0, 1, 5),
     Z("Z", 0, 1, 4),
-    V("V", -1, -1, -1),
-    Q("Q", -1, 1, -1);
+    V("V", -1, -1, -1);
 
     String typeStr;
     int offset;
--- a/src/java.base/share/classes/jdk/experimental/bytecode/TypedCodeBuilder.java	Wed Mar 07 11:43:10 2018 +0530
+++ b/src/java.base/share/classes/jdk/experimental/bytecode/TypedCodeBuilder.java	Wed Mar 07 14:32:37 2018 +0530
@@ -358,8 +358,7 @@
             T res;
             TypeTag tag1 = typeHelper.tag(t1);
             TypeTag tag2 = typeHelper.tag(t2);
-            if (tag1 != TypeTag.A && tag2 != TypeTag.A &&
-                    tag1 != TypeTag.Q && tag2 != TypeTag.Q) {
+            if (tag1 != TypeTag.A && tag2 != TypeTag.A) {
                 res = typeHelper.fromTag(TypeTag.commonSupertype(tag1, tag2));
             } else if (t1 == typeHelper.nullType()) {
                 res = t2;
@@ -389,7 +388,6 @@
     @SuppressWarnings("unchecked")
     public void updateState(Opcode op, Object optValue) {
         switch (op) {
-            case VALOAD:
             case AALOAD:
                 state.pop();
                 state.push(typeHelper.elemtype(state.pop()));
@@ -462,7 +460,6 @@
             case ALOAD:
             case LLOAD:
             case DLOAD:
-            case VLOAD:
                 state.push(state.locals.get((Integer) optValue));
                 break;
             case IALOAD:
@@ -511,7 +508,6 @@
             case ISTORE:
             case FSTORE:
             case ASTORE:
-            case VSTORE:
                 state.load(state.pop(), (int) optValue);
                 break;
             case LSTORE_0:
@@ -540,7 +536,6 @@
             case LUSHR:
                 state.pop();
                 break;
-            case VRETURN:
             case ARETURN:
             case IRETURN:
             case FRETURN:
@@ -580,7 +575,6 @@
                 state.pop();
                 state.push(TypeTag.I);
                 break;
-            case VASTORE:
             case AASTORE:
                 state.pop();
                 state.pop();
@@ -828,7 +822,7 @@
                 state.pop();
                 break;
             case NEW:
-            case VDEFAULT:
+            case DEFAULTVALUE:
                 state.push(typeHelper.type((S) optValue));
                 break;
             case NEWARRAY:
@@ -839,11 +833,6 @@
                 state.pop();
 		state.push(typeHelper.arrayOf(typeHelper.type((S)optValue))); 
                 break;
-            case VBOX:
-            case VUNBOX:
-                state.pop();
-                state.push(typeHelper.type((S) optValue));
-                break;
             case MULTIANEWARRAY:
                 for (int i = 0; i < (byte) ((Object[]) optValue)[1]; i++) {
                     state.pop();
@@ -882,7 +871,7 @@
                 state.pop();
                 break;
             }
-            case VWITHFIELD: {
+            case WITHFIELD: {
                 TypeTag tag = typeHelper.tag((T) optValue);
                 if (tag.width == 1) {
                     state.pop();