Example usage for org.objectweb.asm Opcodes T_LONG

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

Introduction

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

Prototype

int T_LONG

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

Click Source Link

Usage

From source file:com.yahoo.yqlplus.engine.internal.compiler.CodeEmitter.java

public void emitNewArray(TypeWidget elementType, BytecodeExpression e) {
    MethodVisitor mv = getMethodVisitor();
    exec(e);/*from   w ww  .  j  a  v  a 2s. com*/
    cast(BaseTypeAdapter.INT32, e.getType());
    switch (elementType.getJVMType().getSort()) {
    case Type.BYTE:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_BYTE);
        break;
    case Type.BOOLEAN:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_BOOLEAN);
        break;
    case Type.SHORT:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_SHORT);
        break;
    case Type.INT:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_INT);
        break;
    case Type.CHAR:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_CHAR);
        break;
    case Type.FLOAT:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_FLOAT);
        break;
    case Type.LONG:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_LONG);
        break;
    case Type.DOUBLE:
        mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_DOUBLE);
        break;
    case Type.OBJECT:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, elementType.getJVMType().getInternalName());
        break;
    default:
        throw new UnsupportedOperationException("unknown sort for newArray" + elementType.getJVMType());
    }

}

From source file:de.tuberlin.uebb.jbop.optimizer.ClassNodeBuilder.java

License:Open Source License

private int getSort(final Type type) {
    final int sort = type.getSort();
    switch (sort) {
    case Type.INT:
        return Opcodes.T_INT;
    case Type.FLOAT:
        return Opcodes.T_FLOAT;
    case Type.LONG:
        return Opcodes.T_LONG;
    case Type.DOUBLE:
        return Opcodes.T_DOUBLE;
    case Type.SHORT:
        return Opcodes.T_SHORT;
    case Type.CHAR:
        return Opcodes.T_CHAR;
    case Type.BOOLEAN:
        return Opcodes.T_BOOLEAN;
    case Type.BYTE:
        return Opcodes.T_BYTE;
    default:/*from ww  w.  ja  va2  s  .co m*/
        return -1;
    }
}

From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.Block.java

License:Open Source License

