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

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

public final class MethodOperand
extends Operand

Refers to a method. Used for method call instructions. Contains a RVMMethod (which may or may not have been resolved yet.)

TODO: Create subclasses of MethodOperand for internal & specialized targets.

See Also:
Operand, RVMMethod

Field Summary
private  boolean designatedOffset
           
private static byte INTERFACE
           
(package private)  boolean isGuardedInlineOffBranch
          Is this the operand of a call that is the off-branch of a guarded inline?
(package private)  boolean isNonReturningCall
          Is this the operand of a call that never returns?
(package private)  boolean isPreciseTarget
          Is target exactly the method being invoked by this call, or is it a representative for a family of virtual/interface methods?
 Offset jtocOffset
           
(package private)  MemberReference memRef
          Member reference for target.
private static byte SPECIAL
           
 SpecializedMethod spMethod
           
private static byte STATIC
           
(package private)  RVMMethod target
          Target RVMMethod of invocation.
(package private)  byte type
          The type of the invoke (STATIC, SPECIAL, VIRTUAL, INTERFACE)
private static byte VIRTUAL
           
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
instruction
 
Constructor Summary
private MethodOperand(MemberReference ref, RVMMethod tar, byte t)
           
 
Method Summary
static MethodOperand COMPILED(RVMMethod callee, Offset offset)
          Returns a method operand representing a compiled method with designated JTOC offset.
 Operand copy()
          Return a new operand that is semantically equivalent to this.
 MemberReference getMemberRef()
           
 RVMMethod getTarget()
           
 boolean hasDesignatedTarget()
           
 boolean hasPreciseTarget()
           
 boolean hasSpecialVersion()
           
 boolean hasTarget()
           
static MethodOperand INTERFACE(MethodReference ref, RVMMethod target)
          create a method operand for an INVOKE_INTERFACE bytecode
 boolean isGuardedInlineOffBranch()
          Return whether this operand is the off branch of a guarded inline
 boolean isInterface()
           
 boolean isNonReturningCall()
          Get whether this operand represents a method call that never returns (such as a call to athrow());
 boolean isSpecial()
           
 boolean isStatic()
           
 boolean isVirtual()
           
 void refine(RVMMethod target)
          Refine the target information.
 void refine(RVMMethod target, boolean isPreciseTarget)
          Refine the target information.
 void refine(RVMType targetClass)
          Refine the target information.
 void setIsGuardedInlineOffBranch(boolean f)
          Record that this operand is the off branch of a guarded inline
 void setIsNonReturningCall(boolean neverReturns)
          Record whether this operand represents a method call that never returns (such as a call to athrow());
private  void setPreciseTarget()
           
 boolean similar(Operand op)
          Are two operands semantically equivalent?
static MethodOperand SPECIAL(MethodReference ref, RVMMethod target)
          create a method operand for an INVOKE_SPECIAL bytecode
static MethodOperand STATIC(MethodReference ref, RVMMethod target)
          create a method operand for an INVOKE_STATIC bytecode
static MethodOperand STATIC(RVMField target)
          create a method operand for an INVOKE_STATIC bytecode where the target method is known at compile time.
static MethodOperand STATIC(RVMMethod target)
          create a method operand for an INVOKE_STATIC bytecode where the target method is known at compile time.
 String toString()
          Returns the string representation of this operand.
static MethodOperand VIRTUAL(MethodReference ref, RVMMethod target)
          create a method operand for an INVOKE_VIRTUAL bytecode
 
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

STATIC

private static final byte STATIC
See Also:
Constant Field Values

SPECIAL

private static final byte SPECIAL
See Also:
Constant Field Values

VIRTUAL

private static final byte VIRTUAL
See Also:
Constant Field Values

INTERFACE

private static final byte INTERFACE
See Also:
Constant Field Values

memRef

final MemberReference memRef
Member reference for target.

Usually a MethodReference, but may be a FieldReference for internal methods that don't have 'real' Java method but come from OutOfLineMachineCode.


target

RVMMethod target
Target RVMMethod of invocation.


isPreciseTarget

boolean isPreciseTarget
Is target exactly the method being invoked by this call, or is it a representative for a family of virtual/interface methods?


isNonReturningCall

