Permalink
Browse files

initial shot at doing stack garbage collection

  • Loading branch information...
1 parent 2792246 commit f3cbced465710995d852c100217edd0d3eaa5509 Dido Sevilla committed Apr 5, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/thread.c
View
@@ -636,7 +636,7 @@ inline void __arc_stackcheck(value thr)
value cont, env;
int mvcount;
- assert(TSP(thr) > TSBASE(thr));
+ assert(TSP(thr) >= TSBASE(thr));
/* stack is fine, nothing to do */
if (TSP(thr) > TSBASE(thr))
return;
@@ -653,6 +653,10 @@ inline void __arc_stackcheck(value thr)
have been moved to the heap. We ought to be able to safely move
everything from TSFN to TSP such that TSFN is TSTOP. */
mvcount = TSFN(thr) - TSP(thr);
- memmove(TSTOP(thr) - mvcount, TSFN(thr), mvcount*sizeof(value));
+ memmove(TSTOP(thr) - mvcount, TSP(thr), mvcount*sizeof(value));
TSP(thr) = TSTOP(thr) - mvcount;
+
+ /* XXX - if initial stack size is set too low, or under certain
+ circumstances doing this may be insufficient to free up enough
+ memory. */
}

0 comments on commit f3cbced

Please sign in to comment.