当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.IF_ICMPLT属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.IF_ICMPLT属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.IF_ICMPLT属性的具体用法?Java Opcodes.IF_ICMPLT怎么用?Java Opcodes.IF_ICMPLT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.IF_ICMPLT属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ifType

private static If.Type ifType(int opcode) {
  switch (opcode) {
    case Opcodes.IFEQ:
    case Opcodes.IF_ICMPEQ:
    case Opcodes.IF_ACMPEQ:
      return If.Type.EQ;
    case Opcodes.IFNE:
    case Opcodes.IF_ICMPNE:
    case Opcodes.IF_ACMPNE:
      return If.Type.NE;
    case Opcodes.IFLT:
    case Opcodes.IF_ICMPLT:
      return If.Type.LT;
    case Opcodes.IFGE:
    case Opcodes.IF_ICMPGE:
      return If.Type.GE;
    case Opcodes.IFGT:
    case Opcodes.IF_ICMPGT:
      return If.Type.GT;
    case Opcodes.IFLE:
    case Opcodes.IF_ICMPLE:
      return If.Type.LE;
    default:
      throw new Unreachable("Unexpected If instruction opcode: " + opcode);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:26,代码来源:JarSourceCode.java

示例2: test_IF_ICMPLT_0

@Test
public void test_IF_ICMPLT_0() {
    // x < y
    int code = Opcodes.IF_ICMPLT;

    int[] values = new int[]{-5, -2, 0, 3, 7};
    for(int val : values){

        Truthness lt = getForSingleValueJump(val, Opcodes.IFLT);
        Truthness cmp = getForValueComparison(val, 0, Opcodes.IF_ICMPLT);

        //should be the same
        assertEquals(lt.getOfTrue(), cmp.getOfTrue(), 0.001);
        assertEquals(lt.getOfFalse(), cmp.getOfFalse(), 0.001);
    }
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:16,代码来源:HeuristicsForJumpsTest.java

示例3: getJumpTargets

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);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:28,代码来源:JarSourceCode.java

示例4: visitJumpInsn

/**
 * Imports branch instructions, both conditional and unconditional.
 *
 * @param opcode Opcode.
 * @param label  Destination of branch.
 */
@Override
public void visitJumpInsn(final int opcode, final Label label) {
  BasicBlock section = getBasicBlock(label);
    
  switch(opcode) {
    // Unconditional Branch
    case Opcodes.GOTO: finishBlock(section); setCurrent(null); break;
    
    // Zero Test
    case Opcodes.IFEQ: createZeroCondition(Condition.Operator.EQ, section); break;
    case Opcodes.IFNE: createZeroCondition(Condition.Operator.NE, section); break;
    case Opcodes.IFLT: createZeroCondition(Condition.Operator.LT, section); break;
    case Opcodes.IFGE: createZeroCondition(Condition.Operator.GE, section); break;
    case Opcodes.IFGT: createZeroCondition(Condition.Operator.GT, section); break;
    case Opcodes.IFLE: createZeroCondition(Condition.Operator.LE, section); break;
    
    // Integer Comparison
    case Opcodes.IF_ICMPEQ: createCondition(Condition.Operator.EQ, section); break;
    case Opcodes.IF_ICMPNE: createCondition(Condition.Operator.NE, section); break;
    case Opcodes.IF_ICMPLT: createCondition(Condition.Operator.LT, section); break;
    case Opcodes.IF_ICMPGE: createCondition(Condition.Operator.GE, section); break;
    case Opcodes.IF_ICMPGT: createCondition(Condition.Operator.GT, section); break;
    case Opcodes.IF_ICMPLE: createCondition(Condition.Operator.LE, section); break;

    // Reference Comparisons
    case Opcodes.IF_ACMPEQ: createCondition(Condition.Operator.EQ, section); break;
    case Opcodes.IF_ACMPNE: createCondition(Condition.Operator.NE, section); break;
    case Opcodes.IFNULL:    createNullCondition(Condition.Operator.EQ, section); break;
    case Opcodes.IFNONNULL: createNullCondition(Condition.Operator.NE, section); break;
    
    // TODO: JSR (paired with RET)
    case Opcodes.JSR: System.err.println("visitJumpInsn: JSR");
  }
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:40,代码来源:MethodImporter.java

示例5: getForValueComparison

public static Truthness getForValueComparison(int firstValue, int secondValue, int opcode) {

        double a = firstValue;
        double b = secondValue;

        switch (opcode) {
            case Opcodes.IF_ICMPEQ: // ie, a == b
                return new Truthness(
                        1d - Truthness.normalizeValue(Math.abs(a - b)),
                        a != b ? 1d : 0d
                );

            case Opcodes.IF_ICMPNE: // ie, a != b
                return getForValueComparison(firstValue, secondValue, Opcodes.IF_ICMPEQ).invert();

            case Opcodes.IF_ICMPLT: // ie, a < b
                return new Truthness(
                        a < b ? 1d : 1d / (1.1d + a - b) ,
                        a >= b ? 1d : 1d / (1.1d + b - a)
                );

            case Opcodes.IF_ICMPGE: // ie, a >= b  ->  ! (a < b)
                return getForValueComparison(firstValue, secondValue, Opcodes.IF_ICMPLT).invert();

            case Opcodes.IF_ICMPLE: // ie, a <= b  ->  b >= a -> ! (b < a)
                return getForValueComparison(secondValue, firstValue, Opcodes.IF_ICMPLT).invert();

            case Opcodes.IF_ICMPGT: // ie, a > b  ->  b < a
                return getForValueComparison(secondValue, firstValue, Opcodes.IF_ICMPLT);

            default:
                throw new IllegalArgumentException("Cannot handle opcode " + opcode);
        }
    }
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:34,代码来源:HeuristicsForJumps.java

示例6: test_IF_ICMPLT_true

@Test
public void test_IF_ICMPLT_true(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness t = getForValueComparison(4, 6, code);
    assertTrue(t.isTrue());
    assertFalse(t.isFalse());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:9,代码来源:HeuristicsForJumpsTest.java

示例7: test_IF_ICMPLT_false

@Test
public void test_IF_ICMPLT_false(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness t = getForValueComparison(6, 4, code);
    assertFalse(t.isTrue());
    assertTrue(t.isFalse());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:9,代码来源:HeuristicsForJumpsTest.java

示例8: test_IF_ICMPLT_pos_true

@Test
public void test_IF_ICMPLT_pos_true(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness a = getForValueComparison(4, 6, code);
    assertFalse(a.isFalse());

    Truthness b = getForValueComparison(1, 5, code);
    assertFalse(b.isFalse());

    assertTrue(a.getOfFalse() > b.getOfFalse());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:13,代码来源:HeuristicsForJumpsTest.java

示例9: test_IF_ICMPLT_neg_true

@Test
public void test_IF_ICMPLT_neg_true(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness a = getForValueComparison(-8, -6, code);
    assertFalse(a.isFalse());

    Truthness b = getForValueComparison(-100, -5, code);
    assertFalse(b.isFalse());

    assertTrue(a.getOfFalse() > b.getOfFalse());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:13,代码来源:HeuristicsForJumpsTest.java

示例10: test_IF_ICMPLT_pos_false

@Test
public void test_IF_ICMPLT_pos_false(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness a = getForValueComparison(10, 6, code);
    assertFalse(a.isTrue());

    Truthness b = getForValueComparison(222, 5, code);
    assertFalse(b.isTrue());

    assertTrue(a.getOfTrue() > b.getOfTrue());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:13,代码来源:HeuristicsForJumpsTest.java

示例11: test_IF_ICMPLT_neg_false

@Test
public void test_IF_ICMPLT_neg_false(){
    // x < y
    int code = Opcodes.IF_ICMPLT;

    Truthness a = getForValueComparison(-6, -10, code);
    assertFalse(a.isTrue());

    Truthness b = getForValueComparison(-5, -222, code);
    assertFalse(b.isTrue());

    assertTrue(a.getOfTrue() > b.getOfTrue());
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:13,代码来源:HeuristicsForJumpsTest.java

示例12: visitJumpInsn

@Override
public void visitJumpInsn(final int opcode, final Label label) {
    switch (opcode) {
    case Opcodes.IFEQ:
        ifeq(label);
        break;
    case Opcodes.IFNE:
        ifne(label);
        break;
    case Opcodes.IFLT:
        iflt(label);
        break;
    case Opcodes.IFGE:
        ifge(label);
        break;
    case Opcodes.IFGT:
        ifgt(label);
        break;
    case Opcodes.IFLE:
        ifle(label);
        break;
    case Opcodes.IF_ICMPEQ:
        ificmpeq(label);
        break;
    case Opcodes.IF_ICMPNE:
        ificmpne(label);
        break;
    case Opcodes.IF_ICMPLT:
        ificmplt(label);
        break;
    case Opcodes.IF_ICMPGE:
        ificmpge(label);
        break;
    case Opcodes.IF_ICMPGT:
        ificmpgt(label);
        break;
    case Opcodes.IF_ICMPLE:
        ificmple(label);
        break;
    case Opcodes.IF_ACMPEQ:
        ifacmpeq(label);
        break;
    case Opcodes.IF_ACMPNE:
        ifacmpne(label);
        break;
    case Opcodes.GOTO:
        goTo(label);
        break;
    case Opcodes.JSR:
        jsr(label);
        break;
    case Opcodes.IFNULL:
        ifnull(label);
        break;
    case Opcodes.IFNONNULL:
        ifnonnull(label);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:61,代码来源:InstructionAdapter.java

示例13: ifCmp

/**
 * Generates the instructions to jump to a label based on the comparison of
 * the top two stack values.
 * 
 * @param type
 *            the type of the top two stack values.
 * @param mode
 *            how these values must be compared. One of EQ, NE, LT, GE, GT,
 *            LE.
 * @param label
 *            where to jump if the comparison result is <tt>true</tt>.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
    switch (type.getSort()) {
    case Type.LONG:
        mv.visitInsn(Opcodes.LCMP);
        break;
    case Type.DOUBLE:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL
                : Opcodes.DCMPG);
        break;
    case Type.FLOAT:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL
                : Opcodes.FCMPG);
        break;
    case Type.ARRAY:
    case Type.OBJECT:
        switch (mode) {
        case EQ:
            mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
            return;
        case NE:
            mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
            return;
        }
        throw new IllegalArgumentException("Bad comparison for type "
                + type);
    default:
        int intOp = -1;
        switch (mode) {
        case EQ:
            intOp = Opcodes.IF_ICMPEQ;
            break;
        case NE:
            intOp = Opcodes.IF_ICMPNE;
            break;
        case GE:
            intOp = Opcodes.IF_ICMPGE;
            break;
        case LT:
            intOp = Opcodes.IF_ICMPLT;
            break;
        case LE:
            intOp = Opcodes.IF_ICMPLE;
            break;
        case GT:
            intOp = Opcodes.IF_ICMPGT;
            break;
        }
        mv.visitJumpInsn(intOp, label);
        return;
    }
    mv.visitJumpInsn(mode, label);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:64,代码来源:GeneratorAdapter.java


注:本文中的org.objectweb.asm.Opcodes.IF_ICMPLT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。