klisp

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

commit ec8d62a9a61276602157b037d3c23e82410f7fd7
parent 26f445bbbff6aa1df91bcc20b7d4250eabac7f1b
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Sat, 16 Apr 2011 22:03:38 -0300

Bugfix: added vars popping in kread.

Diffstat:
Msrc/kgc.c | 3---
Msrc/klispconf.h | 6+++---
Msrc/kread.c | 3+++
Msrc/kstate.c | 4+---
Msrc/kstate.h | 2+-
5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/kgc.c b/src/kgc.c @@ -79,7 +79,6 @@ static void removeentry (Node *n) { static void reallymarkobject (klisp_State *K, GCObject *o) { - printf("mark: %p (%s)\n", o, ktv_names[o->gch.tt]); klisp_assert(iswhite(o) && !isdead(K, o)); white2gray(o); /* klisp: most of klisp have the same structure, but conserve the switch @@ -237,7 +236,6 @@ static void traverseproto (global_State *g, Proto *f) { */ static int32_t propagatemark (klisp_State *K) { GCObject *o = K->gray; - printf("propagate: %p (%s)\n", o, ktv_names[o->gch.tt]); K->gray = o->gch.gclist; klisp_assert(isgray(o)); gray2black(o); @@ -394,7 +392,6 @@ static void cleartable (GCObject *l) { static void freeobj (klisp_State *K, GCObject *o) { /* TODO use specific functions like in bigint & lua */ uint8_t type = o->gch.tt; - printf("freeobj: %p (%s)\n", o, ktv_names[type]); switch (type) { /* case LUA_TTABLE: luaH_free(L, gco2h(o)); break; */ case K_TBIGINT: { diff --git a/src/klispconf.h b/src/klispconf.h @@ -14,9 +14,9 @@ #include <stdbool.h> /* temp defines till gc is stabilized */ -#define KUSE_GC 1 +/* #define KUSE_GC 1 */ /* Print msgs when starting and ending gc */ -#define KDEBUG_GC 1 +/* #define KDEBUG_GC 1 */ /* #define KTRACK_MARKS (true) @@ -37,7 +37,7 @@ /* In lua that has incremental gc this is setted to 200, in klisp as we don't yet have incremental gc, we set it to 400 */ -#define KLISPI_GCPAUSE 110 /* 400% (wait memory to quadruple before next GC) */ +#define KLISPI_GCPAUSE 400 /* 400% (wait memory to quadruple before next GC) */ /* diff --git a/src/kread.c b/src/kread.c @@ -466,6 +466,9 @@ TValue kread_fsm(klisp_State *K) } } + krooted_vars_pop(K); + krooted_vars_pop(K); + pop_state(K); assert(ks_sisempty(K)); return obj; diff --git a/src/kstate.c b/src/kstate.c @@ -177,9 +177,7 @@ klisp_State *klisp_newstate (klisp_Alloc f, void *ud) { kinit_ground_env(K); /* set the threshold for gc start now that we have allocated all mem */ -/* K->GCthreshold = 4*K->totalbytes; */ - /* TEST */ - K->GCthreshold = K->totalbytes + 1000; + K->GCthreshold = 4*K->totalbytes; return K; } diff --git a/src/kstate.h b/src/kstate.h @@ -34,7 +34,7 @@ typedef struct { int32_t saved_col; } ksource_info_t; -#define GC_PROTECT_SIZE 6 /* XXX was 32 */ +#define GC_PROTECT_SIZE 32 /* NOTE: when adding TValues here, remember to add them to markroot in kgc.c!! */