import java.util.Hashtable;
import java.util.Set;
import java.util.Vector;
-
-import Analysis.MLP.SESEEffectsKey;
-import Analysis.MLP.SESEEffectsSet;
-import Analysis.MLP.SESEandAgePair;
-import Analysis.MLP.VariableSourceToken;
+import java.util.Iterator;
+import java.util.Collection;
+import Analysis.OoOJava.VariableSourceToken;
+import Analysis.OoOJava.SESEandAgePair;
import Analysis.OwnershipAnalysis.HeapRegionNode;
import IR.ClassDescriptor;
import IR.FieldDescriptor;
private int id;
protected FlatSESEExitNode exit;
protected SESENode treeNode;
- protected FlatSESEEnterNode parent;
- protected Integer oldestAgeToTrack;
- protected boolean isCallerSESEplaceholder;
+ // a leaf tasks simply has no children, ever
+ protected static final int ISLEAF_UNINIT = 1;
+ protected static final int ISLEAF_FALSE = 2;
+ protected static final int ISLEAF_TRUE = 3;
+ protected int isLeafSESE;
+
+ // there is only one main sese that is implicit
+ // (spliced in by the compiler around whole program)
+ protected boolean isMainSESE;
+
+ // this is a useful static name for whichever task
+ // invoked the current local method context
+ protected boolean isCallerProxySESE;
+
+ // all children tasks, INCLUDING those that are reachable
+ // by calling methods
protected Set<FlatSESEEnterNode> children;
+
+ // all possible parents
+ protected Set<FlatSESEEnterNode> parents;
- protected Set<TempDescriptor> inVars;
- protected Set<TempDescriptor> outVars;
+ // sometimes it is useful to know the locally defined
+ // parent or children of an SESE for various analysis,
+ // and by local it is one SESE nested within another
+ // in a single method context
+ protected Set<FlatSESEEnterNode> localChildren;
+ protected FlatSESEEnterNode localParent;
- protected Set<SESEandAgePair> needStaticNameInCode;
- protected Set<SESEandAgePair> staticInVarSrcs;
+ protected Set<TempDescriptor> inVars;
+ protected Set<TempDescriptor> outVars;
protected Set<TempDescriptor> readyInVars;
protected Set<TempDescriptor> staticInVars;
protected Set<TempDescriptor> dynamicInVars;
- protected Set<TempDescriptor> dynamicVars;
+ protected Set<SESEandAgePair> staticInVarSrcs;
protected Hashtable<TempDescriptor, VariableSourceToken> staticInVar2src;
+
+ // get the oldest age of this task that other contexts
+ // have a static name for when tracking variables
+ protected Integer oldestAgeToTrack;
- private SESEEffectsSet seseEffectsSet;
+
+ // a subset of the in-set variables that shouuld be traversed during
+ // the dynamic coarse grained conflict strategy, remember them here so
+ // buildcode can be dumb and just gen the traversals
+ protected Vector<TempDescriptor> inVarsForDynamicCoarseConflictResolution;
// scope info for this SESE
// records which is relevant to garbage collection
protected String firstDepRecField;
protected int numDepRecs;
-
+
public FlatSESEEnterNode( SESENode sn ) {
this.id = identifier++;
treeNode = sn;
- parent = null;
- oldestAgeToTrack = new Integer( 0 );
-
children = new HashSet<FlatSESEEnterNode>();
+ parents = new HashSet<FlatSESEEnterNode>();
+ localChildren = new HashSet<FlatSESEEnterNode>();
+ localParent = null;
inVars = new HashSet<TempDescriptor>();
outVars = new HashSet<TempDescriptor>();
- needStaticNameInCode = new HashSet<SESEandAgePair>();
- staticInVarSrcs = new HashSet<SESEandAgePair>();
readyInVars = new HashSet<TempDescriptor>();
staticInVars = new HashSet<TempDescriptor>();
dynamicInVars = new HashSet<TempDescriptor>();
- dynamicVars = new HashSet<TempDescriptor>();
+ staticInVarSrcs = new HashSet<SESEandAgePair>();
+ oldestAgeToTrack = new Integer( 0 );
staticInVar2src = new Hashtable<TempDescriptor, VariableSourceToken>();
-
- seseEffectsSet = new SESEEffectsSet();
+ inVarsForDynamicCoarseConflictResolution = new Vector<TempDescriptor>();
+
+
fmEnclosing = null;
mdEnclosing = null;
cdEnclosing = null;
- isCallerSESEplaceholder = false;
+ isLeafSESE = ISLEAF_UNINIT;
+
+ isMainSESE = false;
+ isCallerProxySESE = false;
firstDepRecField = null;
numDepRecs = 0;
return exit;
}
+ public void setIsMainSESE() {
+ isMainSESE = true;
+ }
+
+ public boolean getIsMainSESE() {
+ return isMainSESE;
+ }
+
+ public void setIsCallerProxySESE() {
+ isCallerProxySESE = true;
+ }
+
+ public boolean getIsCallerProxySESE() {
+ return isCallerProxySESE;
+ }
+
public int kind() {
return FKind.FlatSESEEnterNode;
}
}
public String getPrettyIdentifier() {
- if( treeNode.getID() != null ) {
+ if( treeNode != null && treeNode.getID() != null ) {
return treeNode.getID();
}
return ""+id;
return "sese "+getPrettyIdentifier()+getIdentifier();
}
- public void setParent( FlatSESEEnterNode parent ) {
- this.parent = parent;
+
+ public void mustTrackAtLeastAge( Integer age ) {
+ if( age > oldestAgeToTrack ) {
+ oldestAgeToTrack = new Integer( age );
+ }
+ }
+
+ public Integer getOldestAgeToTrack() {
+ return oldestAgeToTrack;
+ }
+
+
+ public void addParent( FlatSESEEnterNode parent ) {
+ parents.add( parent );
+ }
+
+ public Set<FlatSESEEnterNode> getParents() {
+ return parents;
+ }
+
+ public void setLocalParent( FlatSESEEnterNode parent ) {
+ localParent = parent;
}
- public FlatSESEEnterNode getParent() {
- return parent;
+ public FlatSESEEnterNode getLocalParent() {
+ return localParent;
}
public void addChild( FlatSESEEnterNode child ) {
children.add( child );
}
+ public void addChildren( Set<FlatSESEEnterNode> batch ) {
+ children.addAll( batch );
+ }
+
public Set<FlatSESEEnterNode> getChildren() {
return children;
}
+ public void addLocalChild( FlatSESEEnterNode child ) {
+ localChildren.add( child );
+ }
+
+ public Set<FlatSESEEnterNode> getLocalChildren() {
+ return localChildren;
+ }
+
+
+
public void addInVar( TempDescriptor td ) {
- inVars.add( td );
+ if (!inVars.contains(td))
+ inVars.add( td );
}
public void addOutVar( TempDescriptor td ) {
}
public void addInVarSet( Set<TempDescriptor> s ) {
- inVars.addAll( s );
+ inVars.addAll(s);
}
public void addOutVarSet( Set<TempDescriptor> s ) {
return outVars;
}
- public void addNeededStaticName( SESEandAgePair p ) {
- needStaticNameInCode.add( p );
- }
-
- public Set<SESEandAgePair> getNeededStaticNames() {
- return needStaticNameInCode;
- }
-
public void addStaticInVarSrc( SESEandAgePair p ) {
staticInVarSrcs.add( p );
}
return dynamicInVars;
}
- public void addDynamicVar( TempDescriptor td ) {
- dynamicVars.add( td );
- }
-
- public Set<TempDescriptor> getDynamicVarSet() {
- return dynamicVars;
- }
-
- public void mustTrackAtLeastAge( Integer age ) {
- if( age > oldestAgeToTrack ) {
- oldestAgeToTrack = new Integer( age );
- }
- }
-
- public Integer getOldestAgeToTrack() {
- return oldestAgeToTrack;
- }
public void setfmEnclosing( FlatMethod fm ) { fmEnclosing = fm; }
public FlatMethod getfmEnclosing() { return fmEnclosing; }
"_SESErec";
}
- public void setCallerSESEplaceholder() {
- isCallerSESEplaceholder = true;
- }
-
- public boolean getIsCallerSESEplaceholder() {
- return isCallerSESEplaceholder;
- }
-
-
public boolean equals( Object o ) {
if( o == null ) {
return false;
return 31*id;
}
- public void writeEffects(TempDescriptor td, String fd, TypeDescriptor type, HeapRegionNode hrn, boolean strongUpdate){
- seseEffectsSet.addWritingVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier()));
- if(strongUpdate){
- seseEffectsSet.addStrongUpdateVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier()));
- }
- }
-
- public void readEffects(TempDescriptor td, String fd, TypeDescriptor type, HeapRegionNode hrn ){
- seseEffectsSet.addReadingVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier()));
- }
-
- public SESEEffectsSet getSeseEffectsSet(){
- return seseEffectsSet;
- }
public void setFirstDepRecField( String field ) {
public int getNumDepRecs() {
return numDepRecs;
}
+
+ public Vector<TempDescriptor> getInVarsForDynamicCoarseConflictResolution() {
+ return inVarsForDynamicCoarseConflictResolution;
+ }
+
+ public void addInVarForDynamicCoarseConflictResolution(TempDescriptor inVar) {
+ if (!inVarsForDynamicCoarseConflictResolution.contains(inVar))
+ inVarsForDynamicCoarseConflictResolution.add(inVar);
+ }
+
+ public void setIsLeafSESE( boolean isLeaf ) {
+ if( isLeaf ) {
+ isLeafSESE = ISLEAF_TRUE;
+ } else {
+ isLeafSESE = ISLEAF_FALSE;
+ }
+ }
+
+ public boolean getIsLeafSESE() {
+ if( isLeafSESE == ISLEAF_UNINIT ) {
+ throw new Error( "isLeafSESE uninitialized" );
+ }
+
+ return isLeafSESE == ISLEAF_TRUE;
+ }
+
}