A patch for "STk not properly tail-recursive?"

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Fri, 07 Oct 1994 15:50:08 +0000

Argh, as I said the interpreter is tail recursive but it construct in parallel
a stack of calls (this is only used for presenting the context when an error
arise) which was not tail recursive. So there are no memory leak as I thought
(and I prefer that :) ). Since the patch is small, I sent it here, just in
case.

                -- Erick

--------------------------cut here---------------------------
*** eval.c~ Mon Sep 26 15:52:57 1994
--- eval.c Thu Oct 6 13:36:45 1994
***************
*** 149,155 ****
    register int len;
    long eval_stack_save = eval_stack_ptr;
  
- Top:
    /* Retain current expression in the eval stack */
    if (eval_stack_ptr >= eval_stack_size-1){
      /* make the eval stack larger */
--- 149,154 ----
***************
*** 166,173 ****
        env_stack = must_realloc(env_stack,
eval_stack_size*sizeof(SCM));
      }
    }
! eval_stack[++eval_stack_ptr] = x;
! env_stack[eval_stack_ptr] = env;
  
    /* Eval */
    switch TYPE(x) {
--- 165,175 ----
        env_stack = must_realloc(env_stack,
eval_stack_size*sizeof(SCM));
      }
    }
!
! eval_stack_ptr += 1;
! Top:
! eval_stack[eval_stack_ptr] = x;
! env_stack[eval_stack_ptr] = env;
  
    /* Eval */
    switch TYPE(x) {
Received on Fri Oct 07 1994 - 15:50:09 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST