Example usage for org.objectweb.asm Opcodes LCONST_0

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

Introduction

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

Prototype

int LCONST_0

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

Click Source Link

Usage

From source file:org.apache.drill.exec.compile.bytecode.ValueHolderIden.java

License:Apache License

private static void initType(int index, Type t, DirectSorter v) {
    switch (t.getSort()) {
    case Type.BOOLEAN:
    case Type.BYTE:
    case Type.CHAR:
    case Type.SHORT:
    case Type.INT:
        v.visitInsn(Opcodes.ICONST_0);//from   w w w.j a v a2  s.  c  om
        v.directVarInsn(Opcodes.ISTORE, index);
        break;
    case Type.LONG:
        v.visitInsn(Opcodes.LCONST_0);
        v.directVarInsn(Opcodes.LSTORE, index);
        break;
    case Type.FLOAT:
        v.visitInsn(Opcodes.FCONST_0);
        v.directVarInsn(Opcodes.FSTORE, index);
        break;
    case Type.DOUBLE:
        v.visitInsn(Opcodes.DCONST_0);
        v.directVarInsn(Opcodes.DSTORE, index);
        break;
    case Type.OBJECT:
        v.visitInsn(Opcodes.ACONST_NULL);
        v.directVarInsn(Opcodes.ASTORE, index);
        break;
    default:
        throw new UnsupportedOperationException();
    }
}

From source file:org.decojer.cavaj.readers.asm.ReadMethodVisitor.java

License:Open Source License

