harpoon.IR.Quads
Class COMPONENTOF

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

public class COMPONENTOF
extends Quad

COMPONENTOF objects implement the test needed to determine if an ASET needs to throw an exception. Specifically, COMPONENTOF evaluates to boolean true if a certain temporary is an instance of the component type of a certain array, or boolean false otherwise. The given array should never have components of primitive type, as COMPONENTOF would always return true in this case, given a type-safe program.

In quad-with-try form ONLY: The component object to test (componentref) may have the value null, in which case COMPONENTOF returns true (it is always safe to store null in an object array). In all other forms the component object must be provably non-null. An explicit null-check may be needed prior to the COMPONENTOF if the component object cannot be proven non-null.

Version:
$Id: COMPONENTOF.java,v 1.5 2002/04/11 04:00:34 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
ASET, "The Java Virtual Machine Specification", Serialized Form

Field Summary
protected  Temp arrayref
          The array object to test.
protected  Temp dst
          The Temp in which to store the result of the test.
protected  Temp objectref
          The component object to test.
 
Fields inherited from class harpoon.IR.Quads.Quad
arrayFactory
 
Constructor Summary
COMPONENTOF(QuadFactory qf, HCodeElement source, Temp dst, Temp arrayref, Temp objectref)
          Creates a COMPONENTOF representing a typecheck test.
 
Method Summary
<T> T
accept(QuadValueVisitor<T> v)
           
 void accept(QuadVisitor v)
          Accept a visitor.
 Temp arrayref()
          Returns the array reference to test.
 Temp[] def()
          Returns the Temps defined by this quad.
 Temp dst()
          Returns the Temp in which to store the result of the type check test.
 int kind()
          Return an integer enumeration of the kind of this Quad.
 Temp objectref()
          Returns the component object reference to test.
 Quad rename(QuadFactory qqf, TempMap defMap, TempMap useMap)
          Create a new Quad identical to the receiver, but with all Temps renamed according to a mapping.
 String toString()
          Returns a human-readable representation of this Quad.
 Temp[] use()
          Returns the Temps used by this quad.
 
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

dst

protected Temp dst
The Temp in which to store the result of the test.


arrayref

protected Temp arrayref
The array object to test.


objectref

protected Temp objectref
The component object to test.

Constructor Detail

COMPONENTOF

public COMPONENTOF(QuadFactory qf,
                   HCodeElement source,
                   Temp dst,
                   Temp arrayref,
                   Temp objectref)
Creates a COMPONENTOF representing a typecheck test.

Parameters:
dst - the Temp in which to store the result of the test. The Temp specified by dst gets a boolean true value if objectref contains a reference to an instance of the component type of the array in arrayref or any subtype; or a boolean false value otherwise. In quad-with-try form only, the result is also true if objectref is null; in all other forms this possibility is a semantic error.
arrayref - the array object to test. Should never be an array of primitive component type. The Temp specified by arrayref should never contain the value null at run-time.
objectref - the component object to test. The Temp specified by objectref may contain the value null at run-time if and only if we are in quad-with-try form.
Method Detail

dst

public Temp dst()
Returns the Temp in which to store the result of the type check test.


arrayref

public Temp arrayref()
Returns the array reference to test.


objectref

public Temp objectref()
Returns the component object reference to test.


use

public Temp[] use()
Returns the Temps used by this quad.

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

def

public Temp[] def()
Returns the Temps defined by this quad.

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

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

rename

public Quad rename(QuadFactory qqf,
                   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.

Specified by:
accept in class Quad

accept

public <T> T accept(QuadValueVisitor<T> v)
Specified by:
accept in class Quad

toString

public String toString()
Returns a human-readable representation of this Quad.

Specified by:
toString in class Quad