edu.arizona.cs.mbel.instructions
Class LDLOC

java.lang.Object
  extended byedu.arizona.cs.mbel.instructions.Instruction
      extended byedu.arizona.cs.mbel.instructions.LDLOC
All Implemented Interfaces:
ShortFormInstruction

public class LDLOC
extends Instruction
implements ShortFormInstruction

Load local variable.
Stack transition:
... --> ..., value


Field Summary
static int LDLOC
           
static int LDLOC_0
           
static int LDLOC_1
           
static int LDLOC_2
           
static int LDLOC_3
           
static int LDLOC_S
           
protected static int[] OPCODE_LIST
           
 
Constructor Summary
LDLOC(boolean shortF, int index)
          Makes a LDLOC object with the given local var index, possibly short form (only to be used for ldloc and ldloc.s)
LDLOC(int op)
          Makes a LDLOC object corresponding to the given opcode (only for ldloc.0 -- ldloc.3)
LDLOC(int opcode, ClassParser parse)
           
 
Method Summary
protected  void emit(ByteBuffer buffer, ClassEmitter emitter)
          Writes the instruction to the given buffer in raw byte form
 boolean equals(java.lang.Object o)
           
 int getIndexValue()
           
 int getLength()
          Returns the length in bytes of this instruction, as would be found on disk.
 java.lang.String getName()
          Returns the string representation of this instruction (may vary instance-to-instance)
 boolean isShort()
           
 
Methods inherited from class edu.arizona.cs.mbel.instructions.Instruction
getOpcode, readInstruction, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LDLOC

public static final int LDLOC
See Also:
Constant Field Values

LDLOC_S

public static final int LDLOC_S
See Also:
Constant Field Values

LDLOC_0

public static final int LDLOC_0
See Also:
Constant Field Values

LDLOC_1

public static final int LDLOC_1
See Also:
Constant Field Values

LDLOC_2

public static final int LDLOC_2
See Also:
Constant Field Values

LDLOC_3

public static final int LDLOC_3
See Also:
Constant Field Values

OPCODE_LIST

protected static final int[] OPCODE_LIST
Constructor Detail

LDLOC

public LDLOC(boolean shortF,
             int index)
      throws InstructionInitException
Makes a LDLOC object with the given local var index, possibly short form (only to be used for ldloc and ldloc.s)

Parameters:
shortF - true iff this is a short form instruction (i.e. 0<=index<256)
index - the local var index

LDLOC

public LDLOC(int op)
      throws InstructionInitException
Makes a LDLOC object corresponding to the given opcode (only for ldloc.0 -- ldloc.3)

Parameters:
op - the opcode for this instruction. Must be one of {LDLOC_0,LDLOC_1,LDLOC_2,LDLOC_3}

LDLOC

public LDLOC(int opcode,
             ClassParser parse)
      throws java.io.IOException,
             InstructionInitException
Method Detail

isShort

public boolean isShort()
Specified by:
isShort in interface ShortFormInstruction

getIndexValue

public int getIndexValue()

getName

public java.lang.String getName()
Description copied from class: Instruction
Returns the string representation of this instruction (may vary instance-to-instance)

Specified by:
getName in class Instruction
Returns:
a string representing this instruction (i.e. "cpblk")

getLength

public int getLength()
Description copied from class: Instruction
Returns the length in bytes of this instruction, as would be found on disk. This value includes any prefixes prepended to this instruction.

Overrides:
getLength in class Instruction

emit

protected void emit(ByteBuffer buffer,
                    ClassEmitter emitter)
Description copied from class: Instruction
Writes the instruction to the given buffer in raw byte form

Overrides:
emit in class Instruction
Parameters:
buffer - the buffer to write to
emitter - a ClassEmitter for reconciling references to tokens

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Instruction