FileDocCategorySizeDatePackage
InsnUtils.javaAPI DocGlassfish v2 API9583Fri May 04 22:34:28 BST 2007com.sun.jdo.api.persistence.enhancer.classfile

InsnUtils

public class InsnUtils extends Object implements VMConstants
InsnUtils provides a set of static methods which serve to select vm instructions during code annotation.

Fields Summary
Constructors Summary
Methods Summary
public static InsnaLoad(int i, ConstantPool pool)
Return the best instruction for loading a reference from a local variable slot

    if (i == 0)
      return Insn.create(opc_aload_0);
    else if (i == 1)
      return Insn.create(opc_aload_1);
    else if (i == 2)
      return Insn.create(opc_aload_2);
    else if (i == 3)
      return Insn.create(opc_aload_3);
    return Insn.create(opc_aload, i);
  
public static InsnaStore(int i, ConstantPool pool)
Return the best instruction for storing a reference to a local variable slot

    if (i == 0)
      return Insn.create(opc_astore_0);
    else if (i == 1)
      return Insn.create(opc_astore_1);
    else if (i == 2)
      return Insn.create(opc_astore_2);
    else if (i == 3)
      return Insn.create(opc_astore_3);
    return Insn.create(opc_astore, i);
  
public static InsndLoad(int i, ConstantPool pool)
Return the best instruction for loading a double from a local variable slot

    if (i == 0)
      return Insn.create(opc_dload_0);
    else if (i == 1)
      return Insn.create(opc_dload_1);
    else if (i == 2)
      return Insn.create(opc_dload_2);
    else if (i == 3)
      return Insn.create(opc_dload_3);
    return Insn.create(opc_dload, i);
  
public static InsndStore(int i, ConstantPool pool)
Return the best instruction for storing a double to a local variable slot

    if (i == 0)
      return Insn.create(opc_dstore_0);
    else if (i == 1)
      return Insn.create(opc_dstore_1);
    else if (i == 2)
      return Insn.create(opc_dstore_2);
    else if (i == 3)
      return Insn.create(opc_dstore_3);
    return Insn.create(opc_dstore, i);
  
public static InsndoubleConstant(double d, ConstantPool pool)
Return the best instruction for loading the specified double constant onto the stack.

    if (d == 0)
      return Insn.create(opc_dconst_0);
    else if (d == 1)
      return Insn.create(opc_dconst_1);
    else
      return Insn.create(opc_ldc2_w, pool.addDouble(d));
  
public static InsnfLoad(int i, ConstantPool pool)
Return the best instruction for loading a float from a local variable slot

    if (i == 0)
      return Insn.create(opc_fload_0);
    else if (i == 1)
      return Insn.create(opc_fload_1);
    else if (i == 2)
      return Insn.create(opc_fload_2);
    else if (i == 3)
      return Insn.create(opc_fload_3);
    return Insn.create(opc_fload, i);
  
public static InsnfStore(int i, ConstantPool pool)
Return the best instruction for storing a float to a local variable slot

    if (i == 0)
      return Insn.create(opc_fstore_0);
    else if (i == 1)
      return Insn.create(opc_fstore_1);
    else if (i == 2)
      return Insn.create(opc_fstore_2);
    else if (i == 3)
      return Insn.create(opc_fstore_3);
    return Insn.create(opc_fstore, i);
  
public static InsnfloatConstant(float f, ConstantPool pool)
Return the best instruction for loading the specified float constant onto the stack.

    if (f == 0)
      return Insn.create(opc_fconst_0);
    else if (f == 1)
      return Insn.create(opc_fconst_1);
    else if (f == 2)
      return Insn.create(opc_fconst_2);
    else
      return Insn.create(opc_ldc, pool.addFloat(f));
  
