mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
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.
This commit is contained in:
parent
a20feea43e
commit
5df43b60a9
5 changed files with 17 additions and 26 deletions
|
@ -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) \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue