From a96045d019bd1429afdfbc8312a341439607c2a9 Mon Sep 17 00:00:00 2001 From: yeom Date: Mon, 18 Jan 2010 19:56:23 +0000 Subject: [PATCH] changes. --- Robust/src/Analysis/MLP/ConflictGraph.java | 369 +++++++++++------- Robust/src/Analysis/MLP/LiveInNode.java | 8 +- Robust/src/Analysis/MLP/MLPAnalysis.java | 69 ++-- Robust/src/Analysis/MLP/SESEEffectsSet.java | 4 + .../OwnershipAnalysis/HeapRegionNode.java | 1 + Robust/src/IR/Flat/BuildCode.java | 21 +- 6 files changed, 294 insertions(+), 178 deletions(-) diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java index 138fe11e..ad9df31e 100644 --- a/Robust/src/Analysis/MLP/ConflictGraph.java +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -57,12 +57,13 @@ public class ConflictGraph { } private boolean hasSameReadEffects(ConflictNode nodeA, ConflictNode nodeB) { - + StallSiteNode stallSiteNode = null; LiveInNode liveInNode = null; - - if(nodeA instanceof StallSiteNode && nodeB instanceof StallSiteNode){ - return hasSameReadEffects((StallSiteNode)nodeA,(StallSiteNode)nodeB); + + if (nodeA instanceof StallSiteNode && nodeB instanceof StallSiteNode) { + return hasSameReadEffects((StallSiteNode) nodeA, + (StallSiteNode) nodeB); } if (nodeA instanceof StallSiteNode) { @@ -90,51 +91,56 @@ public class ConflictGraph { Set readSetA = linA.getReadEffectsSet(); Set readSetB = linB.getReadEffectsSet(); - boolean returnValue=true; + boolean returnValue = true; for (Iterator iterator = readSetA.iterator(); iterator.hasNext();) { SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator.next(); for (Iterator iterator2 = readSetB.iterator(); iterator2.hasNext();) { SESEEffectsKey opr = (SESEEffectsKey) iterator2.next(); - if (!(seseEffectsKey.getHRNUniqueId() - .equals(opr.getHRNUniqueId()) - && seseEffectsKey.getFieldDescriptor().equals( - opr.getFieldDescriptor()))) { - returnValue=false; + if (!(seseEffectsKey.getHRNUniqueId().equals( + opr.getHRNUniqueId()) && seseEffectsKey + .getFieldDescriptor().equals(opr.getFieldDescriptor()))) { + returnValue = false; } } } return returnValue; } - + private boolean hasSameReadEffects(StallSiteNode ssnA, StallSiteNode ssnB) { - + HashSet effectSetA = ssnA.getStallSite().getEffectSet(); HashSet nodeSetA = ssnA.getStallSite().getHRNSet(); HashSet effectSetB = ssnB.getStallSite().getEffectSet(); HashSet nodeSetB = ssnA.getStallSite().getHRNSet(); - boolean returnValue=true; - + boolean returnValue = true; + for (Iterator iteratorA = effectSetA.iterator(); iteratorA.hasNext();) { Effect effectKeyA = (Effect) iteratorA.next(); - for (Iterator iterator2A = nodeSetA.iterator(); iterator2A.hasNext();) { + for (Iterator iterator2A = nodeSetA.iterator(); iterator2A + .hasNext();) { HeapRegionNode hrnA = (HeapRegionNode) iterator2A.next(); - - for (Iterator iteratorB = effectSetB.iterator(); iteratorB.hasNext();) { + + for (Iterator iteratorB = effectSetB.iterator(); iteratorB + .hasNext();) { Effect effectKeyB = (Effect) iteratorB.next(); - for (Iterator iterator2B = nodeSetB.iterator(); iterator2B.hasNext();) { - HeapRegionNode hrnB = (HeapRegionNode) iterator2B.next(); - - if(!(hrnA.getGloballyUniqueIdentifier().equals(hrnB.getGloballyUniqueIdentifier()) && effectKeyA.getField().equals(effectKeyB.getField()))){ - returnValue=false; + for (Iterator iterator2B = nodeSetB.iterator(); iterator2B + .hasNext();) { + HeapRegionNode hrnB = (HeapRegionNode) iterator2B + .next(); + + if (!(hrnA.getGloballyUniqueIdentifier().equals( + hrnB.getGloballyUniqueIdentifier()) && effectKeyA + .getField().equals(effectKeyB.getField()))) { + returnValue = false; } } } - + } - + } - + return returnValue; } @@ -144,11 +150,11 @@ public class ConflictGraph { HashSet nodeSetA = ssnA.getStallSite().getHRNSet(); Set readSetB = linB.getReadEffectsSet(); - if(readSetB==null){ + if (readSetB == null) { return false; } - - boolean returnValue=true; + + boolean returnValue = true; for (Iterator iterator = effectSetA.iterator(); iterator.hasNext();) { Effect effectKey = (Effect) iterator.next(); @@ -161,10 +167,9 @@ public class ConflictGraph { .next(); if (!(seseEffectsKey.getHRNUniqueId().equals( - hrn.getGloballyUniqueIdentifier()) - && seseEffectsKey.getFieldDescriptor().equals( - effectKey.getField()))) { - returnValue=false; + hrn.getGloballyUniqueIdentifier()) && seseEffectsKey + .getFieldDescriptor().equals(effectKey.getField()))) { + returnValue = false; } } @@ -388,52 +393,81 @@ public class ConflictGraph { } + private boolean hasStrongUpdate(SESEEffectsKey writeEffect, + Set strongUpdateSet) { + + if(strongUpdateSet!=null){ + Iterator strongUpdateIter = strongUpdateSet.iterator(); + while (strongUpdateIter.hasNext()) { + SESEEffectsKey strongEffect = (SESEEffectsKey) strongUpdateIter + .next(); + + if (strongEffect.getHRNUniqueId().equals( + writeEffect.getHRNUniqueId()) + && strongEffect.getFieldDescriptor().equals( + writeEffect.getFieldDescriptor())) { + return true; + } + } + } + + return false; + } + private boolean isWriteConflicts(LiveInNode nodeA, LiveInNode nodeB) { Set readEffectsSetA = nodeA.getReadEffectsSet(); Set writeEffectsSetA = nodeA.getWriteEffectsSet(); + Set strongUpdateSetA = nodeA.getStrongUpdateSet(); + Set readEffectsSetB = nodeB.getReadEffectsSet(); Set writeEffectsSetB = nodeB.getWriteEffectsSet(); - + Set strongUpdateSetB = nodeB.getStrongUpdateSet(); + // if node A has write effects on reading/writing regions of node B if (writeEffectsSetA != null) { Iterator writeIterA = writeEffectsSetA.iterator(); while (writeIterA.hasNext()) { SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterA .next(); - String writeHeapRegionID = seseEffectsKey.getHRNUniqueId(); - String writeFieldName = seseEffectsKey.getFieldDescriptor(); - if (readEffectsSetB != null) { - Iterator readIterB = readEffectsSetB - .iterator(); - while (readIterB.hasNext()) { - SESEEffectsKey readingEffect = (SESEEffectsKey) readIterB - .next(); + if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetA)) { + + String writeHeapRegionID = seseEffectsKey.getHRNUniqueId(); + String writeFieldName = seseEffectsKey.getFieldDescriptor(); - if (readingEffect.getHRNUniqueId().equals( - writeHeapRegionID) - && readingEffect.getFieldDescriptor().equals( - writeFieldName)) { - return true; + if (readEffectsSetB != null) { + Iterator readIterB = readEffectsSetB + .iterator(); + while (readIterB.hasNext()) { + SESEEffectsKey readingEffect = (SESEEffectsKey) readIterB + .next(); + + if (readingEffect.getHRNUniqueId().equals( + writeHeapRegionID) + && readingEffect.getFieldDescriptor() + .equals(writeFieldName)) { + return true; + } } } - } - if (writeEffectsSetB != null) { - Iterator writeIterB = writeEffectsSetB - .iterator(); - while (writeIterB.hasNext()) { - SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterB - .next(); + if (writeEffectsSetB != null) { + Iterator writeIterB = writeEffectsSetB + .iterator(); + while (writeIterB.hasNext()) { + SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterB + .next(); - if (writingEffect.getHRNUniqueId().equals( - writeHeapRegionID) - && writingEffect.getFieldDescriptor().equals( - writeFieldName)) { - return true; + if (writingEffect.getHRNUniqueId().equals( + writeHeapRegionID) + && writingEffect.getFieldDescriptor() + .equals(writeFieldName)) { + return true; + } } } + } } @@ -445,35 +479,39 @@ public class ConflictGraph { while (writeIterB.hasNext()) { SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterB .next(); - String writeHeapRegionID = seseEffectsKey.getHRNUniqueId(); - String writeFieldName = seseEffectsKey.getFieldDescriptor(); - if (readEffectsSetA != null) { - Iterator readIterA = readEffectsSetA - .iterator(); - while (readIterA.hasNext()) { - SESEEffectsKey readingEffect = (SESEEffectsKey) readIterA - .next(); - if (readingEffect.getHRNUniqueId().equals( - writeHeapRegionID) - && readingEffect.getFieldDescriptor().equals( - writeFieldName)) { - return true; + if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetB)) { + + String writeHeapRegionID = seseEffectsKey.getHRNUniqueId(); + String writeFieldName = seseEffectsKey.getFieldDescriptor(); + + if (readEffectsSetA != null) { + Iterator readIterA = readEffectsSetA + .iterator(); + while (readIterA.hasNext()) { + SESEEffectsKey readingEffect = (SESEEffectsKey) readIterA + .next(); + if (readingEffect.getHRNUniqueId().equals( + writeHeapRegionID) + && readingEffect.getFieldDescriptor() + .equals(writeFieldName)) { + return true; + } } } - } - if (writeEffectsSetA != null) { - Iterator writeIterA = writeEffectsSetA - .iterator(); - while (writeIterA.hasNext()) { - SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterA - .next(); - if (writingEffect.getHRNUniqueId().equals( - writeHeapRegionID) - && writingEffect.getFieldDescriptor().equals( - writeFieldName)) { - return true; + if (writeEffectsSetA != null) { + Iterator writeIterA = writeEffectsSetA + .iterator(); + while (writeIterA.hasNext()) { + SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterA + .next(); + if (writingEffect.getHRNUniqueId().equals( + writeHeapRegionID) + && writingEffect.getFieldDescriptor() + .equals(writeFieldName)) { + return true; + } } } } @@ -483,6 +521,36 @@ public class ConflictGraph { return false; } + private boolean isSelfConflicted(LiveInNode liveInNode) { + + int strongUpdateCount = 0; + + if (liveInNode.getWriteEffectsSet() != null + && liveInNode.getWriteEffectsSet().size() > 0) { + + Set strongUpdateSet = liveInNode + .getStrongUpdateSet(); + + Iterator writeIter = liveInNode + .getWriteEffectsSet().iterator(); + while (writeIter.hasNext()) { + SESEEffectsKey writeEffect = (SESEEffectsKey) writeIter.next(); + if (hasStrongUpdate(writeEffect, strongUpdateSet)) { + strongUpdateCount++; + } + } + + if (liveInNode.getWriteEffectsSet().size() == strongUpdateCount) { + return false; + }else{ + return true; + } + + } + + return false; + } + public void analyzePossibleConflicts(Set analyzedIDSet, ConflictNode currentNode) { @@ -491,15 +559,17 @@ public class ConflictGraph { // examine the case where self-edge exists if (currentNode instanceof LiveInNode) { LiveInNode liveInNode = (LiveInNode) currentNode; - // Set writeSet=liveInNode.getWriteEffectsSet(); - - if (liveInNode.getWriteEffectsSet() != null - && liveInNode.getWriteEffectsSet().size() > 0) { +// if (liveInNode.getWriteEffectsSet() != null +// && liveInNode.getWriteEffectsSet().size() > 0) { +// addConflictEdge(ConflictEdge.FINE_GRAIN_EDGE, currentNode, +// currentNode); +// } + if(isSelfConflicted(liveInNode)){ addConflictEdge(ConflictEdge.FINE_GRAIN_EDGE, currentNode, currentNode); } + } - // Set> set = id2cn.entrySet(); for (Iterator iterator = set.iterator(); iterator.hasNext();) { @@ -619,13 +689,14 @@ public class ConflictGraph { public void addLiveInNode(TempDescriptor td, Set hrnSet, FlatSESEEnterNode fsen, Set readEffectsSet, - Set writeEffectsSet, Set reachabilitySet) { + Set writeEffectsSet, + Set strongUpdateSet, Set reachabilitySet) { String liveinNodeID = td + "_" + fsen.getIdentifier(); LiveInNode newNode = new LiveInNode(liveinNodeID, td, hrnSet, - readEffectsSet, writeEffectsSet, reachabilitySet, fsen - .getIdentifier()); + readEffectsSet, writeEffectsSet, strongUpdateSet, + reachabilitySet, fsen.getIdentifier()); id2cn.put(liveinNodeID, newNode); } @@ -653,13 +724,14 @@ public class ConflictGraph { return resultSet; } - - public Set getStallSiteWaitingElementSet(ParentChildConflictsMap conflictsMap, HashSet seseLockSet){ - + + public Set getStallSiteWaitingElementSet( + ParentChildConflictsMap conflictsMap, HashSet seseLockSet) { + HashSet waitingElementSet = new HashSet(); Set> s = id2cn.entrySet(); Collection stallSites = conflictsMap.getStallMap().values(); - + for (Iterator iterator = stallSites.iterator(); iterator.hasNext();) { StallSite stallSite = (StallSite) iterator.next(); @@ -677,10 +749,10 @@ public class ConflictGraph { .hasNext();) { ConflictEdge conflictEdge = (ConflictEdge) iter2 .next(); - - int type=-1; + + int type = -1; HashSet allocSet = new HashSet(); - + if (conflictEdge.getType() == ConflictEdge.COARSE_GRAIN_EDGE) { if (isReadOnly(node)) { type = 2; // coarse read @@ -693,38 +765,43 @@ public class ConflictGraph { allocSet.addAll(getAllocSet(conflictEdge .getVertexV())); - } else if(conflictEdge.getType() == ConflictEdge.FINE_GRAIN_EDGE){// it is fine-grain edge + } else if (conflictEdge.getType() == ConflictEdge.FINE_GRAIN_EDGE) {// it + // is + // fine-grain + // edge allocSet.addAll(getAllocSet(node)); if (isReadOnly(node)) { - //fine-grain read - type=0; + // fine-grain read + type = 0; } else { - //fine-grain write - type=1; + // fine-grain write + type = 1; } } - - if(type>-1){ - for (Iterator seseLockIter = seseLockSet.iterator(); seseLockIter.hasNext();) { - SESELock seseLock=seseLockIter.next(); - if(seseLock.containsConflictNode(stallSiteNode)){ - WaitingElement newElement=new WaitingElement(); - newElement.setAllocList(allocSet); - newElement.setWaitingID(seseLock.getID()); - newElement.setStatus(type); - waitingElementSet.add(newElement); - } - } + + if (type > -1) { + for (Iterator seseLockIter = seseLockSet + .iterator(); seseLockIter.hasNext();) { + SESELock seseLock = seseLockIter.next(); + if (seseLock + .containsConflictNode(stallSiteNode)) { + WaitingElement newElement = new WaitingElement(); + newElement.setAllocList(allocSet); + newElement.setWaitingID(seseLock + .getID()); + newElement.setStatus(type); + waitingElementSet.add(newElement); + } + } } } } } } - + } - - + return waitingElementSet; } @@ -853,7 +930,7 @@ public class ConflictGraph { HashSet seseLockSet) { HashSet waitingElementSet = new HashSet(); - + Set> s = id2cn.entrySet(); Iterator> i = s.iterator(); @@ -864,16 +941,16 @@ public class ConflictGraph { if (node instanceof LiveInNode) { LiveInNode liveInNode = (LiveInNode) node; if (liveInNode.getSESEIdentifier() == seseID) { - + HashSet edgeSet = liveInNode.getEdgeSet(); for (Iterator iterator = edgeSet.iterator(); iterator .hasNext();) { ConflictEdge conflictEdge = (ConflictEdge) iterator .next(); - int type=-1; + int type = -1; HashSet allocSet = new HashSet(); - + if (conflictEdge.getType() == ConflictEdge.COARSE_GRAIN_EDGE) { if (isReadOnly(node)) { type = 2; // coarse read @@ -886,29 +963,33 @@ public class ConflictGraph { allocSet.addAll(getAllocSet(conflictEdge .getVertexV())); - } else if(conflictEdge.getType() == ConflictEdge.FINE_GRAIN_EDGE){// it is fine-grain edge + } else if (conflictEdge.getType() == ConflictEdge.FINE_GRAIN_EDGE) {// it + // is + // fine-grain + // edge allocSet.addAll(getAllocSet(node)); if (isReadOnly(node)) { - //fine-grain read - type=0; + // fine-grain read + type = 0; } else { - //fine-grain write - type=1; + // fine-grain write + type = 1; } } - - if(type>-1){ - - for (Iterator seseLockIter = seseLockSet.iterator(); seseLockIter.hasNext();) { - SESELock seseLock=seseLockIter.next(); - if(seseLock.containsConflictNode(liveInNode)){ - WaitingElement newElement=new WaitingElement(); - newElement.setAllocList(allocSet); - newElement.setWaitingID(seseLock.getID()); - newElement.setStatus(type); - waitingElementSet.add(newElement); - } - } + + if (type > -1) { + + for (Iterator seseLockIter = seseLockSet + .iterator(); seseLockIter.hasNext();) { + SESELock seseLock = seseLockIter.next(); + if (seseLock.containsConflictNode(liveInNode)) { + WaitingElement newElement = new WaitingElement(); + newElement.setAllocList(allocSet); + newElement.setWaitingID(seseLock.getID()); + newElement.setStatus(type); + waitingElementSet.add(newElement); + } + } } } @@ -1024,7 +1105,9 @@ public class ConflictGraph { for (Iterator iterator = hrnSet.iterator(); iterator.hasNext();) { HeapRegionNode hrn = (HeapRegionNode) iterator.next(); // allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier()); - returnSet.add(new Integer(hrn.getAllocationSite().getID())); + if (hrn.getAllocationSite() != null) { + returnSet.add(new Integer(hrn.getAllocationSite().getID())); + } } } else { LiveInNode liveInNode = (LiveInNode) node; @@ -1032,7 +1115,9 @@ public class ConflictGraph { for (Iterator iterator = hrnSet.iterator(); iterator.hasNext();) { HeapRegionNode hrn = (HeapRegionNode) iterator.next(); // allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier()); - returnSet.add(new Integer(hrn.getAllocationSite().getID())); + if (hrn.getAllocationSite() != null) { + returnSet.add(new Integer(hrn.getAllocationSite().getID())); + } } } diff --git a/Robust/src/Analysis/MLP/LiveInNode.java b/Robust/src/Analysis/MLP/LiveInNode.java index 1923ce65..fc556c53 100644 --- a/Robust/src/Analysis/MLP/LiveInNode.java +++ b/Robust/src/Analysis/MLP/LiveInNode.java @@ -11,17 +11,19 @@ public class LiveInNode extends ConflictNode { Set readEffectsSet; Set writeEffectsSet; + Set strongUpdateSet; Set hrnSet; int seseID; public LiveInNode(String id, TempDescriptor td, Set hrnSet, Set readEffectsSet, - Set writeEffectsSet, Set reachabilitySet, int seseID) { + Set writeEffectsSet, Set strongUpdateSet, Set reachabilitySet, int seseID) { this.hrnSet = hrnSet; this.id = id; this.td = td; this.readEffectsSet = readEffectsSet; this.writeEffectsSet = writeEffectsSet; + this.strongUpdateSet=strongUpdateSet; this.reachabilitySet = reachabilitySet; this.seseID=seseID; } @@ -37,6 +39,10 @@ public class LiveInNode extends ConflictNode { public Set getWriteEffectsSet() { return writeEffectsSet; } + + public Set getStrongUpdateSet(){ + return strongUpdateSet; + } public void addReadEffectsSet(Set newReadEffectsSet) { if (newReadEffectsSet != null) { diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index b4ef4021..eb7e1c85 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -1539,9 +1539,16 @@ public class MLPAnalysis { while (referSetIter.hasNext()) { TempDescriptor tempDescriptor = (TempDescriptor) referSetIter .next(); - currentSESE.writeEffects(tempDescriptor, field - .getSymbol(), dst.getType(), accessHRN, - strongUpdate); + SESEEffectsSet effectSet=currentSESE.getSeseEffectsSet(); + ///// if write effects occurs through variable which was strongly updated, ignore it? + if(effectSet.getStrongUpdateSet(tempDescriptor)!=null && effectSet.getStrongUpdateSet(tempDescriptor).size()>0){ +// System.out.println("not write effect?"); + }else{ + currentSESE.writeEffects(tempDescriptor, field + .getSymbol(), dst.getType(), accessHRN, + strongUpdate); + } + ///// } // } } @@ -2117,32 +2124,35 @@ public class MLPAnalysis { // reachability set Set reachabilitySet = new HashSet(); LabelNode ln = og.td2ln.get(tempDescriptor); - Iterator refEdgeIter = ln.iteratorToReferencees(); - while (refEdgeIter.hasNext()) { - ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter.next(); - - ReachabilitySet set = referenceEdge.getBeta(); - Iterator ttsIter = set.iterator(); - while (ttsIter.hasNext()) { - TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter.next(); - - HashSet newTokenTupleSet = new HashSet(); - // reachabilitySet.add(tokenTupleSet); + if(ln!=null){ + Iterator refEdgeIter = ln.iteratorToReferencees(); + while (refEdgeIter.hasNext()) { + ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter.next(); + + ReachabilitySet set = referenceEdge.getBeta(); + Iterator ttsIter = set.iterator(); + while (ttsIter.hasNext()) { + TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter.next(); + + HashSet newTokenTupleSet = new HashSet(); + // reachabilitySet.add(tokenTupleSet); + + Iterator iter = tokenTupleSet.iterator(); + while (iter.hasNext()) { + TokenTuple tt = (TokenTuple) iter.next(); + int token = tt.getToken(); + String uniqueID = og.id2hrn.get(new Integer(token)) + .getGloballyUniqueIdentifier(); + GloballyUniqueTokenTuple gtt = new GloballyUniqueTokenTuple( + uniqueID, tt); + newTokenTupleSet.add(gtt); + } - Iterator iter = tokenTupleSet.iterator(); - while (iter.hasNext()) { - TokenTuple tt = (TokenTuple) iter.next(); - int token = tt.getToken(); - String uniqueID = og.id2hrn.get(new Integer(token)) - .getGloballyUniqueIdentifier(); - GloballyUniqueTokenTuple gtt = new GloballyUniqueTokenTuple( - uniqueID, tt); - newTokenTupleSet.add(gtt); + reachabilitySet.add(newTokenTupleSet); } - - reachabilitySet.add(newTokenTupleSet); } } + return reachabilitySet; } @@ -2174,13 +2184,18 @@ public class MLPAnalysis { TempDescriptor tempDescriptor = (TempDescriptor) iterator .next(); + if(tempDescriptor.getType().isImmutable()){ + continue; + } + // effects set SESEEffectsSet seseEffectsSet = fsen.getSeseEffectsSet(); Set readEffectsSet = seseEffectsSet .getReadingSet(tempDescriptor); Set writeEffectsSet = seseEffectsSet .getWritingSet(tempDescriptor); - + Set strongUpdateSet = seseEffectsSet.getStrongUpdateSet(tempDescriptor); + Set reachabilitySet = calculateReachabilitySet(og, tempDescriptor); @@ -2201,7 +2216,7 @@ public class MLPAnalysis { } conflictGraph.addLiveInNode(tempDescriptor, hrnSet, fsen, - readEffectsSet, writeEffectsSet, reachabilitySet); + readEffectsSet, writeEffectsSet, strongUpdateSet, reachabilitySet); } if(conflictGraph.id2cn.size()>0){ diff --git a/Robust/src/Analysis/MLP/SESEEffectsSet.java b/Robust/src/Analysis/MLP/SESEEffectsSet.java index be6500af..c03edfc7 100644 --- a/Robust/src/Analysis/MLP/SESEEffectsSet.java +++ b/Robust/src/Analysis/MLP/SESEEffectsSet.java @@ -94,6 +94,10 @@ public class SESEEffectsSet { public Set getWritingSet(TempDescriptor td) { return writeTable.get(td); } + + public Set getStrongUpdateSet(TempDescriptor td){ + return strongUpdateTable.get(td); + } public String printSet() { diff --git a/Robust/src/Analysis/OwnershipAnalysis/HeapRegionNode.java b/Robust/src/Analysis/OwnershipAnalysis/HeapRegionNode.java index 8c20871b..05994018 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/HeapRegionNode.java +++ b/Robust/src/Analysis/OwnershipAnalysis/HeapRegionNode.java @@ -241,6 +241,7 @@ public class HeapRegionNode extends OwnershipNode { endpart = endpart.replaceAll("S", "1"); endpart = endpart.replaceAll("P", "2"); endpart = endpart.replaceAll("A", "3"); + endpart = endpart.replace(".", ""); String modified = fristpart.substring(0, idx) + endpart; return Long.parseLong(modified); } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index ac52e6b6..b76043ff 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3416,8 +3416,7 @@ public class BuildCode { output.println(" WaitingElement* newElement=NULL;"); output.println(" struct Queue* list=NULL;"); output.println(" struct QueueItem* newQItem=NULL;"); - output - .println(" pthread_mutex_lock( &(parentCommon->lock) );"); + output.println(" pthread_mutex_lock( &(parentCommon->lock) );"); for (Iterator iterator = waitingQueueSet.iterator(); iterator .hasNext();) { WaitingElement waitingElement = (WaitingElement) iterator.next(); @@ -3449,8 +3448,8 @@ public class BuildCode { output.println(" /*decide whether it is runnable or not in regarding to memory conflicts*/"); output.println(" {"); - output.println(" pthread_mutex_lock( &(parentCommon->lock) );"); output.println(" if( !isEmpty(newWaitingItemQueue) ){"); + output.println(" pthread_mutex_lock( &(parentCommon->lock) );"); output.println(" int idx;"); output.println(" for(idx = 0 ; idx < numRelatedWaitingQueue ; idx++){"); output.println(" struct Queue *allocQueue=parentCommon->allocSiteArray[idx].waitingQueue;"); @@ -3462,9 +3461,9 @@ public class BuildCode { output.println(" }"); output.println(" nextQItem=getNextQueueItem(nextQItem);"); output.println(" }"); - output.println(" }"); - output.println(" }"); - output.println(" pthread_mutex_unlock( &(parentCommon->lock) );"); + output.println(" }"); + output.println(" }"); + output.println(" pthread_mutex_unlock( &(parentCommon->lock) );"); output.println(" }"); output.println(" }"); output.println(); @@ -3475,7 +3474,10 @@ public class BuildCode { // create it's lock and take it immediately output.println(" pthread_mutex_init( &(seseToIssue->common.lock), NULL );"); output.println(" pthread_mutex_lock( &(seseToIssue->common.lock) );"); - + // eom +// output.println(" pthread_mutex_init( &(seseToIssue->common.waitingQueueLock), NULL );"); + // + if( fsen != mlpa.getMainSESE() ) { // count up outstanding dependencies, static first, then dynamic Iterator staticSrcsItr = fsen.getStaticInVarSrcs().iterator(); @@ -3604,7 +3606,7 @@ public class BuildCode { } output.println(" /* SESE exiting */"); - + String com = paramsprefix+"->common"; // this SESE cannot be done until all of its children are done @@ -3663,6 +3665,7 @@ public class BuildCode { output.println(" pthread_mutex_unlock( &(consumer->lock) );"); output.println(" }"); + // eom // clean up its lock element from waiting queue, and decrement dependency count for next SESE block if( fsen != mlpa.getMainSESE() ) { @@ -3671,6 +3674,7 @@ public class BuildCode { output.println(" /* check memory dependency*/"); output.println(" {"); output.println(" pthread_mutex_lock( &(___params___->common.parent->lock) );"); +// output.println(" pthread_mutex_lock( &(___params___->common.parent->waitingQueueLock) );"); output.println(" int idx;"); output.println(" int giveCount=0;"); output.println(" struct Queue* launchQueue=createQueue();"); @@ -3726,6 +3730,7 @@ public class BuildCode { // output.println(" }"); output.println(" }"); output.println(" pthread_mutex_unlock( &(___params___->common.parent->lock) );"); +// output.println(" pthread_mutex_unlock( &(___params___->common.parent->waitingQueueLock) );"); output.println(" if(!isEmpty(launchQueue)){"); output.println(" struct QueueItem* qItem=getHead(launchQueue);"); output.println(" while(qItem!=NULL){"); -- 2.34.1