1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-05 23:20:38 +02:00

Relax assumptions made in the precise VM stack marking procedure.

* 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.
This commit is contained in:
Ludovic Courtès 2009-08-20 12:18:57 +02:00
parent e3eb628d88
commit 78747ac6fb

View 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,