1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 14:21:10 +02:00

fix marking empty VM continuations

* libguile/vm.h (struct scm_vm_cont):
* libguile/vm.c (capture_vm_cont, reinstate_vm_cont): Change so we just
  store the registers as they are, with the reloc.
  (vm_cont_mark): Only mark the stack if it has elements on it, otherwise
  we get a bogus fp.

* libguile/stacks.c (scm_make_stack): Update for change to vm
  continuations.
This commit is contained in:
Andy Wingo 2009-01-13 22:33:21 +01:00
parent d5968e7f4e
commit 7aa6f86b77
4 changed files with 15 additions and 11 deletions

View file

@ -2,7 +2,7 @@ Installation Instructions
************************* *************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc. 2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
@ -67,6 +67,9 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came all sorts of other programs in order to regenerate files that came
with the distribution. with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options Compilers and Options
===================== =====================

View file

@ -516,8 +516,8 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1,
vm_cont = scm_cdr (scm_car (cont->vm_conts)); vm_cont = scm_cdr (scm_car (cont->vm_conts));
data = SCM_VM_CONT_DATA (vm_cont); data = SCM_VM_CONT_DATA (vm_cont);
vmframe = scm_c_make_vm_frame (vm_cont, vmframe = scm_c_make_vm_frame (vm_cont,
data->stack_base + data->fp, data->fp + data->reloc,
data->stack_base + data->sp, data->sp + data->reloc,
data->ip, data->ip,
data->reloc); data->reloc);
} else } else

View file

@ -119,7 +119,8 @@ vm_cont_mark (SCM obj)
{ {
struct scm_vm_cont *p = SCM_VM_CONT_DATA (obj); struct scm_vm_cont *p = SCM_VM_CONT_DATA (obj);
vm_mark_stack (p->stack_base, p->stack_size, p->stack_base + p->fp, p->reloc); if (p->stack_size)
vm_mark_stack (p->stack_base, p->stack_size, p->fp + p->reloc, p->reloc);
return SCM_BOOL_F; return SCM_BOOL_F;
} }
@ -149,8 +150,8 @@ capture_vm_cont (struct scm_vm *vp)
memset (p->stack_base, 0, p->stack_size * sizeof (SCM)); memset (p->stack_base, 0, p->stack_size * sizeof (SCM));
#endif #endif
p->ip = vp->ip; p->ip = vp->ip;
p->sp = vp->sp - vp->stack_base; p->sp = vp->sp;
p->fp = vp->fp - vp->stack_base; p->fp = vp->fp;
memcpy (p->stack_base, vp->stack_base, p->stack_size * sizeof (SCM)); memcpy (p->stack_base, vp->stack_base, p->stack_size * sizeof (SCM));
p->reloc = p->stack_base - vp->stack_base; p->reloc = p->stack_base - vp->stack_base;
SCM_RETURN_NEWSMOB (scm_tc16_vm_cont, p); SCM_RETURN_NEWSMOB (scm_tc16_vm_cont, p);
@ -167,7 +168,7 @@ reinstate_vm_cont (struct scm_vm *vp, SCM cont)
} }
#ifdef VM_ENABLE_STACK_NULLING #ifdef VM_ENABLE_STACK_NULLING
{ {
scm_t_ptrdiff nzero = (vp->sp - vp->stack_base) - p->sp; scm_t_ptrdiff nzero = (vp->sp - p->sp);
if (nzero > 0) if (nzero > 0)
memset (vp->stack_base + p->stack_size, 0, nzero * sizeof (SCM)); memset (vp->stack_base + p->stack_size, 0, nzero * sizeof (SCM));
/* actually nzero should always be negative, because vm_reset_stack will /* actually nzero should always be negative, because vm_reset_stack will
@ -175,8 +176,8 @@ reinstate_vm_cont (struct scm_vm *vp, SCM cont)
} }
#endif #endif
vp->ip = p->ip; vp->ip = p->ip;
vp->sp = vp->stack_base + p->sp; vp->sp = p->sp;
vp->fp = vp->stack_base + p->fp; vp->fp = p->fp;
memcpy (vp->stack_base, p->stack_base, p->stack_size * sizeof (SCM)); memcpy (vp->stack_base, p->stack_base, p->stack_size * sizeof (SCM));
} }

View file

@ -102,8 +102,8 @@ extern SCM scm_vm_trace_frame (SCM vm);
struct scm_vm_cont { struct scm_vm_cont {
scm_byte_t *ip; scm_byte_t *ip;
scm_t_ptrdiff sp; SCM *sp;
scm_t_ptrdiff fp; SCM *fp;
scm_t_ptrdiff stack_size; scm_t_ptrdiff stack_size;
SCM *stack_base; SCM *stack_base;
scm_t_ptrdiff reloc; scm_t_ptrdiff reloc;