private Type getObjectType(final int operand) {
    if (Opcodes.T_INT == operand) {
        return Type.getType(int[].class);
    }// w  w  w .ja  v a  2  s .c o m
    if (Opcodes.T_FLOAT == operand) {
        return Type.getType(float[].class);
    }
    if (Opcodes.T_LONG == operand) {
        return Type.getType(long[].class);
    }
    if (Opcodes.T_DOUBLE == operand) {
        return Type.getType(double[].class);
    }
    return Type.getType(Object.class);
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.NewArrayInstruction.java

License:Open Source License

public NewArrayInstruction(final ReadMethod readMethod, final int lineNumber, final int arrayElemType,
        int newObjIdSeqIndex) {
    super(readMethod, Opcodes.NEWARRAY, lineNumber);
    assert arrayElemType == Opcodes.T_BOOLEAN || arrayElemType == Opcodes.T_CHAR
            || arrayElemType == Opcodes.T_FLOAT || arrayElemType == Opcodes.T_DOUBLE
            || arrayElemType == Opcodes.T_BYTE || arrayElemType == Opcodes.T_SHORT
            || arrayElemType == Opcodes.T_INT || arrayElemType == Opcodes.T_LONG;
    this.arrayElemType = arrayElemType;
    this.newObjectIdentifierSequenceIndex = newObjIdSeqIndex;
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.NewArrayInstruction.java

License:Open Source License

private NewArrayInstruction(final ReadMethod readMethod, final int lineNumber, final int arrayElemType,
        final int index, int newObjIdSeqIndex) {
    super(readMethod, Opcodes.NEWARRAY, lineNumber, index);
    assert arrayElemType == Opcodes.T_BOOLEAN || arrayElemType == Opcodes.T_CHAR
            || arrayElemType == Opcodes.T_FLOAT || arrayElemType == Opcodes.T_DOUBLE
            || arrayElemType == Opcodes.T_BYTE || arrayElemType == Opcodes.T_SHORT
            || arrayElemType == Opcodes.T_INT || arrayElemType == Opcodes.T_LONG;
    this.arrayElemType = arrayElemType;
    this.newObjectIdentifierSequenceIndex = newObjIdSeqIndex;
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.NewArrayInstruction.java

License:Open Source License

@Override
public String toString() {
    String elemType;/*from www  . j a  va  2s .  c  om*/
    switch (this.arrayElemType) {
    case Opcodes.T_BOOLEAN:
        elemType = "T_BOOLEAN";
        break;
    case Opcodes.T_CHAR:
        elemType = "T_CHAR";
        break;
    case Opcodes.T_FLOAT:
        elemType = "T_FLOAT";
        break;
    case Opcodes.T_DOUBLE:
        elemType = "T_DOUBLE";
        break;
    case Opcodes.T_BYTE:
        elemType = "T_BYTE";
        break;
    case Opcodes.T_SHORT:
        elemType = "T_SHORT";
        break;
    case Opcodes.T_INT:
        elemType = "T_INT";
        break;
    case Opcodes.T_LONG:
        elemType = "T_LONG";
        break;
    default:
        elemType = "--ERROR--";
    }
    return new StringBuilder(elemType.length() + 9).append("NEWARRAY ").append(elemType).toString();
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.NewArrayInstruction2.java

License:Open Source License

public NewArrayInstruction2(final ReadMethod readMethod, final int lineNumber, final int arrayElemType,
        long newObjIdSeqIndex) {
    super(readMethod, Opcodes.NEWARRAY, lineNumber);
    assert arrayElemType == Opcodes.T_BOOLEAN || arrayElemType == Opcodes.T_CHAR
            || arrayElemType == Opcodes.T_FLOAT || arrayElemType == Opcodes.T_DOUBLE
            || arrayElemType == Opcodes.T_BYTE || arrayElemType == Opcodes.T_SHORT
            || arrayElemType == Opcodes.T_INT || arrayElemType == Opcodes.T_LONG;
    this.arrayElemType = arrayElemType;
    this.newObjectIdentifier = newObjIdSeqIndex;
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.NewArrayInstruction2.java

License:Open Source License

public NewArrayInstruction2(final ReadMethod readMethod, final int lineNumber, final int arrayElemType,
        final int index, long newObjIdSeqIndex) {
    super(readMethod, Opcodes.NEWARRAY, lineNumber, index);
    assert arrayElemType == Opcodes.T_BOOLEAN || arrayElemType == Opcodes.T_CHAR
            || arrayElemType == Opcodes.T_FLOAT || arrayElemType == Opcodes.T_DOUBLE
            || arrayElemType == Opcodes.T_BYTE || arrayElemType == Opcodes.T_SHORT
            || arrayElemType == Opcodes.T_INT || arrayElemType == Opcodes.T_LONG;
    this.arrayElemType = arrayElemType;
    this.newObjectIdentifier = newObjIdSeqIndex;
}

From source file:edu.mit.streamjit.util.bytecode.MethodResolver.java

License:Open Source License

private void interpret(IntInsnNode insn, FrameState frame, BBInfo block) {
    int operand = insn.operand;
    switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH:
        frame.stack.push(module.constants().getSmallestIntConstant(insn.operand));
        break;//from   w  ww  .j av  a  2 s .  c  om
    case Opcodes.NEWARRAY:
        ArrayType t;
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            t = module.types().getArrayType(boolean[].class);
            break;
        case Opcodes.T_BYTE:
            t = module.types().getArrayType(byte[].class);
            break;
        case Opcodes.T_CHAR:
            t = module.types().getArrayType(char[].class);
            break;
        case Opcodes.T_SHORT:
            t = module.types().getArrayType(short[].class);
            break;
        case Opcodes.T_INT:
            t = module.types().getArrayType(int[].class);
            break;
        case Opcodes.T_LONG:
            t = module.types().getArrayType(long[].class);
            break;
        case Opcodes.T_FLOAT:
            t = module.types().getArrayType(float[].class);
            break;
        case Opcodes.T_DOUBLE:
            t = module.types().getArrayType(double[].class);
            break;
        default:
            throw new AssertionError(operand);
        }
        NewArrayInst i = new NewArrayInst(t, frame.stack.pop());
        block.block.instructions().add(i);
        frame.stack.push(i);
        break;
    default:
        throw new UnsupportedOperationException("" + insn.getOpcode());
    }
}

From source file:edu.mit.streamjit.util.bytecode.MethodUnresolver.java

License:Open Source License

private void emit(NewArrayInst i, InsnList insns) {
    ArrayType t = i.getType();// w w w.  j  a v  a 2 s. co  m
    if (t.getDimensions() == 1) {
        load(i.getOperand(0), insns);
        RegularType ct = t.getComponentType();
        if (ct instanceof PrimitiveType) {
            if (ct.equals(booleanType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_BOOLEAN));
            else if (ct.equals(byteType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_BYTE));
            else if (ct.equals(charType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_CHAR));
            else if (ct.equals(shortType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_SHORT));
            else if (ct.equals(intType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_INT));
            else if (ct.equals(longType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_LONG));
            else if (ct.equals(floatType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_FLOAT));
            else if (ct.equals(doubleType))
                insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_DOUBLE));
        } else {
            insns.add(new TypeInsnNode(Opcodes.ANEWARRAY, internalName(ct.getKlass())));
        }
    } else {
        for (Value v : i.operands())
            load(v, insns);
        insns.add(new MultiANewArrayInsnNode(t.getDescriptor(), i.getNumOperands()));
    }
    store(i, insns);
}