klisp

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

commit 2486a8a3ab3fa279ed79ee9f6db4b13b64d58014
parent feae5bcdbe41d8abfaf64077495305144eeff1ac
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 15 Apr 2011 15:56:29 -0300

Changed name to tvs and vals stacks to make confusing not as easy.

Diffstat:
Msrc/kgc.c | 6+++---
Msrc/kstate.c | 4++--
Msrc/kstate.h | 32++++++++++++++++----------------
3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/kgc.c b/src/kgc.c @@ -571,10 +571,10 @@ static void markroot (klisp_State *K) { (all valid indexes are below top), all the objects in the two protected areas, and the two two dummy pairs */ markvaluearray(K, K->sbuf, K->stop); - markvaluearray(K, K->rootedtv_buf, K->rootedtv_top); + markvaluearray(K, K->rooted_tvs_buf, K->rooted_tvs_top); /* the area protecting variables is an array of type TValue *[] */ - TValue **ptr = K->rootedv_buf; - for (int i = 0, top = K->rootedv_top; i < top; i++, ptr++) { + TValue **ptr = K->rooted_vars_buf; + for (int i = 0, top = K->rooted_vars_top; i < top; i++, ptr++) { markvalue(K, **ptr); } diff --git a/src/kstate.c b/src/kstate.c @@ -116,8 +116,8 @@ klisp_State *klisp_newstate (klisp_Alloc f, void *ud) { /* init the stacks used to protect variables & values from gc, this should be done before any new object is created because they are used by them */ - K->rootedtv_top = 0; - K->rootedv_top = 0; + K->rooted_tvs_top = 0; + K->rooted_vars_top = 0; K->dummy_pair1 = kcons(K, KINERT, KNIL); K->dummy_pair2 = kcons(K, KINERT, KNIL); diff --git a/src/kstate.h b/src/kstate.h @@ -131,13 +131,13 @@ struct klisp_State { /* TValue stack to protect values from gc, must not grow, otherwise it may call the gc */ - int32_t rootedtv_top; - TValue rootedtv_buf[GC_PROTECT_SIZE]; + int32_t rooted_tvs_top; + TValue rooted_tvs_buf[GC_PROTECT_SIZE]; /* TValue * stack to protect c variables from gc. This is used when the object pointed to by a variable may change */ - int32_t rootedv_top; - TValue *rootedv_buf[GC_PROTECT_SIZE]; + int32_t rooted_vars_top; + TValue *rooted_vars_buf[GC_PROTECT_SIZE]; /* These two are useful for constructing lists by means of set-car & set-cdr. The idea is that these dummy pairs start as the head of @@ -293,28 +293,28 @@ inline bool ks_tbisempty(klisp_State *K) ** Functions to protect values from GC ** TODO: add write barriers */ -inline void krootedtv_push(klisp_State *K, TValue tv) +inline void krooted_tvs_push(klisp_State *K, TValue tv) { - klisp_assert(K->rootedtv_top < GC_PROTECT_SIZE); - K->rootedtv_buf[K->rootedtv_top++] = tv; + klisp_assert(K->rooted_tvs_top < GC_PROTECT_SIZE); + K->rooted_tvs_buf[K->rooted_tvs_top++] = tv; } -inline void krootedtv_pop(klisp_State *K) +inline void krooted_tvs_pop(klisp_State *K) { - klisp_assert(K->rootedtv_top > 0); - --(K->rootedtv_top); + klisp_assert(K->rooted_tvs_top > 0); + --(K->rooted_tvs_top); } -inline void krootedv_push(klisp_State *K, TValue *v) +inline void krooted_vars_push(klisp_State *K, TValue *v) { - klisp_assert(K->rootedv_top < GC_PROTECT_SIZE); - K->rootedv_buf[K->rootedv_top++] = v; + klisp_assert(K->rooted_vars_top < GC_PROTECT_SIZE); + K->rooted_vars_buf[K->rooted_vars_top++] = v; } -inline void krootedv_pop(klisp_State *K) +inline void krooted_vars_pop(klisp_State *K) { - klisp_assert(K->rootedv_top > 0); - --(K->rootedv_top); + klisp_assert(K->rooted_vars_top > 0); + --(K->rooted_vars_top); } /* dummy functions will be in kpair.h, because we can't include