From a6bb945801a2f624802ff3e1a9cd5d44326ae0c5 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 26 Jun 2009 20:01:21 +0000 Subject: [PATCH] bug fixes --- .../Analysis/Locality/DelayComputation.java | 49 +++++++++++++------ .../Analysis/Locality/DiscoverConflicts.java | 8 +-- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/Robust/src/Analysis/Locality/DelayComputation.java b/Robust/src/Analysis/Locality/DelayComputation.java index 93b0489b..2bade8a1 100644 --- a/Robust/src/Analysis/Locality/DelayComputation.java +++ b/Robust/src/Analysis/Locality/DelayComputation.java @@ -41,8 +41,37 @@ public class DelayComputation { public void doAnalysis() { Set localityset=locality.getLocalityBindings(); - for(Iterator lb=localityset.iterator();lb.hasNext();) { - analyzeMethod(lb.next()); + for(Iterator lbit=localityset.iterator();lbit.hasNext();) { + analyzeMethod(lbit.next()); + } + + dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelaymap); + dcopts.doAnalysis(); + + + for(Iterator lbit=localityset.iterator();lbit.hasNext();) { + LocalityBinding lb=lbit.next(); + + MethodDescriptor md=lb.getMethod(); + FlatMethod fm=state.getMethodFlat(md); + if (lb.isAtomic()) + continue; + + if (lb.getHasAtomic()) { + HashSet cannotdelay=cannotdelaymap.get(lb); + HashSet notreadyset=computeNotReadySet(lb, cannotdelay); + HashSet otherset=new HashSet(); + otherset.addAll(fm.getNodeSet()); + otherset.removeAll(notreadyset); + otherset.removeAll(cannotdelay); + notreadymap.put(lb, notreadyset); + othermap.put(lb, otherset); + } + + //We now have: + //(1) Cannot delay set -- stuff that must be done before commit + //(2) Not ready set -- stuff that must wait until commit + //(3) everything else -- stuff that should be done before commit } } @@ -583,21 +612,13 @@ public class DelayComputation { for(int i=0;i notreadyset=computeNotReadySet(lb, cannotdelay); - HashSet otherset=new HashSet(); - otherset.addAll(fm.getNodeSet()); + if (lb.getHasAtomic()) { - otherset.removeAll(notreadyset); - otherset.removeAll(cannotdelay); - notreadymap.put(lb, notreadyset); cannotdelaymap.put(lb, cannotdelay); - othermap.put(lb, otherset); } - //We now have: - //(1) Cannot delay set -- stuff that must be done before commit - //(2) Not ready set -- stuff that must wait until commit - //(3) everything else -- stuff that should be done before commit + + } //end of method //Problems: @@ -612,8 +633,6 @@ public class DelayComputation { //(B). You read a field/element in the transactional set //(C). The source didn't have a transactional read on it - dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelay); - dcopts.doAnalysis(); MethodDescriptor md=lb.getMethod(); FlatMethod fm=state.getMethodFlat(md); Hashtable atomictable=locality.getAtomic(lb); diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java index f0acbd48..d8eaadcd 100644 --- a/Robust/src/Analysis/Locality/DiscoverConflicts.java +++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java @@ -23,7 +23,7 @@ public class DiscoverConflicts { Hashtable> leftsrcmap; Hashtable> rightsrcmap; TypeAnalysis typeanalysis; - HashSetcannotdelay; + Hashtable>cannotdelaymap; Hashtable>>> lbtofnmap; @@ -41,13 +41,13 @@ public class DiscoverConflicts { lbtofnmap=new Hashtable>>>(); } - public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, HashSet cannotdelay) { + public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, Hashtable> cannotdelaymap) { this.locality=locality; this.fields=new HashSet(); this.arrays=new HashSet(); this.state=state; this.typeanalysis=typeanalysis; - this.cannotdelay=cannotdelay; + this.cannotdelaymap=cannotdelaymap; transreadmap=new Hashtable>(); treadmap=new Hashtable>(); srcmap=new Hashtable>(); @@ -295,7 +295,7 @@ public class DiscoverConflicts { Hashtable atomictable=locality.getAtomic(lb); //Check whether this node matters for delayed computation - if (cannotdelay!=null&&!cannotdelay.contains(fn)) + if (cannotdelaymap!=null&&cannotdelaymap.contains(lb)&&!cannotdelaymap.get(lb).contains(fn)) continue; if (atomictable.get(fn).intValue()>0) { -- 2.34.1