From 14aa25e410d49586c8ff9b4a80d2b6046b769905 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 3 Dec 2009 11:03:39 +0100 Subject: remove debug frames * libguile/debug.h (scm_t_debug_frame): Remove this type, as it was internal to the old evaluator. (SCM_EVALFRAME, SCM_APPLYFRAME, SCM_VOIDFRAME, SCM_MACROEXPF) (SCM_TAILREC, SCM_TRACED_FRAME, SCM_ARGS_READY, SCM_DOVERFLOW) (SCM_MAX_FRAME_SIZE, SCM_FRAMETYPE) (SCM_EVALFRAMEP, SCM_APPLYFRAMEP, SCM_VOIDFRAMEP, SCM_MACROEXPFP) (SCM_TAILRECP, SCM_TRACED_FRAME_P, SCM_ARGS_READY_P, SCM_OVERFLOWP) (SCM_SET_MACROEXP, SCM_SET_TAILREC, SCM_SET_TRACED_FRAME) (SCM_SET_ARGSREADY, SCM_SET_OVERFLOW) (SCM_CLEAR_MACROEXP, SCM_CLEAR_TRACED_FRAME, SCM_CLEAR_ARGSREADY): Remove macro accessors to scm_t_debug_frame. (SCM_DEBUGOBJP, SCM_DEBUGOBJ_FRAME, SCM_SET_DEBUGOBJ_FRAME): (scm_debug_object_p, scm_make_debugobj): Remove debugobj accessors. (scm_i_unmemoize_expr): Remove unused declaration. * libguile/debug.c (scm_debug_options): No more max limit on frame sizes. (scm_start_stack): Just call out to scm_vm_call_with_new_stack. (scm_debug_object_p, scm_make_debugobj, scm_init_debug): No more debugobj smob type. * libguile/deprecated.h: * libguile/deprecated.c (scm_i_deprecated_last_debug_frame) (scm_last_debug_frame): Remove deprecated debug-frame bits. * libguile/stacks.c (scm_make_stack): Rework this function and its dependents to only walk VM frames. (scm_stack_id): Call out to the holder of the VM frame in question, which should be a VM or a VM continuation, for the stack ID. Currently this bit is stubbed out. (scm_last_stack_frame): Removed. It seems this is mainly useful for a debugger, and we need to rewrite the debugger to work on the Scheme level. * test-suite/tests/continuations.test ("continuations"): Remove test for last-stack-frame. * libguile/continuations.h (struct scm_t_contregs): * libguile/continuations.c (scm_make_continuation): (copy_stack_and_call, scm_i_with_continuation_barrier): No need to save and restore debug frames. * libguile/threads.h (scm_i_thread): Don't track debug frames. (scm_i_last_debug_frame, scm_i_set_last_debug_frame): Remove macro accessors. * libguile/threads.c (guilify_self_1): Don't track debug frames. * libguile/throw.c: No need to track debug frames in a jmpbuf. * libguile/vm-engine.c (vm_engine, VM_PUSH_DEBUG_FRAMES): Don't push debug frames. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): New function. Currently stubbed out though. --- libguile/debug.c | 50 +++----------------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) (limited to 'libguile/debug.c') diff --git a/libguile/debug.c b/libguile/debug.c index f0dd29a0a..91eef165b 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -49,6 +49,7 @@ #include "libguile/fluids.h" #include "libguile/programs.h" #include "libguile/memoize.h" +#include "libguile/vm.h" #include "libguile/validate.h" #include "libguile/debug.h" @@ -73,7 +74,7 @@ SCM_DEFINE (scm_debug_options, "debug-options-interface", 0, 1, 0, scm_dynwind_critical_section (SCM_BOOL_F); ans = scm_options (setting, scm_debug_opts, FUNC_NAME); - if (!(1 <= SCM_N_FRAMES && SCM_N_FRAMES <= SCM_MAX_FRAME_SIZE)) + if (SCM_N_FRAMES < 1) { scm_options (ans, scm_debug_opts, FUNC_NAME); SCM_OUT_OF_RANGE (1, setting); @@ -246,52 +247,10 @@ SCM_DEFINE (scm_sys_start_stack, "%start-stack", 2, 0, 0, "Call @var{thunk} on an evaluator stack tagged with @var{id}.") #define FUNC_NAME s_scm_sys_start_stack { - SCM answer; - scm_t_debug_frame vframe; - scm_t_debug_info vframe_vect_body; - vframe.prev = scm_i_last_debug_frame (); - vframe.status = SCM_VOIDFRAME; - vframe.vect = &vframe_vect_body; - vframe.vect[0].id = id; - scm_i_set_last_debug_frame (&vframe); - answer = scm_call_0 (thunk); - scm_i_set_last_debug_frame (vframe.prev); - return answer; + return scm_vm_call_with_new_stack (scm_the_vm (), thunk, id); } #undef FUNC_NAME -/* {Debug Objects} - * - * The debugging evaluator throws these on frame traps. - */ - -scm_t_bits scm_tc16_debugobj; - -static int -debugobj_print (SCM obj, SCM port, scm_print_state *pstate SCM_UNUSED) -{ - scm_puts ("#', port); - return 1; -} - -SCM_DEFINE (scm_debug_object_p, "debug-object?", 1, 0, 0, - (SCM obj), - "Return @code{#t} if @var{obj} is a debug object.") -#define FUNC_NAME s_scm_debug_object_p -{ - return scm_from_bool(SCM_DEBUGOBJP (obj)); -} -#undef FUNC_NAME - - -SCM -scm_make_debugobj (scm_t_debug_frame *frame) -{ - return scm_cell (scm_tc16_debugobj, (scm_t_bits) frame); -} - /* Undocumented debugging procedure */ @@ -337,9 +296,6 @@ scm_init_debug () init_stack_limit (); scm_init_opts (scm_debug_options, scm_debug_opts); - scm_tc16_debugobj = scm_make_smob_type ("debug-object", 0); - scm_set_smob_print (scm_tc16_debugobj, debugobj_print); - scm_add_feature ("debug-extensions"); #include "libguile/debug.x" -- cgit v1.2.3