edu.arizona.cs.mbel.instructions
Class LDARG

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

public class LDARG
extends Instruction
implements ShortFormInstruction

Load argument.
Stack transition:
... --> ..., value


Field Summary
static int LDARG
           
static int LDARG_0
           
static int LDARG_1
           
static int LDARG_2
           
static int LDARG_3
           
static int LDARG_S
           
protected static int[] OPCODE_LIST
           
 
Constructor Summary
LDARG(boolean shortF, int num)
          Makes a LDARG object with the given argument number, possibly in short form (only for ldarg and ldarg.s)
LDARG(int op)
          Makes a LDARG object corresponding to the given opcode (only to be used for ldarg.0 -- ldarg.3)
LDARG(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 getArgumentNumber()
           
 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 hasArgument()
          Returns true iff this ldarg instruction is one of the types that has an explicit argument (i.e. ldarg or ldarg.s)
 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

LDARG

public static final int LDARG
See Also:
Constant Field Values

LDARG_S

public static final int LDARG_S
See Also:
Constant Field Values

LDARG_0

public static final int LDARG_0
See Also:
Constant Field Values

LDARG_1

public static final int LDARG_1
See Also:
Constant Field Values

LDARG_2

public static final int LDARG_2
See Also:
Constant Field Values

LDARG_3

public static final int LDARG_3
See Also:
Constant Field Values

OPCODE_LIST

protected static final int[] OPCODE_LIST
Constructor Detail

LDARG

public LDARG(int op)
      throws InstructionInitException
Makes a LDARG object corresponding to the given opcode (only to be used for ldarg.0 -- ldarg.3)

Parameters:
op - the opcode

LDARG

public LDARG(boolean shortF,
             int num)
      throws InstructionInitException
Makes a LDARG object with the given argument number, possibly in short form (only for ldarg and ldarg.s)

Parameters:
shortF - true iff this is a short form instruction (i.e. 0<=num<256)
num - the argument number

LDARG

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

hasArgument

public boolean hasArgument()
Returns true iff this ldarg instruction is one of the types that has an explicit argument (i.e. ldarg or ldarg.s)


isShort

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

getArgumentNumber

public int getArgumentNumber()

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