[Pkg-gnupg-commit] [gnupg2] 230/292: gpgscm: Remove dubious stack implementation.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Nov 21 06:31:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit d7c5799c282a03dcce0e3d327075233353cb76cc
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 18:08:42 2016 +0100

    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 <justus at g10code.com>
---
 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 727e0c0..f5e4b0a 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 44dd165..c1340d7 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; i<nframes; i++) {
-    struct dump_stack_frame *frame;
-    frame = (struct dump_stack_frame *)sc->dump_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 f4231c4..bd6cda5 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list