harpoon.IR.LowQuad
Class PCALL

java.lang.Object
  extended by harpoon.IR.Quads.Quad
      extended by harpoon.IR.Quads.SIGMA
          extended by harpoon.IR.LowQuad.PCALL
All Implemented Interfaces:
HCodeElement, CFGraphable<Quad,Edge>, UseDefable, Graph.Node<Quad,Edge>, Serializable, Cloneable, Comparable<Quad>

public class PCALL
extends SIGMA

PCALL objects represent a method pointer dereference and invocation. Interpretation is similar to that of harpoon.IR.Quads.CALL.

If an exception is thrown by the called method, the Temp specified by retex will be assigned the non-null reference to the thrown exception, and the Temp specified by the retval field will be undefined (that is, it may have any value at all). Execution will proceed along the second outgoing edge, nextEdge(1). If no exception is thrown, the return value will be assigned to the Temp specified by retval (if any), and retex will be undefined. Execution will proceed along the first outgoing edge, nextEdge(0).

See also IR.Quads.CALL and IR.Tree.CALL.

Version:
$Id: PCALL.java,v 1.4 2002/04/10 03:04:57 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Field Summary
protected  boolean isTailCall
          Whether this should be treated as a tail call.
protected  boolean isVirtual
          Whether this is a virtual or non-virtual method invocation.
protected  Temp[] params
          Parameters to pass to the method.
protected  Temp ptr
          The method pointer to dereference.
protected  Temp retex
          Destination for any exception thrown by the method.
protected  Temp retval
          Destination for the method's return value; null for void methods.
 
Fields inherited from class harpoon.IR.Quads.SIGMA
dst, src
 
Fields inherited from class harpoon.IR.Quads.Quad
arrayFactory
 
Constructor Summary
PCALL(LowQuadFactory qf, HCodeElement source, Temp ptr, Temp[] params, Temp retval, Temp retex, Temp[][] dst, Temp[] src, boolean isVirtual, boolean isTailCall)
          Creates a PCALL representing a method pointer dereference and method invocation.
PCALL(LowQuadFactory qf, HCodeElement source, Temp ptr, Temp[] params, Temp retval, Temp retex, Temp[] src, boolean isVirtual, boolean isTailCall)
          Creates a PCALL with an empty dst array of the proper size and arity.
 
Method Summary
 void accept(QuadVisitor v)
          Accept a visitor.
 Temp[] def()
          Return all the Temps defined by this Quad.
 boolean isTailCall()
          Return true if this method should return the same value the callee returns or throw whatever exception the callee throws (in which case we can get rid of our stack and let the callee return directly to our caller).
 boolean isVirtual()
          Returns true if ptr points to the address of the method to invoke; or false if ptr contains the direct address of the method to invoke.
 int kind()
          Return an integer enumeration of the kind of this Quad.
 Temp[] params()
          Returns the parameters of this method invocation.
 Temp params(int i)
          Returns a specified parameter in the params array.
 int paramsLength()
          Returns the number of parameters in the params array.
 Temp ptr()
          Returns the POINTER which is to be dereferenced by this PCALL.
 Quad rename(QuadFactory qf, TempMap defMap, TempMap useMap)
          Create a new Quad identical to the receiver, but with all Temps renamed according to a mapping.
 Temp retex()
          Returns the Temp which will get any exception thrown by the called method, or null if exceptions are not caught.
 Temp retval()
          Returns the Temp which will hold the return value of the method, or the value null if the method returns no value.
 String toString()
          Force everyone to reimplement toString()
 Temp[] use()
          Return all the Temps used by this Quad.
 
Methods inherited from class harpoon.IR.Quads.SIGMA
accept, arity, assign, dst, dst, dst, numSigmas, removeSigma, src, src
 
Methods inherited from class harpoon.IR.Quads.Quad
addEdge, addEdges, addHandlers, clone, clone, clone, compareTo, defC, edgeC, edges, getFactory, getID, getLineNumber, getSourceFile, handlers, hashCode, isPred, isSucc, map, map, map, next, next, nextEdge, nextEdge, nextLength, pred, predC, prev, prev, prevEdge, prevEdge, prevLength, remove, removeHandlers, rename, replace, succ, succC, toLongString, transferHandlers, useC
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ptr

protected final Temp ptr
The method pointer to dereference.


params

protected Temp[] params
Parameters to pass to the method.


retval

protected Temp retval
Destination for the method's return value; null for void methods.


