< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java

Print this page
@@ -397,10 +397,21 @@
          Assert.check(alive || isStatementStart());
      }
  
      /** Emit a ldc (or ldc_w) instruction, taking into account operand size
      */
+     public void emitLdc(LoadableConstant constant, int od) {
+         if (od <= 255) {
+             emitop1(ldc1, od, constant);
+         }
+         else {
+             emitop2(ldc2, od, constant);
+         }
+     }
+ 
+     /** Emit a ldc (or ldc_w) instruction, taking into account operand size
+      */
      public void emitLdc(LoadableConstant constant) {
          int od = poolWriter.putConstant(constant);
          if (od <= 255) {
              emitop1(ldc1, od, constant);
          }

@@ -1018,11 +1029,16 @@
          case putstatic:
              state.pop(((Symbol)data).erasure(types));
              break;
          case new_: {
              Type t = (Type)data;
-             state.push(uninitializedObject(t.tsym.erasure(types), cp-3));
+             state.push(uninitializedObject(t.tsym.erasure(types), cp - 3));
+             break;
+         }
+         case defaultvalue: {
+             Type t = (Type)data;
+             state.push(t.tsym.erasure(types));
              break;
          }
          case sipush:
              state.push(syms.intType);
              break;

@@ -1047,21 +1063,24 @@
              state.pop(2);
              break;
          case goto_:
              markDead();
              break;
+         case withfield:
+             state.pop(((Symbol)data).erasure(types));
+             break;
          case putfield:
              state.pop(((Symbol)data).erasure(types));
              state.pop(1); // object ref
              break;
          case getfield:
              state.pop(1); // object ref
              state.push(((Symbol)data).erasure(types));
              break;
          case checkcast: {
              state.pop(1); // object ref
-             Type t = types.erasure((Type)data);
+             Type t = types.erasure(data instanceof  ConstantPoolQType ? ((ConstantPoolQType)data).type: (Type)data);
              state.push(t);
              break; }
          case ldc2w:
              state.push(types.constantType((LoadableConstant)data));
              break;

@@ -1771,12 +1790,12 @@
              switch (t.getTag()) {
              case CLASS:
              case ARRAY:
                  int width = width(t);
                  Type old = stack[stacksize-width];
-                 Assert.check(types.isSubtype(types.erasure(old),
-                                        types.erasure(t)));
+                 Assert.check(types.isSubtype(types.erasure(old), types.erasure(t)) ||
+                         (old.isPrimitiveClass() != t.isPrimitiveClass() && types.isConvertible(types.erasure(old), types.erasure(t))));
                  stack[stacksize-width] = t;
                  break;
              default:
              }
          }

@@ -2446,8 +2465,10 @@
              mnem[if_acmp_null] = "if_acmp_null";
              mnem[if_acmp_nonnull] = "if_acmp_nonnull";
              mnem[goto_w] = "goto_w";
              mnem[jsr_w] = "jsr_w";
              mnem[breakpoint] = "breakpoint";
+             mnem[defaultvalue] = "defaultvalue";
+             mnem[withfield] = "withfield";
          }
      }
  }
< prev index next >