1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

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.
This commit is contained in:
Andy Wingo 2009-12-21 21:57:20 +01:00
parent 86fd6dff2a
commit 7656f19446
5 changed files with 46 additions and 40 deletions

View file

@ -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