本文整理汇总了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());
}
}