[Nice-commit] Nice/src/bossa/syntax analyse.nice,1.68,1.69
Brought to you by:
bonniot
From: <bo...@us...> - 2003-05-21 15:40:11
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8885/src/bossa/syntax Modified Files: analyse.nice Log Message: Use a LinkedList instead of a HashSet to store the collection of locals in the most inner loop. They form a set by construction, and the overhead of maintaining a hashtable is huge, given the typically small number of locals in a loop block. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** analyse.nice 21 May 2003 14:21:00 -0000 1.68 --- analyse.nice 21 May 2003 15:32:13 -0000 1.69 *************** *** 70,74 **** ?LoopStmt currentLoop = null; ! ?Set<VarSymbol> currentLoopVars = null; Stack<LabeledStmt> labels = new Stack(); --- 70,77 ---- ?LoopStmt currentLoop = null; ! /* The set of all local constant variables whose scope is the current ! most inner loop. Null if we are not inside a loop at this point. ! */ ! ?Collection<VarSymbol> localsOfCurrentLoop = null; Stack<LabeledStmt> labels = new Stack(); *************** *** 220,225 **** { if (v.constant && (info.flags[v.index] || ! info.currentLoopVars != null && ! !notNull(info.currentLoopVars).contains(v))) bossa.util.User.error(loc, "" + v + " cannot be assigned a value multiple times"); --- 223,228 ---- { if (v.constant && (info.flags[v.index] || ! info.localsOfCurrentLoop != null && ! !notNull(info.localsOfCurrentLoop).contains(v))) bossa.util.User.error(loc, "" + v + " cannot be assigned a value multiple times"); *************** *** 556,561 **** info.addVar(notNull(decl.left)); ! if (info.currentLoopVars != null && notNull(decl.left).constant) ! notNull(info.currentLoopVars).add(notNull(decl.left)); } --- 559,564 ---- info.addVar(notNull(decl.left)); ! if (info.localsOfCurrentLoop != null && notNull(decl.left).constant) ! notNull(info.localsOfCurrentLoop).add(notNull(decl.left)); } *************** *** 614,626 **** ?LoopStmt save = info.currentLoop; ! ?Set<VarSymbol> loopVarSave = info.currentLoopVars; info.currentLoop = l; ! info.currentLoopVars = new HashSet(); analyse(l.loopBody, info); info.currentLoop = save; ! info.currentLoopVars = loopVarSave; /* The update code is considered reachable even if the loop cannot terminate --- 617,629 ---- ?LoopStmt save = info.currentLoop; ! ?Collection<VarSymbol> localsOfCurrentLoopSave = info.localsOfCurrentLoop; info.currentLoop = l; ! info.localsOfCurrentLoop = new LinkedList(); analyse(l.loopBody, info); info.currentLoop = save; ! info.localsOfCurrentLoop = localsOfCurrentLoopSave; /* The update code is considered reachable even if the loop cannot terminate |