mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 01:00:20 +02:00
Rework hook dispatch mechanism
* libguile/vm-engine.c (RUN_HOOK, RUN_HOOK0, RUN_HOOK1): Rework to dispatch through specific per-hook procedures. Might reduce register pressure in the VM. * libguile/vm.c (vm_dispatch_apply_hook): (vm_dispatch_push_continuation_hook): (vm_dispatch_pop_continuation_hook): (vm_dispatch_next_hook): (vm_dispatch_abort_hook): (vm_dispatch_restore_continuation_hook): New internal helpers.
This commit is contained in:
parent
c4f7923fa9
commit
ea0cd17d11
2 changed files with 51 additions and 17 deletions
|
@ -168,8 +168,12 @@ scm_i_capture_current_stack (void)
|
|||
0);
|
||||
}
|
||||
|
||||
static void vm_dispatch_hook (SCM vm, int hook_num,
|
||||
SCM *argv, int n) SCM_NOINLINE;
|
||||
static void vm_dispatch_apply_hook (SCM vm) SCM_NOINLINE;
|
||||
static void vm_dispatch_push_continuation_hook (SCM vm) SCM_NOINLINE;
|
||||
static void vm_dispatch_pop_continuation_hook (SCM vm, SCM *old_fp) SCM_NOINLINE;
|
||||
static void vm_dispatch_next_hook (SCM vm) SCM_NOINLINE;
|
||||
static void vm_dispatch_abort_hook (SCM vm) SCM_NOINLINE;
|
||||
static void vm_dispatch_restore_continuation_hook (SCM vm) SCM_NOINLINE;
|
||||
|
||||
static void
|
||||
vm_dispatch_hook (SCM vm, int hook_num, SCM *argv, int n)
|
||||
|
@ -238,6 +242,38 @@ vm_dispatch_hook (SCM vm, int hook_num, SCM *argv, int n)
|
|||
vp->trace_level = saved_trace_level;
|
||||
}
|
||||
|
||||
static void
|
||||
vm_dispatch_apply_hook (SCM vm)
|
||||
{
|
||||
return vm_dispatch_hook (vm, SCM_VM_APPLY_HOOK, NULL, 0);
|
||||
}
|
||||
static void vm_dispatch_push_continuation_hook (SCM vm)
|
||||
{
|
||||
return vm_dispatch_hook (vm, SCM_VM_PUSH_CONTINUATION_HOOK, NULL, 0);
|
||||
}
|
||||
static void vm_dispatch_pop_continuation_hook (SCM vm, SCM *old_fp)
|
||||
{
|
||||
struct scm_vm *vp = SCM_VM_DATA (vm);
|
||||
return vm_dispatch_hook (vm, SCM_VM_POP_CONTINUATION_HOOK,
|
||||
&SCM_FRAME_LOCAL (old_fp, 1),
|
||||
SCM_FRAME_NUM_LOCALS (old_fp, vp->sp) - 1);
|
||||
}
|
||||
static void vm_dispatch_next_hook (SCM vm)
|
||||
{
|
||||
return vm_dispatch_hook (vm, SCM_VM_NEXT_HOOK, NULL, 0);
|
||||
}
|
||||
static void vm_dispatch_abort_hook (SCM vm)
|
||||
{
|
||||
struct scm_vm *vp = SCM_VM_DATA (vm);
|
||||
return vm_dispatch_hook (vm, SCM_VM_ABORT_CONTINUATION_HOOK,
|
||||
&SCM_FRAME_LOCAL (vp->fp, 1),
|
||||
SCM_FRAME_NUM_LOCALS (vp->fp, vp->sp) - 1);
|
||||
}
|
||||
static void vm_dispatch_restore_continuation_hook (SCM vm)
|
||||
{
|
||||
return vm_dispatch_hook (vm, SCM_VM_RESTORE_CONTINUATION_HOOK, NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
vm_abort (SCM vm, SCM tag, size_t nstack, SCM *stack_args, SCM tail, SCM *sp,
|
||||
scm_i_jmp_buf *current_registers) SCM_NORETURN;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue