Class CallSiteReference

  • All Implemented Interfaces:
    ContextItem, BytecodeConstants

    public abstract class CallSiteReference
    extends ProgramCounter
    implements BytecodeConstants, ContextItem
    Simple object that represents a static call site (ie., an invoke instruction in the bytecode) Note that the identity of a call site reference depends on two things: the program counter, and the containing IR. Thus, it suffices to define equals() and hashCode() from ProgramCounter, since this class does not maintain a pointer to the containing IR (or CGNode) anyway. If using a hashtable of CallSiteReference from different IRs, you probably want to use a wrapper which also holds a pointer to the governing CGNode.
    • Constructor Detail

      • CallSiteReference

        protected CallSiteReference​(int programCounter,
                                    MethodReference declaredTarget)
        Parameters:
        programCounter - Index into bytecode describing this instruction
        declaredTarget - The method target as declared at the call site
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Description copied from class: ProgramCounter
        A Program Counter value is enough to uniquely identify a call site reference within a method. Note: must use these objects with extreme care; this only works if you never mix ProgramLocations from different methods in the same collection.
        Overrides:
        equals in class ProgramCounter
        See Also:
        Object.equals(Object)
      • make

        public static CallSiteReference make​(int programCounter,
                                             MethodReference declaredTarget,
                                             IInvokeInstruction.IDispatch invocationCode)
        This factory method plays a little game to avoid storing the invocation code in the object; this saves a byte (probably actually a whole word) in each created object. TODO: Consider canonicalization?
      • getDeclaredTarget

        public MethodReference getDeclaredTarget()
        Return the Method that this call site calls. This represents the method declared in the invoke instruction only.
      • getInvocationCode

        public abstract IInvokeInstruction.IDispatch getInvocationCode()
        Return one of INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, or INVOKEINTERFACE
      • getInvocationString

        public String getInvocationString()
      • isInterface

        public final boolean isInterface()
        Is this an invokeinterface call site?
      • isVirtual

        public final boolean isVirtual()
        Is this an invokevirtual call site?
      • isSpecial

        public final boolean isSpecial()
        Is this an invokespecial call site?
      • isStatic

        public boolean isStatic()
        Is this an invokestatic call site?
      • isFixed

        public boolean isFixed()
      • isDispatch

        public boolean isDispatch()