Example usage for org.objectweb.asm Opcodes IF_ICMPGT

List of usage examples for org.objectweb.asm Opcodes IF_ICMPGT

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes IF_ICMPGT.

Prototype

int IF_ICMPGT

To view the source code for org.objectweb.asm Opcodes IF_ICMPGT.

Click Source Link

Usage

From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPGT_2_IF_ICMPLE_Transition.java

License:Open Source License

public IF_ICMPGT_2_IF_ICMPLE_Transition() {
    super();
    this.sourceInstruction = Opcodes.IF_ICMPGT;
    this.targetInstruction = Opcodes.IF_ICMPLE;
}

From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPLE_2_IF_ICMPGT_Transition.java

License:Open Source License

public IF_ICMPLE_2_IF_ICMPGT_Transition() {
    super();
    this.sourceInstruction = Opcodes.IF_ICMPLE;
    this.targetInstruction = Opcodes.IF_ICMPGT;
}

From source file:com.trigersoft.jaque.expression.ExpressionMethodVisitor.java

License:Apache License

@Override
public void visitJumpInsn(int opcode, Label label) {
    int etype;/*w ww .ja  v a 2  s  . c  o m*/
    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:de.codesourcery.asm.util.ASMUtil.java

License:Apache License

/**
 * Check whether an instruction is a conditional branch operation.
 *  /*from  w  w  w .  j a  v a  2  s  .  co 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  w w .ja  v  a 2  s  .c  o m*/
    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 evalTwoOpValue(final Number op1, final Number op2, final int opcode) {
    switch (opcode) {
    case Opcodes.IF_ICMPEQ:
        return op1.intValue() == op2.intValue();
    case Opcodes.IF_ICMPNE:
        return op1.intValue() != op2.intValue();
    case Opcodes.IF_ICMPLT:
        return op1.intValue() < op2.intValue();
    case Opcodes.IF_ICMPGE:
        return op1.intValue() >= op2.intValue();
    case Opcodes.IF_ICMPGT:
        return op1.intValue() > op2.intValue();
    case Opcodes.IF_ICMPLE:
        return op1.intValue() <= op2.intValue();
    case Opcodes.IF_ACMPEQ:
        return op1 == op2;
    case Opcodes.IF_ACMPNE:
        return op1 != op2;
    default:/*from  ww  w  .  j a  v a2  s.  c om*/
        return false;
    }
}

From source file:de.tuberlin.uebb.jbop.optimizer.controlflow.ConstantIfInlinerTest.java

License:Open Source License

/**
 * Tests that constantIfInliner is working correctly.
 * /*  w ww .j a  v  a 2s. c  o m*/
 * Input is
 * 
 * <pre>
 * if(1<=2)
 * ...
 * </pre>
 * 
 * @throws JBOPClassException
 *           the jBOP class exception
 */

@Test
public void testConstantIfInlinerIF_ICMPGT() throws JBOPClassException {
    // INIT
    final LabelNode label = new LabelNode();
    builder.addInsn(new InsnNode(Opcodes.ICONST_1)).//
            addInsn(new InsnNode(Opcodes.ICONST_2)).//
            addInsn(new JumpInsnNode(Opcodes.IF_ICMPGT, label)).//
            addInsn(new InsnNode(Opcodes.NOP)).//
            addInsn(label).//
            addInsn(new InsnNode(Opcodes.RETURN));

    // RUN
    assertEquals(6, method.instructions.size());
    final InsnList optimized = constantIfInliner.optimize(method.instructions, method);

    // ASSERT
    assertEquals(3, optimized.size());
    assertEquals(Opcodes.NOP, optimized.get(0).getOpcode());
}

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  .j a  v a2 s. co m*/
    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.unisb.cs.st.javaslicer.common.classRepresentation.instructions.JumpInstruction.java

License:Open Source License

@Override
public String toString() {
    String condition;/*from ww  w .  j  a v a  2s.  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 www.  j a v a  2  s . 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;
}