1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00

VM manages hook sets itself

* libguile/vm.h (SCM_VM_ABORT_HOOK): Rename from
  SCM_VM_ABORT_CONTINUATION_HOOK.
* libguile/vm-engine.c (ABORT_HOOK):
* libguile/vm.c (invoke_abort_hook): Adapt to SCM_VM_ABORT_HOOK name
change.
(reset_vm_hook_enabled): New helper.
(VM_ADD_HOOK, VM_REMOVE_HOOK): New helper macros, replacing
VM_DEFINE_HOOK.
(scm_vm_add_abort_hook_x, scm_vm_remove_abort_hook_x)
(scm_vm_add_apply_hook_x, scm_vm_remove_apply_hook_x)
(scm_vm_add_return_hook_x, scm_vm_remove_return_hook_x)
(scm_vm_add_next_hook_x, scm_vm_remove_next_hook_x): New functions,
replacing direct access to the hooks.  Allows us to know in a more
fine-grained way when to enable hooks.
(scm_set_vm_trace_level_x): Use reset_vm_hook_enabled to update the
individual hook_enabled flags.
* module/statprof.scm:
* module/system/vm/coverage.scm:
* module/system/vm/traps.scm:
* module/system/vm/vm.scm: Adapt VM hook users to the new API.
This commit is contained in:
Andy Wingo 2018-09-14 08:42:41 +02:00
parent ce5c05ac4a
commit bf31fe4cf6
7 changed files with 130 additions and 62 deletions

View file

@ -126,7 +126,7 @@
#define APPLY_HOOK() RUN_HOOK (apply)
#define RETURN_HOOK() RUN_HOOK (return)
#define NEXT_HOOK() RUN_HOOK (next)
#define ABORT_CONTINUATION_HOOK() RUN_HOOK (abort)
#define ABORT_HOOK() RUN_HOOK (abort)
@ -780,7 +780,7 @@ VM_NAME (scm_thread *thread)
intervening C frames to jump over, so we just continue
directly. */
ABORT_CONTINUATION_HOOK ();
ABORT_HOOK ();
if (mcode)
scm_jit_enter_mcode (thread, mcode);
@ -3025,7 +3025,7 @@ VM_NAME (scm_thread *thread)
}
#undef ABORT_CONTINUATION_HOOK
#undef ABORT_HOOK
#undef ALIGNED_P
#undef APPLY_HOOK
#undef BEGIN_DISPATCH_SWITCH