Example usage for org.objectweb.asm Opcodes LSTORE

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

Introduction

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

Prototype

int LSTORE

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

Click Source Link

Usage

From source file:jp.co.dgic.testing.common.virtualmock.asm.AbstractAsmMethodVisitor.java

License:Open Source License

protected int getStoreOpcodeByType(Type type) {
    if (type.equals(Type.BOOLEAN_TYPE))
        return Opcodes.ISTORE;
    if (type.equals(Type.BYTE_TYPE))
        return Opcodes.ISTORE;
    if (type.equals(Type.CHAR_TYPE))
        return Opcodes.ISTORE;
    if (type.equals(Type.SHORT_TYPE))
        return Opcodes.ISTORE;
    if (type.equals(Type.INT_TYPE))
        return Opcodes.ISTORE;
    if (type.equals(Type.LONG_TYPE))
        return Opcodes.LSTORE;
    if (type.equals(Type.DOUBLE_TYPE))
        return Opcodes.DSTORE;
    if (type.equals(Type.FLOAT_TYPE))
        return Opcodes.FSTORE;
    return Opcodes.ASTORE;
}

From source file:jpcsp.Allegrex.compiler.CompilerContext.java

License:Open Source License

@Override
public void storeLTmp1() {
    mv.visitVarInsn(Opcodes.LSTORE, LOCAL_TMP1);
}

From source file:org.adjective.stout.tools.StackVisualiserMethodVisitor.java

License:Apache License

public void visitVarInsn(int opcode, int var) {
    String description = (var == 0 ? "this" : "v" + var);
    switch (opcode) {
    case Opcodes.ISTORE:
    case Opcodes.LSTORE:
    case Opcodes.FSTORE:
    case Opcodes.DSTORE:
    case Opcodes.ASTORE: {
        Type type = getType(Opcodes.ISTORE, opcode);
        pop(type);/*from   www  .jav a  2s .  c o  m*/
    }
        break;
    case Opcodes.ILOAD:
    case Opcodes.LLOAD:
    case Opcodes.FLOAD:
    case Opcodes.DLOAD:
    case Opcodes.ALOAD: {
        Type type = getType(Opcodes.ILOAD, opcode);
        if (_isStatic) {
            var++;
        }
        if (var == 0) {
            type = _this;
        } else if (var <= _arguments.length) {
            type = _arguments[var - 1];
        }
        push(description, type);
    }
        break;
    default:
        throw new IllegalArgumentException("Unsupported opcode " + OPCODES[opcode]);
    }
    print(opcode, description);
}

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  ww  .  java  2  s .  c o m*/
        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.brutusin.instrumentation.utils.TreeInstructions.java

License:Apache License

public static VarInsnNode getStoreInst(Type type, int position) {
    int opCode = -1;
    switch (type.getDescriptor().charAt(0)) {
    case 'B':
        opCode = Opcodes.ISTORE;/* ww w.  j av a 2s. co  m*/
        break;
    case 'C':
        opCode = Opcodes.ISTORE;
        break;
    case 'D':
        opCode = Opcodes.DSTORE;
        break;
    case 'F':
        opCode = Opcodes.FSTORE;
        break;
    case 'I':
        opCode = Opcodes.ISTORE;
        break;
    case 'J':
        opCode = Opcodes.LSTORE;
        break;
    case 'L':
        opCode = Opcodes.ASTORE;
        break;
    case '[':
        opCode = Opcodes.ASTORE;
        break;
    case 'Z':
        opCode = Opcodes.ISTORE;
        break;
    case 'S':
        opCode = Opcodes.ISTORE;
        break;
    default:
        throw new ClassFormatError("Invalid method signature: " + type.getDescriptor());
    }
    return new VarInsnNode(opCode, position);
}

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

License:Open Source License

