List of usage examples for org.objectweb.asm Opcodes IFLE
int IFLE
To view the source code for org.objectweb.asm Opcodes IFLE.
Click Source Link
From source file:de.codesourcery.asm.util.ASMUtil.java
License:Apache License
/** * Check whether an instruction is a conditional branch operation. * /*ww w . jav a2 s .c o m*/ * @param node * @return */ public static boolean isConditionalJump(AbstractInsnNode node) { if (node.getType() == AbstractInsnNode.JUMP_INSN) { switch (node.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 true; } } return false; }
From source file:de.scoopgmbh.copper.instrument.BuildStackInfoAdapter.java
License:Apache License
@Override public void visitJumpInsn(int arg0, Label arg1) { savePreviousFrame();/*from w ww . j ava 2 s. com*/ switch (arg0) { case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPNE: currentFrame.popStack(); case Opcodes.IFEQ: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFLT: case Opcodes.IFNE: case Opcodes.IFNONNULL: case Opcodes.IFNULL: currentFrame.popStack(); case Opcodes.GOTO: forwardFrames.put(arg1, new StackInfo(currentFrame)); break; case Opcodes.JSR: currentFrame.pushStack(retAddressType); forwardFrames.put(arg1, new StackInfo(currentFrame)); break; default: logger.debug("Unhandled: "); } if (logger.isDebugEnabled()) logger.debug("jumpInsn " + getOpCode(arg0) + " " + arg1); delegate.visitJumpInsn(arg0, arg1); }
From source file:de.tuberlin.uebb.jbop.optimizer.controlflow.ConstantIfInliner.java
License:Open Source License
private boolean evalSingleOpValue(final Number op1, final int opcode) { switch (opcode) { case Opcodes.IFEQ: return op1.intValue() == 0; case Opcodes.IFNE: return op1.intValue() != 0; case Opcodes.IFLT: return op1.intValue() < 0; case Opcodes.IFGE: return op1.intValue() >= 0; case Opcodes.IFGT: return op1.intValue() > 0; case Opcodes.IFLE: return op1.intValue() <= 0; case Opcodes.IFNULL: return op1 == null; case Opcodes.IFNONNULL: return op1 != null; default://from ww w . j a v a 2s . c o m return false; } }
From source file:de.tuberlin.uebb.jbop.optimizer.loop.ForLoop.java
License:Open Source License
private boolean eval(final int i, final int loopCount, final int ifNode) { if (ifNode == Opcodes.IF_ICMPLE) { return i <= loopCount; }/*w w w. java 2s. c om*/ if (ifNode == Opcodes.IF_ICMPEQ) { return i == loopCount; } if (ifNode == Opcodes.IF_ICMPGE) { return i >= loopCount; } if (ifNode == Opcodes.IF_ICMPGT) { return i > loopCount; } if (ifNode == Opcodes.IF_ICMPLT) { return i < loopCount; } if (ifNode == Opcodes.IF_ICMPNE) { return i != loopCount; } if (ifNode == Opcodes.IFGE) { return i >= 0; } if (ifNode == Opcodes.IFEQ) { return i == 0; } if (ifNode == Opcodes.IFGT) { return i > 0; } if (ifNode == Opcodes.IFLE) { return i <= 0; } if (ifNode == Opcodes.IFLT) { return i < 0; } if (ifNode == Opcodes.IFNE) { return i != 0; } return false; }
From source file:de.tuberlin.uebb.jbop.optimizer.utils.NodeHelper.java
License:Open Source License
/** * Returns true if node is an one-param-if-Statement. * //ww w . j a v a 2s .co m * @param node * the node * @return true if node is one value if */ public static boolean isOneValueIf(final AbstractInsnNode node) { if (node == null) { return false; } if (node.getOpcode() == Opcodes.IFNULL) { return true; } if (node.getOpcode() == Opcodes.IFNONNULL) { return true; } if (node.getOpcode() >= Opcodes.IFEQ && node.getOpcode() <= Opcodes.IFLE) { return true; } return false; }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.JumpInstruction.java
License:Open Source License
@Override public String toString() { String condition;/*from ww w . ja v a2 s . co m*/ switch (getOpcode()) { case Opcodes.IFEQ: condition = "IFEQ"; break; case Opcodes.IFNE: condition = "IFNE"; break; case Opcodes.IFLT: condition = "IFLT"; break; case Opcodes.IFGE: condition = "IFGE"; break; case Opcodes.IFGT: condition = "IFGT"; break; case Opcodes.IFLE: condition = "IFLE"; break; case Opcodes.IF_ICMPEQ: condition = "IF_ICMPEQ"; break; case Opcodes.IF_ICMPNE: condition = "IF_ICMPNE"; break; case Opcodes.IF_ICMPLT: condition = "IF_ICMPLT"; break; case Opcodes.IF_ICMPGE: condition = "IF_ICMPGE"; break; case Opcodes.IF_ICMPGT: condition = "IF_ICMPGT"; break; case Opcodes.IF_ICMPLE: condition = "IF_ICMPLE"; break; case Opcodes.IF_ACMPEQ: condition = "IF_ACMPEQ"; break; case Opcodes.IF_ACMPNE: condition = "IF_ACMPNE"; break; case Opcodes.GOTO: condition = "GOTO"; break; case Opcodes.JSR: condition = "JSR"; break; case Opcodes.IFNULL: condition = "IFNULL"; break; case Opcodes.IFNONNULL: condition = "IFNONNULL"; break; default: assert false; condition = "--ERROR--"; break; } return condition + " " + this.label; }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.JumpInstruction2.java
License:Open Source License
@Override public String toString() { String condition;//from ww w .ja v a 2s . c o m switch (getOpcode()) { case Opcodes.IFEQ: condition = "IFEQ"; break; case Opcodes.IFNE: condition = "IFNE"; break; case Opcodes.IFLT: condition = "IFLT"; break; case Opcodes.IFGE: condition = "IFGE"; break; case Opcodes.IFGT: condition = "IFGT"; break; case Opcodes.IFLE: condition = "IFLE"; break; case Opcodes.IF_ICMPEQ: condition = "IF_ICMPEQ"; break; case Opcodes.IF_ICMPNE: condition = "IF_ICMPNE"; break; case Opcodes.IF_ICMPLT: condition = "IF_ICMPLT"; break; case Opcodes.IF_ICMPGE: condition = "IF_ICMPGE"; break; case Opcodes.IF_ICMPGT: condition = "IF_ICMPGT"; break; case Opcodes.IF_ICMPLE: condition = "IF_ICMPLE"; break; case Opcodes.IF_ACMPEQ: condition = "IF_ACMPEQ"; break; case Opcodes.IF_ACMPNE: condition = "IF_ACMPNE"; break; case Opcodes.GOTO: condition = "GOTO"; break; case Opcodes.JSR: condition = "JSR"; break; case Opcodes.IFNULL: condition = "IFNULL"; break; case Opcodes.IFNONNULL: condition = "IFNONNULL"; break; default: assert false; condition = "--ERROR--"; break; } return condition + " " + this.target; }
From source file:dyco4j.instrumentation.internals.InitTracingMethodVisitor.java
License:BSD License
@Override public void visitJumpInsn(final int opcode, final Label label) { mv.visitJumpInsn(opcode, label);/*from ww w . j a v a 2s.co m*/ switch (opcode) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFNULL: case Opcodes.IFNONNULL: this.stackFrame.pop(); 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: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: this.stackFrame.pop(); this.stackFrame.pop(); break; case Opcodes.JSR: this.stackFrame.push(OTHER); break; } addBranch(label); }
From source file:edu.mit.streamjit.util.bytecode.MethodResolver.java
License:Open Source License
private void interpret(JumpInsnNode insn, FrameState frame, BBInfo block) { //All JumpInsnNodes have a target. Find it. BBInfo target = blockByInsn(insn.label); assert target != null; if (insn.getOpcode() == Opcodes.GOTO) { block.block.instructions().add(new JumpInst(target.block)); return;/* w w w .j av a 2 s . co m*/ } else if (insn.getOpcode() == Opcodes.JSR) throw new UnsupportedOperationException("jsr not supported; upgrade to Java 6-era class files"); //Remaining opcodes are branches. BBInfo fallthrough = blocks.get(blocks.indexOf(block) + 1); BranchInst.Sense sense = OPCODE_TO_SENSE.get(insn.getOpcode()); //The second operand may come from the stack or may be a constant 0 or null. Value right; switch (insn.getOpcode()) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: right = module.constants().getConstant(0); break; case Opcodes.IFNULL: case Opcodes.IFNONNULL: right = module.constants().getNullConstant(); 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: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: right = frame.stack.pop(); break; default: throw new AssertionError("Can't happen! Branch opcode missing? " + insn.getOpcode()); } //First operand always comes from the stack. Value left = frame.stack.pop(); block.block.instructions().add(new BranchInst(left, sense, right, target.block, fallthrough.block)); }
From source file:edu.umd.cs.guitar.testcase.plugin.edg.ClassDBVisitor.java
License:Open Source License
@Override public void visitJumpInsn(int opcode, Label label) { currentMethod.setEmpty(false);/* w w w. j a va 2 s .c om*/ currentMethod.setEmpty(false); switch (opcode) { 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.GOTO: // case Opcodes.JSR: case Opcodes.IFNULL: case Opcodes.IFNONNULL: // add all label reads/writes as condition reads/writes currentMethod.getConditionReads().addAll(labelReads); currentMethod.getConditionWrites().addAll(labelWrites); break; } }