summaryrefslogtreecommitdiffstats
path: root/signal.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-05-22 07:38:34 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-05-22 07:38:34 -0700
commitd036239788b1825bfa05588d7f9ee379cd95fc54 (patch)
treeab26943583572b02c78c4c7d3c1ba8bc644cf69d /signal.h
parent43b371fa552149ad237fec114af4f4feb65fa5bf (diff)
downloadtxr-d036239788b1825bfa05588d7f9ee379cd95fc54.tar.gz
txr-d036239788b1825bfa05588d7f9ee379cd95fc54.tar.bz2
txr-d036239788b1825bfa05588d7f9ee379cd95fc54.zip
Ligher weight debug instrumentation.
This speeds up the TXR Lisp interpreter, because do_eval sets up a debug frame and uses debug_return. * debug.c (debug_block_s): Symbol removed. (debug_init): Remove initialization of debug_block_s. * debug.h (debug_block_s): Declaration removed. (debug_enter): Do not establish a named block or a catch block; no time-wasting unwind stack manipulation at all. The debug_depth variable is managed by the extended setjmp context now. Provide a return value variable, and a well-defined name to branch to to exit from the debug block. (debug_return): Do not use heavy-weight uw_block_return; simply set the return variable and branch to debug_return_out label. * signal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST, EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): New macros. (extended_jmp_buf): Define optional global state variables using EJ_OPT_MEMB. (extended_setjmp): Save and restore optional globals using EJ_OPT_SAVE and EJ_OPT_RESTORE. Now debug_depth is saved and restored if debugging support is compiled in. * match.c (open_data_source): Remove bogus debug_return invocations which were uncovered here by changes to the macro. * eval.c (do_eval, expand_macro): debug_return must now be after debug_end, because it won't dynamically clean up frames that it doesn't know about. The set_dyn_env is no longer unreachable in expand_macro; it is now necessary because debug_return isn't doing the longjmp that previously restored dyn_env.
Diffstat (limited to 'signal.h')
-rw-r--r--signal.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/signal.h b/signal.h
index 036475e7..4b942275 100644
--- a/signal.h
+++ b/signal.h
@@ -25,6 +25,21 @@
*/
+#if CONFIG_DEBUG_SUPPORT
+extern int debug_depth;
+#define EJ_DBG_MEMB int dbg_depth;
+#define EJ_DBG_SAVE(EJB) (EJB).dbg_depth = debug_depth,
+#define EJ_DBG_REST(EJB) debug_depth = (EJB).dbg_depth,
+#else
+#define EJ_DBG_MEMB
+#define EJ_DBG_SAVE(EJB)
+#define EJ_DBG_REST(EJB)
+#endif
+
+#define EJ_OPT_MEMB EJ_DBG_MEMB
+#define EJ_OPT_SAVE(EJB) EJ_DBG_SAVE(EJB)
+#define EJ_OPT_REST(EJB) EJ_DBG_REST(EJB)
+
#if HAVE_POSIX_SIGS
#define sig_save_enable \
@@ -62,6 +77,7 @@ typedef struct {
val de;
int gc;
val **gc_pt;
+ EJ_OPT_MEMB
int rv;
} extended_jmp_buf;
@@ -72,12 +88,14 @@ typedef struct {
gc_enabled = (EJB).gc, \
gc_prot_top = (EJB).gc_pt, \
sig_mask(SIG_SETMASK, &(EJB).blocked, 0), \
+ EJ_OPT_REST(EJB) \
(EJB).rv) \
: ((EJB).se = async_sig_enabled, \
(EJB).de = dyn_env, \
(EJB).gc = gc_enabled, \
(EJB).gc_pt = gc_prot_top, \
(EJB).blocked = sig_blocked_cache, \
+ EJ_OPT_SAVE(EJB) \
0))
#define extended_longjmp(EJB, ARG) \
@@ -99,6 +117,7 @@ typedef struct {
val de;
int gc;
val **gc_pt;
+ EJ_OPT_MEMB
int rv;
} extended_jmp_buf;
@@ -107,10 +126,12 @@ typedef struct {
? (dyn_env = (EJB).de, \
gc_enabled = ((EJB).gc), \
gc_prot_top = (EJB).gc_pt, \
+ EJ_OPT_REST(EJB) \
(EJB).rv) \
: ((EJB).de = dyn_env, \
(EJB).gc = gc_enabled, \
(EJB).gc_pt = gc_prot_top, \
+ EJ_OPT_SAVE(EJB) \
0))
#define extended_longjmp(EJB, ARG) \