}
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) {
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);
Set<Long> allocSet = conflictsMap
.getAllocationSiteIDSetofStallSite();
-
+
if (allocSet.size() > 0) {
FlatNode enclosingFlatNode=null;
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(" }");
+
}
}
}
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) ){");