X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/346e4402a4e0110d53ee691137d562a8018a27e1..53befeb700c31dec58cec2c8f6f34535541a2f39:/libguile/continuations.c diff --git a/libguile/continuations.c b/libguile/continuations.c index 80a2790b8..f85647684 100644 --- a/libguile/continuations.c +++ b/libguile/continuations.c @@ -1,22 +1,26 @@ -/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +# include +#endif #include "libguile/_scm.h" @@ -32,6 +36,7 @@ #include "libguile/dynwind.h" #include "libguile/values.h" #include "libguile/eval.h" +#include "libguile/vm.h" #include "libguile/validate.h" #include "libguile/continuations.h" @@ -50,6 +55,7 @@ continuation_mark (SCM obj) scm_gc_mark (continuation->root); scm_gc_mark (continuation->throw_value); + scm_gc_mark (continuation->vm_conts); scm_mark_locations (continuation->stack, continuation->num_stack_items); #ifdef __ia64__ if (continuation->backing_store) @@ -116,13 +122,14 @@ scm_make_continuation (int *first) continuation->root = thread->continuation_root; continuation->dframe = scm_i_last_debug_frame (); src = thread->continuation_base; - SCM_NEWSMOB (cont, scm_tc16_continuation, continuation); - #if ! SCM_STACK_GROWS_UP src -= stack_size; #endif continuation->offset = continuation->stack - src; memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size); + continuation->vm_conts = scm_vm_capture_continuations (); + + SCM_NEWSMOB (cont, scm_tc16_continuation, continuation); *first = !setjmp (continuation->jmpbuf); if (*first) @@ -201,6 +208,7 @@ copy_stack (void *data) copy_stack_data *d = (copy_stack_data *)data; memcpy (d->dst, d->continuation->stack, sizeof (SCM_STACKITEM) * d->continuation->num_stack_items); + scm_vm_reinstate_continuations (d->continuation->vm_conts); #ifdef __ia64__ SCM_I_CURRENT_THREAD->pending_rbs_continuation = d->continuation; #endif