From 0780b952d15ec1698ce563ce0a4f2c6732ff0bb6 Mon Sep 17 00:00:00 2001 From: yeom Date: Fri, 8 Jan 2010 02:37:08 +0000 Subject: [PATCH] changes. --- Robust/src/Analysis/MLP/ConflictGraph.java | 40 +---- Robust/src/Analysis/MLP/MLPAnalysis.java | 181 +++++++++------------ Robust/src/IR/Flat/BuildCode.java | 78 +++++---- 3 files changed, 119 insertions(+), 180 deletions(-) diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java index 512732a1..fd5e0d69 100644 --- a/Robust/src/Analysis/MLP/ConflictGraph.java +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -76,25 +76,6 @@ public class ConflictGraph { } - // add for another case - if (readEffectsSet != null) { - Iterator readIter = readEffectsSet.iterator(); - while (readIter.hasNext()) { - SESEEffectsKey seseEffectsKey = (SESEEffectsKey) readIter - .next(); - String readHeapRegionID = seseEffectsKey.getHRNUniqueId(); - HashSet 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 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; diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 76f0069b..81aa04c9 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -2440,57 +2440,42 @@ public class MLPAnalysis { } if (isAfterChildSESE) { - - HashSet srcTempSet = getTempDescSetReferenceToSameHRN( - og, src); - for (Iterator iterator = srcTempSet.iterator(); iterator - .hasNext();) { - TempDescriptor possibleSrc = (TempDescriptor) iterator - .next(); - if (!currentConflictsMap.isAccessible(possibleSrc)) { - HashSet 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 visitedHRN = new HashSet(); - visitedHRN.add(hrn); - setupRelatedAllocSiteAnalysis(og, mc, hrn, - visitedHRN); - } else { - flagAllocationSite(mc, hrn.getAllocationSite()); - } + + if (!currentConflictsMap.isAccessible(src)) { + HashSet 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 visitedHRN = new HashSet(); + 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 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 srcTempSet = getTempDescSetReferenceToSameHRN( - og, src); - for (Iterator iterator = srcTempSet.iterator(); iterator - .hasNext();) { - TempDescriptor possibleSrc = (TempDescriptor) iterator - .next(); - if (!currentConflictsMap.isAccessible(possibleSrc)) { - HashSet 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 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 visitedHRN = new HashSet(); - 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 visitedHRN = new HashSet(); + visitedHRN.add(hrn); + setupRelatedAllocSiteAnalysis(og, mc, hrn, + visitedHRN); + } else { + flagAllocationSite(mc, hrn.getAllocationSite()); } } - currentConflictsMap.addAccessibleVar(possibleSrc); + } + currentConflictsMap.addAccessibleVar(src); - HashSet dstTempSet = getTempDescSetReferenceToSameHRN( - og, dst); - for (Iterator iterator = dstTempSet.iterator(); iterator - .hasNext();) { - TempDescriptor possibleDst = (TempDescriptor) iterator - .next(); - if (!currentConflictsMap.isAccessible(possibleDst)) { - HashSet refHRN = getReferenceHeapIDSet( - og, possibleDst); - currentConflictsMap.addStallSite(possibleDst, refHRN, - new StallTag(fn)); + if (!currentConflictsMap.isAccessible(dst)) { + HashSet 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 visitedHRN = new HashSet(); - 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 visitedHRN = new HashSet(); + 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 edges = getRefEdgeSetReferenceToSameHRN( og, dst); diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index df5f82f5..34f1e7bb 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2711,7 +2711,7 @@ public class BuildCode { Set allocSet = conflictsMap .getAllocationSiteIDSetofStallSite(); - + if (allocSet.size() > 0) { FlatNode enclosingFlatNode=null; @@ -2723,43 +2723,47 @@ public class BuildCode { ConflictGraph graph=mlpa.getConflictGraphResults().get(enclosingFlatNode); Set 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) ){"); -- 2.34.1