From: bdemsky Date: Thu, 9 Apr 2009 06:38:16 +0000 (+0000) Subject: bug fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fb0d4e9a5e1e7620da99793360cdce8c8af6a506;p=IRC.git bug fixes --- diff --git a/Robust/src/Analysis/Locality/LocalityBinding.java b/Robust/src/Analysis/Locality/LocalityBinding.java index 132bdfb6..1a100c3b 100644 --- a/Robust/src/Analysis/Locality/LocalityBinding.java +++ b/Robust/src/Analysis/Locality/LocalityBinding.java @@ -84,7 +84,9 @@ public class LocalityBinding { st+="[conflict] "; } for(int i=0; i> table; Set hoisted; UseDef usedef; @@ -33,7 +33,7 @@ public class LoopInvariant { table=new Hashtable>(); hoisted=new HashSet(); usedef=new UseDef(fm); - posttree=new DomTree(fm,true); + domtree=new DomTree(fm,false); tounroll=new HashSet(); recurse(root); } @@ -78,8 +78,9 @@ public class LoopInvariant { fields.addAll(f); if (t!=null) types.addAll(t); - if (gft.containsAtomic(md)) + if (gft.containsAtomic(md)) { unsafe=true; + } } else if (fn.kind()==FKind.FlatSetFieldNode) { FlatSetFieldNode fsfn=(FlatSetFieldNode)fn; fields.add(fsfn.getField()); @@ -128,7 +129,7 @@ public class LoopInvariant { } } if (isLeaf) - tounroll.add(l); + tounroll.add(entrance); break; case FKind.FlatFieldNode: @@ -139,7 +140,7 @@ public class LoopInvariant { continue nextfn; } if (isLeaf) - tounroll.add(l); + tounroll.add(entrance); break; default: @@ -168,7 +169,7 @@ public class LoopInvariant { domset.add(incoming); FlatNode tmp=incoming; while(tmp!=entrance) { - tmp=posttree.idom(tmp); + tmp=domtree.idom(tmp); domset.add(tmp); } if (first) { @@ -202,4 +203,4 @@ public class LoopInvariant { } return false; } -} \ No newline at end of file +} diff --git a/Robust/src/Analysis/Loops/LoopOptimize.java b/Robust/src/Analysis/Loops/LoopOptimize.java index 84eeffc1..2d6f2e32 100644 --- a/Robust/src/Analysis/Loops/LoopOptimize.java +++ b/Robust/src/Analysis/Loops/LoopOptimize.java @@ -30,7 +30,10 @@ public class LoopOptimize { } } public void processLoop(Loops l) { - if (loopinv.tounroll.contains(l)) { + Set entrances=l.loopEntrances(); + assert entrances.size()==1; + FlatNode entrance=(FlatNode)entrances.iterator().next(); + if (loopinv.tounroll.contains(entrance)) { unrollLoop(l); } else { hoistOps(l); @@ -124,6 +127,25 @@ public class LoopOptimize { copytable.put(fn, copy); copyendtable.put(fn, copyend); } + /* Splice header in */ + + FlatNode[] prevarray=new FlatNode[entrance.numPrev()]; + FlatNode first=copytable.get(entrance); + for(int i=0;i tmp1${MAINCLASS}.java diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 0a9c17bf..0cc7d088 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -309,6 +309,9 @@ public class BuildCode { outmethod.println("printf(\"nRemoteReadSend= %d\\n\", nRemoteSend);"); outmethod.println("printf(\"bytesSent= %d\\n\", bytesSent);"); outmethod.println("printf(\"bytesRecv= %d\\n\", bytesRecv);"); + } else if (state.SINGLETM) { + outmethod.println("printf(\"nSoftAbortAbort= %d\\n\", nSoftAbortAbort);"); + outmethod.println("printf(\"nSoftAbortCommit= %d\\n\", nSoftAbortCommit);"); } outmethod.println("#endif\n"); } @@ -791,6 +794,9 @@ public class BuildCode { outclassdefs.print("extern int bytesSent;\n"); outclassdefs.print("extern int bytesRecv;\n"); outclassdefs.print("extern void handle();\n"); + } else if (state.SINGLETM) { + outclassdefs.println("extern int nSoftAbortAbort;"); + outclassdefs.println("extern int nSoftAbortCommit;"); } outclassdefs.print("#endif\n"); outclassdefs.print("int numprefetchsites = " + pa.prefetchsiteid + ";\n"); diff --git a/Robust/src/IR/Flat/FlatBackEdge.java b/Robust/src/IR/Flat/FlatBackEdge.java index e6905cfe..b300ff1e 100644 --- a/Robust/src/IR/Flat/FlatBackEdge.java +++ b/Robust/src/IR/Flat/FlatBackEdge.java @@ -11,6 +11,9 @@ public class FlatBackEdge extends FlatNode { public String toString() { return "backedge"; } + public FlatNode clone(TempMap t) { + return new FlatBackEdge(); + } public int kind() { return FKind.FlatBackEdge; diff --git a/Robust/src/IR/Flat/FlatNode.java b/Robust/src/IR/Flat/FlatNode.java index 7f82c2d7..bc3063c8 100644 --- a/Robust/src/IR/Flat/FlatNode.java +++ b/Robust/src/IR/Flat/FlatNode.java @@ -41,6 +41,13 @@ public class FlatNode { n.addPrev(this); } /** This function modifies the graph */ + public void setNewNext(int i, FlatNode n) { + if (next.size()<=i) + next.setSize(i+1); + next.set(i, n); + n.addPrev(this); + } + /** This function modifies the graph */ public void setprev(int i, FlatNode n) { prev.set(i, n); } @@ -61,7 +68,7 @@ public class FlatNode { return new TempDescriptor[0]; } public FlatNode clone(TempMap t) { - throw new Error(); + throw new Error("no clone method for"+this); } public void rewriteUse(TempMap t) { diff --git a/Robust/src/IR/Flat/TempObject.java b/Robust/src/IR/Flat/TempObject.java index 01589158..2da66d68 100644 --- a/Robust/src/IR/Flat/TempObject.java +++ b/Robust/src/IR/Flat/TempObject.java @@ -64,6 +64,8 @@ public class TempObject { public boolean isLocalPrim(TempDescriptor t) { if (!params.containsTemp(t)) { Position p=(Position)temptostore.get(t); + if (p==null) + System.out.println(t); return !p.inStruct; } return false; diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index 875fa9de..bb312b5e 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -22,7 +22,7 @@ #define NUMPTRS 100 -#define INITIALHEAPSIZE 16*1024*1024 +#define INITIALHEAPSIZE 64*1024*1024 #define GCPOINT(x) ((int)((x)*0.95)) /* This define takes in how full the heap is initially and returns a new heap size to use */ #define HEAPSIZE(x,y) ((int)(x+y))*2 @@ -655,12 +655,20 @@ void * mygcmalloc(struct garbagelist * stackptr, int size) { if (curr_heapbase==0) { /* Need to allocate base heap */ curr_heapbase=malloc(INITIALHEAPSIZE); + if (curr_heapbase==NULL) { + printf("malloc failed\n"); + exit(-1); + } bzero(curr_heapbase, INITIALHEAPSIZE); curr_heaptop=curr_heapbase+INITIALHEAPSIZE; curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(INITIALHEAPSIZE); curr_heapptr=curr_heapbase+size; to_heapbase=malloc(INITIALHEAPSIZE); + if (to_heapbase==NULL) { + printf("malloc failed\n"); + exit(-1); + } to_heaptop=to_heapbase+INITIALHEAPSIZE; to_heapptr=to_heapbase; ptr=curr_heapbase; diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c index 01955417..ca659d9d 100644 --- a/Robust/src/Runtime/thread.c +++ b/Robust/src/Runtime/thread.c @@ -105,6 +105,9 @@ void initializethreads() { sigaction(SIGSEGV,&sig,0); sigaction(SIGFPE,&sig,0); signal(SIGPIPE, SIG_IGN); +#ifdef STM + newobjs=calloc(1, sizeof(struct objlist)); +#endif } #if defined(THREADS)||defined(STM)