From d036239788b1825bfa05588d7f9ee379cd95fc54 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 22 May 2015 07:38:34 -0700 Subject: 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. --- match.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'match.c') diff --git a/match.c b/match.c index e4e7b119..562e1dfd 100644 --- a/match.c +++ b/match.c @@ -3859,16 +3859,16 @@ static void open_data_source(match_files_ctx *c) debuglf(spec, lit("opening data source ~a"), name, nao); if (complex_open_failed(fp)) { - if (consp(source_spec) && car(source_spec) == nothrow_k) { + if (consp(source_spec) && car(source_spec) == nothrow_k) debuglf(spec, lit("could not open ~a: " "treating as failed match due to nothrow"), name, nao); - debug_return (nil); - } else if (errno != 0) + else if (errno != 0) file_err(spec, lit("could not open ~a (error ~a/~a)"), name, num(errno), string_utf8(strerror(errno)), nao); else file_err(spec, lit("could not open ~a"), name, nao); - debug_return (nil); + c->data = nil; + return; } c->files = cons(name, cdr(c->files)); /* Get rid of cons and nothrow */ -- cgit v1.2.3