boolean isNonReturningCall
Is this the operand of a call that never returns?


isGuardedInlineOffBranch

boolean isGuardedInlineOffBranch
Is this the operand of a call that is the off-branch of a guarded inline?


type

byte type
The type of the invoke (STATIC, SPECIAL, VIRTUAL, INTERFACE)


designatedOffset

private boolean designatedOffset

jtocOffset

public Offset jtocOffset

spMethod

public SpecializedMethod spMethod
Constructor Detail

MethodOperand

private MethodOperand(MemberReference ref,
                      RVMMethod tar,
                      byte t)
Parameters:
ref - MemberReference of method to call
tar - the RVMMethod to call (may be null)
t - the type of invoke used to call it (STATIC, SPECIAL, VIRTUAL, INTERFACE)
Method Detail

setPreciseTarget

private void setPreciseTarget()

COMPILED

public static MethodOperand COMPILED(RVMMethod callee,
                                     Offset offset)
Returns a method operand representing a compiled method with designated JTOC offset. (used by ConvertToLowLevelIR)

Parameters:
callee - the callee method
offset - designated jtop offset of compiled method of callee
Returns:
the method operand

hasDesignatedTarget

public boolean hasDesignatedTarget()

SPECIAL

public static MethodOperand SPECIAL(MethodReference ref,
                                    RVMMethod target)
create a method operand for an INVOKE_SPECIAL bytecode

Parameters:
ref - MemberReference of method to call
target - the RVMMethod to call (may be null)
Returns:
the newly created method operand

STATIC

public static MethodOperand STATIC(MethodReference ref,
                                   RVMMethod target)
create a method operand for an INVOKE_STATIC bytecode

Parameters:
ref - MemberReference of method to call
target - the RVMMethod to call (may be null)
Returns:
the newly created method operand

STATIC

public static MethodOperand STATIC(RVMMethod target)
create a method operand for an INVOKE_STATIC bytecode where the target method is known at compile time.

Parameters:
target - the RVMMethod to call
Returns:
the newly created method operand

STATIC

public static MethodOperand STATIC(RVMField target)
create a method operand for an INVOKE_STATIC bytecode where the target method is known at compile time.

Parameters:
target - the RVMMethod to call
Returns:
the newly created method operand

VIRTUAL

public static MethodOperand VIRTUAL(MethodReference ref,
                                    RVMMethod target)
create a method operand for an INVOKE_VIRTUAL bytecode

Parameters:
ref - MemberReference of method to call
target - the RVMMethod to call (may be null)
Returns:
the newly created method operand

INTERFACE

public static MethodOperand INTERFACE(MethodReference ref,
                                      RVMMethod target)
create a method operand for an INVOKE_INTERFACE bytecode

Parameters:
ref - MemberReference of method to call
target - the RVMMethod to call (may be null)
Returns:
the newly created method operand

isStatic

public boolean isStatic()

isVirtual

public boolean isVirtual()

isSpecial

public boolean isSpecial()

isInterface

public boolean isInterface()

hasTarget

public boolean hasTarget()

hasPreciseTarget

public boolean hasPreciseTarget()

getTarget

public RVMMethod getTarget()

getMemberRef

public MemberReference getMemberRef()

isNonReturningCall

public boolean isNonReturningCall()
Get whether this operand represents a method call that never returns (such as a call to athrow());

Returns:
Does this op represent a call that never returns?

setIsNonReturningCall

public void setIsNonReturningCall(boolean neverReturns)
Record whether this operand represents a method call that never returns (such as a call to athrow());


isGuardedInlineOffBranch

public boolean isGuardedInlineOffBranch()
Return whether this operand is the off branch of a guarded inline


setIsGuardedInlineOffBranch

public void setIsGuardedInlineOffBranch(boolean f)
Record that this operand is the off branch of a guarded inline


refine

public void refine(RVMMethod target)
Refine the target information. Used to reduce the set of targets for an invokevirtual.


refine

public void refine(RVMType targetClass)
Refine the target information. Used to reduce the set of targets for an invokevirtual.


refine

public void refine(RVMMethod target,
                   boolean isPreciseTarget)
Refine the target information. Used to reduce the set of targets for an invokevirtual.


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.

hasSpecialVersion

public boolean hasSpecialVersion()