changes.
authoryeom <yeom>
Fri, 8 Jan 2010 02:37:08 +0000 (02:37 +0000)
committeryeom <yeom>
Fri, 8 Jan 2010 02:37:08 +0000 (02:37 +0000)
Robust/src/Analysis/MLP/ConflictGraph.java
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/IR/Flat/BuildCode.java

index 512732a1afd71cc606e85a67239ed02ea709408b..fd5e0d691981b9c101015a83e5a8cd7f42b6f541 100644 (file)
@@ -76,25 +76,6 @@ public class ConflictGraph {
 
                        }
                        
-                       // add for another case
-                       if (readEffectsSet != null) {
-                               Iterator<SESEEffectsKey> readIter = readEffectsSet.iterator();
-                               while (readIter.hasNext()) {
-                                       SESEEffectsKey seseEffectsKey = (SESEEffectsKey) readIter
-                                       .next();
-                                       String readHeapRegionID = seseEffectsKey.getHRNUniqueId();
-                                       HashSet<HeapRegionNode> stallSiteHRNSet = nodeA.getHRNSet();
-                                       for (Iterator iterator = stallSiteHRNSet.iterator(); iterator
-                                                       .hasNext();) {
-                                               HeapRegionNode stallHRN = (HeapRegionNode) iterator.next();
-                                               if (stallHRN.getGloballyUniqueIdentifier().equals(
-                                                               readHeapRegionID)) {
-                                                       result = result | true;
-                                               }
-                                       }
-                               }                                                               
-                       }               
-                       
                }
 
                if (readEffectsSet != null) {
@@ -133,26 +114,7 @@ public class ConflictGraph {
                                }
 
                        }
-                       
-                       // for another case where only reading regions are overlapped
-                       readIter = readEffectsSet.iterator();
-                       while (readIter.hasNext()) {
-                               
-                               SESEEffectsKey seseEffectsKey = (SESEEffectsKey) readIter
-                               .next();
-                               String readHeapRegionID = seseEffectsKey.getHRNUniqueId();
-                               
-                               HashSet<HeapRegionNode> stallSiteHRNSet = nodeA.getHRNSet();
-                               for (Iterator iterator = stallSiteHRNSet.iterator(); iterator
-                                               .hasNext();) {
-                                       HeapRegionNode stallHRN = (HeapRegionNode) iterator.next();
-                                       if (stallHRN.getGloballyUniqueIdentifier().equals(
-                                                       readHeapRegionID)) {
-                                               result = result | true;
-                                       }
-                               }
-                       }
-                       
+                                               
                }
 
                return result;
