return resultSet;
}
- /*
public Set<Integer> getAllocationSiteIDSetBySESEID(int seseID) {
HashSet<Integer> allocSiteIDSet = new HashSet<Integer>();
if (node instanceof LiveInNode) {
LiveInNode liveInNode = (LiveInNode) node;
if (liveInNode.getSESEIdentifier() == seseID) {
- Set<HeapRegionNode> hrnSet = liveInNode.getHRNSet();
- for (Iterator iterator = hrnSet.iterator(); iterator
- .hasNext();) {
- HeapRegionNode hrn = (HeapRegionNode) iterator.next();
- // allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier());
- allocSiteIDSet.add(new pthread_mutex_lock( &(parentCommon->lock) );
- addWaitingQueueElement(parentCommon->allocSiteArray,numRelatedAllocSites,196130920,seseToIssue->common.classID);
- ++(seseToIssue->common.unresolvedDependencies);
- addWaitingQueueElement(parentCommon->allocSiteArray,numRelatedAllocSites,1289650030,seseToIssue->common.classID); Integer(hrn
- .getGloballyUniqueIntegerIdentifier()));
+
+ HashSet<ConflictEdge> edgeSet = liveInNode.getEdgeSet();
+ for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) {
+ ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
+ if (conflictEdge.getType() == ConflictEdge.COARSE_GRAIN_EDGE) {
+ allocSiteIDSet.addAll(getHRNIdentifierSet(conflictEdge.getVertexU()));
+ allocSiteIDSet.addAll(getHRNIdentifierSet(conflictEdge.getVertexV()));
+ }else{// it is fine-grain edge
+ allocSiteIDSet.addAll(getHRNIdentifierSet(node));
+ }
}
+
}
}
}
return allocSiteIDSet;
}
-*/
- public Set<Integer> getAllocationSiteIDSetBySESEID(int seseID) {
-
+ public Set<Integer> getAllocationSiteIDSetofStallSite() {
+
HashSet<Integer> allocSiteIDSet = new HashSet<Integer>();
Set<Entry<String, ConflictNode>> s = id2cn.entrySet();
Iterator<Entry<String, ConflictNode>> i = s.iterator();
-
+
while (i.hasNext()) {
+
Entry<String, ConflictNode> entry = i.next();
ConflictNode node = entry.getValue();
-
- if (node instanceof LiveInNode) {
- LiveInNode liveInNode = (LiveInNode) node;
- if (liveInNode.getSESEIdentifier() == seseID) {
-
- HashSet<ConflictEdge> edgeSet = liveInNode.getEdgeSet();
- for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) {
- ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
- if (conflictEdge.getType() == ConflictEdge.COARSE_GRAIN_EDGE) {
- allocSiteIDSet.addAll(getHRNIdentifierSet(conflictEdge.getVertexU()));
- allocSiteIDSet.addAll(getHRNIdentifierSet(conflictEdge.getVertexV()));
- }else{// it is fine-grain edge
- allocSiteIDSet.addAll(getHRNIdentifierSet(node));
- }
- }
-
-
-// Set<HeapRegionNode> hrnSet = liveInNode.getHRNSet();
-// for (Iterator iterator = hrnSet.iterator(); iterator
-// .hasNext();) {
-// HeapRegionNode hrn = (HeapRegionNode) iterator.next();
-// // allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier());
-// allocSiteIDSet.add(new Integer(hrn
-// .getGloballyUniqueIntegerIdentifier()));
-// }
-
- }
+
+ if(node instanceof StallSiteNode){
+ allocSiteIDSet.addAll(getHRNIdentifierSet(node));
}
+
}
-
+
return allocSiteIDSet;
-
+
}
public Set<Integer> getAllocationSiteIDSet() {
SESESummary currentSummary) {
OwnershipGraph og = ownAnalysis.getOwnvershipGraphByMethodContext(mc);
+
+ currentConflictsMap.clearStallMap();
switch (fn.kind()) {
package Analysis.MLP;
+import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
stallEdgeMap.clear();
}
+ public void clearStallMap(){
+ stallMap.clear();
+ }
+
public void makeAllInaccessible(){
Set<TempDescriptor> keySet=accessibleMap.keySet();
}
+ public Set<Integer> getAllocationSiteIDSetofStallSite() {
+
+ HashSet<Integer> returnSet=new HashSet<Integer>();
+
+ Enumeration<StallSite> stallSiteEnum=stallMap.elements();
+ while (stallSiteEnum.hasMoreElements()) {
+ StallSite stallSite = (StallSite) stallSiteEnum.nextElement();
+ HashSet<HeapRegionNode> hrnSet=stallSite.getHRNSet();
+ for (Iterator iterator = hrnSet.iterator(); iterator.hasNext();) {
+ HeapRegionNode hrn = (HeapRegionNode) iterator.next();
+ // allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier());
+ returnSet.add(new Integer(hrn
+ .getGloballyUniqueIntegerIdentifier()));
+ }
+ }
+ return returnSet;
+
+ }
+
public boolean equals(Object o) {
if (o == null) {
import Analysis.Locality.TypeAnalysis;
import Analysis.MLP.ConflictGraph;
import Analysis.MLP.MLPAnalysis;
+import Analysis.MLP.ParentChildConflictsMap;
import Analysis.MLP.VariableSourceToken;
import Analysis.MLP.CodePlan;
import Analysis.MLP.SESEandAgePair;
output.println(" "+dynVar+"_srcSESE = NULL;");
}
}
+
+ // eom
+ // handling stall site
+ ParentChildConflictsMap conflictsMap=mlpa.getConflictsResults().get(fn);
+ if (conflictsMap != null) {
+
+ Set<Integer> allocSet = conflictsMap
+ .getAllocationSiteIDSetofStallSite();
+
+ if (allocSet.size() > 0) {
+ output.println(" /* stall on parent's stall sites */");
+ output.println(" {");
+ output
+ .println(" pthread_mutex_lock( &(seseCaller->lock) );");
+
+ for (Iterator iterator = allocSet.iterator(); iterator
+ .hasNext();) {
+ Integer allocID = (Integer) iterator.next();
+ output
+ .println(" if(addWaitingQueueElement(seseCaller->allocSiteArray,numRelatedAllocSites,"
+ + allocID + ",seseCaller)!=0){");
+
+ output
+ .println(" psem_init( &(seseCaller->memoryStallSiteSem) );");
+ output
+ .println(" psem_take( &(seseCaller->memoryStallSiteSem) );");
+ output.println(" }");
+ }
+ output
+ .println(" pthread_mutex_unlock( &(seseCaller->lock) );");
+ output.println(" }");
+ }
+
+ }
+
}
switch(fn.kind()) {
output.println(" removeItem(___params___->common.parent->allocSiteArray[idx].waitingQueue,qItem);");
output.println(" if( !isEmpty(___params___->common.parent->allocSiteArray[idx].waitingQueue) ){");
output.println(" SESEcommon* nextItem=peekItem(___params___->common.parent->allocSiteArray[idx].waitingQueue);");
- output.println(" pthread_mutex_lock( &(nextItem->lock) );");
- output.println(" --(nextItem->unresolvedDependencies);");
- output.println(" if( nextItem->unresolvedDependencies == 0){");
- output.println(" workScheduleSubmit( (void*)nextItem);");
+ output.println(" if(nextItem->classID==___params___->common.parent->classID){");
+ output.println(" struct QueueItem* stallItem=findItem(___params___->common.parent->allocSiteArray[idx].waitingQueue,nextItem);");
+ output.println(" removeItem(___params___->common.parent->allocSiteArray[idx].waitingQueue,stallItem);");
+ output.println(" psem_give(&(nextItem->memoryStallSiteSem));");
+ output.println(" }else{");
+ output.println(" pthread_mutex_lock( &(nextItem->lock) );");
+ output.println(" --(nextItem->unresolvedDependencies);");
+ output.println(" if( nextItem->unresolvedDependencies == 0){");
+ output.println(" workScheduleSubmit( (void*)nextItem);");
+ output.println(" }");
+ output.println(" pthread_mutex_unlock( &(nextItem->lock) );");
output.println(" }");
- output.println(" pthread_mutex_unlock( &(nextItem->lock) );");
output.println(" }");
output.println(" }");
output.println(" }");
// data has been taken care of--set sese pointer to remember self over method
// calls to a non-zero, invalid address
output.println(" seseCaller = (SESEcommon*) 0x1;");
+
}
public void generateFlatWriteDynamicVarNode( FlatMethod fm,