retex

protected Temp retex
Destination for any exception thrown by the method. May not be null.


isVirtual

protected boolean isVirtual
Whether this is a virtual or non-virtual method invocation.


isTailCall

protected boolean isTailCall
Whether this should be treated as a tail call.

Constructor Detail

PCALL

public PCALL(LowQuadFactory qf,
             HCodeElement source,
             Temp ptr,
             Temp[] params,
             Temp retval,
             Temp retex,
             Temp[][] dst,
             Temp[] src,
             boolean isVirtual,
             boolean isTailCall)
Creates a PCALL representing a method pointer dereference and method invocation. Interpretation is similar to that of harpoon.IR.Quads.CALL.

If an exception is thrown by the called method, the Temp specified by retex will be assigned the non-null reference to the thrown exception, and the Temp specified by the retval field will be undefined (that is, it may have any value at all). Execution will proceed along the second outgoing edge, nextEdge(1). If no exception is thrown, the return value will be assigned to the Temp specified by retval (if any), and retex will be undefined. Execution will proceed along the first outgoing edge, nextEdge(0).

Parameters:
ptr - the method pointer to dereference and invoke.
params - an array of Temps containing the parameters to pass to the method. The object on which to invoke the method is the first element in the parameter list of a virtual method; non-virtual methods do not need to specify a receiver. For non-virtual methods, params should match exactly the number and types of parameters in the method descriptor. For virtual methods, the receiver object (which is not included in the descriptor) is element zero of the params array.
retval - the destination Temp for the method's return value, or null if the method returns no value (return type is void.
retex - the destination Temp for any exception thrown by the called method. May not be null.
dst - the elements of the pairs on the left-hand side of the sigma function assignment block associated with this PCALL.
src - the arguments to the sigma functions associated with this PCALL.
isVirtual - true if this is a virtual method invocation, in which case ptr points to the address of the method to invoke, or false if this is a non-virtual invocation, in which case ptr is the actual address of the method to invoke.
isTailCall - true if this method should return the same value the callee returns or throw whatever exception the callee throws (in which case we can get rid of our stack and let the callee return directly to our caller). Usually false.

PCALL

public PCALL(LowQuadFactory qf,
             HCodeElement source,
             Temp ptr,
             Temp[] params,
             Temp retval,
             Temp retex,
             Temp[] src,
             boolean isVirtual,
             boolean isTailCall)
Creates a PCALL with an empty dst array of the proper size and arity. Other arguments as above.

Method Detail

ptr

public Temp ptr()
Returns the POINTER which is to be dereferenced by this PCALL.


params

public Temp[] params()
Returns the parameters of this method invocation.


params

public Temp params(int i)
Returns a specified parameter in the params array.


paramsLength

public int paramsLength()
Returns the number of parameters in the params array.


retval

public Temp retval()
Returns the Temp which will hold the return value of the method, or the value null if the method returns no value.


retex

public Temp retex()
Returns the Temp which will get any exception thrown by the called method, or null if exceptions are not caught.


isVirtual

public boolean isVirtual()
Returns true if ptr points to the address of the method to invoke; or false if ptr contains the direct address of the method to invoke.


isTailCall

public boolean isTailCall()
Return true if this method should return the same value the callee returns or throw whatever exception the callee throws (in which case we can get rid of our stack and let the callee return directly to our caller). Usually false.


kind

public int kind()
Description copied from class: Quad
Return an integer enumeration of the kind of this Quad. The enumerated values are defined in QuadKind.

Specified by:
kind in class Quad

use

public Temp[] use()
Description copied from class: Quad
Return all the Temps used by this Quad.

Specified by:
use in interface UseDefable
Overrides:
use in class SIGMA

def

public Temp[] def()
Description copied from class: Quad
Return all the Temps defined by this Quad.

Specified by:
def in interface UseDefable
Overrides:
def in class SIGMA

rename

public Quad rename(QuadFactory qf,
                   TempMap defMap,
                   TempMap useMap)
Description copied from class: Quad
Create a new Quad identical to the receiver, but with all Temps renamed according to a mapping. The new Quad will have no edges.

The new Quad will come from the specified QuadFactory.

Specified by:
rename in class Quad

accept

public void accept(QuadVisitor v)
Description copied from class: Quad
Accept a visitor.

Overrides:
accept in class SIGMA

toString

public String toString()
Description copied from class: Quad
Force everyone to reimplement toString()

Overrides:
toString in class SIGMA