index 76f0069b1962e1c8423c7513eec10528b3771a0c..81aa04c98da503c51d985a67dc2e65f6ba519206 100644 (file)
@@ -2440,57 +2440,42 @@ public class MLPAnalysis {
                        }
 
                        if (isAfterChildSESE) {
-
-                               HashSet<TempDescriptor> srcTempSet = getTempDescSetReferenceToSameHRN(
-                                               og, src);
-                               for (Iterator iterator = srcTempSet.iterator(); iterator
-                                               .hasNext();) {
-                                       TempDescriptor possibleSrc = (TempDescriptor) iterator
-                                                       .next();
-                                       if (!currentConflictsMap.isAccessible(possibleSrc)) {
-                                               HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(
-                                                               og, possibleSrc);
-                                               currentConflictsMap.addStallSite(possibleSrc, refHRN,
-                                                               new StallTag(fn));
-
-                                               // flag stall site for disjoint analysis
-                                               for (Iterator iterator2 = refHRN.iterator(); iterator2
-                                                               .hasNext();) {
-                                                       HeapRegionNode hrn = (HeapRegionNode) iterator2
-                                                                       .next();
-                                                       if (hrn.isParameter()) {
-                                                               // if stall site is paramter heap region, need
-                                                               // to decompose into caller's
-                                                               HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
-                                                               visitedHRN.add(hrn);
-                                                               setupRelatedAllocSiteAnalysis(og, mc, hrn,
-                                                                               visitedHRN);
-                                                       } else {
-                                                               flagAllocationSite(mc, hrn.getAllocationSite());
-                                                       }
+                               
+                               if (!currentConflictsMap.isAccessible(src)) {
+                                       HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(
+                                                       og, src);
+                                       currentConflictsMap.addStallSite(src, refHRN,
+                                                       new StallTag(fn));
+
+                                       // flag stall site for disjoint analysis
+                                       for (Iterator iterator2 = refHRN.iterator(); iterator2
+                                                       .hasNext();) {
+                                               HeapRegionNode hrn = (HeapRegionNode) iterator2
+                                                               .next();
+                                               if (hrn.isParameter()) {
+                                                       // if stall site is paramter heap region, need
+                                                       // to decompose into caller's
+                                                       HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
+                                                       visitedHRN.add(hrn);
+                                                       setupRelatedAllocSiteAnalysis(og, mc, hrn,
+                                                                       visitedHRN);
+                                               } else {
+                                                       flagAllocationSite(mc, hrn.getAllocationSite());
                                                }
-
                                        }
-                                       // else{
-                                       // System.out.println("src is accessible="+possibleSrc);
-                                       // }
-
-                                       currentConflictsMap.addAccessibleVar(possibleSrc);
 
-                                       // contribute read effect on source's stall site
-                                       currentConflictsMap.contributeEffect(possibleSrc, field
-                                                       .getType().getSafeSymbol(), field.getSymbol(),
-                                                       StallSite.READ_EFFECT);
                                }
+                               currentConflictsMap.addAccessibleVar(src);
 
-                               HashSet<TempDescriptor> dstTempSet = getTempDescSetReferenceToSameHRN(
-                                               og, dst);
-                               for (Iterator iterator = dstTempSet.iterator(); iterator
-                                               .hasNext();) {
-                                       TempDescriptor possibleDst = (TempDescriptor) iterator
-                                                       .next();
-                                       currentConflictsMap.addAccessibleVar(possibleDst);
+                               // contribute read effect on source's stall site
+                               currentConflictsMap.contributeEffect(src, field
+                                               .getType().getSafeSymbol(), field.getSymbol(),
+                                               StallSite.READ_EFFECT);
+                               
+                               if(field.getType().isImmutable()){
+                                       currentConflictsMap.addAccessibleVar(dst);
                                }
+                       
                        }
 
                        if (currentMethodSummary.getChildSESECount() == 0) {
@@ -2517,79 +2502,65 @@ public class MLPAnalysis {
 
                        if (isAfterChildSESE) {
 
-                               HashSet<TempDescriptor> srcTempSet = getTempDescSetReferenceToSameHRN(
-                                               og, src);
-                               for (Iterator iterator = srcTempSet.iterator(); iterator
-                                               .hasNext();) {
-                                       TempDescriptor possibleSrc = (TempDescriptor) iterator
-                                                       .next();
-                                       if (!currentConflictsMap.isAccessible(possibleSrc)) {
-                                               HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(
-                                                               og, possibleSrc);
-                                               currentConflictsMap.addStallSite(possibleSrc, refHRN,
-                                                               new StallTag(fn));
-
-                                               // flag stall site for disjoint analysis
-                                               for (Iterator iterator2 = refHRN.iterator(); iterator2
-                                                               .hasNext();) {
-                                                       HeapRegionNode hrn = (HeapRegionNode) iterator2
-                                                                       .next();
+                               if (!currentConflictsMap.isAccessible(src)) {
+                                       HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(og,
+                                                       src);
+                                       currentConflictsMap.addStallSite(src, refHRN, new StallTag(
+                                                       fn));
 
-                                                       if (hrn.isParameter()) {
-                                                               // if stall site is paramter heap region, need
-                                                               // to decompose into caller's
-                                                               HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
-                                                               visitedHRN.add(hrn);
-                                                               setupRelatedAllocSiteAnalysis(og, mc, hrn,
-                                                                               visitedHRN);
-                                                       } else {
-                                                               flagAllocationSite(mc, hrn.getAllocationSite());
-                                                       }
+                                       // flag stall site for disjoint analysis
+                                       for (Iterator iterator2 = refHRN.iterator(); iterator2
+                                                       .hasNext();) {
+                                               HeapRegionNode hrn = (HeapRegionNode) iterator2.next();
 
+                                               if (hrn.isParameter()) {
+                                                       // if stall site is paramter heap region, need
+                                                       // to decompose into caller's
+                                                       HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
+                                                       visitedHRN.add(hrn);
+                                                       setupRelatedAllocSiteAnalysis(og, mc, hrn,
+                                                                       visitedHRN);
+                                               } else {
+                                                       flagAllocationSite(mc, hrn.getAllocationSite());
                                                }
 
                                        }
-                                       currentConflictsMap.addAccessibleVar(possibleSrc);
+
                                }
+                               currentConflictsMap.addAccessibleVar(src);
 
-                               HashSet<TempDescriptor> dstTempSet = getTempDescSetReferenceToSameHRN(
-                                               og, dst);
-                               for (Iterator iterator = dstTempSet.iterator(); iterator
-                                               .hasNext();) {
-                                       TempDescriptor possibleDst = (TempDescriptor) iterator
-                                                       .next();
 
-                                       if (!currentConflictsMap.isAccessible(possibleDst)) {
-                                               HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(
-                                                               og, possibleDst);
-                                               currentConflictsMap.addStallSite(possibleDst, refHRN,
-                                                               new StallTag(fn));
+                               if (!currentConflictsMap.isAccessible(dst)) {
+                                       HashSet<HeapRegionNode> refHRN = getReferenceHeapIDSet(
+                                                       og, dst);
+                                       currentConflictsMap.addStallSite(dst, refHRN,
+                                                       new StallTag(fn));
 
-                                               // flag stall site for disjoint analysis
-                                               for (Iterator iterator2 = refHRN.iterator(); iterator2
-                                                               .hasNext();) {
-                                                       HeapRegionNode hrn = (HeapRegionNode) iterator2
-                                                                       .next();
-                                                       if (hrn.isParameter()) {
-                                                               // if stall site is paramter heap region, need
-                                                               // to decompose into caller's
-                                                               HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
-                                                               visitedHRN.add(hrn);
-                                                               setupRelatedAllocSiteAnalysis(og, mc, hrn,
-                                                                               visitedHRN);
-                                                       } else {
-                                                               flagAllocationSite(mc, hrn.getAllocationSite());
-                                                       }
+                                       // flag stall site for disjoint analysis
+                                       for (Iterator iterator2 = refHRN.iterator(); iterator2
+                                                       .hasNext();) {
+                                               HeapRegionNode hrn = (HeapRegionNode) iterator2
+                                                               .next();
+                                               if (hrn.isParameter()) {
+                                                       // if stall site is paramter heap region, need
+                                                       // to decompose into caller's
+                                                       HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
+                                                       visitedHRN.add(hrn);
+                                                       setupRelatedAllocSiteAnalysis(og, mc, hrn,
+                                                                       visitedHRN);
+                                               } else {
+                                                       flagAllocationSite(mc, hrn.getAllocationSite());
                                                }
                                        }
-
-                                       currentConflictsMap.addAccessibleVar(possibleDst);
-                                       // contribute write effect on destination's stall site
-                                       currentConflictsMap.contributeEffect(possibleDst, field
-                                                       .getType().getSafeSymbol(), field.getSymbol(),
-                                                       StallSite.WRITE_EFFECT);
                                }
 
+                               currentConflictsMap.addAccessibleVar(dst);
+                               // contribute write effect on destination's stall site
+                               currentConflictsMap.contributeEffect(dst, field
+                                               .getType().getSafeSymbol(), field.getSymbol(),
+                                               StallSite.WRITE_EFFECT);
+                       
+
                                // TODO need to create edge mapping for newly created edge
                                HashSet<ReferenceEdge> edges = getRefEdgeSetReferenceToSameHRN(
                                                og, dst);
index df5f82f54eca29dcff350dcb6503a3728d70aa87..34f1e7bb88718608684dbeb83d40fcf98a06a494 100644 (file)
@@ -2711,7 +2711,7 @@ public class BuildCode {
 
                        Set<Long> allocSet = conflictsMap
                                        .getAllocationSiteIDSetofStallSite();
-       
+                       
                        if (allocSet.size() > 0) {
                                
                                FlatNode enclosingFlatNode=null;
@@ -2723,43 +2723,47 @@ public class BuildCode {
                                
                                ConflictGraph graph=mlpa.getConflictGraphResults().get(enclosingFlatNode);
                                Set<Integer> connectedSet=graph.getConnectedConflictNodeSet(conflictsMap);
-                               
-                               output.println("   /*  stall on parent's stall sites */");
-                               output.println("  {");
-                               output.println("     pthread_mutex_lock( &(seseCaller->lock) );");
-                           //
-                               output.println("     ConflictNode* node;");
-                               for (Iterator iterator = connectedSet.iterator(); iterator
-                                               .hasNext();) {
-                                       Integer integer = (Integer) iterator.next();
-                                       //output.print(" "+integer);
-                                       if(integer.intValue()<0){
-                                               output.println("     node=mlpCreateConflictNode(seseCaller->classID);");
-                                       }else{
-                                               output.println("     node=mlpCreateConflictNode( "+integer+" );");
+               
+                               if(connectedSet.size()>0){
+                                       output.println("   /*  stall on parent's stall sites */");
+                                       output.println("   //"+connectedSet);
+                                       output.println("  {");
+                                       output.println("     pthread_mutex_lock( &(seseCaller->lock) );");
+                                   //
+                                       output.println("     ConflictNode* node;");
+                                       for (Iterator iterator = connectedSet.iterator(); iterator
+                                                       .hasNext();) {
+                                               Integer integer = (Integer) iterator.next();
+                                               //output.print(" "+integer);
+                                               if(integer.intValue()<0){
+                                                       output.println("     node=mlpCreateConflictNode(seseCaller->classID);");
+                                               }else{
+                                                       output.println("     node=mlpCreateConflictNode( "+integer+" );");
+                                               }
+                                               output.println("     addNewConflictNode(node, seseCaller->connectedList);");
                                        }
-                                       output.println("     addNewConflictNode(node, seseCaller->connectedList);");
-                               }
-                               //
-                               
-                               output.println("     psem_init( &(seseCaller->memoryStallSiteSem) );");
-                               output.println("     int qIdx;");
-                               output.println("     int takeCount=0;");
-                               for (Iterator iterator = allocSet.iterator(); iterator
-                                               .hasNext();) {
-                                       Long allocID = (Long) iterator.next();
-                                       output.println("     qIdx=getQueueIdx(seseCaller->allocSiteArray,numRelatedAllocSites,"
-                                                                       + allocID + ");");
-                                       output.println("     if(qIdx!=-1 && !isEmpty(seseCaller->allocSiteArray[qIdx].waitingQueue)){");
-                                       output.println("        addNewItemBack(seseCaller->allocSiteArray[qIdx].waitingQueue,seseCaller);");
-                                       output.println("        takeCount++;");
+                                       //
+                                       
+                                       output.println("     psem_init( &(seseCaller->memoryStallSiteSem) );");
+                                       output.println("     int qIdx;");
+                                       output.println("     int takeCount=0;");
+                                       for (Iterator iterator = allocSet.iterator(); iterator
+                                                       .hasNext();) {
+                                               Long allocID = (Long) iterator.next();
+                                               output.println("     qIdx=getQueueIdx(seseCaller->allocSiteArray,numRelatedAllocSites,"
+                                                                               + allocID + ");");
+                                               output.println("     if(qIdx!=-1 && !isEmpty(seseCaller->allocSiteArray[qIdx].waitingQueue)){");
+                                               output.println("        addNewItemBack(seseCaller->allocSiteArray[qIdx].waitingQueue,seseCaller);");
+                                               output.println("        takeCount++;");
+                                               output.println("     }");
+                                       }
+                                       output.println("     pthread_mutex_unlock( &(seseCaller->lock) );");
+                                       output.println("     if( takeCount>0 ){");
+                                       output.println("        psem_take( &(seseCaller->memoryStallSiteSem) );");
                                        output.println("     }");
+                                       output.println("  }");
                                }
-                               output.println("     pthread_mutex_unlock( &(seseCaller->lock) );");
-                               output.println("     if( takeCount>0 ){");
-                               output.println("        psem_take( &(seseCaller->memoryStallSiteSem) );");
-                               output.println("     }");
-                               output.println("  }");
+
                        }
                }
       }     
@@ -3641,8 +3645,10 @@ public class BuildCode {
        output.println("           SESEcommon* item=qItem->objectptr;");
        output.println("           if(item->classID==___params___->common.classID){");
        output.println("              removeItem(___params___->common.parent->allocSiteArray[idx].waitingQueue,qItem);");
-       output.println("           }");
+       output.println("              qItem=NULL;");
+       output.println("           }else{");
        output.println("           qItem=getNextQueueItem(qItem);");
+       output.println("           }");
        output.println("        }");
        output.println("        if( !isEmpty(___params___->common.parent->allocSiteArray[idx].waitingQueue) ){");