summaryrefslogtreecommitdiff
path: root/libguile/vm.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-08-07 12:43:25 +0200
committerAndy Wingo <wingo@pobox.com>2018-08-07 12:43:25 +0200
commit41100f77864d58690fe511ff19879d08504bef32 (patch)
tree70209aed92ddbe4037d4072730f4c0a9b283be72 /libguile/vm.c
parent0a01963d0771250524aa58aca308312d22754d41 (diff)
parent215617caea2aa0a25377d68a517cf8a75686b1c4 (diff)
downloadguile-41100f77864d58690fe511ff19879d08504bef32.tar.gz
Merge branch 'master' into lightning
This includes a manual cherry-pick of relevant stable-2.2 commits up to 4c91de3e45e7c98d5b7c484509fe5c59bd70f9fd.
Diffstat (limited to 'libguile/vm.c')
-rw-r--r--libguile/vm.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libguile/vm.c b/libguile/vm.c
index 0e60b29ce..cb4278349 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -582,7 +582,7 @@ return_unused_stack_to_os (struct scm_vm *vp)
do
ret = madvise ((void *) lo, hi - lo, MADV_DONTNEED);
- while (ret && errno == -EAGAIN);
+ while (ret && errno == EAGAIN);
if (ret)
perror ("madvise failed");
@@ -991,7 +991,7 @@ cons_rest (scm_thread *thread, uint32_t base)
static void
push_interrupt_frame (scm_thread *thread, uint8_t *mra)
{
- union scm_vm_stack_element *old_fp;
+ union scm_vm_stack_element *old_fp, *new_fp;
size_t frame_overhead = 3;
size_t old_frame_size = frame_locals_count (thread);
SCM proc = scm_i_async_pop (thread);
@@ -1000,14 +1000,15 @@ push_interrupt_frame (scm_thread *thread, uint8_t *mra)
alloc_frame (thread, old_frame_size + frame_overhead + 1);
old_fp = thread->vm.fp;
- thread->vm.fp = SCM_FRAME_SLOT (old_fp, old_frame_size + frame_overhead - 1);
- SCM_FRAME_SET_DYNAMIC_LINK (thread->vm.fp, old_fp);
+ new_fp = SCM_FRAME_SLOT (old_fp, old_frame_size + frame_overhead - 1);
+ SCM_FRAME_SET_DYNAMIC_LINK (new_fp, old_fp);
/* Arrange to return to the same handle-interrupts opcode to handle
any additional interrupts. */
- SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS (thread->vm.fp, thread->vm.ip);
- SCM_FRAME_SET_MACHINE_RETURN_ADDRESS (thread->vm.fp, mra);
+ SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS (new_fp, thread->vm.ip);
+ SCM_FRAME_SET_MACHINE_RETURN_ADDRESS (new_fp, mra);
+ SCM_FRAME_LOCAL (new_fp, 0) = proc;
- SCM_FRAME_LOCAL (thread->vm.fp, 0) = proc;
+ thread->vm.fp = new_fp;
}
struct return_to_continuation_data
@@ -1375,7 +1376,6 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
SCM_FRAME_SET_DYNAMIC_LINK (return_fp, vp->fp);
vp->ip = (uint32_t *) vm_boot_continuation_code;
- vp->fp = call_fp;
SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS (call_fp, vp->ip);
SCM_FRAME_SET_MACHINE_RETURN_ADDRESS (call_fp, 0);
@@ -1384,6 +1384,8 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
for (i = 0; i < nargs; i++)
SCM_FRAME_LOCAL (call_fp, i + 1) = argv[i];
+ vp->fp = call_fp;
+
{
jmp_buf registers;
int resume;