[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 08/13: Adapt JIT calling convention; continuations take
From: |
Andy Wingo |
Subject: |
[Guile-commits] 08/13: Adapt JIT calling convention; continuations take mra from stack |
Date: |
Sun, 19 Aug 2018 04:44:17 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 5df43b60a9c5186343c3270a710a7ccf1bcbbabd
Author: Andy Wingo <address@hidden>
Date: Mon Aug 13 10:27:13 2018 +0200
Adapt JIT calling convention; continuations take mra from stack
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Update prototype of
capture-continuation.
* libguile/jit.h:
* libguile/jit.c (scm_jit_enter_mcode): Return void, not the vra.
Instead, we expect the code to set vp->ip for the vra.
* libguile/vm-engine.c (instrument-entry, instrument-loop)
(return-values, abort): Adapt scm_jit_enter_mcode calling convention.
(capture-continuation): No need to pass an mra; the intrinsic will
read it from the stack.
* libguile/vm.c (capture_continuation): Remove mra arg, as we take mra
from the continuation.
(scm_call_n): Adapt to scm_jit_enter_mcode change.
---
libguile/intrinsics.h | 3 +--
libguile/jit.c | 3 +--
libguile/jit.h | 4 ++--
libguile/vm-engine.c | 29 +++++++++++------------------
libguile/vm.c | 4 ++--
5 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/libguile/intrinsics.h b/libguile/intrinsics.h
index aa2355b..47a8969 100644
--- a/libguile/intrinsics.h
+++ b/libguile/intrinsics.h
@@ -69,7 +69,6 @@ typedef void (*scm_t_thread_mra_intrinsic) (scm_thread*,
uint8_t*);
typedef uint32_t* (*scm_t_vra_from_thread_intrinsic) (scm_thread*);
typedef uint8_t* (*scm_t_mra_from_thread_scm_intrinsic) (scm_thread*, SCM);
typedef uint8_t* (*scm_t_mra_from_thread_mra_intrinsic) (scm_thread*,
uint8_t*);
-typedef SCM (*scm_t_scm_from_thread_mra_intrinsic) (scm_thread*, uint8_t*);
#define SCM_FOR_ALL_VM_INTRINSICS(M) \
M(scm_from_scm_scm, add, "add", ADD) \
@@ -121,7 +120,7 @@ typedef SCM (*scm_t_scm_from_thread_mra_intrinsic)
(scm_thread*, uint8_t*);
M(thread_mra, push_interrupt_frame, "push-interrupt-frame",
PUSH_INTERRUPT_FRAME) \
M(thread_scm_scm, foreign_call, "foreign-call", FOREIGN_CALL) \
M(thread_scm_noreturn, reinstate_continuation_x, "reinstate-continuation!",
REINSTATE_CONTINUATION_X) \
- M(scm_from_thread_mra, capture_continuation, "capture-continuation",
CAPTURE_CONTINUATION) \
+ M(scm_from_thread, capture_continuation, "capture-continuation",
CAPTURE_CONTINUATION) \
M(mra_from_thread_scm, compose_continuation, "compose-continuation",
COMPOSE_CONTINUATION) \
M(int_from_scm, rest_arg_length, "rest-arg-length", REST_ARG_LENGTH) \
M(mra_from_thread_mra, abort_to_prompt, "abort-to-prompt", ABORT_TO_PROMPT) \
diff --git a/libguile/jit.c b/libguile/jit.c
index 346e919..69b2021 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -1215,11 +1215,10 @@ scm_jit_compute_mcode (scm_thread *thread, struct
scm_jit_function_data *data)
return NULL;
}
-uint32_t *
+void
scm_jit_enter_mcode (scm_thread *thread, const uint8_t *mcode)
{
abort ();
- return NULL;
}
void
diff --git a/libguile/jit.h b/libguile/jit.h
index 34f5751..325ec35 100644
--- a/libguile/jit.h
+++ b/libguile/jit.h
@@ -53,8 +53,8 @@ enum scm_jit_counter_value
SCM_INTERNAL const uint8_t *scm_jit_compute_mcode (scm_thread *thread,
struct
scm_jit_function_data *data);
-SCM_INTERNAL uint32_t *scm_jit_enter_mcode (scm_thread *thread,
- const uint8_t *mcode);
+SCM_INTERNAL void scm_jit_enter_mcode (scm_thread *thread,
+ const uint8_t *mcode);
SCM_INTERNAL void scm_init_jit (void);
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 9789fc8..8dc5c00 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -472,8 +472,8 @@ VM_NAME (scm_thread *thread)
if (mcode)
{
- ip = scm_jit_enter_mcode (thread, mcode);
- CACHE_SP ();
+ scm_jit_enter_mcode (thread, mcode);
+ CACHE_REGISTER ();
NEXT (0);
}
}
@@ -682,8 +682,8 @@ VM_NAME (scm_thread *thread)
if (mcode)
{
- ip = scm_jit_enter_mcode (thread, mcode);
- CACHE_SP ();
+ scm_jit_enter_mcode (thread, mcode);
+ CACHE_REGISTER ();
NEXT (0);
}
else
@@ -716,8 +716,8 @@ VM_NAME (scm_thread *thread)
if (mcode)
{
- ip = scm_jit_enter_mcode (thread, mcode);
- CACHE_SP ();
+ scm_jit_enter_mcode (thread, mcode);
+ CACHE_REGISTER ();
NEXT (0);
}
}
@@ -735,12 +735,11 @@ VM_NAME (scm_thread *thread)
VM_DEFINE_OP (15, capture_continuation, "capture-continuation", DOP1
(X8_S24))
{
uint32_t dst;
- uint8_t *mra = NULL;
UNPACK_24 (op, dst);
SYNC_IP ();
- SP_SET (dst, CALL_INTRINSIC (capture_continuation, (thread, mra)));
+ SP_SET (dst, CALL_INTRINSIC (capture_continuation, (thread)));
NEXT (1);
}
@@ -769,16 +768,10 @@ VM_NAME (scm_thread *thread)
ABORT_CONTINUATION_HOOK ();
if (mcode)
- {
- ip = scm_jit_enter_mcode (thread, mcode);
- CACHE_SP ();
- NEXT (0);
- }
- else
- {
- CACHE_REGISTER ();
- NEXT (0);
- }
+ scm_jit_enter_mcode (thread, mcode);
+
+ CACHE_REGISTER ();
+ NEXT (0);
}
/* builtin-ref dst:12 idx:12
diff --git a/libguile/vm.c b/libguile/vm.c
index 36255b2..4e60a96 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -1086,7 +1086,7 @@ reinstate_continuation_x (scm_thread *thread, SCM cont)
}
static SCM
-capture_continuation (scm_thread *thread, uint8_t *mra)
+capture_continuation (scm_thread *thread)
{
struct scm_vm *vp = &thread->vm;
SCM vm_cont = capture_stack (vp->stack_top,
@@ -1441,7 +1441,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
if (vp->trace_level)
invoke_abort_hook (thread);
if (mcode)
- vp->ip = scm_jit_enter_mcode (thread, mcode);
+ scm_jit_enter_mcode (thread, mcode);
}
else
vp->ip = get_callee_vcode (thread);
- [Guile-commits] branch lightning updated (0d00164 -> 3827769), Andy Wingo, 2018/08/19
- [Guile-commits] 01/13: Minor optimization in RESET_FRAME, Andy Wingo, 2018/08/19
- [Guile-commits] 04/13: Add unpack-values-object intrinsic, Andy Wingo, 2018/08/19
- [Guile-commits] 03/13: Change call/cc inst to capture-continuation, Andy Wingo, 2018/08/19
- [Guile-commits] 09/13: Update error-wrong-num-args intrinsic prototype, Andy Wingo, 2018/08/19
- [Guile-commits] 02/13: Rework program->ip mapping in VM to always call intrinsic, Andy Wingo, 2018/08/19
- [Guile-commits] 12/13: Define intrinsics for atomic ops, Andy Wingo, 2018/08/19
- [Guile-commits] 07/13: Continuations capture machine code address, Andy Wingo, 2018/08/19
- [Guile-commits] 05/13: Invoke VM hooks through intrinsics, Andy Wingo, 2018/08/19
- [Guile-commits] 06/13: Rework foreign-call trampoline, Andy Wingo, 2018/08/19
- [Guile-commits] 08/13: Adapt JIT calling convention; continuations take mra from stack,
Andy Wingo <=
- [Guile-commits] 11/13: 64-bit intrinsic args and return values passed indirectly on 32-bit, Andy Wingo, 2018/08/19
- [Guile-commits] 10/13: Avoid needless 64-bit args on 32-bit machines for some intrinsics, Andy Wingo, 2018/08/19
- [Guile-commits] 13/13: Add instrumentation to VM builtins, Andy Wingo, 2018/08/19