klisp

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

commit 57cd4aa9819801558b14d8ae0c5d51f353d07396
parent 8e26327b55afd79210216bc33f4d5310349d0496
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Sat, 16 Apr 2011 21:33:08 -0300

Bugfix: macro parameters name conflict caused some objects to be seen as uncollectible.

Diffstat:
Msrc/kgc.c | 13+++++++++----
Msrc/klispconf.h | 2+-
Msrc/kobject.h | 4++--
3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/kgc.c b/src/kgc.c @@ -18,6 +18,10 @@ #include "kport.h" #include "imath.h" +/* XXX */ +#include "kwrite.h" +/* XXX */ + #define GCSTEPSIZE 1024u #define GCSWEEPMAX 40 #define GCSWEEPCOST 10 @@ -50,12 +54,12 @@ TValue *array_ = (a); \ int32_t size_ = (s); \ for(int32_t i_ = 0; i_ < size_; i_++, array_++) { \ - TValue o_ = *array_; \ - markvalue(k, o_); \ + TValue mva_obj_ = *array_; \ + markvalue(k, mva_obj_); \ }}) -#define markvalue(k,o) { checkconsistency(o); \ - if (iscollectable(o) && iswhite(gcvalue(o))) \ +#define markvalue(k,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) \ reallymarkobject(k,gcvalue(o)); } #define markobject(k,t) { if (iswhite(obj2gco(t))) \ @@ -390,6 +394,7 @@ 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 @@ -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 400 /* 400% (wait memory to quadruple before next GC) */ +#define KLISPI_GCPAUSE 110 /* 400% (wait memory to quadruple before next GC) */ /* diff --git a/src/kobject.h b/src/kobject.h @@ -209,8 +209,8 @@ typedef struct __attribute__ ((__packed__)) GCheader { */ /* NOTE: This is intended for use in switch statements */ -#define ttype(o) ({ TValue o_ = (o); \ - ttisdouble(o_)? K_TDOUBLE : ttype_(o_); }) +#define ttype(o) ({ TValue tto_ = (o); \ + ttisdouble(tto_)? K_TDOUBLE : ttype_(tto_); }) /* This is intended for internal use below. DON'T USE OUTSIDE THIS FILE */ #define ttag(o) ((o).tv.t)