Relax assumptions made in the precise VM stack marking procedure.
authorLudovic Courtès <ludo@gnu.org>
Thu, 20 Aug 2009 10:18:57 +0000 (12:18 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 20 Aug 2009 10:18:57 +0000 (12:18 +0200)
* libguile/vm.c (vm_stack_mark): Change assertions into checks to
  determine whether VM points to a sane (initialized) object.  The
  assumption previously was that free-list elements would be zeroed, as
  implied by the comment in <gc/gc_mark.h>, but this doesn't appear to
  be the case.

libguile/vm.c

index 2920924..8fd378c 100644 (file)
@@ -359,16 +359,12 @@ vm_stack_mark (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
      corresponding VM.  */
   vm = * ((struct scm_vm **) addr);
 
-  if (vm->stack_base == NULL)
+  if ((SCM *) addr != vm->stack_base - 1
+      || vm->stack_limit - vm->stack_base != vm->stack_size)
     /* ADDR must be a pointer to a free-list element, which we must ignore
        (see warning in <gc/gc_mark.h>).  */
     return mark_stack_ptr;
 
-  /* Sanity checks.  */
-  assert ((SCM *) addr == vm->stack_base - 1);
-  assert (vm->sp >= (SCM *) addr);
-  assert (vm->stack_limit - vm->stack_base == vm->stack_size);
-
   for (word = (GC_word *) vm->stack_base; word <= (GC_word *) vm->sp; word++)
     mark_stack_ptr = GC_MARK_AND_PUSH ((* (GC_word **) word),
                                       mark_stack_ptr, mark_stack_limit,