diff options
author | Andy Wingo <wingo@pobox.com> | 2018-09-14 12:57:16 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-09-14 13:02:44 +0200 |
commit | 12b125f2ad6defe77de29cab6f54f367e07550c2 (patch) | |
tree | df8016189ad967aee3cb55d940ab7b752f96e49a /libguile/vm-engine.c | |
parent | 8bb9ae3b51aa5f16b6b364f5212c0f3a82136a2f (diff) | |
download | guile-12b125f2ad6defe77de29cab6f54f367e07550c2.tar.gz |
Hook refactors
* libguile/vm.h (SCM_VM_NUM_HOOKS): Remove hook enumeration.
(struct scm_vm): Re-arrange members to be more dense and to use common
cache lines for commonly-used members. Declare hooks and their enabled
flags by name.
* libguile/vm-engine.c (RUN_HOOK): Refer to hooks by name.
* libguile/vm.c (FOR_EACH_HOOK): New helper.
(vm_hook_compute_enabled, vm_recompute_disable_mcode): New routines to
recompute when hooks are enabled, and whether to disable mcode because
hooks are active.
(set_vm_trace_level): New helper.
(invoke_hook): Take hook to invoke by value.
(DEFINE_INVOKE_HOOK): Refactor to use named hooks.
(scm_i_vm_prepare_stack): Init named hooks.
(VM_ADD_HOOK, VM_REMOVE_HOOK): Refactor to use named hooks, and also
recompute global disable_mcode flag.
(scm_set_vm_trace_level_x, scm_c_set_vm_engine_x): Use internal helper.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r-- | libguile/vm-engine.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 7ce306caa..6ab5f2439 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -110,9 +110,9 @@ #endif #if VM_USE_HOOKS -#define RUN_HOOK(H, h) \ +#define RUN_HOOK(h) \ do { \ - if (SCM_UNLIKELY (VP->hooks_enabled[SCM_VM_##H##_HOOK])) \ + if (SCM_UNLIKELY (VP->h##_hook_enabled)) \ { \ SYNC_IP (); \ invoke_##h##_hook (thread); \ @@ -120,13 +120,13 @@ } \ } while (0) #else -#define RUN_HOOK(H, h) +#define RUN_HOOK(h) #endif -#define APPLY_HOOK() RUN_HOOK (APPLY, apply) -#define RETURN_HOOK() RUN_HOOK (RETURN, return) -#define NEXT_HOOK() RUN_HOOK (NEXT, next) -#define ABORT_HOOK() RUN_HOOK (ABORT, abort) +#define APPLY_HOOK() RUN_HOOK (apply) +#define RETURN_HOOK() RUN_HOOK (return) +#define NEXT_HOOK() RUN_HOOK (next) +#define ABORT_HOOK() RUN_HOOK (abort) |