klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit 8fc836e63831a2170ed8aaf02282dd786082ca52
parent 55ec7ab33e1f1f512c7913965b9e3d11343a1131
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Wed, 20 Apr 2011 11:14:43 -0300

GC Bugfix: added krooted_push to save source info before consing it up in kread. (Thanks Valrind!)

Diffstat:
Msrc/kgports.c | 2+-
Msrc/kread.c | 7+++++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/kgports.c b/src/kgports.c @@ -498,7 +498,7 @@ void load(klisp_State *K, TValue *xparams, TValue ptree, TValue denv) if (ttispair(tail)) { krooted_tvs_push(K, ls); TValue new_cont = kmake_continuation(K, kget_cc(K), - do_seq, 2, tail, denv); + do_seq, 2, tail, denv); kset_cc(K, new_cont); krooted_tvs_pop(K); /* ls */ } diff --git a/src/kread.c b/src/kread.c @@ -300,10 +300,13 @@ TValue kread_fsm(klisp_State *K) /* token ok, read defined object */ /* NOTE: save the source info to return it after the defined object is read */ - push_data(K, kcons(K, tok, ktok_get_source_info(K))); + TValue si = ktok_get_source_info(K); + krooted_tvs_push(K, si); + push_data(K, kcons(K, tok, si)); + krooted_tvs_pop(K); + krooted_tvs_pop(K); push_state(K, ST_SHARED_DEF); read_next_token = true; - krooted_tvs_pop(K); } } break;