|
|
|
@ -29,21 +29,21 @@ import gnu.bytecode.CpoolClass; |
|
|
|
|
*/ |
|
|
|
|
public abstract class Opcodes { |
|
|
|
|
|
|
|
|
|
public final static Type ALL_INT_TYPE = Type.tUInt; |
|
|
|
|
public final static Type BOOL_INT_TYPE = Type.tBoolInt; |
|
|
|
|
public final static Type INT_TYPE = Type.tInt; |
|
|
|
|
public final static Type LONG_TYPE = Type.tLong; |
|
|
|
|
public final static Type FLOAT_TYPE = Type.tFloat; |
|
|
|
|
public final static Type DOUBLE_TYPE = Type.tDouble; |
|
|
|
|
public final static Type OBJECT_TYPE = Type.tUObject; |
|
|
|
|
public final static Type BOOLEAN_TYPE = Type.tBoolean; |
|
|
|
|
public final static Type BYTEBOOL_TYPE = Type.tBoolByte; |
|
|
|
|
public final static Type BYTE_TYPE = Type.tByte; |
|
|
|
|
public final static Type CHAR_TYPE = Type.tChar; |
|
|
|
|
public final static Type SHORT_TYPE = Type.tShort; |
|
|
|
|
public final static Type VOID_TYPE = Type.tVoid; |
|
|
|
|
private final static Type ALL_INT_TYPE = Type.tUInt; |
|
|
|
|
private final static Type BOOL_INT_TYPE = Type.tBoolInt; |
|
|
|
|
private final static Type INT_TYPE = Type.tInt; |
|
|
|
|
private final static Type LONG_TYPE = Type.tLong; |
|
|
|
|
private final static Type FLOAT_TYPE = Type.tFloat; |
|
|
|
|
private final static Type DOUBLE_TYPE = Type.tDouble; |
|
|
|
|
private final static Type OBJECT_TYPE = Type.tUObject; |
|
|
|
|
private final static Type BOOLEAN_TYPE = Type.tBoolean; |
|
|
|
|
private final static Type BYTEBOOL_TYPE = Type.tBoolByte; |
|
|
|
|
private final static Type BYTE_TYPE = Type.tByte; |
|
|
|
|
private final static Type CHAR_TYPE = Type.tChar; |
|
|
|
|
private final static Type SHORT_TYPE = Type.tShort; |
|
|
|
|
private final static Type VOID_TYPE = Type.tVoid; |
|
|
|
|
|
|
|
|
|
public final static Type types[][] = { |
|
|
|
|
private final static Type types[][] = { |
|
|
|
|
{BOOL_INT_TYPE, LONG_TYPE, FLOAT_TYPE, DOUBLE_TYPE, OBJECT_TYPE }, |
|
|
|
|
{ INT_TYPE, LONG_TYPE, FLOAT_TYPE, DOUBLE_TYPE, OBJECT_TYPE, |
|
|
|
|
BYTEBOOL_TYPE, CHAR_TYPE, SHORT_TYPE }, |
|
|
|
@ -51,277 +51,387 @@ public abstract class Opcodes { |
|
|
|
|
{ ALL_INT_TYPE, LONG_TYPE, FLOAT_TYPE, DOUBLE_TYPE, OBJECT_TYPE } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public static final int opc_nop = 0; |
|
|
|
|
public static final int opc_aconst_null = 1; |
|
|
|
|
public static final int opc_iconst_m1 = 2; |
|
|
|
|
public static final int opc_iconst_0 = 3; |
|
|
|
|
public static final int opc_iconst_1 = 4; |
|
|
|
|
public static final int opc_iconst_2 = 5; |
|
|
|
|
public static final int opc_iconst_3 = 6; |
|
|
|
|
public static final int opc_iconst_4 = 7; |
|
|
|
|
public static final int opc_iconst_5 = 8; |
|
|
|
|
public static final int opc_lconst_0 = 9; |
|
|
|
|
public static final int opc_lconst_1 = 10; |
|
|
|
|
public static final int opc_fconst_0 = 11; |
|
|
|
|
public static final int opc_fconst_1 = 12; |
|
|
|
|
public static final int opc_fconst_2 = 13; |
|
|
|
|
public static final int opc_dconst_0 = 14; |
|
|
|
|
public static final int opc_dconst_1 = 15; |
|
|
|
|
public static final int opc_bipush = 16; |
|
|
|
|
public static final int opc_sipush = 17; |
|
|
|
|
public static final int opc_ldc = 18; |
|
|
|
|
public static final int opc_ldc_w = 19; |
|
|
|
|
public static final int opc_ldc2_w = 20; |
|
|
|
|
public static final int opc_iload = 21; |
|
|
|
|
public static final int opc_lload = 22; |
|
|
|
|
public static final int opc_fload = 23; |
|
|
|
|
public static final int opc_dload = 24; |
|
|
|
|
public static final int opc_aload = 25; |
|
|
|
|
public static final int opc_iload_0 = 26; |
|
|
|
|
public static final int opc_iload_1 = 27; |
|
|
|
|
public static final int opc_iload_2 = 28; |
|
|
|
|
public static final int opc_iload_3 = 29; |
|
|
|
|
public static final int opc_lload_0 = 30; |
|
|
|
|
public static final int opc_lload_1 = 31; |
|
|
|
|
public static final int opc_lload_2 = 32; |
|
|
|
|
public static final int opc_lload_3 = 33; |
|
|
|
|
public static final int opc_fload_0 = 34; |
|
|
|
|
public static final int opc_fload_1 = 35; |
|
|
|
|
public static final int opc_fload_2 = 36; |
|
|
|
|
public static final int opc_fload_3 = 37; |
|
|
|
|
public static final int opc_dload_0 = 38; |
|
|
|
|
public static final int opc_dload_1 = 39; |
|
|
|
|
public static final int opc_dload_2 = 40; |
|
|
|
|
public static final int opc_dload_3 = 41; |
|
|
|
|
public static final int opc_aload_0 = 42; |
|
|
|
|
public static final int opc_aload_1 = 43; |
|
|
|
|
public static final int opc_aload_2 = 44; |
|
|
|
|
public static final int opc_aload_3 = 45; |
|
|
|
|
public static final int opc_iaload = 46; |
|
|
|
|
public static final int opc_laload = 47; |
|
|
|
|
public static final int opc_faload = 48; |
|
|
|
|
public static final int opc_daload = 49; |
|
|
|
|
public static final int opc_aaload = 50; |
|
|
|
|
public static final int opc_baload = 51; |
|
|
|
|
public static final int opc_caload = 52; |
|
|
|
|
public static final int opc_saload = 53; |
|
|
|
|
public static final int opc_istore = 54; |
|
|
|
|
public static final int opc_lstore = 55; |
|
|
|
|
public static final int opc_fstore = 56; |
|
|
|
|
public static final int opc_dstore = 57; |
|
|
|
|
public static final int opc_astore = 58; |
|
|
|
|
public static final int opc_istore_0 = 59; |
|
|
|
|
public static final int opc_istore_1 = 60; |
|
|
|
|
public static final int opc_istore_2 = 61; |
|
|
|
|
public static final int opc_istore_3 = 62; |
|
|
|
|
public static final int opc_lstore_0 = 63; |
|
|
|
|
public static final int opc_lstore_1 = 64; |
|
|
|
|
public static final int opc_lstore_2 = 65; |
|
|
|
|
public static final int opc_lstore_3 = 66; |
|
|
|
|
public static final int opc_fstore_0 = 67; |
|
|
|
|
public static final int opc_fstore_1 = 68; |
|
|
|
|
public static final int opc_fstore_2 = 69; |
|
|
|
|
public static final int opc_fstore_3 = 70; |
|
|
|
|
public static final int opc_dstore_0 = 71; |
|
|
|
|
public static final int opc_dstore_1 = 72; |
|
|
|
|
public static final int opc_dstore_2 = 73; |
|
|
|
|
public static final int opc_dstore_3 = 74; |
|
|
|
|
public static final int opc_astore_0 = 75; |
|
|
|
|
public static final int opc_astore_1 = 76; |
|
|
|
|
public static final int opc_astore_2 = 77; |
|
|
|
|
public static final int opc_astore_3 = 78; |
|
|
|
|
public static final int opc_iastore = 79; |
|
|
|
|
public static final int opc_lastore = 80; |
|
|
|
|
public static final int opc_fastore = 81; |
|
|
|
|
public static final int opc_dastore = 82; |
|
|
|
|
public static final int opc_aastore = 83; |
|
|
|
|
public static final int opc_bastore = 84; |
|
|
|
|
public static final int opc_castore = 85; |
|
|
|
|
public static final int opc_sastore = 86; |
|
|
|
|
public static final int opc_pop = 87; |
|
|
|
|
public static final int opc_pop2 = 88; |
|
|
|
|
public static final int opc_dup = 89; |
|
|
|
|
public static final int opc_dup_x1 = 90; |
|
|
|
|
public static final int opc_dup_x2 = 91; |
|
|
|
|
public static final int opc_dup2 = 92; |
|
|
|
|
public static final int opc_dup2_x1 = 93; |
|
|
|
|
public static final int opc_dup2_x2 = 94; |
|
|
|
|
public static final int opc_swap = 95; |
|
|
|
|
public static final int opc_iadd = 96; |
|
|
|
|
public static final int opc_ladd = 97; |
|
|
|
|
public static final int opc_fadd = 98; |
|
|
|
|
public static final int opc_dadd = 99; |
|
|
|
|
public static final int opc_isub = 100; |
|
|
|
|
public static final int opc_lsub = 101; |
|
|
|
|
public static final int opc_fsub = 102; |
|
|
|
|
public static final int opc_dsub = 103; |
|
|
|
|
public static final int opc_imul = 104; |
|
|
|
|
public static final int opc_lmul = 105; |
|
|
|
|
public static final int opc_fmul = 106; |
|
|
|
|
public static final int opc_dmul = 107; |
|
|
|
|
public static final int opc_idiv = 108; |
|
|
|
|
public static final int opc_ldiv = 109; |
|
|
|
|
public static final int opc_fdiv = 110; |
|
|
|
|
public static final int opc_ddiv = 111; |
|
|
|
|
public static final int opc_irem = 112; |
|
|
|
|
public static final int opc_lrem = 113; |
|
|
|
|
public static final int opc_frem = 114; |
|
|
|
|
public static final int opc_drem = 115; |
|
|
|
|
public static final int opc_ineg = 116; |
|
|
|
|
public static final int opc_lneg = 117; |
|
|
|
|
public static final int opc_fneg = 118; |
|
|
|
|
public static final int opc_dneg = 119; |
|
|
|
|
public static final int opc_ishl = 120; |
|
|
|
|
public static final int opc_lshl = 121; |
|
|
|
|
public static final int opc_ishr = 122; |
|
|
|
|
public static final int opc_lshr = 123; |
|
|
|
|
public static final int opc_iushr = 124; |
|
|
|
|
public static final int opc_lushr = 125; |
|
|
|
|
public static final int opc_iand = 126; |
|
|
|
|
public static final int opc_land = 127; |
|
|
|
|
public static final int opc_ior = 128; |
|
|
|
|
public static final int opc_lor = 129; |
|
|
|
|
public static final int opc_ixor = 130; |
|
|
|
|
public static final int opc_lxor = 131; |
|
|
|
|
public static final int opc_iinc = 132; |
|
|
|
|
public static final int opc_i2l = 133; |
|
|
|
|
public static final int opc_i2f = 134; |
|
|
|
|
public static final int opc_i2d = 135; |
|
|
|
|
public static final int opc_l2i = 136; |
|
|
|
|
public static final int opc_l2f = 137; |
|
|
|
|
public static final int opc_l2d = 138; |
|
|
|
|
public static final int opc_f2i = 139; |
|
|
|
|
public static final int opc_f2l = 140; |
|
|
|
|
public static final int opc_f2d = 141; |
|
|
|
|
public static final int opc_d2i = 142; |
|
|
|
|
public static final int opc_d2l = 143; |
|
|
|
|
public static final int opc_d2f = 144; |
|
|
|
|
public static final int opc_i2b = 145; |
|
|
|
|
public static final int opc_i2c = 146; |
|
|
|
|
public static final int opc_i2s = 147; |
|
|
|
|
public static final int opc_lcmp = 148; |
|
|
|
|
public static final int opc_fcmpl = 149; |
|
|
|
|
public static final int opc_fcmpg = 150; |
|
|
|
|
public static final int opc_dcmpl = 151; |
|
|
|
|
public static final int opc_dcmpg = 152; |
|
|
|
|
public static final int opc_ifeq = 153; |
|
|
|
|
public static final int opc_ifne = 154; |
|
|
|
|
public static final int opc_iflt = 155; |
|
|
|
|
public static final int opc_ifge = 156; |
|
|
|
|
public static final int opc_ifgt = 157; |
|
|
|
|
public static final int opc_ifle = 158; |
|
|
|
|
public static final int opc_if_icmpeq = 159; |
|
|
|
|
public static final int opc_if_icmpne = 160; |
|
|
|
|
public static final int opc_if_icmplt = 161; |
|
|
|
|
public static final int opc_if_icmpge = 162; |
|
|
|
|
public static final int opc_if_icmpgt = 163; |
|
|
|
|
public static final int opc_if_icmple = 164; |
|
|
|
|
public static final int opc_if_acmpeq = 165; |
|
|
|
|
public static final int opc_if_acmpne = 166; |
|
|
|
|
public static final int opc_goto = 167; |
|
|
|
|
public static final int opc_jsr = 168; |
|
|
|
|
public static final int opc_ret = 169; |
|
|
|
|
public static final int opc_tableswitch = 170; |
|
|
|
|
public static final int opc_lookupswitch = 171; |
|
|
|
|
public static final int opc_ireturn = 172; |
|
|
|
|
public static final int opc_lreturn = 173; |
|
|
|
|
public static final int opc_freturn = 174; |
|
|
|
|
public static final int opc_dreturn = 175; |
|
|
|
|
public static final int opc_areturn = 176; |
|
|
|
|
public static final int opc_return = 177; |
|
|
|
|
public static final int opc_getstatic = 178; |
|
|
|
|
public static final int opc_putstatic = 179; |
|
|
|
|
public static final int opc_getfield = 180; |
|
|
|
|
public static final int opc_putfield = 181; |
|
|
|
|
public static final int opc_invokevirtual = 182; |
|
|
|
|
public static final int opc_invokespecial = 183; |
|
|
|
|
public static final int opc_invokestatic = 184; |
|
|
|
|
public static final int opc_invokeinterface = 185; |
|
|
|
|
public static final int opc_xxxunusedxxx = 186; |
|
|
|
|
public static final int opc_new = 187; |
|
|
|
|
public static final int opc_newarray = 188; |
|
|
|
|
public static final int opc_anewarray = 189; |
|
|
|
|
public static final int opc_arraylength = 190; |
|
|
|
|
public static final int opc_athrow = 191; |
|
|
|
|
public static final int opc_checkcast = 192; |
|
|
|
|
public static final int opc_instanceof = 193; |
|
|
|
|
public static final int opc_monitorenter = 194; |
|
|
|
|
public static final int opc_monitorexit = 195; |
|
|
|
|
public static final int opc_wide = 196; |
|
|
|
|
public static final int opc_multianewarray = 197; |
|
|
|
|
public static final int opc_ifnull = 198; |
|
|
|
|
public static final int opc_ifnonnull = 199; |
|
|
|
|
public static final int opc_goto_w = 200; |
|
|
|
|
public static final int opc_jsr_w = 201; |
|
|
|
|
public static final int opc_breakpoint = 202; |
|
|
|
|
private final static int opc_nop = 0; |
|
|
|
|
private final static int opc_aconst_null = 1; |
|
|
|
|
private final static int opc_iconst_m1 = 2; |
|
|
|
|
private final static int opc_iconst_0 = 3; |
|
|
|
|
private final static int opc_iconst_1 = 4; |
|
|
|
|
private final static int opc_iconst_2 = 5; |
|
|
|
|
private final static int opc_iconst_3 = 6; |
|
|
|
|
private final static int opc_iconst_4 = 7; |
|
|
|
|
private final static int opc_iconst_5 = 8; |
|
|
|
|
private final static int opc_lconst_0 = 9; |
|
|
|
|
private final static int opc_lconst_1 = 10; |
|
|
|
|
private final static int opc_fconst_0 = 11; |
|
|
|
|
private final static int opc_fconst_1 = 12; |
|
|
|
|
private final static int opc_fconst_2 = 13; |
|
|
|
|
private final static int opc_dconst_0 = 14; |
|
|
|
|
private final static int opc_dconst_1 = 15; |
|
|
|
|
private final static int opc_bipush = 16; |
|
|
|
|
private final static int opc_sipush = 17; |
|
|
|
|
private final static int opc_ldc = 18; |
|
|
|
|
private final static int opc_ldc_w = 19; |
|
|
|
|
private final static int opc_ldc2_w = 20; |
|
|
|
|
private final static int opc_iload = 21; |
|
|
|
|
private final static int opc_lload = 22; |
|
|
|
|
private final static int opc_fload = 23; |
|
|
|
|
private final static int opc_dload = 24; |
|
|
|
|
private final static int opc_aload = 25; |
|
|
|
|
private final static int opc_iload_0 = 26; |
|
|
|
|
private final static int opc_iload_1 = 27; |
|
|
|
|
private final static int opc_iload_2 = 28; |
|
|
|
|
private final static int opc_iload_3 = 29; |
|
|
|
|
private final static int opc_lload_0 = 30; |
|
|
|
|
private final static int opc_lload_1 = 31; |
|
|
|
|
private final static int opc_lload_2 = 32; |
|
|
|
|
private final static int opc_lload_3 = 33; |
|
|
|
|
private final static int opc_fload_0 = 34; |
|
|
|
|
private final static int opc_fload_1 = 35; |
|
|
|
|
private final static int opc_fload_2 = 36; |
|
|
|
|
private final static int opc_fload_3 = 37; |
|
|
|
|
private final static int opc_dload_0 = 38; |
|
|
|
|
private final static int opc_dload_1 = 39; |
|
|
|
|
private final static int opc_dload_2 = 40; |
|
|
|
|
private final static int opc_dload_3 = 41; |
|
|
|
|
private final static int opc_aload_0 = 42; |
|
|
|
|
private final static int opc_aload_1 = 43; |
|
|
|
|
private final static int opc_aload_2 = 44; |
|
|
|
|
private final static int opc_aload_3 = 45; |
|
|
|
|
private final static int opc_iaload = 46; |
|
|
|
|
private final static int opc_laload = 47; |
|
|
|
|
private final static int opc_faload = 48; |
|
|
|
|
private final static int opc_daload = 49; |
|
|
|
|
private final static int opc_aaload = 50; |
|
|
|
|
private final static int opc_baload = 51; |
|
|
|
|
private final static int opc_caload = 52; |
|
|
|
|
private final static int opc_saload = 53; |
|
|
|
|
private final static int opc_istore = 54; |
|
|
|
|
private final static int opc_lstore = 55; |
|
|
|
|
private final static int opc_fstore = 56; |
|
|
|
|
private final static int opc_dstore = 57; |
|
|
|
|
private final static int opc_astore = 58; |
|
|
|
|
private final static int opc_istore_0 = 59; |
|
|
|
|
private final static int opc_istore_1 = 60; |
|
|
|
|
private final static int opc_istore_2 = 61; |
|
|
|
|
private final static int opc_istore_3 = 62; |
|
|
|
|
private final static int opc_lstore_0 = 63; |
|
|
|
|
private final static int opc_lstore_1 = 64; |
|
|
|
|
private final static int opc_lstore_2 = 65; |
|
|
|
|
private final static int opc_lstore_3 = 66; |
|
|
|
|
private final static int opc_fstore_0 = 67; |
|
|
|
|
private final static int opc_fstore_1 = 68; |
|
|
|
|
private final static int opc_fstore_2 = 69; |
|
|
|
|
private final static int opc_fstore_3 = 70; |
|
|
|
|
private final static int opc_dstore_0 = 71; |
|
|
|
|
private final static int opc_dstore_1 = 72; |
|
|
|
|
private final static int opc_dstore_2 = 73; |
|
|
|
|
private final static int opc_dstore_3 = 74; |
|
|
|
|
private final static int opc_astore_0 = 75; |
|
|
|
|
private final static int opc_astore_1 = 76; |
|
|
|
|
private final static int opc_astore_2 = 77; |
|
|
|
|
private final static int opc_astore_3 = 78; |
|
|
|
|
private final static int opc_iastore = 79; |
|
|
|
|
private final static int opc_lastore = 80; |
|
|
|
|
private final static int opc_fastore = 81; |
|
|
|
|
private final static int opc_dastore = 82; |
|
|
|
|
private final static int opc_aastore = 83; |
|
|
|
|
private final static int opc_bastore = 84; |
|
|
|
|
private final static int opc_castore = 85; |
|
|
|
|
private final static int opc_sastore = 86; |
|
|
|
|
private final static int opc_pop = 87; |
|
|
|
|
private final static int opc_pop2 = 88; |
|
|
|
|
private final static int opc_dup = 89; |
|
|
|
|
private final static int opc_dup_x1 = 90; |
|
|
|
|
private final static int opc_dup_x2 = 91; |
|
|
|
|
private final static int opc_dup2 = 92; |
|
|
|
|
private final static int opc_dup2_x1 = 93; |
|
|
|
|
private final static int opc_dup2_x2 = 94; |
|
|
|
|
private final static int opc_swap = 95; |
|
|
|
|
private final static int opc_iadd = 96; |
|
|
|
|
private final static int opc_ladd = 97; |
|
|
|
|
private final static int opc_fadd = 98; |
|
|
|
|
private final static int opc_dadd = 99; |
|
|
|
|
private final static int opc_isub = 100; |
|
|
|
|
private final static int opc_lsub = 101; |
|
|
|
|
private final static int opc_fsub = 102; |
|
|
|
|
private final static int opc_dsub = 103; |
|
|
|
|
private final static int opc_imul = 104; |
|
|
|
|
private final static int opc_lmul = 105; |
|
|
|
|
private final static int opc_fmul = 106; |
|
|
|
|
private final static int opc_dmul = 107; |
|
|
|
|
private final static int opc_idiv = 108; |
|
|
|
|
private final static int opc_ldiv = 109; |
|
|
|
|
private final static int opc_fdiv = 110; |
|
|
|
|
private final static int opc_ddiv = 111; |
|
|
|
|
private final static int opc_irem = 112; |
|
|
|
|
private final static int opc_lrem = 113; |
|
|
|
|
private final static int opc_frem = 114; |
|
|
|
|
private final static int opc_drem = 115; |
|
|
|
|
private final static int opc_ineg = 116; |
|
|
|
|
private final static int opc_lneg = 117; |
|
|
|
|
private final static int opc_fneg = 118; |
|
|
|
|
private final static int opc_dneg = 119; |
|
|
|
|
private final static int opc_ishl = 120; |
|
|
|
|
private final static int opc_lshl = 121; |
|
|
|
|
private final static int opc_ishr = 122; |
|
|
|
|
private final static int opc_lshr = 123; |
|
|
|
|
private final static int opc_iushr = 124; |
|
|
|
|
private final static int opc_lushr = 125; |
|
|
|
|
private final static int opc_iand = 126; |
|
|
|
|
private final static int opc_land = 127; |
|
|
|
|
private final static int opc_ior = 128; |
|
|
|
|
private final static int opc_lor = 129; |
|
|
|
|
private final static int opc_ixor = 130; |
|
|
|
|
private final static int opc_lxor = 131; |
|
|
|
|
private final static int opc_iinc = 132; |
|
|
|
|
private final static int opc_i2l = 133; |
|
|
|
|
private final static int opc_i2f = 134; |
|
|
|
|
private final static int opc_i2d = 135; |
|
|
|
|
private final static int opc_l2i = 136; |
|
|
|
|
private final static int opc_l2f = 137; |
|
|
|
|
private final static int opc_l2d = 138; |
|
|
|
|
private final static int opc_f2i = 139; |
|
|
|
|
private final static int opc_f2l = 140; |
|
|
|
|
private final static int opc_f2d = 141; |
|
|
|
|
private final static int opc_d2i = 142; |
|
|
|
|
private final static int opc_d2l = 143; |
|
|
|
|
private final static int opc_d2f = 144; |
|
|
|
|
private final static int opc_i2b = 145; |
|
|
|
|
private final static int opc_i2c = 146; |
|
|
|
|
private final static int opc_i2s = 147; |
|
|
|
|
private final static int opc_lcmp = 148; |
|
|
|
|
private final static int opc_fcmpl = 149; |
|
|
|
|
private final static int opc_fcmpg = 150; |
|
|
|
|
private final static int opc_dcmpl = 151; |
|
|
|
|
private final static int opc_dcmpg = 152; |
|
|
|
|
private final static int opc_ifeq = 153; |
|
|
|
|
private final static int opc_ifne = 154; |
|
|
|
|
private final static int opc_iflt = 155; |
|
|
|
|
private final static int opc_ifge = 156; |
|
|
|
|
private final static int opc_ifgt = 157; |
|
|
|
|
private final static int opc_ifle = 158; |
|
|
|
|
private final static int opc_if_icmpeq = 159; |
|
|
|
|
private final static int opc_if_icmpne = 160; |
|
|
|
|
private final static int opc_if_icmplt = 161; |
|
|
|
|
private final static int opc_if_icmpge = 162; |
|
|
|
|
private final static int opc_if_icmpgt = 163; |
|
|
|
|
private final static int opc_if_icmple = 164; |
|
|
|
|
private final static int opc_if_acmpeq = 165; |
|
|
|
|
private final static int opc_if_acmpne = 166; |
|
|
|
|
private final static int opc_goto = 167; |
|
|
|
|
private final static int opc_jsr = 168; |
|
|
|
|
private final static int opc_ret = 169; |
|
|
|
|
private final static int opc_tableswitch = 170; |
|
|
|
|
private final static int opc_lookupswitch = 171; |
|
|
|
|
private final static int opc_ireturn = 172; |
|
|
|
|
private final static int opc_lreturn = 173; |
|
|
|
|
private final static int opc_freturn = 174; |
|
|
|
|
private final static int opc_dreturn = 175; |
|
|
|
|
private final static int opc_areturn = 176; |
|
|
|
|
private final static int opc_return = 177; |
|
|
|
|
private final static int opc_getstatic = 178; |
|
|
|
|
private final static int opc_putstatic = 179; |
|
|
|
|
private final static int opc_getfield = 180; |
|
|
|
|
private final static int opc_putfield = 181; |
|
|
|
|
private final static int opc_invokevirtual = 182; |
|
|
|
|
private final static int opc_invokespecial = 183; |
|
|
|
|
private final static int opc_invokestatic = 184; |
|
|
|
|
private final static int opc_invokeinterface = 185; |
|
|
|
|
private final static int opc_xxxunusedxxx = 186; |
|
|
|
|
private final static int opc_new = 187; |
|
|
|
|
private final static int opc_newarray = 188; |
|
|
|
|
private final static int opc_anewarray = 189; |
|
|
|
|
private final static int opc_arraylength = 190; |
|
|
|
|
private final static int opc_athrow = 191; |
|
|
|
|
private final static int opc_checkcast = 192; |
|
|
|
|
private final static int opc_instanceof = 193; |
|
|
|
|
private final static int opc_monitorenter = 194; |
|
|
|
|
private final static int opc_monitorexit = 195; |
|
|
|
|
private final static int opc_wide = 196; |
|
|
|
|
private final static int opc_multianewarray = 197; |
|
|
|
|
private final static int opc_ifnull = 198; |
|
|
|
|
private final static int opc_ifnonnull = 199; |
|
|
|
|
private final static int opc_goto_w = 200; |
|
|
|
|
private final static int opc_jsr_w = 201; |
|
|
|
|
private final static int opc_breakpoint = 202; |
|
|
|
|
|
|
|
|
|
public static FlowBlock createNormal(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createNormal(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
Expression instr) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new InstructionBlock(instr, |
|
|
|
|
new Jump(addr+length))); |
|
|
|
|
return new InstructionBlock(instr, new Jump(addr+length)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createSpecial(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createSpecial(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
int type, int stackcount, int param) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new SpecialBlock(type, stackcount, param, |
|
|
|
|
new Jump(addr+length))); |
|
|
|
|
return new SpecialBlock(type, stackcount, param, |
|
|
|
|
new Jump(addr+length)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createGoto(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createGoto(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, int destAddr) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new EmptyBlock(new Jump(destAddr))); |
|
|
|
|
return new EmptyBlock(new Jump(destAddr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createJsr(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createJsr(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
int destAddr) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new JsrBlock(new Jump(addr+length), |
|
|
|
|
new Jump(destAddr))); |
|
|
|
|
return new JsrBlock(new Jump(addr+length), |
|
|
|
|
new Jump(destAddr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createIfGoto(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createIfGoto(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
int destAddr, Expression instr) |
|
|
|
|
{ |
|
|
|
|
ConditionalBlock ifBlock = |
|
|
|
|
new ConditionalBlock(instr, |
|
|
|
|
return new ConditionalBlock(instr, |
|
|
|
|
new Jump(destAddr), |
|
|
|
|
new Jump(addr+length)); |
|
|
|
|
return new FlowBlock(ca, addr, length, ifBlock); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createSwitch(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createSwitch(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
int[] cases, int[] dests) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new SwitchBlock(new NopOperator(Type.tUInt), |
|
|
|
|
cases, dests)); |
|
|
|
|
return new SwitchBlock(new NopOperator(Type.tUInt), cases, dests); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createBlock(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createBlock(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
StructuredBlock block) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, block); |
|
|
|
|
return block; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static FlowBlock createRet(CodeAnalyzer ca, |
|
|
|
|
private static StructuredBlock createRet(CodeAnalyzer ca, |
|
|
|
|
int addr, int length, |
|
|
|
|
LocalInfo local) |
|
|
|
|
{ |
|
|
|
|
return new FlowBlock(ca, addr, length, |
|
|
|
|
new RetBlock(local)); |
|
|
|
|
return new RetBlock(local); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Read an opcode out of a data input stream and determine its size |
|
|
|
|
* and its successors. |
|
|
|
|
* @param addr The current address. |
|
|
|
|
* @param stream The stream containing the java byte code. |
|
|
|
|
* @return An array of ints; the first entry is the size of the |
|
|
|
|
* instruction, the remaining are the successors. |
|
|
|
|
*/ |
|
|
|
|
public static int[] getSizeAndSuccs(int addr, DataInputStream stream) |
|
|
|
|
throws IOException |
|
|
|
|
{ |
|
|
|
|
int opcode = stream.readUnsignedByte(); |
|
|
|
|
switch (opcode) { |
|
|
|
|
case opc_multianewarray: |
|
|
|
|
stream.skip(3); |
|
|
|
|
return new int[] { 4, addr+4 }; |
|
|
|
|
case opc_invokeinterface: |
|
|
|
|
stream.skip(4); |
|
|
|
|
return new int[] { 5, addr+5 }; |
|
|
|
|
|
|
|
|
|
case opc_wide: { |
|
|
|
|
switch (opcode = stream.readUnsignedByte()) { |
|
|
|
|
case opc_iload: case opc_lload: |
|
|
|
|
case opc_fload: case opc_dload: case opc_aload: |
|
|
|
|
case opc_istore: case opc_lstore: |
|
|
|
|
case opc_fstore: case opc_dstore: case opc_astore: |
|
|
|
|
stream.skip(2); |
|
|
|
|
return new int[] { 4, addr+4 }; |
|
|
|
|
|
|
|
|
|
case opc_iinc: |
|
|
|
|
stream.skip(4); |
|
|
|
|
return new int[] { 6, addr+6 }; |
|
|
|
|
case opc_ret: |
|
|
|
|
stream.skip(2); |
|
|
|
|
return new int[] { 4 }; |
|
|
|
|
default: |
|
|
|
|
throw new ClassFormatError("Invalid wide opcode "+opcode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
case opc_ret: |
|
|
|
|
return new int[] { 2 }; |
|
|
|
|
|
|
|
|
|
case opc_jsr_w: |
|
|
|
|
return new int[] { 5, addr + 5, addr + stream.readInt() }; |
|
|
|
|
|
|
|
|
|
case opc_goto: |
|
|
|
|
return new int[] { 3, addr + stream.readShort() }; |
|
|
|
|
case opc_goto_w: |
|
|
|
|
return new int[] { 5, addr + stream.readInt() }; |
|
|
|
|
|
|
|
|
|
case opc_tableswitch: { |
|
|
|
|
int length = 3-(addr % 4); |
|
|
|
|
stream.skip(length); |
|
|
|
|
int def = addr + stream.readInt(); |
|
|
|
|
int low = stream.readInt(); |
|
|
|
|
int high = stream.readInt(); |
|
|
|
|
int[] dests = new int[high-low+3]; |
|
|
|
|
for (int i=0; i+low <= high; i++) { |
|
|
|
|
dests[i+1] = addr + stream.readInt(); |
|
|
|
|
} |
|
|
|
|
dests[dests.length-1] = def; |
|
|
|
|
dests[0] = length + 13 + 4 * (high-low+1); |
|
|
|
|
return dests; |
|
|
|
|
} |
|
|
|
|
case opc_lookupswitch: { |
|
|
|
|
int length = 3-(addr % 4); |
|
|
|
|
stream.skip(length); |
|
|
|
|
int def = stream.readInt(); |
|
|
|
|
int npairs = stream.readInt(); |
|
|
|
|
int[] dests = new int[npairs+2]; |
|
|
|
|
for (int i=0; i < npairs; i++) { |
|
|
|
|
int value = stream.readInt(); |
|
|
|
|
dests[i+1] = addr + stream.readInt(); |
|
|
|
|
} |
|
|
|
|
dests[npairs+1] = def; |
|
|
|
|
dests[0] = length + 9 + 8 * npairs; |
|
|
|
|
return dests; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case opc_ifnull: case opc_ifnonnull: |
|
|
|
|
case opc_jsr: |
|
|
|
|
return new int[] { 3, addr + 3, addr + stream.readShort() }; |
|
|
|
|
|
|
|
|
|
case opc_sipush: |
|
|
|
|
case opc_ldc_w: |
|
|
|
|
case opc_ldc2_w: |
|
|
|
|
case opc_iinc: |
|
|
|
|
case opc_getstatic: |
|
|
|
|
case opc_getfield: |
|
|
|
|
case opc_putstatic: |
|
|
|
|
case opc_putfield: |
|
|
|
|
case opc_invokevirtual: |
|
|
|
|
case opc_invokespecial: |
|
|
|
|
case opc_invokestatic : |
|
|
|
|
case opc_new: |
|
|
|
|
case opc_anewarray: |
|
|
|
|
case opc_checkcast: |
|
|
|
|
case opc_instanceof: |
|
|
|
|
stream.skip(2); |
|
|
|
|
return new int[] { 3, addr+3 }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (opcode == opc_newarray |
|
|
|
|
|| (opcode >= opc_bipush && opcode <= opc_aload) |
|
|
|
|
|| (opcode >= opc_istore && opcode <= opc_astore)) { |
|
|
|
|
stream.skip(1); |
|
|
|
|
return new int[] { 2, addr+2 }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (opcode >= opc_ireturn && opcode <= opc_return) |
|
|
|
|
return new int[] { 1 }; |
|
|
|
|
if (opcode >= opc_ifeq && opcode <= opc_if_acmpne) |
|
|
|
|
return new int[] { 3, addr + 3, addr + stream.readShort() }; |
|
|
|
|
if (opcode == opc_xxxunusedxxx || opcode > opc_breakpoint) |
|
|
|
|
throw new ClassFormatError("Invalid opcode "+opcode); |
|
|
|
|
|
|
|
|
|
return new int[] { 1, addr+1 }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -335,11 +445,10 @@ public abstract class Opcodes { |
|
|
|
|
* @exception IOException if an read error occured. |
|
|
|
|
* @exception ClassFormatError if an invalid opcode is detected. |
|
|
|
|
*/ |
|
|
|
|
public static FlowBlock readOpcode(int addr, DataInputStream stream, |
|
|
|
|
public static StructuredBlock readOpcode(int addr, DataInputStream stream, |
|
|
|
|
CodeAnalyzer ca) |
|
|
|
|
throws IOException, ClassFormatError |
|
|
|
|
{ |
|
|
|
|
try { |
|
|
|
|
int opcode = stream.readUnsignedByte(); |
|
|
|
|
switch (opcode) { |
|
|
|
|
case opc_nop: |
|
|
|
@ -643,7 +752,7 @@ public abstract class Opcodes { |
|
|
|
|
CpoolRef field = (CpoolRef)ca.method.classAnalyzer.getConstant |
|
|
|
|
(stream.readUnsignedShort()); |
|
|
|
|
|
|
|
|
|
FlowBlock fb = createNormal |
|
|
|
|
StructuredBlock block = createNormal |
|
|
|
|
(ca, addr, 5, new InvokeOperator |
|
|
|
|
(ca, false, |
|
|
|
|
Type.tClass(field.getCpoolClass() |
|
|
|
@ -652,7 +761,7 @@ public abstract class Opcodes { |
|
|
|
|
.getType().getString()), |
|
|
|
|
field.getNameAndType().getName().getString())); |
|
|
|
|
int reserved = stream.readUnsignedShort(); |
|
|
|
|
return fb; |
|
|
|
|
return block; |
|
|
|
|
} |
|
|
|
|
case opc_new: { |
|
|
|
|
CpoolClass cpcls = (CpoolClass) |
|
|
|
@ -785,9 +894,5 @@ public abstract class Opcodes { |
|
|
|
|
default: |
|
|
|
|
throw new ClassFormatError("Invalid opcode "+opcode); |
|
|
|
|
} |
|
|
|
|
} catch (ClassCastException ex) { |
|
|
|
|
ex.printStackTrace(); |
|
|
|
|
throw new ClassFormatError("Constant has wrong type"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|