@Override
public void visitVarInsn(final int opcode, final int var) {
    T t = null;//www . jav a  2  s.  c om

    switch (opcode) {
    /********
     * LOAD *
     ********/
    case Opcodes.ALOAD:
        t = T.REF;
        // fall through
    case Opcodes.DLOAD:
        if (t == null) {
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FLOAD:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ILOAD:
        if (t == null) {
            t = T.AINT;
        }
        // fall through
    case Opcodes.LLOAD:
        if (t == null) {
            t = T.LONG;
        }
        add(new LOAD(this.ops.size(), opcode, this.line, t, var));
        break;
    /*********
     * STORE *
     *********/
    case Opcodes.ASTORE:
        t = T.AREF; // RET allowed too
        // fall through
    case Opcodes.DSTORE:
        if (t == null) {
            t = T.DOUBLE;
        }
        // fall through
    case Opcodes.FSTORE:
        if (t == null) {
            t = T.FLOAT;
        }
        // fall through
    case Opcodes.ISTORE:
        if (t == null) {
            t = T.AINT;
        }
        // fall through
    case Opcodes.LSTORE:
        if (t == null) {
            t = T.LONG;
        }
        add(new STORE(this.ops.size(), opcode, this.line, t, var));
        break;
    /*******
     * RET *
     *******/
    case Opcodes.RET: {
        add(new RET(this.ops.size(), opcode, this.line, var));
        break;
    }
    default:
        log.warn(getM() + ": Unknown var insn opcode '" + opcode + "'!");
    }
}

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

License:Open Source License

/**
 * <p>/*from  w  w w.  j a  v a2s  .  c  om*/
 * isLocalVarDefinition
 * </p>
 * 
 * @return a boolean.
 */
public boolean isLocalVariableDefinition() {
    return asmNode.getOpcode() == Opcodes.ISTORE || asmNode.getOpcode() == Opcodes.LSTORE
            || asmNode.getOpcode() == Opcodes.FSTORE || asmNode.getOpcode() == Opcodes.DSTORE
            || asmNode.getOpcode() == Opcodes.ASTORE || asmNode.getOpcode() == Opcodes.IINC
            || isLocalArrayDefinition();
}

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

License:Open Source License

/**
 * Determine how many bytes the current instruction occupies together with
 * its operands//from   w  w  w.  j a v  a  2s .  c  o  m
 * 
 * @return
 */
private int getBytecodeIncrement(AbstractInsnNode instructionNode) {
    int opcode = instructionNode.getOpcode();
    switch (opcode) {
    case Opcodes.ALOAD: // index
    case Opcodes.ASTORE: // index
    case Opcodes.DLOAD:
    case Opcodes.DSTORE:
    case Opcodes.FLOAD:
    case Opcodes.FSTORE:
    case Opcodes.ILOAD:
    case Opcodes.ISTORE:
    case Opcodes.LLOAD:
    case Opcodes.LSTORE:
        VarInsnNode varNode = (VarInsnNode) instructionNode;
        if (varNode.var > 3)
            return 1;
        else
            return 0;
    case Opcodes.BIPUSH: // byte
    case Opcodes.NEWARRAY:
    case Opcodes.RET:
        return 1;
    case Opcodes.LDC:
        LdcInsnNode ldcNode = (LdcInsnNode) instructionNode;
        if (ldcNode.cst instanceof Double || ldcNode.cst instanceof Long)
            return 2; // LDC2_W
        else
            return 1;
    case 19: //LDC_W
    case 20: //LDC2_W
        return 2;
    case Opcodes.ANEWARRAY: // indexbyte1, indexbyte2
    case Opcodes.CHECKCAST: // indexbyte1, indexbyte2
    case Opcodes.GETFIELD:
    case Opcodes.GETSTATIC:
    case Opcodes.GOTO:
    case Opcodes.IF_ACMPEQ:
    case Opcodes.IF_ACMPNE:
    case Opcodes.IF_ICMPEQ:
    case Opcodes.IF_ICMPNE:
    case Opcodes.IF_ICMPGE:
    case Opcodes.IF_ICMPGT:
    case Opcodes.IF_ICMPLE:
    case Opcodes.IF_ICMPLT:
    case Opcodes.IFLE:
    case Opcodes.IFLT:
    case Opcodes.IFGE:
    case Opcodes.IFGT:
    case Opcodes.IFNE:
    case Opcodes.IFEQ:
    case Opcodes.IFNONNULL:
    case Opcodes.IFNULL:
    case Opcodes.IINC:
    case Opcodes.INSTANCEOF:
    case Opcodes.INVOKESPECIAL:
    case Opcodes.INVOKESTATIC:
    case Opcodes.INVOKEVIRTUAL:
    case Opcodes.JSR:
    case Opcodes.NEW:
    case Opcodes.PUTFIELD:
    case Opcodes.PUTSTATIC:
    case Opcodes.SIPUSH:
        // case Opcodes.LDC_W
        // case Opcodes.LDC2_W

        return 2;
    case Opcodes.MULTIANEWARRAY:
        return 3;
    case Opcodes.INVOKEDYNAMIC:
    case Opcodes.INVOKEINTERFACE:
        return 4;

    case Opcodes.LOOKUPSWITCH:
    case Opcodes.TABLESWITCH:
        // TODO: Could be more
        return 4;
    // case Opcodes.GOTO_W 
    // case Opcodes.JSR_W
    }
    return 0;
}

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

License:Open Source License

@SuppressWarnings("rawtypes")
private static int getNextIndexFromLoad(MethodNode mn) {
    Iterator it = mn.instructions.iterator();
    int index = 0;
    while (it.hasNext()) {
        AbstractInsnNode node = (AbstractInsnNode) it.next();
        if (node instanceof VarInsnNode) {
            VarInsnNode varNode = (VarInsnNode) node;
            int varIndex = varNode.var;
            switch (varNode.getOpcode()) {
            case Opcodes.ALOAD:
            case Opcodes.ILOAD:
            case Opcodes.FLOAD:
            case Opcodes.IALOAD:
            case Opcodes.BALOAD:
            case Opcodes.CALOAD:
            case Opcodes.AALOAD:
            case Opcodes.ASTORE:
            case Opcodes.ISTORE:
            case Opcodes.FSTORE:
            case Opcodes.IASTORE:
            case Opcodes.BASTORE:
            case Opcodes.CASTORE:
            case Opcodes.AASTORE:
                index = Math.max(index, varIndex + 1);
                break;
            case Opcodes.DLOAD:
            case Opcodes.DSTORE:
            case Opcodes.LLOAD:
            case Opcodes.LSTORE:
            case Opcodes.DALOAD:
            case Opcodes.DASTORE:
            case Opcodes.LALOAD:
            case Opcodes.LASTORE:
                index = Math.max(index, varIndex + 2);
                break;
            }/*  w  w w.j av  a  2s  .  c om*/
        }
    }

    return index;
}

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

License:Open Source License

/**
 * <p>getInfectionDistance</p>
 *
 * @param opcodeOrig a int./*from w ww . ja v a  2 s  .  co m*/
 * @param opcodeNew a int.
 * @return a {@link org.objectweb.asm.tree.InsnList} object.
 */
public InsnList getInfectionDistance(int opcodeOrig, int opcodeNew) {
    InsnList distance = new InsnList();

    if (opcodesInt.contains(opcodeOrig)) {
        distance.add(new InsnNode(Opcodes.DUP2));
        distance.add(new LdcInsnNode(opcodeOrig));
        distance.add(new LdcInsnNode(opcodeNew));
        distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC,
                PackageInfo.getNameWithSlash(ReplaceArithmeticOperator.class), "getInfectionDistanceInt",
                "(IIII)D", false));
    } else if (opcodesLong.contains(opcodeOrig)) {
        distance.add(new VarInsnNode(Opcodes.LSTORE, numVariable));
        distance.add(new InsnNode(Opcodes.DUP2));
        distance.add(new VarInsnNode(Opcodes.LLOAD, numVariable));
        distance.add(new InsnNode(Opcodes.DUP2_X2));
        distance.add(new LdcInsnNode(opcodeOrig));
        distance.add(new LdcInsnNode(opcodeNew));
        distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC,
                PackageInfo.getNameWithSlash(ReplaceArithmeticOperator.class), "getInfectionDistanceLong",
                "(JJII)D", false));
        numVariable += 2;
    } else if (opcodesFloat.contains(opcodeOrig)) {
        distance.add(new InsnNode(Opcodes.DUP2));
        distance.add(new LdcInsnNode(opcodeOrig));
        distance.add(new LdcInsnNode(opcodeNew));
        distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC,
                PackageInfo.getNameWithSlash(ReplaceArithmeticOperator.class), "getInfectionDistanceFloat",
                "(FFII)D", false));
    } else if (opcodesDouble.contains(opcodeOrig)) {
        distance.add(new VarInsnNode(Opcodes.DSTORE, numVariable));
        distance.add(new InsnNode(Opcodes.DUP2));
        distance.add(new VarInsnNode(Opcodes.DLOAD, numVariable));
        distance.add(new InsnNode(Opcodes.DUP2_X2));
        distance.add(new LdcInsnNode(opcodeOrig));
        distance.add(new LdcInsnNode(opcodeNew));
        distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC,
                PackageInfo.getNameWithSlash(ReplaceArithmeticOperator.class), "getInfectionDistanceDouble",
                "(DDII)D", false));
        numVariable += 2;
    }

    return distance;
}