diff options
author | Andy Wingo <wingo@pobox.com> | 2009-08-15 14:13:08 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-08-20 18:52:49 +0200 |
commit | 03e6c1659623d1aac4121730c1e453c626042c47 (patch) | |
tree | 4137603e61a866ff9ab725d21c0d11c7b3648103 /libguile/vm.c | |
parent | d94be25f72d217a484b4f4c9b742c610fc9e501c (diff) | |
download | guile-03e6c1659623d1aac4121730c1e453c626042c47.tar.gz |
reorder frame layout
* libguile/frames.h: Reorder the frame layout so the return address
comes below the arguments.working
(SCM_FRAME_SET_RETURN_ADDRESS, SCM_FRAME_SET_MV_RETURN_ADDRESS): New
macros.
* libguile/frames.c (scm_vm_frame_arguments): Use the macros to access
the arguments.
* libguile/vm-engine.c (vm_engine): Fix for new calling convention.
* libguile/vm-engine.h (INIT_FRAME): New macro. Does part of what
NEW_FRAME used to do.
* libguile/vm-i-system.c (call, mv-call): Shuffle args up to make room
for the stack, and adapt to new calling convention.
(goto/args): Shuffling down is easier now.
(return, return/args): Adapt to new frame layout.
* libguile/vm.c (vm_mark_stack): Adapt to new frame layout, and the
possibility of there being crap on the stack.
(really_make_boot_program): Remove extraneous comment.
Diffstat (limited to 'libguile/vm.c')
-rw-r--r-- | libguile/vm.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libguile/vm.c b/libguile/vm.c index cc5e4f924..660f25cb4 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -66,21 +66,20 @@ scm_t_bits scm_tc16_vm_cont; static void vm_mark_stack (SCM *base, scm_t_ptrdiff size, SCM *fp, scm_t_ptrdiff reloc) { - SCM *sp, *upper, *lower; + SCM *sp, *mark; sp = base + size - 1; while (sp > base && fp) { - upper = SCM_FRAME_UPPER_ADDRESS (fp); - lower = SCM_FRAME_LOWER_ADDRESS (fp); + mark = SCM_FRAME_LOWER_ADDRESS (fp) + 3; - for (; sp >= upper; sp--) + for (; sp >= mark; sp--) if (SCM_NIMP (*sp)) { if (scm_in_heap_p (*sp)) scm_gc_mark (*sp); - else - fprintf (stderr, "BADNESS: crap on the stack: %p\n", *sp); + /* this can happen for open frames */ + /* else fprintf (stderr, "BADNESS: crap on the stack: %p\n", *sp); */ } @@ -89,11 +88,6 @@ vm_mark_stack (SCM *base, scm_t_ptrdiff size, SCM *fp, scm_t_ptrdiff reloc) /* update fp from the dynamic link */ fp = (SCM*)*sp-- + reloc; - - /* mark from the el down to the lower address */ - for (; sp >= lower; sp--) - if (*sp && SCM_NIMP (*sp)) - scm_gc_mark (*sp); } } @@ -224,7 +218,6 @@ static SCM really_make_boot_program (long nargs) { SCM u8vec; - /* Make sure "bytes" is 64-bit aligned. */ scm_t_uint8 text[] = { scm_op_mv_call, 0, 0, 1, scm_op_make_int8_1, scm_op_nop, scm_op_nop, scm_op_nop, scm_op_halt }; |