< prev index next >

test/jdk/lib/testlibrary/bytecode/jdk/experimental/bytecode/TypedCodeBuilder.java

Print this page
*** 135,99 ***
              });
              return this;
          }
      }
  
-     @Override
-     public StatefulTypedBuilder typed(TypeTag tag) {
-         return super.typed(tag, StatefulTypedBuilder::new);
-     }
- 
-     public class StatefulTypedBuilder extends LabelledTypedBuilder {
- 
-         TypeTag tag;
- 
-         StatefulTypedBuilder(TypeTag tag) {
-             this.tag = tag;
-         }
- 
-         @Override
-         public C astore_0() {
-             return storeAndUpdate(super::astore_0);
-         }
- 
-         @Override
-         public C astore_1() {
-             return storeAndUpdate(super::astore_1);
-         }
- 
-         @Override
-         public C astore_2() {
-             return storeAndUpdate(super::astore_2);
-         }
- 
-         @Override
-         public C astore_3() {
-             return storeAndUpdate(super::astore_3);
-         }
- 
-         @Override
-         public C astore(int n) {
-             return storeAndUpdate(() -> super.astore(n));
-         }
- 
-         @Override
-         public C aastore() {
-             return storeAndUpdate(super::aastore);
-         }
- 
-         @Override
-         public C areturn() {
-             state.pop(tag);
-             state.push(typeHelper.nullType());
-             return super.areturn();
-         }
- 
-         @Override
-         public C anewarray(S s) {
-             super.anewarray(s);
-             state.pop();
-             state.push(typeHelper.arrayOf(typeHelper.type(s)));
-             return thisBuilder();
-         }
- 
-         @Override
-         public C aconst_null() {
-             super.aconst_null();
-             state.pop();
-             state.push(tag);
-             return thisBuilder();
-         }
- 
-         public C if_acmpeq(CharSequence label) {
-             return jumpAndUpdate(() -> super.if_acmpeq(label));
-         }
- 
-         public C if_acmpne(CharSequence label) {
-             return jumpAndUpdate(() -> super.if_acmpne(label));
-         }
- 
-         private C storeAndUpdate(Supplier<C> op) {
-             state.pop(tag);
-             state.push(typeHelper.nullType());
-             return op.get();
-         }
- 
-         private C jumpAndUpdate(Supplier<C> op) {
-             state.pop(tag);
-             state.pop(tag);
-             state.push(typeHelper.nullType());
-             state.push(typeHelper.nullType());
-             return op.get();
-         }
-     }
- 
      public class State {
          public final ArrayList<T> stack;
          public final Vector<T> locals;
          boolean alive;
  
--- 135,10 ---

*** 384,19 ***
      }
  
      @SuppressWarnings("unchecked")
      public void updateState(Opcode op, Object optValue) {
          switch (op) {
-             case VALOAD:
              case AALOAD:
                  state.pop();
                  state.push(typeHelper.elemtype(state.pop()));
                  break;
              case GOTO_:
                  state.alive = false;
                  break;
              case NOP:
              case INEG:
              case LNEG:
              case FNEG:
              case DNEG:
                  break;
--- 295,19 ---
      }
  
      @SuppressWarnings("unchecked")
      public void updateState(Opcode op, Object optValue) {
          switch (op) {
              case AALOAD:
                  state.pop();
                  state.push(typeHelper.elemtype(state.pop()));
                  break;
              case GOTO_:
                  state.alive = false;
                  break;
              case NOP:
+             case IINC:
              case INEG:
              case LNEG:
              case FNEG:
              case DNEG:
                  break;

*** 456,11 ***
              case ILOAD:
              case FLOAD:
              case ALOAD:
              case LLOAD:
              case DLOAD:
-             case VLOAD:
                  state.push(state.locals.get((Integer) optValue));
                  break;
              case IALOAD:
              case BALOAD:
              case CALOAD:
--- 367,10 ---

*** 505,11 ***
                  state.load(state.pop(), 3);
                  break;
              case ISTORE:
              case FSTORE:
              case ASTORE:
-             case VSTORE:
                  state.load(state.pop(), (int) optValue);
                  break;
              case LSTORE_0:
              case DSTORE_0:
                  state.load(state.pop2(), 0);
--- 415,10 ---

*** 534,11 ***
              case LSHR:
              case LSHL:
              case LUSHR:
                  state.pop();
                  break;
-             case VRETURN:
              case ARETURN:
              case IRETURN:
              case FRETURN:
                  state.pop();
                  break;
--- 443,10 ---

*** 574,11 ***
              case IXOR:
                  state.pop();
                  state.pop();
                  state.push(TypeTag.I);
                  break;
-             case VASTORE:
              case AASTORE:
                  state.pop();
                  state.pop();
                  state.pop();
                  break;
--- 482,10 ---

*** 821,29 ***
                  return;
              case MONITORENTER:
              case MONITOREXIT:
                  state.pop();
                  break;
-             case VNEW:
              case NEW:
                  state.push(typeHelper.type((S) optValue));
                  break;
              case NEWARRAY:
                  state.pop();
                  state.push(typeHelper.arrayOf(typeHelper.fromTag((TypeTag) optValue)));
                  break;
              case ANEWARRAY:
                  state.pop();
                  state.push(typeHelper.arrayOf(typeHelper.arrayOf(typeHelper.type((S)optValue))));
                  break;
-             case VNEWARRAY:
-             case VBOX:
-             case VUNBOX:
-                 state.pop();
-                 state.push(typeHelper.type((S) optValue));
-                 break;
-             case MULTIVNEWARRAY:
              case MULTIANEWARRAY:
                  for (int i = 0; i < (byte) ((Object[]) optValue)[1]; i++) {
                      state.pop();
                  }
                  state.push(typeHelper.type((S) ((Object[]) optValue)[0]));
--- 728,22 ---
                  return;
              case MONITORENTER:
              case MONITOREXIT:
                  state.pop();
                  break;
              case NEW:
+             case DEFAULTVALUE:
                  state.push(typeHelper.type((S) optValue));
                  break;
              case NEWARRAY:
                  state.pop();
                  state.push(typeHelper.arrayOf(typeHelper.fromTag((TypeTag) optValue)));
                  break;
              case ANEWARRAY:
                  state.pop();
                  state.push(typeHelper.arrayOf(typeHelper.arrayOf(typeHelper.type((S)optValue))));
                  break;
              case MULTIANEWARRAY:
                  for (int i = 0; i < (byte) ((Object[]) optValue)[1]; i++) {
                      state.pop();
                  }
                  state.push(typeHelper.type((S) ((Object[]) optValue)[0]));

*** 856,11 ***
                  processInvoke(op, (T) optValue);
                  break;
              case GETSTATIC:
                  state.push((T) optValue);
                  break;
-             case VGETFIELD:
              case GETFIELD:
                  state.pop();
                  state.push((T) optValue);
                  break;
              case PUTSTATIC: {
--- 756,10 ---

*** 880,10 ***
--- 779,19 ---
                      state.pop2();
                  }
                  state.pop();
                  break;
              }
+             case WITHFIELD: {
+                 TypeTag tag = typeHelper.tag((T) optValue);
+                 if (tag.width == 1) {
+                     state.pop();
+                 } else {
+                     state.pop2();
+                 }
+                 break;
+             }
              case BIPUSH:
              case SIPUSH:
                  state.push(TypeTag.I);
                  break;
              case LDC:

*** 914,11 ***
                  break;
              case INSTANCEOF:
                  state.pop();
                  state.push(TypeTag.Z);
                  break;
-             case TYPED:
              case CHECKCAST:
                  break;
  
              default:
                  throw new UnsupportedOperationException("Unsupported opcode: " + op);
--- 822,10 ---

*** 962,10 ***
--- 869,15 ---
              public int putClass(S symbol) {
                  type = typeHelper.type(symbol);
                  return poolHelper.putClass(symbol);
              }
  
+             @Override
+             public int putInlineClass(S symbol) {
+                 throw new IllegalStateException();
+             }
+ 
              @Override
              public int putInt(int i) {
                  type = typeHelper.fromTag(TypeTag.I);
                  return poolHelper.putInt(i);
              }
< prev index next >