本文整理匯總了Java中org.objectweb.asm.tree.JumpInsnNode.getOpcode方法的典型用法代碼示例。如果您正苦於以下問題:Java JumpInsnNode.getOpcode方法的具體用法?Java JumpInsnNode.getOpcode怎麽用?Java JumpInsnNode.getOpcode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.objectweb.asm.tree.JumpInsnNode
的用法示例。
在下文中一共展示了JumpInsnNode.getOpcode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJumpTargets
import org.objectweb.asm.tree.JumpInsnNode; //導入方法依賴的package包/類
private int[] getJumpTargets(JumpInsnNode jump) {
switch (jump.getOpcode()) {
case Opcodes.IFEQ:
case Opcodes.IFNE:
case Opcodes.IFLT:
case Opcodes.IFGE:
case Opcodes.IFGT:
case Opcodes.IFLE:
case Opcodes.IF_ICMPEQ:
case Opcodes.IF_ICMPNE:
case Opcodes.IF_ICMPLT:
case Opcodes.IF_ICMPGE:
case Opcodes.IF_ICMPGT:
case Opcodes.IF_ICMPLE:
case Opcodes.IF_ACMPEQ:
case Opcodes.IF_ACMPNE:
case Opcodes.IFNULL:
case Opcodes.IFNONNULL:
return new int[]{getOffset(jump.label), getOffset(jump.getNext())};
case Opcodes.GOTO:
return new int[]{getOffset(jump.label)};
case Opcodes.JSR: {
throw new Unreachable("JSR should be handled by the ASM jsr inliner");
}
default:
throw new Unreachable("Unexpected opcode in jump instruction: " + jump);
}
}
示例2: makeConditionalExpression
import org.objectweb.asm.tree.JumpInsnNode; //導入方法依賴的package包/類
private JumpExpression makeConditionalExpression(JumpInsnNode node, ExpressionStack stack) {
JumpExpression exp = null;
int jumpDestination = stack.getLabelId(node.label.getLabel());
int opCode = node.getOpcode();
LOG.debug("jump destination L" + jumpDestination);
if (Util.isBetween(opCode, Opcodes.IF_ICMPEQ, Opcodes.IF_ACMPNE)) {
exp = new MultiConditional(opCode, jumpDestination, stack.pop(), stack.pop());
} else if (Util.isBetween(opCode, Opcodes.IFEQ, Opcodes.IFLE)) {
Expression stackTop = stack.peek();
if (stackTop instanceof MultiConditional && !((MultiConditional) stackTop).isJumpDestinationSet()) {
exp = (MultiConditional) stack.pop();
exp.setJumpDestination(jumpDestination);
exp.setOpCode(node.getOpcode());
} else {
exp = new SingleConditional(opCode, jumpDestination, stack.pop());
}
} else if (Util.isBetween(opCode, Opcodes.IFNULL, Opcodes.IFNONNULL)) {
exp = new MultiConditional(opCode, jumpDestination, new PrimaryExpression("null", DataType.UNKNOWN), stack.pop());
} else if (opCode == Opcodes.GOTO) {
exp = new UnconditionalJump(opCode, jumpDestination);
}
if (opCode != Opcodes.GOTO && exp != null && node.getNext() != null && node.getNext() instanceof LabelNode) {
exp.setThenBranchStart(stack.getLabelId(((LabelNode) node.getNext()).getLabel()));
}
return exp;
}
示例3: transformJumpInsnNode
import org.objectweb.asm.tree.JumpInsnNode; //導入方法依賴的package包/類
@Override
protected AbstractInsnNode transformJumpInsnNode(MethodNode mn,
JumpInsnNode jumpNode) {
switch (jumpNode.getOpcode()) {
case Opcodes.IFEQ:
case Opcodes.IFNE:
case Opcodes.IFLT:
case Opcodes.IFGE:
case Opcodes.IFGT:
case Opcodes.IFLE:
TransformationStatistics.insertPush(jumpNode.getOpcode());
this.booleanTestabilityTransformation.insertPush(jumpNode.getOpcode(), jumpNode, mn.instructions);
break;
case Opcodes.IF_ICMPEQ:
case Opcodes.IF_ICMPNE:
case Opcodes.IF_ICMPLT:
case Opcodes.IF_ICMPGE:
case Opcodes.IF_ICMPGT:
case Opcodes.IF_ICMPLE:
TransformationStatistics.insertPush(jumpNode.getOpcode());
this.booleanTestabilityTransformation.insertPush2(jumpNode.getOpcode(), jumpNode, mn.instructions);
break;
case Opcodes.IFNULL:
case Opcodes.IFNONNULL:
TransformationStatistics.insertPush(jumpNode.getOpcode());
this.booleanTestabilityTransformation.insertPushNull(jumpNode.getOpcode(), jumpNode, mn.instructions);
break;
case Opcodes.IF_ACMPEQ:
case Opcodes.IF_ACMPNE:
TransformationStatistics.insertPush(jumpNode.getOpcode());
this.booleanTestabilityTransformation.insertPushEquals(jumpNode.getOpcode(), jumpNode, mn.instructions);
break;
default:
// GOTO, JSR: Do nothing
}
return jumpNode;
}
示例4: readJumpInstruction
import org.objectweb.asm.tree.JumpInsnNode; //導入方法依賴的package包/類
/**
* The {@link AbstractInsnNode#getOpcode()} value should be one of {@code IFEQ}, {@code IFNE},
* {@code IFLT}, {@code IFGE}, {@code IFGT}, {@code IFLE}, {@code IFLT}, {@code IFGE},
* {@code IFGT},{@code IF_ICMPEQ}, {@code IF_ICMPNE}, {@code IF_ICMPLT}, {@code IF_ICMPGE},
* {@code IF_ICMPGT}, {@code IF_ICMPLE}, {@code IF_ACMPEQ}, {@code IF_ACMPNE}, {@code GOTO},
* {@code JSR}, {@code IFNULL} or {@code IFNONNULL}.
*
*
* @param instructionCursor the cursor for the current instruction to read
* @param expressionStack the stack of Expressions
* @param capturedArguments the captured arguments
* @param localVariables the local variables
* @return the list of statements read from the jump instruction
*/
private List<Statement> readJumpInstruction(final InsnCursor instructionCursor,
final Stack<Expression> expressionStack, final List<CapturedArgument> capturedArguments,
final LocalVariables localVariables) {
final JumpInsnNode jumpInsnNode = (JumpInsnNode) instructionCursor.getCurrent();
final LabelNode jumpLabel = jumpInsnNode.label;
// FIXME: add support for LCMP:
// Takes two two-word long integers off the stack and compares them. If
// the two integers are the same, the int 0 is pushed onto the stack. If
// value2 is greater than value1, the int 1 is pushed onto the stack. If
// value1 is greater than value2, the int -1 is pushed onto the stack.
switch (jumpInsnNode.getOpcode()) {
case Opcodes.IFEQ:
case Opcodes.IFNE:
case Opcodes.IFLE:
case Opcodes.IFLT:
case Opcodes.IFGE:
case Opcodes.IFGT:
case Opcodes.IF_ICMPEQ:
case Opcodes.IF_ICMPNE:
case Opcodes.IF_ICMPLE:
case Opcodes.IF_ICMPLT:
case Opcodes.IF_ICMPGE:
case Opcodes.IF_ICMPGT:
case Opcodes.IF_ACMPEQ:
case Opcodes.IF_ACMPNE:
return Arrays.asList(buildControlFlowStatement(instructionCursor, expressionStack,
capturedArguments, localVariables));
case Opcodes.GOTO:
final InsnCursor jumpInstructionCursor = instructionCursor.duplicate();
jumpInstructionCursor.move(jumpLabel.getLabel());
return readStatements(jumpInstructionCursor, expressionStack, capturedArguments,
localVariables);
default:
throw new AnalyzeException("Unexpected JumpInsnNode OpCode: " + jumpInsnNode.getOpcode());
}
}