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

Print this page




 902         case bipush:
 903             state.push(syms.intType);
 904             break;
 905         case ldc1:
 906             state.push(typeForPool(pool.pool[od]));
 907             break;
 908         default:
 909             throw new AssertionError(mnem(op));
 910         }
 911         postop();
 912     }
 913 
 914     /** The type of a constant pool entry. */
 915     private Type typeForPool(Object o) {
 916         if (o instanceof Integer) return syms.intType;
 917         if (o instanceof Float) return syms.floatType;
 918         if (o instanceof String) return syms.stringType;
 919         if (o instanceof Long) return syms.longType;
 920         if (o instanceof Double) return syms.doubleType;
 921         if (o instanceof ClassSymbol) return syms.classType;
 922         if (o instanceof Type.ArrayType) return syms.classType;
 923         if (o instanceof Type.MethodType) return syms.methodTypeType;
 924         if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
 925         if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
 926         throw new AssertionError(o);







 927     }
 928 
 929     /** Emit an opcode with a one-byte operand field;
 930      *  widen if field does not fit in a byte.
 931      */
 932     public void emitop1w(int op, int od) {
 933         if (od > 0xFF) {
 934             emitop(wide);
 935             emitop(op);
 936             emit2(od);
 937         } else {
 938             emitop(op);
 939             emit1(od);
 940         }
 941         if (!alive) return;
 942         switch (op) {
 943         case iload:
 944             state.push(syms.intType);
 945             break;
 946         case lload:




 902         case bipush:
 903             state.push(syms.intType);
 904             break;
 905         case ldc1:
 906             state.push(typeForPool(pool.pool[od]));
 907             break;
 908         default:
 909             throw new AssertionError(mnem(op));
 910         }
 911         postop();
 912     }
 913 
 914     /** The type of a constant pool entry. */
 915     private Type typeForPool(Object o) {
 916         if (o instanceof Integer) return syms.intType;
 917         if (o instanceof Float) return syms.floatType;
 918         if (o instanceof String) return syms.stringType;
 919         if (o instanceof Long) return syms.longType;
 920         if (o instanceof Double) return syms.doubleType;
 921         if (o instanceof ClassSymbol) return syms.classType;



 922         if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
 923         if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
 924         if (o instanceof Type) {
 925             Type ty = ((Type)o).unannotatedType();
 926 
 927             if (ty instanceof Type.ArrayType) return syms.classType;
 928             if (ty instanceof Type.MethodType) return syms.methodTypeType;
 929         }
 930         throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
 931     }
 932 
 933     /** Emit an opcode with a one-byte operand field;
 934      *  widen if field does not fit in a byte.
 935      */
 936     public void emitop1w(int op, int od) {
 937         if (od > 0xFF) {
 938             emitop(wide);
 939             emitop(op);
 940             emit2(od);
 941         } else {
 942             emitop(op);
 943             emit1(od);
 944         }
 945         if (!alive) return;
 946         switch (op) {
 947         case iload:
 948             state.push(syms.intType);
 949             break;
 950         case lload: