org.jikesrvm.compilers.opt.ir.operand
Class TrapCodeOperand

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.operand.Operand
      extended by org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand

public final class TrapCodeOperand
extends Operand

Encode the semantic reason for a trap instruction.

See Also:
Operand

Field Summary
private  byte trapCode
          The trap code.
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
instruction
 
Constructor Summary
private TrapCodeOperand(byte why)
          Create a trap code operand
 
Method Summary
static TrapCodeOperand ArrayBounds()
          Create a trap code operand for an array bounds check
static TrapCodeOperand CheckCast()
          Create a trap code operand for a check cast
 Operand copy()
          Return a new operand that is semantically equivalent to this.
static TrapCodeOperand DivByZero()
          Create a trap code operand for a divide by zero check
 int getTrapCode()
          Return the numeric value representing the trap code; this is used by the assembler (on Intel) when generating code.
 boolean isArrayBounds()
          Does the operand represent an array bounds check ?
 boolean isCheckCast()
          Does the operand represent a check cast?
 boolean isDivByZero()
          Does the operand represent a divide by zero check?
 boolean isDoesImplement()
          Does the operand represent a must implement trap?
 boolean isNullPtr()
          Does the operand represent a null pointer check?
 boolean isRegenerate()
          Does the operand represent a regeneration trap?
 boolean isStackOverflow()
          Does the operand represent a stack overflow check?
 boolean isStoreCheck()
          Does the operand represent an array store check?
static TrapCodeOperand MustImplement()
          Create a trap code operand for a must implement
static TrapCodeOperand NullPtr()
          Create a trap code operand for a null pointer check
static TrapCodeOperand Regenerate()
          Create a trap code operand for a regeneration trap
 boolean similar(Operand op)
          Are two operands semantically equivalent?
static TrapCodeOperand StackOverflow()
          Create a trap code operand for a stack overflow
static TrapCodeOperand StoreCheck()
          Create a trap code operand for a must implement
 String toString()
          Returns the string representation of this operand.
 
Methods inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
asAddressConstant, asBlock, asBranch, asClassConstant, asCondition, asDoubleConstant, asFloatConstant, asIntConstant, asLocation, asLongConstant, asMemory, asMethod, asNullConstant, asObjectConstant, asRegister, asStackLocation, asStringConstant, asTIBConstant, asType, conservativelyApproximates, getIndexInInstruction, getType, isAddress, isAddressConstant, isBlock, isBranch, isClassConstant, isConstant, isDefinitelyNull, isDouble, isDoubleConstant, isFloat, isFloatConstant, isInt, isIntConstant, isIntLike, isLocation, isLong, isLongConstant, isMemory, isMethod, isMovableObjectConstant, isNullConstant, isObjectConstant, isRef, isRegister, isStackLocation, isStringConstant, isTIBConstant, isTrueGuard, isType, meet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

trapCode

private final byte trapCode
The trap code.

Constructor Detail

TrapCodeOperand

private TrapCodeOperand(byte why)
Create a trap code operand

Parameters:
why - the trap code
Method Detail

NullPtr

public static TrapCodeOperand NullPtr()
Create a trap code operand for a null pointer check

Returns:
the newly created trap code operand

ArrayBounds

public static TrapCodeOperand ArrayBounds()
Create a trap code operand for an array bounds check

Returns:
the newly created trap code operand

DivByZero

public static TrapCodeOperand DivByZero()
Create a trap code operand for a divide by zero check

Returns:
the newly created trap code operand

StackOverflow

public static TrapCodeOperand StackOverflow()
Create a trap code operand for a stack overflow

Returns:
the newly created trap code operand

CheckCast

public static TrapCodeOperand CheckCast()
Create a trap code operand for a check cast

Returns:
the newly created trap code operand

MustImplement

public static TrapCodeOperand MustImplement()
Create a trap code operand for a must implement

Returns:
the newly created trap code operand

StoreCheck

public static TrapCodeOperand StoreCheck()
Create a trap code operand for a must implement

Returns:
the newly created trap code operand

Regenerate

public static TrapCodeOperand Regenerate()
Create a trap code operand for a regeneration trap

Returns:
the newly created trap code operand

isNullPtr

public boolean isNullPtr()
Does the operand represent a null pointer check?

Returns:
true if it does and false if it does not

isArrayBounds

public boolean isArrayBounds()
Does the operand represent an array bounds check ?

Returns:
true if it does and false if it does not

isDivByZero

public boolean isDivByZero()
Does the operand represent a divide by zero check?

Returns:
true if it does and false if it does not

isStackOverflow

public boolean isStackOverflow()
Does the operand represent a stack overflow check?

Returns:
true if it does and false if it does not

isCheckCast

public boolean isCheckCast()
Does the operand represent a check cast?

Returns:
true if it does and false if it does not

isDoesImplement

public boolean isDoesImplement()
Does the operand represent a must implement trap?

Returns:
true if it does and false if it does not

isStoreCheck

public boolean isStoreCheck()
Does the operand represent an array store check?

Returns:
true if it does and false if it does not

isRegenerate

public boolean isRegenerate()
Does the operand represent a regeneration trap?

Returns:
true if it does and false if it does not

copy

public Operand copy()
Description copied from class: Operand
Return a new operand that is semantically equivalent to this.

Specified by:
copy in class Operand
Returns:
a copy of this

similar

public boolean similar(Operand op)
Description copied from class: Operand
Are two operands semantically equivalent?

Specified by:
similar in class Operand
Parameters:
op - other operand
Returns:
true if this and op are semantically equivalent or false if they are not.

toString

public String toString()
Returns the string representation of this operand.

Overrides:
toString in class Object
Returns:
a string representation of this operand.

getTrapCode

public int getTrapCode()
Return the numeric value representing the trap code; this is used by the assembler (on Intel) when generating code.

Returns:
Numeric value representing this trap code