scale.alias.steensgaard
Class ECR

java.lang.Object
  extended by scale.common.DisjointSet
      extended by scale.alias.steensgaard.ECR

public class ECR
extends DisjointSet

A class which represents an Equivalence Class Representative (ECR) with associated type information.

$Id: ECR.java,v 1.43 2005-06-15 04:17:05 asmith Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

The ECR is an extension of a fast union/find data structure.


Field Summary
static boolean classTrace
          True if traces are to be performed.
 
Constructor Summary
ECR()
          Create an Equivalence Class Representative (ECR) that is associated with the BOTTOM type (upside down T).
ECR(AliasType type, TypeVar var)
          Create a new Equivalence Class Representative (ECR) with a given type.
 
Method Summary
 void addECRs(Vector<ECR> v)
          Add the list of elements represented by this disjoint set to the vector.
 void cjoin(ECR e)
          A conditional join of two ECRs.
 void cleanup()
          Remove any un-needed stuff after analysis has been performed.
static int created()
          Return the current number of instances of this class.
 int getID()
          Return the unique identifier number representing the ECR.
 int getsetID()
          Return the set representative identifier number for the ECR.
 AliasType getType()
          Return the type associated with the ECR.
 TypeVar getTypeVar()
          Return the type variable that is represented by this ECR.
 void join(ECR e)
          Join the types represented by this ECR and the specified ECR.
static void nextVisit()
          Set up for a new points-to graph traversal - that is, use the next color va * lue.
 void setType(AliasType t)
          Set the type of the ECR.
 void setVisited()
          Associate the current color value with an ECR.
 java.lang.String toString()
          Return a string representation of an ECR.
 java.lang.String toStringShort()
          Return a string representation of an ECR.
 void unionPendingSets(ECR e1, ECR e2)
          Create a new pending set which is the union of the pending sets from two other ECRs.
 boolean visited()
          Return true if this Chord has been visited during the current visit.
 
Methods inherited from class scale.common.DisjointSet
addElements, equivalent, find, getElement, getElements, isRepresentative, size, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classTrace

public static boolean classTrace
True if traces are to be performed.

Constructor Detail

ECR

public ECR()
Create an Equivalence Class Representative (ECR) that is associated with the BOTTOM type (upside down T).


ECR

public ECR(AliasType type,
           TypeVar var)
Create a new Equivalence Class Representative (ECR) with a given type.

Parameters:
type - the initial type of the ECR.
var - the variable that this ECR represents.
Method Detail

created

public static int created()
Return the current number of instances of this class.


getType

public final AliasType getType()
Return the type associated with the ECR.


getID

public final int getID()
Return the unique identifier number representing the ECR.


getsetID

public final int getsetID()
Return the set representative identifier number for the ECR.


getTypeVar

public final TypeVar getTypeVar()
Return the type variable that is represented by this ECR.


addECRs

public void addECRs(Vector<ECR> v)
Add the list of elements represented by this disjoint set to the vector. Only add the points-to relations for user variables. We look at the representative element to get the list.


unionPendingSets

public final void unionPendingSets(ECR e1,
                                   ECR e2)
Create a new pending set which is the union of the pending sets from two other ECRs.

Parameters:
e1 - an ECR containing a pending set to be unioned
e2 - an ECR containing a pending set to be unioned

cjoin

public final void cjoin(ECR e)
A conditional join of two ECRs. A conditional join places this ECR on the pending list of the given ECR, if the type of the given ECR is BOTTOM. We do this in case the type of the given ECR changes at some point. If it does, then we update the type of the first ECR.

Parameters:
e - the given ECR.

join

public final void join(ECR e)
Join the types represented by this ECR and the specified ECR.

Parameters:
e - the specified ECR.

setType

public final void setType(AliasType t)
Set the type of the ECR. We also check if there are any pending ECRs - if so then we need to call join on them.

Parameters:
t - the type.

toString

public java.lang.String toString()
Return a string representation of an ECR.

Overrides:
toString in class java.lang.Object

toStringShort

public java.lang.String toStringShort()
Return a string representation of an ECR. In this routine, we just return a short version of the ECR. Specifically, we return only the id value of the type.


nextVisit

public static void nextVisit()
Set up for a new points-to graph traversal - that is, use the next color va * lue. This color is used to mark ECRs in points-to set traversals


setVisited

public void setVisited()
Associate the current color value with an ECR. The color is for the use of points-to set traversal algorithms.


visited

public boolean visited()
Return true if this Chord has been visited during the current visit.


cleanup

public void cleanup()
Remove any un-needed stuff after analysis has been performed.