summaryrefslogtreecommitdiff
path: root/libguile/vm.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-09-26 16:24:35 +0200
committerLudovic Courtès <ludo@gnu.org>2010-09-27 01:25:45 +0200
commit8e4c60ff2902363b41f4c23e686ad65c17e90196 (patch)
tree2d9afc272f1c7e0d0595460b75f8b2f525ef23d5 /libguile/vm.c
parent8684029d210be37775e32f7f4b4ca499bb1f1c56 (diff)
downloadguile-8e4c60ff2902363b41f4c23e686ad65c17e90196.tar.gz
Fix argument passing in VM hooks.
* libguile/vm.c (vm_dispatch_hook): Take care of FRAME's alignment explicitly so that it's correct even if the current stack frame isn't 8-byte aligned (as can be the case on i686--the SysV i386 ABI just says that the stack is word-aligned.)
Diffstat (limited to 'libguile/vm.c')
-rw-r--r--libguile/vm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libguile/vm.c b/libguile/vm.c
index 7512d10ff..17ad96dd5 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -191,7 +191,7 @@ vm_dispatch_hook (SCM vm, int hook_num)
struct scm_vm *vp;
SCM hook;
struct scm_frame c_frame;
- scm_t_aligned_cell frame;
+ scm_t_cell *frame;
SCM args[1];
int saved_trace_level;
@@ -218,9 +218,14 @@ vm_dispatch_hook (SCM vm, int hook_num)
c_frame.sp = vp->sp;
c_frame.ip = vp->ip;
c_frame.offset = 0;
- frame.cell.word_0 = SCM_PACK (scm_tc7_frame);
- frame.cell.word_1 = PTR2SCM (&c_frame);
- args[0] = PTR2SCM (&frame);
+
+ /* Arrange for FRAME to be 8-byte aligned, like any other cell. */
+ frame = alloca (sizeof (*frame) + 8);
+ frame = (scm_t_cell *) ROUND_UP ((scm_t_uintptr) frame, 8UL);
+
+ frame->word_0 = SCM_PACK (scm_tc7_frame);
+ frame->word_1 = PTR2SCM (&c_frame);
+ args[0] = PTR2SCM (frame);
scm_c_run_hookn (hook, args, 1);