From d7c5799c282a03dcce0e3d327075233353cb76cc Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 8 Nov 2016 18:08:42 +0100 Subject: gpgscm: Remove dubious stack implementation. * tests/gpgscm/scheme-private.h (struct scheme): Remove related fields. * tests/gpgscm/scheme.c: Drop all !USE_SCHEME_STACK code. * tests/gpgscm/scheme.h (USE_SCHEME_STACK): Remove macro. Signed-off-by: Justus Winter --- tests/gpgscm/scheme-private.h | 2 - tests/gpgscm/scheme.c | 88 ------------------------------------------- tests/gpgscm/scheme.h | 5 --- 3 files changed, 95 deletions(-) diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index 727e0c0bb..f5e4b0a7c 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -155,8 +155,6 @@ void *ext_data; /* For the benefit of foreign functions */ long gensym_cnt; struct scheme_interface *vptr; -void *dump_base; /* pointer to base of allocated dump stack */ -int dump_size; /* number of frames allocated for dump stack */ }; /* operator code */ diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 44dd16559..c1340d7a3 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2442,93 +2442,6 @@ static pointer _Error_1(scheme *sc, const char *s, pointer a) { #define s_return(sc,a) return _s_return(sc,a) -#ifndef USE_SCHEME_STACK - -/* this structure holds all the interpreter's registers */ -struct dump_stack_frame { - enum scheme_opcodes op; - pointer args; - pointer envir; - pointer code; -}; - -#define STACK_GROWTH 3 - -static void s_save(scheme *sc, enum scheme_opcodes op, pointer args, pointer code) -{ - int nframes = (int)sc->dump; - struct dump_stack_frame *next_frame; - - /* enough room for the next frame? */ - if (nframes >= sc->dump_size) { - sc->dump_size += STACK_GROWTH; - /* alas there is no sc->realloc */ - sc->dump_base = realloc(sc->dump_base, - sizeof(struct dump_stack_frame) * sc->dump_size); - } - next_frame = (struct dump_stack_frame *)sc->dump_base + nframes; - next_frame->op = op; - next_frame->args = args; - next_frame->envir = sc->envir; - next_frame->code = code; - sc->dump = (pointer)(nframes+1); -} - -static pointer _s_return(scheme *sc, pointer a) -{ - int nframes = (int)sc->dump; - struct dump_stack_frame *frame; - - sc->value = (a); - if (nframes <= 0) { - return sc->NIL; - } - nframes--; - frame = (struct dump_stack_frame *)sc->dump_base + nframes; - sc->op = frame->op; - sc->args = frame->args; - sc->envir = frame->envir; - sc->code = frame->code; - sc->dump = (pointer)nframes; - return sc->T; -} - -static INLINE void dump_stack_reset(scheme *sc) -{ - /* in this implementation, sc->dump is the number of frames on the stack */ - sc->dump = (pointer)0; -} - -static INLINE void dump_stack_initialize(scheme *sc) -{ - sc->dump_size = 0; - sc->dump_base = NULL; - dump_stack_reset(sc); -} - -static void dump_stack_free(scheme *sc) -{ - free(sc->dump_base); - sc->dump_base = NULL; - sc->dump = (pointer)0; - sc->dump_size = 0; -} - -static INLINE void dump_stack_mark(scheme *sc) -{ - int nframes = (int)sc->dump; - int i; - for(i=0; idump_base + i; - mark(frame->args); - mark(frame->envir); - mark(frame->code); - } -} - -#else - static INLINE void dump_stack_reset(scheme *sc) { sc->dump = sc->NIL; @@ -2565,7 +2478,6 @@ static INLINE void dump_stack_mark(scheme *sc) { mark(sc->dump); } -#endif #define s_retbool(tf) s_return(sc,(tf) ? sc->T : sc->F) diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index f4231c474..bd6cda5ac 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -44,11 +44,6 @@ extern "C" { # define USE_PLIST 0 #endif -/* - * Leave it defined if you want continuations, and also for the Sharp Zaurus. - * Undefine it if you only care about faster speed and not strict Scheme compatibility. - */ -#define USE_SCHEME_STACK #if USE_DL # define USE_INTERFACE 1 -- cgit v1.2.3