Example usage for org.objectweb.asm.tree LdcInsnNode getOpcode

List of usage examples for org.objectweb.asm.tree LdcInsnNode getOpcode

Introduction

In this page you can find the example usage for org.objectweb.asm.tree LdcInsnNode getOpcode.

Prototype

public int getOpcode() 

Source Link

Document

Returns the opcode of this instruction.

Usage

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

License:Open Source License

private void interpret(LdcInsnNode insn, FrameState frame, BBInfo block) {
    assert insn.getOpcode() == Opcodes.LDC;
    ConstantFactory cf = module.constants();
    Object c = insn.cst;/*  w ww.  ja  v a  2s  .  c  o m*/
    if (c instanceof Integer)
        frame.stack.push(cf.getSmallestIntConstant((Integer) c));
    else if (c instanceof Long)
        frame.stack.push(cf.getConstant((Long) c));
    else if (c instanceof Float)
        frame.stack.push(cf.getConstant((Float) c));
    else if (c instanceof Double)
        frame.stack.push(cf.getConstant((Double) c));
    else if (c instanceof String)
        frame.stack.push(cf.getConstant((String) c));
    else if (c instanceof org.objectweb.asm.Type) {
        org.objectweb.asm.Type t = (org.objectweb.asm.Type) c;
        Constant<Class<?>> d = cf.getConstant(getKlassByInternalName(t.getInternalName()).getBackingClass());
        frame.stack.push(d);
    } else
        throw new AssertionError(c);
}