From: bdemsky Date: Sat, 26 Sep 2009 03:00:13 +0000 (+0000) Subject: major bug fix X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a98e3fa91d0d5e20e14bbe819bfaff72dc4290ff;p=IRC.git major bug fix --- diff --git a/Robust/src/Analysis/Prefetch/LoopExit.java b/Robust/src/Analysis/Prefetch/LoopExit.java index 498f2a80..7769b48f 100644 --- a/Robust/src/Analysis/Prefetch/LoopExit.java +++ b/Robust/src/Analysis/Prefetch/LoopExit.java @@ -63,9 +63,10 @@ public class LoopExit { void propagateset(Set tovisit, Hashtable> table, FlatNode fn, FlatNode fnnext, FlatCondBranch fcb) { boolean enqueuechange=false; + if (!table.containsKey(fnnext)) + table.put(fnnext, new HashSet()); + if (table.containsKey(fn)) { - if (!table.containsKey(fnnext)) - table.put(fnnext, new HashSet()); HashSet toadd=new HashSet(); toadd.addAll(table.get(fn)); if (toadd.contains(fnnext)) //can't propagate back to node @@ -75,16 +76,11 @@ public class LoopExit { enqueuechange=true; } } - if (fcb!=null) { - if (!table.containsKey(fnnext)) - table.put(fnnext, new HashSet()); - if (!table.get(fnnext).contains(fcb)) { - table.get(fnnext).add(fcb); - enqueuechange=true; - } + if (fcb!=null&&!table.get(fnnext).contains(fcb)) { + table.get(fnnext).add(fcb); + enqueuechange=true; } if (enqueuechange) tovisit.add(fnnext); } - } diff --git a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java b/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java index 78a6faf2..f16f8754 100644 --- a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java +++ b/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java @@ -73,8 +73,9 @@ public class PrefetchAnalysis { tovisit = fm.getNodeSet(); while(!tovisit.isEmpty()) { FlatNode fn = (FlatNode)tovisit.iterator().next(); - doChildNodeAnalysis(fm.getMethod(),fn); tovisit.remove(fn); + + doChildNodeAnalysis(fm.getMethod(),fn); } } @@ -696,10 +697,10 @@ public class PrefetchAnalysis { newprob currhash = (Hashtable) prefetch_hash.get(fn); for(Enumeration pphash= currhash.keys(); pphash.hasMoreElements();) { PrefetchPair pp = (PrefetchPair) pphash.nextElement(); - System.out.print(pp.toString() + ", "); + double v=currhash.get(pp).doubleValue(); + if (v>.2) + System.out.print(pp.toString() +"-"+v + ", "); } System.out.println(")"); } else { @@ -786,28 +789,20 @@ nexttemp: private void doInsPrefetchAnalysis(FlatMethod fm, Hashtable> newprefetchset) { Hashtable> pset1_hash = new Hashtable>(); - HashSet pset1_init = new HashSet(); - LinkedList newtovisit = new LinkedList(); - LinkedList newvisited = new LinkedList(); - - newtovisit.addLast((FlatNode)fm); - while(!newtovisit.isEmpty()) { - FlatNode fn = (FlatNode) newtovisit.iterator().next(); - newtovisit.remove(0); - pset1_hash.put(fn, pset1_init); //Initialize pset1_hash - newvisited.addLast(fn); - for(int i=0; i()); } + Set tovisit=fm.getNodeSet(); /* Start with a top down sorted order of nodes */ - while(!newvisited.isEmpty()) { - applyPrefetchInsertRules((FlatNode) newvisited.getFirst(), newvisited, pset1_hash, newprefetchset); - newvisited.remove(0); + while(!tovisit.isEmpty()) { + FlatNode fn=(FlatNode)tovisit.iterator().next(); + tovisit.remove(fn); + applyPrefetchInsertRules(fn, tovisit, pset1_hash, newprefetchset); } delSubsetPPairs(newprefetchset); } @@ -892,7 +887,7 @@ nexttemp: * this function creates pset1 such that it contains prefetch pairs that have been prefetched at * the previous nodes */ - private void applyPrefetchInsertRules(FlatNode fn, LinkedList newvisited, Hashtable> pset1_hash, Hashtable> newprefetchset) { + private void applyPrefetchInsertRules(FlatNode fn, Set tovisit, Hashtable> pset1_hash, Hashtable> newprefetchset) { if(fn.kind() == FKind.FlatMethod) { HashSet pset1 = new HashSet(); Hashtable prefetchset = prefetch_hash.get(fn); @@ -907,7 +902,7 @@ nexttemp: if (comparePSet1(pset1_hash.get(fn), pset1)) { for(int j=0; j pset1 = new HashSet(); pset1.addAll(pset2); pset1.addAll(newpset); + /* Enqueue child node if Pset1 has changed */ if (comparePSet1(pset1_hash.get(fn), pset1)) { for(int i=0; i> newprefetchset) { - boolean isFNPresent = false; /* Detects presence of FlatNew node */ /* This modifies the Flat representation graph */ for(Enumeration e = newprefetchset.keys(); e.hasMoreElements();) { FlatNode fn = (FlatNode) e.nextElement(); @@ -992,24 +987,16 @@ nexttemp: /* Check if previous node of this FlatNode is a NEW node * If yes, delete this flatnode and its prefetch set from hash table * This eliminates prefetches for NULL ptrs*/ - for(int i = 0; i< fn.numPrev(); i++) { - FlatNode nn = fn.getPrev(i); - if(nn.kind() == FKind.FlatNew) { - isFNPresent = true; - } - } - if(!isFNPresent) { - while(fn.numPrev() > 0) { - FlatNode nn = fn.getPrev(0); - for(int j = 0; j 0) { + FlatNode nn = fn.getPrev(0); + for(int j = 0; j