st+="[conflict] ";
}
for(int i=0; i<isglobal.length; i++)
- if (isglobal[i].equals(LocalityAnalysis.LOCAL))
+ if (isglobal[i]==null)
+ st+="NULL";
+ else if (isglobal[i].equals(LocalityAnalysis.LOCAL))
st+="local ";
else if (isglobal[i].equals(LocalityAnalysis.GLOBAL))
st+="global ";
}
GlobalFieldType gft;
LoopFinder loops;
- DomTree posttree;
+ DomTree domtree;
Hashtable<FlatNode, Vector<FlatNode>> table;
Set<FlatNode> hoisted;
UseDef usedef;
table=new Hashtable<FlatNode, Vector<FlatNode>>();
hoisted=new HashSet<FlatNode>();
usedef=new UseDef(fm);
- posttree=new DomTree(fm,true);
+ domtree=new DomTree(fm,false);
tounroll=new HashSet();
recurse(root);
}
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());
}
}
if (isLeaf)
- tounroll.add(l);
+ tounroll.add(entrance);
break;
case FKind.FlatFieldNode:
continue nextfn;
}
if (isLeaf)
- tounroll.add(l);
+ tounroll.add(entrance);
break;
default:
domset.add(incoming);
FlatNode tmp=incoming;
while(tmp!=entrance) {
- tmp=posttree.idom(tmp);
+ tmp=domtree.idom(tmp);
domset.add(tmp);
}
if (first) {
}
return false;
}
-}
\ No newline at end of file
+}
}
}
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);
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<entrance.numPrev();i++) {
+ prevarray[i]=entrance.getPrev(i);
+ }
+ for(int i=0;i<prevarray.length;i++) {
+ FlatNode prev=prevarray[i];
+
+ if (!lelements.contains(prev)) {
+ //need to fix this edge
+ for(int j=0;j<prev.numNext();j++) {
+ if (prev.getNext(j)==entrance)
+ prev.setNext(j, first);
+ }
+ }
+ }
+
/* Copy the edges */
for(Iterator it=lelements.iterator();it.hasNext();) {
FlatNode fn=(FlatNode)it.next();
FlatNode nnext=fn.getNext(i);
if (nnext==entrance) {
/* Back to loop header...point to old graph */
- copyend.addNext(nnext);
+ copyend.setNewNext(i,nnext);
} else if (lelements.contains(nnext)) {
/* In graph...point to first graph */
- copyend.addNext(copytable.get(nnext));
+ copyend.setNewNext(i,copytable.get(nnext));
} else {
/* Outside loop */
/* Just goto same place as before */
- copyend.addNext(nnext);
+ copyend.setNewNext(i,nnext);
}
}
}
+
/* Splice out loop invariant stuff */
for(Iterator it=lelements.iterator();it.hasNext();) {
FlatNode fn=(FlatNode)it.next();
if (tohoist.contains(fn)) {
TempDescriptor[] writes=fn.writesTemps();
TempDescriptor tmp=writes[0];
- FlatOpNode fon=new FlatOpNode(temptable.get(fn),tmp, null, new Operation(Operation.ASSIGN));
+ FlatOpNode fon=new FlatOpNode(tmp, temptable.get(fn), null, new Operation(Operation.ASSIGN));
fn.replace(fon);
}
}
/* Barrier Server waits for messages */
boolean waitforthreaddone = true;
while(waitforthreaddone) {
- if(mybarr.done)
- waitforthreaddone = false;
+ atomic {
+ if(mybarr.done)
+ waitforthreaddone = false;
+ }
}
/* Start threads */
Node.java \
AStarPathFinder.java
-FLAGS=-singleTM -nooptimize -mainclass ${MAINCLASS} -debug -transstats -joptimize
+FLAGS=-singleTM -optimize -mainclass ${MAINCLASS} -debug -transstats -joptimize
default:
cpp ${MAINCLASS}.java > tmp1${MAINCLASS}.java
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");
}
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");
public String toString() {
return "backedge";
}
+ public FlatNode clone(TempMap t) {
+ return new FlatBackEdge();
+ }
public int kind() {
return FKind.FlatBackEdge;
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);
}
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) {
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;
#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
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;
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)