< prev index next >

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

Print this page
*** 30,26 ***
  import com.sun.tools.javac.resources.CompilerProperties.Errors;
  import com.sun.tools.javac.util.*;
  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  
  import java.util.function.ToIntBiFunction;
- import java.util.function.ToIntFunction;
  
  import static com.sun.tools.javac.code.TypeTag.BOT;
  import static com.sun.tools.javac.code.TypeTag.INT;
  import static com.sun.tools.javac.jvm.ByteCodes.*;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Class;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Double;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Fieldref;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Float;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Integer;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_InterfaceMethodref;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Long;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_MethodHandle;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_MethodType;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Methodref;
- import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_String;
  import static com.sun.tools.javac.jvm.UninitializedType.*;
  import static com.sun.tools.javac.jvm.ClassWriter.StackMapTableFrame;
  import java.util.Arrays;
  
  /** An internal structure that corresponds to the code attribute of
--- 30,14 ---

*** 397,10 ***
--- 385,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 ***
          case putstatic:
              state.pop(((Symbol)data).erasure(types));
              break;
          case new_: {
              Type t = (Type)data;
!             state.push(uninitializedObject(t.tsym.erasure(types), cp-3));
              break;
          }
          case sipush:
              state.push(syms.intType);
              break;
--- 1017,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));
+             break;
+         }
+         case aconst_init: {
+             Type t = (Type)data;
+             state.push(t.tsym.erasure(types));
              break;
          }
          case sipush:
              state.push(syms.intType);
              break;

*** 1047,21 ***
              state.pop(2);
              break;
          case goto_:
              markDead();
              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);
              state.push(t);
              break; }
          case ldc2w:
              state.push(types.constantType((LoadableConstant)data));
              break;
--- 1051,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(data instanceof  ConstantPoolQType ? ((ConstantPoolQType)data).type: (Type)data);
              state.push(t);
              break; }
          case ldc2w:
              state.push(types.constantType((LoadableConstant)data));
              break;

*** 1771,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)));
                  stack[stacksize-width] = t;
                  break;
              default:
              }
          }
--- 1778,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)) ||
!                         (old.isPrimitiveClass() != t.isPrimitiveClass() && types.isConvertible(types.erasure(old), types.erasure(t))));
                  stack[stacksize-width] = t;
                  break;
              default:
              }
          }

*** 2446,8 ***
--- 2453,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[aconst_init] = "aconst_init";
+             mnem[withfield] = "withfield";
          }
      }
  }
< prev index next >