@Override
public void visitInsn(final int opcode) {
    T t = null;//  w ww .ja v a2  s.  c  om
    int iValue = Integer.MIN_VALUE;
    Object oValue = null;

    switch (opcode) {
    case Opcodes.NOP:
        // nothing to do, ignore
        break;
    /*******
     * ADD *
     *******/
    case Opcodes.DADD:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FADD:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IADD:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LADD:
        if (t == null) {
            t = T.LONG;
        }
        add(new ADD(this.ops.size(), opcode, this.line, t));
        break;
    /*********
     * ALOAD *
     *********/
    case Opcodes.AALOAD:
        t = T.REF;
        // fall through
    case Opcodes.BALOAD:
        if (t == null) {
            t = T.SMALL;
        }
        // fall through
    case Opcodes.CALOAD:
        if (t == null) {
            t = T.CHAR;
        }
        // fall through
    case Opcodes.DALOAD:
        if (t == null) {
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FALOAD:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IALOAD:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LALOAD:
        if (t == null) {
            t = T.LONG;
        }
        // fall through
    case Opcodes.SALOAD:
        if (t == null) {
            t = T.SHORT;
        }
        add(new ALOAD(this.ops.size(), opcode, this.line, t));
        break;
    /*******
     * AND *
     *******/
    case Opcodes.IAND:
        t = T.AINT;
        // fall through
    case Opcodes.LAND:
        if (t == null) {
            t = T.LONG;
        }
        add(new AND(this.ops.size(), opcode, this.line, t));
        break;
    /***************
     * ARRAYLENGTH *
     ***************/
    case Opcodes.ARRAYLENGTH:
        add(new ARRAYLENGTH(this.ops.size(), opcode, this.line));
        break;
    /**********
     * ASTORE *
     **********/
    case Opcodes.AASTORE:
        t = T.REF;
        // fall through
    case Opcodes.BASTORE:
        if (t == null) {
            t = T.SMALL;
        }
        // fall through
    case Opcodes.CASTORE:
        if (t == null) {
            t = T.CHAR;
        }
        // fall through
    case Opcodes.DASTORE:
        if (t == null) {
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FASTORE:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IASTORE:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LASTORE:
        if (t == null) {
            t = T.LONG;
        }
        // fall through
    case Opcodes.SASTORE:
        if (t == null) {
            t = T.SHORT;
        }
        add(new ASTORE(this.ops.size(), opcode, this.line, t));
        break;
    /********
     * CAST *
     ********/
    case Opcodes.D2F:
        t = T.DOUBLE;
        oValue = T.FLOAT;
        // fall through
    case Opcodes.D2I:
        if (t == null) {
            t = T.DOUBLE;
            oValue = T.INT;
        }
        // fall through
    case Opcodes.D2L:
        if (t == null) {
            t = T.DOUBLE;
            oValue = T.LONG;
        }
        // fall through
    case Opcodes.F2D:
        if (t == null) {
            t = T.FLOAT;
            oValue = T.DOUBLE;
        }
        // fall through
    case Opcodes.F2I:
        if (t == null) {
            t = T.FLOAT;
            oValue = T.INT;
        }
        // fall through
    case Opcodes.F2L:
        if (t == null) {
            t = T.FLOAT;
            oValue = T.LONG;
        }
        // fall through
    case Opcodes.I2B:
        if (t == null) {
            t = T.INT;
            oValue = T.BYTE;
        }
        // fall through
    case Opcodes.I2C:
        if (t == null) {
            t = T.INT;
            oValue = T.CHAR;
        }
        // fall through
    case Opcodes.I2D:
        if (t == null) {
            t = T.INT;
            oValue = T.DOUBLE;
        }
        // fall through
    case Opcodes.I2F:
        if (t == null) {
            t = T.INT;
            oValue = T.FLOAT;
        }
        // fall through
    case Opcodes.I2L:
        if (t == null) {
            t = T.INT;
            oValue = T.LONG;
        }
        // fall through
    case Opcodes.I2S:
        if (t == null) {
            t = T.INT;
            oValue = T.SHORT;
        }
        // fall through
    case Opcodes.L2D:
        if (t == null) {
            t = T.LONG;
            oValue = T.DOUBLE;
        }
        // fall through
    case Opcodes.L2F:
        if (t == null) {
            t = T.LONG;
            oValue = T.FLOAT;
        }
        // fall through
    case Opcodes.L2I:
        if (t == null) {
            t = T.LONG;
            oValue = T.INT;
        }
        assert oValue instanceof T;
        add(new CAST(this.ops.size(), opcode, this.line, t, (T) oValue));
        break;
    /*******
     * CMP *
     *******/
    case Opcodes.DCMPG:
        t = T.DOUBLE;
        iValue = CMP.T_G;
        // fall through
    case Opcodes.DCMPL:
        if (t == null) {
            t = T.DOUBLE;
            iValue = CMP.T_L;
        }
        // fall through
    case Opcodes.FCMPG:
        if (t == null) {
            t = T.FLOAT;
            iValue = CMP.T_G;
        }
        // fall through
    case Opcodes.FCMPL:
        if (t == null) {
            t = T.FLOAT;
            iValue = CMP.T_L;
        }
        // fall through
    case Opcodes.LCMP:
        if (t == null) {
            t = T.LONG;
            iValue = CMP.T_0;
        }
        add(new CMP(this.ops.size(), opcode, this.line, t, iValue));
        break;
    /*******
     * DIV *
     *******/
    case Opcodes.DDIV:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FDIV:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IDIV:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LDIV:
        if (t == null) {
            t = T.LONG;
        }
        add(new DIV(this.ops.size(), opcode, this.line, t));
        break;
    /*******
     * DUP *
     *******/
    case Opcodes.DUP:
        oValue = DUP.Kind.DUP;
        // fall through
    case Opcodes.DUP_X1:
        if (oValue == null) {
            oValue = DUP.Kind.DUP_X1;
        }
        // fall through
    case Opcodes.DUP_X2:
        if (oValue == null) {
            oValue = DUP.Kind.DUP_X2;
        }
        // fall through
    case Opcodes.DUP2:
        if (oValue == null) {
            oValue = DUP.Kind.DUP2;
        }
        // fall through
    case Opcodes.DUP2_X1:
        if (oValue == null) {
            oValue = DUP.Kind.DUP2_X1;
        }
        // fall through
    case Opcodes.DUP2_X2:
        if (oValue == null) {
            oValue = DUP.Kind.DUP2_X2;
        }
        add(new DUP(this.ops.size(), opcode, this.line, (DUP.Kind) oValue));
        break;
    /***********
     * MONITOR *
     ***********/
    case Opcodes.MONITORENTER:
        oValue = MONITOR.Kind.ENTER;
        // fall through
    case Opcodes.MONITOREXIT:
        if (oValue == null) {
            oValue = MONITOR.Kind.EXIT;
        }
        add(new MONITOR(this.ops.size(), opcode, this.line, (MONITOR.Kind) oValue));
        break;
    /*******
     * MUL *
     *******/
    case Opcodes.DMUL:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FMUL:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IMUL:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LMUL:
        if (t == null) {
            t = T.LONG;
        }
        add(new MUL(this.ops.size(), opcode, this.line, t));
        break;
    /*******
     * NEG *
     *******/
    case Opcodes.DNEG:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FNEG:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.INEG:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LNEG:
        if (t == null) {
            t = T.LONG;
        }
        add(new NEG(this.ops.size(), opcode, this.line, t));
        break;
    /******
     * OR *
     ******/
    case Opcodes.IOR:
        t = T.AINT;
        // fall through
    case Opcodes.LOR:
        if (t == null) {
            t = T.LONG;
        }
        add(new OR(this.ops.size(), opcode, this.line, t));
        break;
    /*******
     * POP *
     *******/
    case Opcodes.POP:
        oValue = POP.Kind.POP;
        // fall through
    case Opcodes.POP2:
        if (oValue == null) {
            oValue = POP.Kind.POP2;
        }
        add(new POP(this.ops.size(), opcode, this.line, (POP.Kind) oValue));
        break;
    /********
     * PUSH *
     ********/
    case Opcodes.ACONST_NULL:
        t = T.REF;
        // fall through
    case Opcodes.DCONST_0:
        if (t == null) {
            oValue = 0D;
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FCONST_0:
        if (t == null) {
            oValue = 0F;
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ICONST_0:
        if (t == null) {
            oValue = 0;
            t = T.getJvmIntT(0);
        }
        // fall through
    case Opcodes.LCONST_0:
        if (t == null) {
            oValue = 0L;
            t = T.LONG;
        }
        // fall through
    case Opcodes.DCONST_1:
        if (t == null) {
            oValue = 1D;
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FCONST_1:
        if (t == null) {
            oValue = 1F;
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ICONST_1:
        if (t == null) {
            oValue = 1;
            t = T.getJvmIntT(1);
        }
        // fall through
    case Opcodes.LCONST_1:
        if (t == null) {
            oValue = 1L;
            t = T.LONG;
        }
        // fall through
    case Opcodes.FCONST_2:
        if (t == null) {
            oValue = 2F;
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ICONST_2:
        if (t == null) {
            oValue = 2;
            t = T.getJvmIntT(2);
        }
        // fall through
    case Opcodes.ICONST_3:
        if (t == null) {
            oValue = 3;
            t = T.getJvmIntT(3);
        }
        // fall through
    case Opcodes.ICONST_4:
        if (t == null) {
            oValue = 4;
            t = T.getJvmIntT(4);
        }
        // fall through
    case Opcodes.ICONST_5:
        if (t == null) {
            oValue = 5;
            t = T.getJvmIntT(5);
        }
        // fall through
    case Opcodes.ICONST_M1:
        if (t == null) {
            oValue = -1;
            t = T.getJvmIntT(-1);
        }
        add(new PUSH(this.ops.size(), opcode, this.line, t, oValue));
        break;
    /*******
     * REM *
     *******/
    case Opcodes.DREM:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FREM:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IREM:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LREM:
        if (t == null) {
            t = T.LONG;
        }
        add(new REM(this.ops.size(), opcode, this.line, t));
        break;
    /**********
     * RETURN *
     **********/
    case Opcodes.ARETURN:
        t = T.REF;
        // fall through
    case Opcodes.DRETURN:
        if (t == null) {
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FRETURN:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.IRETURN:
        if (t == null) {
            t = T.AINT;
        }
        // fall through
    case Opcodes.LRETURN:
        if (t == null) {
            t = T.LONG;
        }
        // fall through
    case Opcodes.RETURN:
        if (t == null) {
            t = T.VOID;
        }
        add(new RETURN(this.ops.size(), opcode, this.line, t));
        break;
    /*******
     * SHL *
     *******/
    case Opcodes.ISHL:
        t = T.INT;
        // fall through
    case Opcodes.LSHL:
        if (t == null) {
            t = T.LONG;
        }
        add(new SHL(this.ops.size(), opcode, this.line, t, T.INT));
        break;
    /*******
     * SHR *
     *******/
    case Opcodes.ISHR:
    case Opcodes.IUSHR:
        t = T.INT;
        // fall through
    case Opcodes.LSHR:
    case Opcodes.LUSHR:
        if (t == null) {
            t = T.LONG;
        }
        add(new SHR(this.ops.size(), opcode, this.line, t, T.INT,
                opcode == Opcodes.IUSHR || opcode == Opcodes.LUSHR));
        break;
    /*******
     * SUB *
     *******/
    case Opcodes.DSUB:
        t = T.DOUBLE;
        // fall through
    case Opcodes.FSUB:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ISUB:
        if (t == null) {
            t = T.INT;
        }
        // fall through
    case Opcodes.LSUB:
        if (t == null) {
            t = T.LONG;
        }
        add(new SUB(this.ops.size(), opcode, this.line, t));
        break;
    /********
     * SWAP *
     ********/
    case Opcodes.SWAP:
        add(new SWAP(this.ops.size(), opcode, this.line));
        break;
    /*********
     * THROW *
     *********/
    case Opcodes.ATHROW:
        add(new THROW(this.ops.size(), opcode, this.line));
        break;
    /*******
     * XOR *
     *******/
    case Opcodes.IXOR:
        t = T.AINT;
        // fall through
    case Opcodes.LXOR: {
        if (t == null) {
            t = T.LONG;
        }
        add(new XOR(this.ops.size(), opcode, this.line, t));
        break;
    }
    default:
        log.warn(getM() + ": Unknown insn opcode '" + opcode + "'!");
    }
}

From source file:org.evosuite.graphs.cfg.ASMWrapper.java

License:Open Source License

/**
 * <p>//w  w w . ja  va 2s .  c  o  m
 * isConstant
 * </p>
 * 
 * @return a boolean.
 */
public boolean isConstant() {
    switch (asmNode.getOpcode()) {
    case Opcodes.LDC:
    case Opcodes.ICONST_0:
    case Opcodes.ICONST_1:
    case Opcodes.ICONST_2:
    case Opcodes.ICONST_3:
    case Opcodes.ICONST_4:
    case Opcodes.ICONST_5:
    case Opcodes.ICONST_M1:
    case Opcodes.LCONST_0:
    case Opcodes.LCONST_1:
    case Opcodes.DCONST_0:
    case Opcodes.DCONST_1:
    case Opcodes.FCONST_0:
    case Opcodes.FCONST_1:
    case Opcodes.FCONST_2:
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH:
        return true;
    default:
        return false;
    }
}

From source file:org.evosuite.instrumentation.CreateClassResetClassAdapter.java

License:Open Source License

private void createEmptyStaticReset() {
    logger.info("Creating brand-new static initializer in class {}", className);
    MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, ClassResetter.STATIC_RESET,
            "()V", null, null);
    mv.visitCode();/*from   w  ww  .  j a va  2s .  c o  m*/
    for (StaticField staticField : static_fields) {

        if (!finalFields.contains(staticField.name)) {

            logger.info("Adding bytecode for initializing field {}", staticField.name);

            if (staticField.value != null) {
                mv.visitLdcInsn(staticField.value);
            } else {
                Type type = Type.getType(staticField.desc);
                switch (type.getSort()) {
                case Type.BOOLEAN:
                case Type.BYTE:
                case Type.CHAR:
                case Type.SHORT:
                case Type.INT:
                    mv.visitInsn(Opcodes.ICONST_0);
                    break;
                case Type.FLOAT:
                    mv.visitInsn(Opcodes.FCONST_0);
                    break;
                case Type.LONG:
                    mv.visitInsn(Opcodes.LCONST_0);
                    break;
                case Type.DOUBLE:
                    mv.visitInsn(Opcodes.DCONST_0);
                    break;
                case Type.ARRAY:
                case Type.OBJECT:
                    mv.visitInsn(Opcodes.ACONST_NULL);
                    break;
                }
            }
            mv.visitFieldInsn(Opcodes.PUTSTATIC, className, staticField.name, staticField.desc);

        }
    }
    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(0, 0);
    mv.visitEnd();

}

From source file:org.evosuite.instrumentation.mutation.ReplaceConstant.java

License:Open Source License

private Object getValue(AbstractInsnNode constant) {
    switch (constant.getOpcode()) {
    case Opcodes.LDC:
        return ((LdcInsnNode) constant).cst;
    case Opcodes.ICONST_0:
        return 0;
    case Opcodes.ICONST_1:
        return 1;
    case Opcodes.ICONST_2:
        return 2;
    case Opcodes.ICONST_3:
        return 3;
    case Opcodes.ICONST_4:
        return 4;
    case Opcodes.ICONST_5:
        return 5;
    case Opcodes.ICONST_M1:
        return -1;
    case Opcodes.LCONST_0:
        return 0L;
    case Opcodes.LCONST_1:
        return 1L;
    case Opcodes.DCONST_0:
        return 0.0;
    case Opcodes.DCONST_1:
        return 1.0;
    case Opcodes.FCONST_0:
        return 0.0F;
    case Opcodes.FCONST_1:
        return 1.0F;
    case Opcodes.FCONST_2:
        return 2.0F;
    case Opcodes.SIPUSH:
        return ((IntInsnNode) constant).operand;
    case Opcodes.BIPUSH:
        return ((IntInsnNode) constant).operand;
    default://from  ww w .  j a va2 s .c om
        throw new RuntimeException("Unknown constant: " + constant.getOpcode());
    }
}

From source file:org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter.java

License:Open Source License

/**
 * Creates an empty __STATIC_RESET method where no <clinit> was found.
 *///from  ww  w . j  av a2  s.c  o  m
private void createEmptyStaticReset() {
    logger.info("Creating brand-new static initializer in class " + className);
    MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC,
            ClassResetter.STATIC_RESET, "()V", null, null);
    mv.visitCode();
    for (StaticField staticField : static_fields) {

        if (!finalFields.contains(staticField.name) && !staticField.name.startsWith("__cobertura")
                && !staticField.name.startsWith("$jacoco") && !staticField.name.startsWith("$VRc") // Old
        // Emma
        ) {

            logger.info("Adding bytecode for initializing field " + staticField.name);

            if (staticField.value != null) {
                mv.visitLdcInsn(staticField.value);
            } else {
                Type type = Type.getType(staticField.desc);
                switch (type.getSort()) {
                case Type.BOOLEAN:
                case Type.BYTE:
                case Type.CHAR:
                case Type.SHORT:
                case Type.INT:
                    mv.visitInsn(Opcodes.ICONST_0);
                    break;
                case Type.FLOAT:
                    mv.visitInsn(Opcodes.FCONST_0);
                    break;
                case Type.LONG:
                    mv.visitInsn(Opcodes.LCONST_0);
                    break;
                case Type.DOUBLE:
                    mv.visitInsn(Opcodes.DCONST_0);
                    break;
                case Type.ARRAY:
                case Type.OBJECT:
                    mv.visitInsn(Opcodes.ACONST_NULL);
                    break;
                }
            }
            mv.visitFieldInsn(Opcodes.PUTSTATIC, className, staticField.name, staticField.desc);

        }
    }
    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(0, 0);
    mv.visitEnd();

}

From source file:org.evosuite.runtime.instrumentation.CreateClassResetMethodAdapter.java

License:Open Source License

@Override
public void visitCode() {
    super.visitCode();
    for (StaticField staticField : staticFields) {

        if (!finalFields.contains(staticField.name) && !staticField.name.startsWith("__cobertura")
                && !staticField.name.startsWith("$jacoco") && !staticField.name.startsWith("$VRc") // Old Emma
        ) {//from w  w  w. j  a  va2s  .  c  o m

            if (staticField.value != null) {
                mv.visitLdcInsn(staticField.value);
            } else {
                Type type = Type.getType(staticField.desc);
                switch (type.getSort()) {
                case Type.BOOLEAN:
                case Type.BYTE:
                case Type.CHAR:
                case Type.SHORT:
                case Type.INT:
                    mv.visitInsn(Opcodes.ICONST_0);
                    break;
                case Type.FLOAT:
                    mv.visitInsn(Opcodes.FCONST_0);
                    break;
                case Type.LONG:
                    mv.visitInsn(Opcodes.LCONST_0);
                    break;
                case Type.DOUBLE:
                    mv.visitInsn(Opcodes.DCONST_0);
                    break;
                case Type.ARRAY:
                case Type.OBJECT:
                    mv.visitInsn(Opcodes.ACONST_NULL);
                    break;
                }
            }
            mv.visitFieldInsn(Opcodes.PUTSTATIC, className, staticField.name, staticField.desc);
        }
    }

}

From source file:org.evosuite.seeding.PrimitivePoolMethodAdapter.java

License:Open Source License

@Override
public void visitInsn(int opcode) {
    Object constant = null;/*w  w w.j  av a2 s .  c  o  m*/
    switch (opcode) {
    case Opcodes.ICONST_0:
        constant = 0;
        break;
    case Opcodes.ICONST_1:
        constant = 1;
        break;
    case Opcodes.ICONST_2:
        constant = 2;
        break;
    case Opcodes.ICONST_3:
        constant = 3;
        break;
    case Opcodes.ICONST_4:
        constant = 4;
        break;
    case Opcodes.ICONST_5:
        constant = 5;
        break;
    case Opcodes.ICONST_M1:
        constant = -1;
        break;
    case Opcodes.LCONST_0:
        constant = 0L;
        break;
    case Opcodes.LCONST_1:
        constant = 1L;
        break;
    case Opcodes.DCONST_0:
        constant = 0.0;
        break;
    case Opcodes.DCONST_1:
        constant = 1.0;
        break;
    case Opcodes.FCONST_0:
        constant = 0f;
        break;
    case Opcodes.FCONST_1:
        constant = 1f;
        break;
    case Opcodes.FCONST_2:
        constant = 2f;
        break;
    }
    if (constant != null) {
        if (DependencyAnalysis.isTargetClassName(className)) {
            poolManager.addSUTConstant(constant);
        } else {
            poolManager.addNonSUTConstant(constant);
        }
    }
    super.visitInsn(opcode);
}

From source file:org.formulacompiler.compiler.internal.bytecode.TypeCompilerForScaledLongs.java

License:Open Source License

@Override
protected void compileZero(GeneratorAdapter _mv) throws CompilerException {
    _mv.visitInsn(Opcodes.LCONST_0);
}

From source file:org.glassfish.pfl.tf.spi.Util.java

License:Open Source License

public void initLocal(MethodVisitor mv, LocalVariableNode var) {
    info(2, "Initializing variable " + var);
    Type type = Type.getType(var.desc);
    switch (type.getSort()) {
    case Type.BYTE:
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.SHORT:
    case Type.INT:
        mv.visitInsn(Opcodes.ICONST_0);/*w ww  .  j  av a2  s  .c o  m*/
        mv.visitVarInsn(Opcodes.ISTORE, var.index);
        break;

    case Type.LONG:
        mv.visitInsn(Opcodes.LCONST_0);
        mv.visitVarInsn(Opcodes.LSTORE, var.index);
        break;

    case Type.FLOAT:
        mv.visitInsn(Opcodes.FCONST_0);
        mv.visitVarInsn(Opcodes.FSTORE, var.index);
        break;

    case Type.DOUBLE:
        mv.visitInsn(Opcodes.DCONST_0);
        mv.visitVarInsn(Opcodes.DSTORE, var.index);
        break;

    default:
        mv.visitInsn(Opcodes.ACONST_NULL);
        mv.visitVarInsn(Opcodes.ASTORE, var.index);
    }
}