toprocess.remove(fn);
boolean isatomic=atomictab.get(fn).intValue()>0;
- Hashtable<TempDescriptor, Integer> nodetemptab=state.DSM?temptab.get(fn):null;
+ Hashtable<TempDescriptor, Integer> nodetemptab=temptab.get(fn);
List<TempDescriptor> reads=Arrays.asList(fn.readsTemps());
List<TempDescriptor> writes=Arrays.asList(fn.writesTemps());
for(Iterator<TempDescriptor> writeit=writes.iterator(); writeit.hasNext();) {
TempDescriptor wrtmp=writeit.next();
if (state.SINGLETM) {
- if (wrtmp.getType().isPtr()) {
+ if (wrtmp.getType().isPtr()&&
+ (nodetemptab.get(wrtmp)!=LocalityAnalysis.SCRATCH)) {
TempNodePair tnp=new TempNodePair(wrtmp);
tempset.add(tnp);
}
TempDescriptor tmpd=tempit.next();
FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tmpd, lb, false, nodetoconvs.get(fn).contains(tmpd));
atomictab.put(fgcn, atomictab.get(fn));
- if (state.DSM)
- temptab.put(fgcn, (Hashtable<TempDescriptor, Integer>)temptab.get(fn).clone());
+ temptab.put(fgcn, (Hashtable<TempDescriptor, Integer>)temptab.get(fn).clone());
FlatNode[] prevarray=new FlatNode[fn.numPrev()];
for(int i=0; i<fn.numPrev(); i++) {
//subtract out the ones we write to
transtemps.removeAll(Arrays.asList(fn.writesTemps()));
//add in the globals we read from
+ Hashtable<TempDescriptor, Integer> pretemptab=locality.getNodePreTempInfo(lb, fn);
if (state.SINGLETM) {
TempDescriptor [] readtemps=fn.readsTemps();
for(int i=0; i<readtemps.length; i++) {
TempDescriptor tmp=readtemps[i];
- if (tmp.getType().isPtr()) {
+ if (tmp.getType().isPtr()&&
+ pretemptab.get(tmp).intValue()!=LocalityAnalysis.SCRATCH) {
transtemps.add(tmp);
}
}
} else {
- Hashtable<TempDescriptor, Integer> pretemptab=locality.getNodePreTempInfo(lb, fn);
TempDescriptor [] readtemps=fn.readsTemps();
for(int i=0; i<readtemps.length; i++) {
TempDescriptor tmp=readtemps[i];
for(Iterator<TempDescriptor> tempit=tempset.iterator(); tempit.hasNext();) {
FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, true);
atomictab.put(fgcn, atomictab.get(fn));
- if (state.DSM) {
- temptab.put(fgcn, (Hashtable<TempDescriptor, Integer>)temptab.get(fn).clone());
- }
+ temptab.put(fgcn, (Hashtable<TempDescriptor, Integer>)temptab.get(fn).clone());
fgcn.addNext(fn.getNext(0));
fn.setNext(0, fgcn);
}
break;
case FKind.FlatCall:
- processCallNodeSTM(lb, (FlatCall)fn, isAtomic(atomictable, fn), currtable);
+ processCallNodeSTM(lb, (FlatCall)fn, isAtomic(atomictable, fn), currtable, temptable.get(fn));
break;
case FKind.FlatNew:
default:
throw new Error("In finding fn.kind()= " + fn.kind());
}
+
Hashtable<TempDescriptor,Integer> oldtable=temptable.get(fn);
if (oldtable==null||!oldtable.equals(currtable)) {
// Update table for this node
currtable.put(fn.getDst(), NORMAL);
}
- void processCallNodeSTM(LocalityBinding currlb, FlatCall fc, boolean isatomic, Hashtable<TempDescriptor, Integer> currtable) {
+ void processCallNodeSTM(LocalityBinding currlb, FlatCall fc, boolean isatomic, Hashtable<TempDescriptor, Integer> currtable, Hashtable<TempDescriptor, Integer> oldtable) {
MethodDescriptor nodemd=fc.getMethod();
Set methodset=null;
Set runmethodset=null;
}
Integer currreturnval=STMEITHER; //Start off with the either value
+ if (oldtable!=null&&fc.getReturnTemp()!=null&&
+ oldtable.get(fc.getReturnTemp())!=null) {
+ //ensure termination
+ currreturnval=mergestm(currreturnval, oldtable.get(fc.getReturnTemp()));
+ }
+
for(Iterator methodit=methodset.iterator(); methodit.hasNext();) {
MethodDescriptor md=(MethodDescriptor) methodit.next();
// start transaction
boolean done = false;
//synchronized(gridLock) {
- done = connect(q.x1, q.y1, q.x2, q.y2, q.nn, tempg, grid);
+ done = connect(q.x1, q.y1, q.x2, q.y2, q.nn, tempg, grid);
if(DEBUG && done) {
debugQueue.next = debugQueue.enQueue(q);
}
// Taking the copy is not really a computational(time) overhead because
// it avoids the grid 'reset' phase
// needed if we do the expansion in place.
+ //int [][][]tempg=new int[GRID_SIZE][GRID_SIZE][2];
for (int x = 0; x < GRID_SIZE; x++) {
for (int y = 0; y < GRID_SIZE; y++) {
for (int z = 0; z < 2; z++)
//TODO remove after debugging
//Large Grid size
System.out.println("Starting main.......\n");
- LeeRouter lr = new LeeRouter(filename, false, true, false);
+ LeeRouter lr = new LeeRouter(filename, false, false, false);
//Small grid size
//LeeRouter lr = new LeeRouter(filename, true, true, false);
LeeRouter lt;
WorkQueue t;
boolean done;
- int[][][] tempg;
+ // int[][][] tempg;
/*
protected static ThreadLocal<ThreadState> _threadState = new ThreadLocal<ThreadState>() {
totalLaidTracks=0;
myLaidTracks=0;
done = true;
-
this.lt = lt;
- tempg = new int[lt.GRID_SIZE][lt.GRID_SIZE][2]; // Lee 2D Grid copy
}
public void run() {
+ int [][][] tempg = scratch new int[lt.GRID_SIZE][lt.GRID_SIZE][2]; // Lee 2D Grid copy
+
while (!finished && !stop) {
if(sampleNow) {
//collectMyStatistics();
sampleNow = false;
}
if(done) {
- atomic {
+ atomic {
t = lt.getNextTrack();
done = false;
}
//collectStatistics(_threadState.get());
break;
} else {
- atomic {
+ atomic {
//System.out.println("Laying track "+t.nn);
- lt.layNextTrack(t, tempg);
+ lt.layNextTrack(t, tempg);
done = true;
}
//updateStatistics();
GridCell.java \
LeeThread.java \
WorkQueue.java
-FLAGS=-singleTM -optimize -mainclass ${MAINCLASS} -joptimize -debug -garbagestats -transstats
+FLAGS=-mainclass ${MAINCLASS} -joptimize -debug -singleTM -optimize -dcopts -abcclose -transstats -profile
default:
../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
output.println(dst+"="+ src +"->"+field+ ";");
if (ffn.getField().getType().isPtr()&&locality.getAtomic(lb).get(ffn).intValue()>0&&
- ((dc==null)||dc.getNeedTrans(lb, ffn))) {
+ ((dc==null)||dc.getNeedTrans(lb, ffn))&&
+ locality.getNodePreTempInfo(lb, ffn).get(ffn.getSrc())!=LocalityAnalysis.SCRATCH) {
output.println("TRANSREAD("+dst+", "+dst+");");
}
} else if (state.DSM) {
String dst=generateTemp(fm,fsfn.getDst(),lb);
if (srcptr&&!fsfn.getSrc().getType().isNull()) {
output.println("{");
- if ((dc==null)||dc.getNeedSrcTrans(lb, fsfn)) {
+ if ((dc==null)||dc.getNeedSrcTrans(lb, fsfn)&&
+ locality.getNodePreTempInfo(lb, fsfn).get(fsfn.getSrc())!=LocalityAnalysis.SCRATCH) {
output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);");
} else {
output.println("INTPTR srcoid=(INTPTR)"+src+";");
}
}
- if (wb.needBarrier(fsfn))
+ if (wb.needBarrier(fsfn)&&
+ locality.getNodePreTempInfo(lb, fsfn).get(fsfn.getDst())!=LocalityAnalysis.SCRATCH) {
output.println("*((unsigned int *)&("+dst+"->___objstatus___))|=DIRTY;");
+ }
if (srcptr&!fsfn.getSrc().getType().isNull()) {
output.println("*((unsigned INTPTR *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;");
output.println("}");
output.println(dst +"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];");
if (elementtype.isPtr()&&locality.getAtomic(lb).get(fen).intValue()>0&&
- ((dc==null)||dc.getNeedTrans(lb, fen))) {
+ ((dc==null)||dc.getNeedTrans(lb, fen))&&
+ locality.getNodePreTempInfo(lb, fen).get(fen.getSrc())!=LocalityAnalysis.SCRATCH) {
output.println("TRANSREAD("+dst+", "+dst+");");
}
} else if (state.DSM) {
if (state.SINGLETM && locality.getAtomic(lb).get(fsen).intValue()>0) {
//Transaction set element case
- if (wb.needBarrier(fsen))
+ if (wb.needBarrier(fsen)&&
+ locality.getNodePreTempInfo(lb, fsen).get(fsen.getDst())!=LocalityAnalysis.SCRATCH) {
output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___objstatus___))|=DIRTY;");
+ }
if (fsen.getSrc().getType().isPtr()&&!fsen.getSrc().getType().isNull()) {
output.println("{");
String src=generateTemp(fm, fsen.getSrc(), lb);
- if ((dc==null)||dc.getNeedSrcTrans(lb, fsen)) {
+ if ((dc==null)||dc.getNeedSrcTrans(lb, fsen)&&
+ locality.getNodePreTempInfo(lb, fsen).get(fsen.getSrc())!=LocalityAnalysis.SCRATCH) {
output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);");
} else {
output.println("INTPTR srcoid=(INTPTR)"+src+";");
TypeDescriptor td=parseTypeDescriptor(pn);
Vector args=parseArgumentList(pn);
- boolean isglobal=pn.getChild("global")!=null;
+ boolean isglobal=pn.getChild("global")!=null||
+ pn.getChild("scratch")!=null;
String disjointId=null;
if( pn.getChild("disjoint") != null) {
disjointId = pn.getChild("disjoint").getTerminal();
return con;
} else if (isNode(pn,"createarray")) {
//System.out.println(pn.PPrint(3,true));
- boolean isglobal=pn.getChild("global")!=null;
+ boolean isglobal=pn.getChild("global")!=null||
+ pn.getChild("scratch")!=null;
String disjointId=null;
if( pn.getChild("disjoint") != null) {
disjointId = pn.getChild("disjoint").getTerminal();
//Keywords for transactions
key_table.put("atomic", new Integer(Sym.ATOMIC));
key_table.put("global", new Integer(Sym.GLOBAL));
+ key_table.put("scratch", new Integer(Sym.SCRATCH));
//Keywords for hacking prefetch calls in java
key_table.put("getoffset", new Integer(Sym.GETOFFSET));
//Keywords for disjointness in Java
"isavailable",
"long",
"native", "new", "optional", "package", "private", "protected", "public",
- "return", "sese", "short", "static", "strictfp", "super", "switch", "synchronized",
+ "return", "scratch", "sese", "short", "static", "strictfp", "super", "switch", "synchronized",
"tag", "task", "taskexit", //keywords for failure aware computation
"this", "throw", "throws", "transient", "try", "void",
"volatile", "while"
//distributed transaction keywords
terminal ATOMIC;
terminal GLOBAL;
+terminal SCRATCH;
terminal GETOFFSET;
non terminal ParseNode atomic_statement;
non terminal ParseNode getoffset_expression;
pn.addChild("body").addChild(body);
RESULT=pn;
:}
- ;
+;
+
constructor_declarator ::=
simple_name:name LPAREN formal_parameter_list_opt:fplo RPAREN {:
ParseNode pn=new ParseNode("constructor_declarator");
pn.addChild("global");
RESULT=pn;
:}
+ | SCRATCH NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {:
+ ParseNode pn=new ParseNode("createobject");
+ pn.addChild(type);
+ pn.addChild(args);
+ pn.addChild(feo);
+ pn.addChild("scratch");
+ RESULT=pn;
+ :}
// Objects we want to track in disjointness analysis
| DISJOINT IDENTIFIER:id NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {:
ParseNode pn=new ParseNode("createobject");
pn.addChild("global");
RESULT=pn;
:}
+ | SCRATCH NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("scratch");
+ RESULT=pn;
+ :}
| DISJOINT IDENTIFIER:id NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
ParseNode pn=new ParseNode("createarray");
pn.addChild(type);
pn.addChild("global");
RESULT=pn;
:}
+ | SCRATCH NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("scratch");
+ RESULT=pn;
+ :}
| DISJOINT IDENTIFIER:id NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
ParseNode pn=new ParseNode("createarray");
pn.addChild(type);
#define NUMPTRS 100
-#define INITIALHEAPSIZE 64*1024*1024
+#define INITIALHEAPSIZE 128*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
t_cache = objstrCreate(1048576);
t_reserve=NULL;
t_chashCreate(CHASH_SIZE, CLOADFACTOR);
- ___Thread____NN____staticStart____L___Thread___((struct ___Thread____NN____staticStart____L___Thread____params *)p);
+ ___Thread____NNR____staticStart____L___Thread___((struct ___Thread____NNR____staticStart____L___Thread____params *)p);
objstrDelete(t_cache);
objstrDelete(t_reserve);
t_chashDelete();