public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
int target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); switch (opcode) { case GOTO : target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); return true; case JSR_W : if (opcode == JSR) target = index + ci.s16bitAt(index + 1); else target = index + ci.s32bitAt(index + 1);
int target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); switch (opcode) { case GOTO : target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); return true; case JSR_W : if (opcode == JSR) target = index + ci.s16bitAt(index + 1); else target = index + ci.s32bitAt(index + 1);
return opstring + " " + iter.byteAt(pos + 1); case SIPUSH: return opstring + " " + iter.s16bitAt(pos + 1); case LDC: return opstring + " " + ldc(pool, iter.byteAt(pos + 1)); case IF_ICMPLT: case IF_ICMPNE: return opstring + " " + (iter.s16bitAt(pos + 1) + pos); case IINC: return opstring + " " + iter.byteAt(pos + 1) + ", " + iter.signedByteAt(pos + 2); case GOTO: case JSR: return opstring + " " + (iter.s16bitAt(pos + 1) + pos); case RET: return opstring + " " + iter.byteAt(pos + 1);
if ((Opcode.IFEQ <= op && op <= Opcode.IF_ACMPNE) || op == Opcode.IFNULL || op == Opcode.IFNONNULL) { Mark to = makeMark(marks, index + ci.s16bitAt(index + 1)); Mark next = makeMark(marks, index + 3); makeMark(marks, index, makeArray(to.block, next.block), 3, false); switch (op) { case Opcode.GOTO : makeGoto(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.JSR : makeJsr(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.RET :
return opstring + " " + iter.byteAt(pos + 1); case SIPUSH: return opstring + " " + iter.s16bitAt(pos + 1); case LDC: return opstring + " " + ldc(pool, iter.byteAt(pos + 1)); case IF_ICMPLT: case IF_ICMPNE: return opstring + " " + (iter.s16bitAt(pos + 1) + pos); case IINC: return opstring + " " + iter.byteAt(pos + 1) + ", " + iter.signedByteAt(pos + 2); case GOTO: case JSR: return opstring + " " + (iter.s16bitAt(pos + 1) + pos); case RET: return opstring + " " + iter.byteAt(pos + 1);
if ((Opcode.IFEQ <= op && op <= Opcode.IF_ACMPNE) || op == Opcode.IFNULL || op == Opcode.IFNONNULL) { Mark to = makeMark(marks, index + ci.s16bitAt(index + 1)); Mark next = makeMark(marks, index + 3); makeMark(marks, index, makeArray(to.block, next.block), 3, false); switch (op) { case Opcode.GOTO : makeGoto(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.JSR : makeJsr(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.RET :
public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
public static int getJumpTarget(int pos, CodeIterator iter) { int opcode = iter.byteAt(pos); pos += (opcode == JSR_W || opcode == GOTO_W) ? iter.s32bitAt(pos + 1) : iter.s16bitAt(pos + 1); return pos; }
public static int decodeValueAt(OpParameterType type, CodeIterator iterator, int index) { switch(type) { case S1: return iterator.byteAt(index); case S2: return iterator.s16bitAt(index); case S4: return iterator.s32bitAt(index); case U1: return iterator.byteAt(index); case U2: return iterator.u16bitAt(index); case U4: default: throw new RuntimeException("unsupported"); } }
ClassFile cf = new ClassFile(new DataInputStream(className + ".class"))); for (Object m : cf.getMethods()) { MethodInfo minfo = (MethodInfo)m; CodeAttribute ca = minfo.getCodeAttribute(); for (CodeIterator ci = ca.iterator(); ci.hasNext();) { int index = ci.next(); int op = ci.byteAt(index); if (op == Opcode.GETYFIELD) { int a1 = ci.s16bitAt(index + 1); String fieldName = " " + cf.getConstPool().getFieldrefName(a1); System.out.println("field name: " + fieldName); } }
switch (op) { case Opcode.INVOKEINTERFACE: int a1 = ci.s16bitAt(address + 1); params += " " + cf.getConstPool().getInterfaceMethodrefName(a1); System.out.println("a1 = " + a1);
int target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); switch (opcode) { case GOTO : target = index + ci.s16bitAt(index + 1); checkTarget(index, target, codeLength, stack, stackDepth); return true; case JSR_W : if (opcode == JSR) target = index + ci.s16bitAt(index + 1); else target = index + ci.s32bitAt(index + 1);
int val = it.s16bitAt(index + 1);
int val = it.s16bitAt(index + 1);
if ((Opcode.IFEQ <= op && op <= Opcode.IF_ACMPNE) || op == Opcode.IFNULL || op == Opcode.IFNONNULL) { Mark to = makeMark(marks, index + ci.s16bitAt(index + 1)); Mark next = makeMark(marks, index + 3); makeMark(marks, index, makeArray(to.block, next.block), 3, false); switch (op) { case Opcode.GOTO : makeGoto(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.JSR : makeJsr(marks, index, index + ci.s16bitAt(index + 1), 3); break; case Opcode.RET :
if ((Opcode.IFEQ <= op && op <= Opcode.IF_ACMPNE) || op == Opcode.IFNULL || op == Opcode.IFNONNULL) { Mark to = makeMark(marks, index + ci.s16bitAt(index + 1)); Mark next = makeMark(marks, index + 3); makeMark(marks, index, makeArray(to.block, next.block), 3, false); case Opcode.GOTO : case Opcode.JSR : makeGotoJsr(marks, index, index + ci.s16bitAt(index + 1), op == Opcode.GOTO, 3); break;