jdk.internal.org.objectweb.asm.tree.IntInsnNode Java Examples

The following examples show how to use jdk.internal.org.objectweb.asm.tree.IntInsnNode. 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: BasicInterpreter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public BasicValue unaryOperation(final AbstractInsnNode insn, final BasicValue value)
        throws AnalyzerException {
    switch (insn.getOpcode()) {
        case INEG:
        case IINC:
        case L2I:
        case F2I:
        case D2I:
        case I2B:
        case I2C:
        case I2S:
            return BasicValue.INT_VALUE;
        case FNEG:
        case I2F:
        case L2F:
        case D2F:
            return BasicValue.FLOAT_VALUE;
        case LNEG:
        case I2L:
        case F2L:
        case D2L:
            return BasicValue.LONG_VALUE;
        case DNEG:
        case I2D:
        case L2D:
        case F2D:
            return BasicValue.DOUBLE_VALUE;
        case IFEQ:
        case IFNE:
        case IFLT:
        case IFGE:
        case IFGT:
        case IFLE:
        case TABLESWITCH:
        case LOOKUPSWITCH:
        case IRETURN:
        case LRETURN:
        case FRETURN:
        case DRETURN:
        case ARETURN:
        case PUTSTATIC:
            return null;
        case GETFIELD:
            return newValue(Type.getType(((FieldInsnNode) insn).desc));
        case NEWARRAY:
            switch (((IntInsnNode) insn).operand) {
                case T_BOOLEAN:
                    return newValue(Type.getType("[Z"));
                case T_CHAR:
                    return newValue(Type.getType("[C"));
                case T_BYTE:
                    return newValue(Type.getType("[B"));
                case T_SHORT:
                    return newValue(Type.getType("[S"));
                case T_INT:
                    return newValue(Type.getType("[I"));
                case T_FLOAT:
                    return newValue(Type.getType("[F"));
                case T_DOUBLE:
                    return newValue(Type.getType("[D"));
                case T_LONG:
                    return newValue(Type.getType("[J"));
                default:
                    break;
            }
            throw new AnalyzerException(insn, "Invalid array type");
        case ANEWARRAY:
            return newValue(Type.getType("[" + Type.getObjectType(((TypeInsnNode) insn).desc)));
        case ARRAYLENGTH:
            return BasicValue.INT_VALUE;
        case ATHROW:
            return null;
        case CHECKCAST:
            return newValue(Type.getObjectType(((TypeInsnNode) insn).desc));
        case INSTANCEOF:
            return BasicValue.INT_VALUE;
        case MONITORENTER:
        case MONITOREXIT:
        case IFNULL:
        case IFNONNULL:
            return null;
        default:
            throw new AssertionError();
    }
}