diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-02-09 01:37:05 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-02-09 01:37:05 +0100 |
commit | 9d8f5a14662f6500c21ac4fa0afd083fc9e2467a (patch) | |
tree | db231af5a5033762b8dbd713de1776839037f53b /sys/src/cmd/acid/acid.h | |
parent | 6b146c70c2863bf1e9d5c4a35cbd8426c5a161e7 (diff) |
acid: fix memory corruption due to gc
we cannot call gc() in execute() because it will gc
anonyous intermediate results which happens when we
construct a list and the elements are calculated by
calling a function thru ocall() which calls execute().
also, the _thiscmd symbol; which is used to keep
a reference to a statement so it wont get garbage
collected; does not work as yyparse() is recursive
(include statements).
we add execrec() function which *only* gets called from
yyparse() when evaluating a statement. it will
keep a stack on the _thiscmd symbol handling the yyparse()
recursion.
we also only call gc() in execrec() before calling
execute(). so execute() will never gc() while evaluating
a statement which prevents the intermediate results
from getting collected.
Diffstat (limited to 'sys/src/cmd/acid/acid.h')
-rw-r--r-- | sys/src/cmd/acid/acid.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/src/cmd/acid/acid.h b/sys/src/cmd/acid/acid.h index 897a0cc50..bd0d6b7cb 100644 --- a/sys/src/cmd/acid/acid.h +++ b/sys/src/cmd/acid/acid.h @@ -190,6 +190,7 @@ void dostop(int); Lsym* enter(char*, int); void error(char*, ...); void execute(Node*); +void execrec(Node*); void fatal(char*, ...); void flatten(Node**, Node*); void gc(void); |