[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 12/13: Microoptimizations to hook dispatch
From: |
Andy Wingo |
Subject: |
[Guile-commits] 12/13: Microoptimizations to hook dispatch |
Date: |
Wed, 27 Jun 2018 14:00:13 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 2a8d72f7e0f54037f7d9200f48ee8c91d13e5b75
Author: Andy Wingo <address@hidden>
Date: Wed Jun 27 19:26:03 2018 +0200
Microoptimizations to hook dispatch
* libguile/vm.c (vm_dispatch_hook): Add a check that we're in the debug
engine and the trace level is positive. Allows us to do cheaper
checks for when to dispatch hooks.
(scm_call_n): Just check if trace level is nonzero.
* libguile/vm-engine.c (RUN_HOOK): Likewise just check if trace level is
nonzero.
---
libguile/vm-engine.c | 2 +-
libguile/vm.c | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index b0a5ca7..d08ebbb 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -112,7 +112,7 @@
#if VM_USE_HOOKS
#define RUN_HOOK(exp) \
do { \
- if (SCM_UNLIKELY (VP->trace_level > 0)) \
+ if (SCM_UNLIKELY (VP->trace_level)) \
{ \
SYNC_IP (); \
exp; \
diff --git a/libguile/vm.c b/libguile/vm.c
index cb23535..7720afa 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -216,6 +216,9 @@ vm_dispatch_hook (scm_thread *thread, int hook_num, int n)
int saved_trace_level;
uint8_t saved_compare_result;
+ if (vp->trace_level <= 0 || vp->engine != SCM_VM_DEBUG_ENGINE)
+ return;
+
hook = vp->hooks[hook_num];
if (SCM_LIKELY (scm_is_false (hook))
@@ -1418,7 +1421,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
{
scm_gc_after_nonlocal_exit ();
/* Non-local return. */
- if (vp->engine == SCM_VM_DEBUG_ENGINE && vp->trace_level > 0)
+ if (vp->trace_level)
vm_dispatch_abort_hook (thread);
}
else
@@ -1429,7 +1432,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
/* FIXME: Make this return an IP. */
apply_non_program (thread);
- if (vp->engine == SCM_VM_DEBUG_ENGINE && vp->trace_level > 0)
+ if (vp->trace_level)
vm_dispatch_apply_hook (thread);
}
- [Guile-commits] branch master updated (7883290 -> 593e2db), Andy Wingo, 2018/06/27
- [Guile-commits] 01/13: allocate-words intrinsic, Andy Wingo, 2018/06/27
- [Guile-commits] 04/13: Intrinsic for "prompt", Andy Wingo, 2018/06/27
- [Guile-commits] 07/13: Refactor handling of active VM registers, Andy Wingo, 2018/06/27
- [Guile-commits] 05/13: bind-rest inst uses cons-rest intrinsic, Andy Wingo, 2018/06/27
- [Guile-commits] 11/13: Minor optimizations to debug hook dispatch, Andy Wingo, 2018/06/27
- [Guile-commits] 02/13: Compile current-module as intrinsic call, Andy Wingo, 2018/06/27
- [Guile-commits] 12/13: Microoptimizations to hook dispatch,
Andy Wingo <=
- [Guile-commits] 13/13: Refactor hook dispatch in VM, Andy Wingo, 2018/06/27
- [Guile-commits] 09/13: Intrinsics take registers from thread, Andy Wingo, 2018/06/27
- [Guile-commits] 06/13: Use CALL_INTRINSICS helper in VM, Andy Wingo, 2018/06/27
- [Guile-commits] 08/13: Minor scm_thread refactoring, Andy Wingo, 2018/06/27
- [Guile-commits] 03/13: Remove dedicated current-module instruction., Andy Wingo, 2018/06/27
- [Guile-commits] 10/13: Remove "resume" arg from vm engine, Andy Wingo, 2018/06/27