public static InsniLoad(int i, ConstantPool pool)
Return the best instruction for loading an int from a local variable slot

    if (i == 0)
      return Insn.create(opc_iload_0);
    else if (i == 1)
      return Insn.create(opc_iload_1);
    else if (i == 2)
      return Insn.create(opc_iload_2);
    else if (i == 3)
      return Insn.create(opc_iload_3);
    return Insn.create(opc_iload, i);
  
public static InsniStore(int i, ConstantPool pool)
Return the best instruction for storing an int to a local variable slot

    if (i == 0)
      return Insn.create(opc_istore_0);
    else if (i == 1)
      return Insn.create(opc_istore_1);
    else if (i == 2)
      return Insn.create(opc_istore_2);
    else if (i == 3)
      return Insn.create(opc_istore_3);
    return Insn.create(opc_istore, i);
  
public static InsnintegerConstant(int i, ConstantPool pool)
Return the best instruction for loading the specified integer constant onto the stack - hopefully use short form

    if (i == 0)
      return Insn.create(opc_iconst_0);
    else if (i == 1)
      return Insn.create(opc_iconst_1);
    else if (i == 2)
      return Insn.create(opc_iconst_2);
    else if (i == 3)
      return Insn.create(opc_iconst_3);
    else if (i == 4)
      return Insn.create(opc_iconst_4);
    else if (i == 5)
      return Insn.create(opc_iconst_5);
    else if (i >= -128 && i < 128)
      return Insn.create(opc_bipush, i);
    return Insn.create(opc_ldc, pool.addInteger(i));
  
public static InsnlLoad(int i, ConstantPool pool)
Return the best instruction for loading a long from a local variable slot

    if (i == 0)
      return Insn.create(opc_lload_0);
    else if (i == 1)
      return Insn.create(opc_lload_1);
    else if (i == 2)
      return Insn.create(opc_lload_2);
    else if (i == 3)
      return Insn.create(opc_lload_3);
    return Insn.create(opc_lload, i);
  
public static InsnlStore(int i, ConstantPool pool)
Return the best instruction for storing a long to a local variable slot

    if (i == 0)
      return Insn.create(opc_lstore_0);
    else if (i == 1)
      return Insn.create(opc_lstore_1);
    else if (i == 2)
      return Insn.create(opc_lstore_2);
    else if (i == 3)
      return Insn.create(opc_lstore_3);
    return Insn.create(opc_lstore, i);
  
public static Insnload(int tp, int i, ConstantPool pool)
Return the best instruction for loading a value from a local variable slot

    switch(tp) {
    //@olsen: added these cases:
    case T_BOOLEAN:
    case T_CHAR:
    case T_BYTE:
    case T_SHORT:
    //@olsen: end added cases
    case T_INT:
      return iLoad(i, pool);
    case T_FLOAT:
      return fLoad(i, pool);
    case T_DOUBLE:
      return dLoad(i, pool);
    case T_LONG:
      return lLoad(i, pool);
    case TC_OBJECT:
      return aLoad(i, pool);
    default:
        throw new InsnError("bad load type");//NOI18N
    }
  
public static InsnlongConstant(long l, ConstantPool pool)
Return the best instruction for loading the specified long constant onto the stack.

    if (l == 0)
      return Insn.create(opc_lconst_0);
    else if (l == 1)
      return Insn.create(opc_lconst_1);
    else
      return Insn.create(opc_ldc2_w, pool.addLong(l));
  
public static Insnstore(int tp, int i, ConstantPool pool)
Return the best instruction for storing a value to a local variable slot

    switch(tp) {
    //@olsen: added these cases:
    case T_BOOLEAN:
    case T_CHAR:
    case T_BYTE:
    case T_SHORT:
    //@olsen: end added cases
    case T_INT:
      return iStore(i, pool);
    case T_FLOAT:
      return fStore(i, pool);
    case T_DOUBLE:
      return dStore(i, pool);
    case T_LONG:
      return lStore(i, pool);
    case TC_OBJECT:
      return aStore(i, pool);
    default:
        throw new InsnError("bad store type");//NOI18N
    }