summaryrefslogtreecommitdiff
path: root/libguile/vm-engine.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-12-21 21:57:20 +0100
committerAndy Wingo <wingo@pobox.com>2009-12-21 21:57:20 +0100
commit7656f194465ed50901c9cf3e31a68c3014b576ba (patch)
tree09e7dbdbc7d32d797ffff984e56e080de7713221 /libguile/vm-engine.h
parent86fd6dff2a77150148ed7b3d9152e0a431070666 (diff)
downloadguile-7656f194465ed50901c9cf3e31a68c3014b576ba.tar.gz
rework vm tracing
* libguile/vm-engine.c (VM_NAME): Engines take the VM itself (not the vp), so they can pass the VM to hooks. No more hook args, we dispatch without them. * libguile/vm-engine.h (RUN_HOOK): Dispatch the hook if the trace level is positive (instead of if the hook is there). Don't cache registers on return from the dispatch. * libguile/vm.h: * libguile/vm.c (vm_dispatch_hook): Don't bother with a dynwind; instead decrement the trace level when going into a hook, and if we have a nonlocal exit, the trace level never gets incremented again. Worse is better. (make_vm, scm_vm_trace_level, scm_set_vm_trace_level_x): New concept, trace level. If positive, we run the hooks, otherwise we don't. Should work. Removed scm_vm_trace_frame, I don't think that was the right way to do it. * module/system/vm/vm.scm: Replace vm-trace-frame with vm-trace-level and set-vm-trace-level!; the hooks actually get the frame as an argument now.
Diffstat (limited to 'libguile/vm-engine.h')
-rw-r--r--libguile/vm-engine.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/libguile/vm-engine.h b/libguile/vm-engine.h
index 949e9c473..2cce7344e 100644
--- a/libguile/vm-engine.h
+++ b/libguile/vm-engine.h
@@ -206,15 +206,14 @@
#undef RUN_HOOK
#if VM_USE_HOOKS
-#define RUN_HOOK(h) \
-{ \
- if (SCM_UNLIKELY (scm_is_true (vp->hooks[h])))\
- { \
- SYNC_REGISTER (); \
- vm_dispatch_hook (vp, vp->hooks[h], hook_args); \
- CACHE_REGISTER (); \
- } \
-}
+#define RUN_HOOK(h) \
+ { \
+ if (SCM_UNLIKELY (vp->trace_level > 0)) \
+ { \
+ SYNC_REGISTER (); \
+ vm_dispatch_hook (vm, h); \
+ } \
+ }
#else
#define RUN_HOOK(h)
#endif