harpoon.Analysis.PointerAnalysis
Class PAThreadMap

java.lang.Object
  extended by harpoon.Analysis.PointerAnalysis.PAThreadMap
All Implemented Interfaces:
Serializable

public class PAThreadMap
extends Object
implements Serializable

PAThreadMap implements the parallel thread map (i.e. the "tau" function from the algorithm). For each thread node n, tau(n) is a conservative approximation of the number of instances of nT that could run in parallel with the current thread. tau(n) is a number from the set {0,1,2} where 0 stands for no instance, 1 for at most one instance and 2 for possibly multiple instances. PAThreadMap is more or less a Hashtable with some access functions to enforce the new rules for addition and substraction.

Version:
$Id: PAThreadMap.java,v 1.6 2005/08/17 23:34:01 salcianu Exp $
Author:
Alexandru SALCIANU <salcianu@retezat.lcs.mit.edu>
See Also:
Serialized Form

Constructor Summary
PAThreadMap()
          Creates a PAThreadMap.
 
Method Summary
 Enumeration activeThreads()
          Returns all the thread nodes nT that have assigned a non-zero count (i.e. tau(nT) > 0 in the algorithm)
 Set activeThreadSet()
          Returns all the thread nodes nT that have assigned a non-zero count (i.e. tau(nT) > 0 in the algorithm)
 void add(PANode n, int delta)
          Add a positive delta to the value attached to a node.
 Object clone()
          clone creates a copy of this thread map; by doing a simple shallow copy of the hash field.
 void dec(PANode n)
          Decrements the value attached to n
 boolean equals(Object o)
          Checks the equality of two PAThreadMaps
 int getValue(PANode n)
           
 void inc(PANode n)
          Increments the value attached to n
 void incAll(Set nodes)
          Convenient function that calls inc for all the nodes from set
 void insert(PAThreadMap tau2, Relation mu)
          Inserts the image of tau2 through the mu mapping into this object.
 boolean isStarted(PANode nt)
          Checks whether the thread "nt" is started or not.
 void join(PAThreadMap tau2)
          join combines two PAThreadMaps in a control-flow join poin
 PAThreadMap keepTheEssential(Set essential_nodes)
          Produces a new PAThreadMap containing only the thread nodes that appear in essential_nodes.
 void remove(Set set)
          Remove all the PANodes that appear in set from this thread map.
 void setToZero(PANode n)
          Set to zero the value attached to the node n.
 PAThreadMap specialize(Map map)
           
 String toString()
          Pretty print function for debug purposes.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PAThreadMap

public PAThreadMap()
Creates a PAThreadMap.

Method Detail

getValue

public int getValue(PANode n)

inc

public void inc(PANode n)
Increments the value attached to n


incAll

public void incAll(Set nodes)
Convenient function that calls inc for all the nodes from set


dec

public void dec(PANode n)
Decrements the value attached to n


isStarted

public boolean isStarted(PANode nt)
Checks whether the thread "nt" is started or not.


add

public void add(PANode n,
                int delta)
Add a positive delta to the value attached to a node.


setToZero

public void setToZero(PANode n)
Set to zero the value attached to the node n.


activeThreads

public Enumeration activeThreads()
Returns all the thread nodes nT that have assigned a non-zero count (i.e. tau(nT) > 0 in the algorithm)


activeThreadSet

public Set activeThreadSet()
Returns all the thread nodes nT that have assigned a non-zero count (i.e. tau(nT) > 0 in the algorithm)


remove

public void remove(Set set)
Remove all the PANodes that appear in set from this thread map.


join

public void join(PAThreadMap tau2)
join combines two PAThreadMaps in a control-flow join poin


insert

public void insert(PAThreadMap tau2,
                   Relation mu)
Inserts the image of tau2 through the mu mapping into this object. Forall node in tau2.activeThreads, forall node2 in mu(node), tau(node2) += tau2(node).


specialize

public PAThreadMap specialize(Map map)

clone

public Object clone()
clone creates a copy of this thread map; by doing a simple shallow copy of the hash field.

Overrides:
clone in class Object

keepTheEssential

public PAThreadMap keepTheEssential(Set essential_nodes)
Produces a new PAThreadMap containing only the thread nodes that appear in essential_nodes.


equals

public boolean equals(Object o)
Checks the equality of two PAThreadMaps

Overrides:
equals in class Object

toString

public String toString()
Pretty print function for debug purposes. tau1.equals(tau2) <==> tau1.toString().equals(tau2.toString()).

Overrides:
toString in class Object