Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#IF_ICMPNE

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#IF_ICMPNE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstructionAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 2
Source File: InstructionAdapter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 3
Source File: GeneratorAdapter.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.DCMPG : Opcodes.DCMPL);
            break;
        case Type.FLOAT:
            mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPG : Opcodes.FCMPL);
            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);
}
 
Example 4
Source File: InstructionAdapter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 5
Source File: GeneratorAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source File: InstructionAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 7
Source File: GeneratorAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: InstructionAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 9
Source File: InstructionAdapter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 10
Source File: GeneratorAdapter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * 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 {@literal true}.
  */
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:
            if (mode == EQ) {
                mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
                return;
            } else if (mode == NE) {
                mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
                return;
            } else {
                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;
                default:
                    throw new IllegalArgumentException("Bad comparison mode " + mode);
            }
            mv.visitJumpInsn(intOp, label);
            return;
    }
    mv.visitJumpInsn(mode, label);
}
 
Example 11
Source File: InstructionAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 12
Source File: GeneratorAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 13
Source File: InstructionAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 14
Source File: GeneratorAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 15
Source File: InstructionAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 16
Source File: GeneratorAdapter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 17
Source File: InstructionAdapter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 18
Source File: GeneratorAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 19
Source File: InstructionAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}
 
Example 20
Source File: InstructionAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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();
    }
}