Example usage for org.objectweb.asm Opcodes T_BOOLEAN

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

Introduction

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

Prototype

int T_BOOLEAN

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

Click Source Link

Usage

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;// w  w  w  .j  av  a2  s .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;// w w  w .ja v  a2  s  .co m
    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();//  www.  ja  v  a 2s  . c  o 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);
}

From source file:edu.ubc.mirrors.holograms.HologramMethodGenerator.java

License:Open Source License

@Override
public void visitIntInsn(int opcode, int operand) {
    if (opcode == Opcodes.NEWARRAY) {
        // Wrap with an ArrayMirror
        Type elementType;//from  www .  j a  va  2s .  c  o m
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            elementType = Type.BOOLEAN_TYPE;
            break;
        case Opcodes.T_BYTE:
            elementType = Type.BYTE_TYPE;
            break;
        case Opcodes.T_CHAR:
            elementType = Type.CHAR_TYPE;
            break;
        case Opcodes.T_SHORT:
            elementType = Type.SHORT_TYPE;
            break;
        case Opcodes.T_INT:
            elementType = Type.INT_TYPE;
            break;
        case Opcodes.T_LONG:
            elementType = Type.LONG_TYPE;
            break;
        case Opcodes.T_FLOAT:
            elementType = Type.FLOAT_TYPE;
            break;
        case Opcodes.T_DOUBLE:
            elementType = Type.DOUBLE_TYPE;
            break;
        default:
            throw new IllegalArgumentException("Unknown type number: " + operand);
        }

        getClassMirror(elementType);
        swap();
        invokeinterface(classMirrorType.getInternalName(), "newArray",
                Type.getMethodDescriptor(Type.getType(ArrayMirror.class), Type.INT_TYPE));

        String arrayHologramType = "edu/ubc/mirrors/holograms/" + getSortName(elementType.getSort())
                + "ArrayHologram";

        invokestatic(objectHologramType.getInternalName(), "make",
                Type.getMethodDescriptor(hologramType, objectMirrorType));
        checkcast(Type.getObjectType(arrayHologramType));

        return;
    }

    super.visitIntInsn(opcode, operand);
}

From source file:org.adjective.stout.operation.CreateArrayExpression.java

License:Apache License

public static int getTypeCode(Class<?> type) {
    if (type == Character.TYPE) {
        return Opcodes.T_CHAR;
    }/*from w w w.j a  v  a2 s  .  com*/
    if (type == Byte.TYPE) {
        return Opcodes.T_BYTE;
    }
    if (type == Integer.TYPE) {
        return Opcodes.T_INT;
    }
    if (type == Boolean.TYPE) {
        return Opcodes.T_BOOLEAN;
    }
    if (type == Short.TYPE) {
        return Opcodes.T_SHORT;
    }
    if (type == Long.TYPE) {
        return Opcodes.T_LONG;
    }
    if (type == Float.TYPE) {
        return Opcodes.T_FLOAT;
    }
    if (type == Double.TYPE) {
        return Opcodes.T_DOUBLE;
    }
    throw new IllegalArgumentException("Not a primitive " + type);
}

From source file:org.evosuite.instrumentation.testability.transformer.BooleanArrayTransformer.java

License:Open Source License

@Override
protected AbstractInsnNode transformIntInsnNode(MethodNode mn, IntInsnNode intInsnNode) {
    if (intInsnNode.operand == Opcodes.T_BOOLEAN) {
        intInsnNode.operand = Opcodes.T_INT;
    }//from   w  ww .  j  av  a2s. co m
    return intInsnNode;
}