List of usage examples for org.objectweb.asm Opcodes IF_ICMPEQ
int IF_ICMPEQ
To view the source code for org.objectweb.asm Opcodes IF_ICMPEQ.
Click Source Link
From source file:com.mebigfatguy.junitflood.jvm.OperandStack.java
License:Apache License
public void performJumpInsn(int opcode, Label label) { 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: pop();/*from w ww . j a va 2s . c om*/ 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: pop2(); break; case Opcodes.GOTO: //nop break; case Opcodes.JSR: //nop -- a fudge break; } }
From source file:com.nginious.http.xsp.expr.EqualsOperator.java
License:Apache License
/** * Compiles bytecode for evaluating this equals operator producing * an integer as result. The specified method visitor is used for generating * bytecode./*from w w w.j a v a 2s .c o m*/ * * @param visitor the method visitor */ private void compileInt(MethodVisitor visitor) { Label trueLabel = new Label(); Label falseLabel = new Label(); value1.compile(visitor, Type.INT); value2.compile(visitor, Type.INT); visitor.visitJumpInsn(Opcodes.IF_ICMPEQ, trueLabel); visitor.visitLdcInsn(false); visitor.visitJumpInsn(Opcodes.GOTO, falseLabel); visitor.visitLabel(trueLabel); visitor.visitLdcInsn(true); visitor.visitLabel(falseLabel); }
From source file:com.nginious.http.xsp.expr.NotEqualsOperator.java
License:Apache License
/** * Compiles bytecode for evaluating this not equals operator producing * an integer as result. The specified method visitor is used for generating * bytecode./*from ww w.ja v a 2 s . com*/ * * @param visitor the method visitor */ private void compileInt(MethodVisitor visitor) { Label trueLabel = new Label(); Label falseLabel = new Label(); value1.compile(visitor, Type.INT); value2.compile(visitor, Type.INT); visitor.visitJumpInsn(Opcodes.IF_ICMPEQ, trueLabel); visitor.visitLdcInsn(true); visitor.visitJumpInsn(Opcodes.GOTO, falseLabel); visitor.visitLabel(trueLabel); visitor.visitLdcInsn(false); visitor.visitLabel(falseLabel); }
From source file:com.nginious.http.xsp.expr.OrOperator.java
License:Apache License
/** * Creates bytecode for evaluating this or operator. The bytecode is generated using * the specified method visitor. The result of the evaluation produces the specified * type./*from ww w . j a v a 2s. co m*/ * * @param visitor the method visitor * @param type the type */ void compile(MethodVisitor visitor, Type type) { Label labelTrue = new Label(); Label labelEnd = new Label(); // Test first value value1.compile(visitor, type); visitor.visitInsn(Opcodes.ICONST_1); visitor.visitJumpInsn(Opcodes.IF_ICMPEQ, labelTrue); // Test second value value2.compile(visitor, type); visitor.visitInsn(Opcodes.ICONST_1); visitor.visitJumpInsn(Opcodes.IF_ICMPEQ, labelTrue); // False visitor.visitLdcInsn(false); visitor.visitJumpInsn(Opcodes.GOTO, labelEnd); // True visitor.visitLabel(labelTrue); visitor.visitLdcInsn(true); visitor.visitLabel(labelEnd); }
From source file:com.offbynull.coroutines.instrumenter.asm.InstructionUtils.java
License:Open Source License
/** * For each element in an object array, performs an action. * @param counterVar parameter used to keep track of count in loop * @param arrayLenVar parameter used to keep track of array length * @param array object array instruction list -- must leave an array on top of the stack * @param action action to perform on each element -- element will be at top of stack and must be consumed by these instructions * @return instructions instruction list to perform some action if two ints are equal * @throws NullPointerException if any argument is {@code null} *///from ww w .j a v a 2 s . c om public static InsnList forEach(Variable counterVar, Variable arrayLenVar, InsnList array, InsnList action) { Validate.notNull(counterVar); Validate.notNull(arrayLenVar); Validate.notNull(array); Validate.notNull(action); Validate.isTrue(counterVar.getType().equals(Type.INT_TYPE)); Validate.isTrue(arrayLenVar.getType().equals(Type.INT_TYPE)); InsnList ret = new InsnList(); LabelNode doneLabelNode = new LabelNode(); LabelNode loopLabelNode = new LabelNode(); // put zero in to counterVar ret.add(new LdcInsnNode(0)); // int ret.add(new VarInsnNode(Opcodes.ISTORE, counterVar.getIndex())); // // load array we'll be traversing over ret.add(array); // object[] // put array length in to arrayLenVar ret.add(new InsnNode(Opcodes.DUP)); // object[], object[] ret.add(new InsnNode(Opcodes.ARRAYLENGTH)); // object[], int ret.add(new VarInsnNode(Opcodes.ISTORE, arrayLenVar.getIndex())); // object[] // loopLabelNode: test if counterVar == arrayLenVar, if it does then jump to doneLabelNode ret.add(loopLabelNode); ret.add(new VarInsnNode(Opcodes.ILOAD, counterVar.getIndex())); // object[], int ret.add(new VarInsnNode(Opcodes.ILOAD, arrayLenVar.getIndex())); // object[], int, int ret.add(new JumpInsnNode(Opcodes.IF_ICMPEQ, doneLabelNode)); // object[] // load object from object[] ret.add(new InsnNode(Opcodes.DUP)); // object[], object[] ret.add(new VarInsnNode(Opcodes.ILOAD, counterVar.getIndex())); // object[], object[], int ret.add(new InsnNode(Opcodes.AALOAD)); // object[], object // call action ret.add(action); // object[] // increment counter var and goto loopLabelNode ret.add(new IincInsnNode(counterVar.getIndex(), 1)); // object[] ret.add(new JumpInsnNode(Opcodes.GOTO, loopLabelNode)); // object[] // doneLabelNode: pop object[] off of stack ret.add(doneLabelNode); ret.add(new InsnNode(Opcodes.POP)); // return ret; }
From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPEQ_2_IF_ICMPNE_Transition.java
License:Open Source License
public IF_ICMPEQ_2_IF_ICMPNE_Transition() { super(); this.sourceInstruction = Opcodes.IF_ICMPEQ; this.targetInstruction = Opcodes.IF_ICMPNE; }
From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPNE_2_IF_ICMPEQ_Transition.java
License:Open Source License
public IF_ICMPNE_2_IF_ICMPEQ_Transition() { super(); this.sourceInstruction = Opcodes.IF_ICMPNE; this.targetInstruction = Opcodes.IF_ICMPEQ; }
From source file:com.trigersoft.jaque.expression.ExpressionMethodVisitor.java
License:Apache License
@Override public void visitJumpInsn(int opcode, Label label) { int etype;/*w w w .j a va2 s . c om*/ switch (opcode) { case Opcodes.GOTO: go(label); return; default: case Opcodes.JSR: throw notLambda(opcode); case Opcodes.IFEQ: etype = ExpressionType.NotEqual; // Equal pushZeroConstantOrReduce(); break; case Opcodes.IFNE: etype = ExpressionType.Equal; // NotEqual pushZeroConstantOrReduce(); break; case Opcodes.IFLT: etype = ExpressionType.GreaterThanOrEqual; // LessThan pushZeroConstantOrReduce(); break; case Opcodes.IFGE: etype = ExpressionType.LessThan; // GreaterThanOrEqual pushZeroConstantOrReduce(); break; case Opcodes.IFGT: etype = ExpressionType.LessThanOrEqual; // GreaterThan pushZeroConstantOrReduce(); break; case Opcodes.IFLE: etype = ExpressionType.GreaterThan; // LessThanOrEqual pushZeroConstantOrReduce(); break; case Opcodes.IF_ICMPEQ: case Opcodes.IF_ACMPEQ: // ?? etype = ExpressionType.NotEqual; // Equal break; case Opcodes.IF_ICMPNE: case Opcodes.IF_ACMPNE: // ?? etype = ExpressionType.Equal; // NotEqual break; case Opcodes.IF_ICMPLT: etype = ExpressionType.GreaterThanOrEqual; // LessThan break; case Opcodes.IF_ICMPGE: etype = ExpressionType.LessThan; // GreaterThanOrEqual break; case Opcodes.IF_ICMPGT: etype = ExpressionType.LessThanOrEqual; // GreaterThan break; case Opcodes.IF_ICMPLE: etype = ExpressionType.GreaterThan; // LessThanOrEqual break; case Opcodes.IFNULL: case Opcodes.IFNONNULL: Expression e = Expression.isNull(_exprStack.pop()); if (opcode == Opcodes.IFNULL) // IFNONNULL e = Expression.logicalNot(e); branch(label, e); return; } Expression second = _exprStack.pop(); Expression first = _exprStack.pop(); Expression e = Expression.binary(etype, first, second); branch(label, e); }
From source file:com.yahoo.yqlplus.engine.internal.compiler.EqualsExpression.java
private void emitIntEquals(CodeEmitter code) { Label done = new Label(); MethodVisitor mv = code.getMethodVisitor(); Label isTrue = new Label(); mv.visitJumpInsn(Opcodes.IF_ICMPEQ, isTrue); emitFalse(code);// w w w . j a v a2s .c o m mv.visitJumpInsn(Opcodes.GOTO, done); mv.visitLabel(isTrue); emitTrue(code); mv.visitLabel(done); }
From source file:de.codesourcery.asm.util.ASMUtil.java
License:Apache License
/** * Check whether an instruction is a conditional branch operation. * // www. j a v a 2s. 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; }