From: Nikodemus S. <tsi...@cc...> - 2004-09-11 16:08:03
|
On Sun, 5 Sep 2004, David Lichteblau wrote: > * (with-simple-restart (ok "ok") > (labels ((doit () (doit))) (doit))) > Control stack guard page temporarily disabled: proceed with caution > debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread 22392: > Control stack exhausted (no more space for function call frames). This is probably due to heavily nested or infinitely recursive function calls, or a tail call that SBCL cannot or has not optimized away. > restarts (invokable by number or by possibly-abbreviated name): > 0: [OK ] ok > 1: [ABORT ] Reduce debugger level (leaving debugger, returning to toplevel). > 2: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop. > (SB-KERNEL::CONTROL-STACK-EXHAUSTED-ERROR 0)[:EXTERNAL] > 0] ok > * (with-simple-restart (ok "ok") > (labels ((doit () (doit))) (doit))) > > debugger invoked on a SIMPLE-ERROR in thread 22392: > segmentation violation at #X805ACC7 Apparently the issue is that selecting a user-provided restart doesn't re-protect the stack guard page, as that is done outside REPL-FUN. Moving the (sb!kernel::protect-control-stack-guard-page 1) to top of the loop in REPL-FUN seems to fix this. Unless someone can think of a reason why that would be a bad move, I'm going to commit something along those lines. sb-aclrepl needs the same treatment, which to me at least indicates that the REPL interface is sub-optimal: people writing alternate toplevels should not have to muck about with these details. Possibly the interface should be changed from *REPL-FUN-GENERATOR* to *REP-FUN-GENERATOR*, which would be called from a system-provided loop, with control-stack scrubbing and and page protection handled by the by the loop before each call to the generated rep-fun. Furthermore, as things stand *REPL-FUN-GENERATOR* is called only when TOPLEVEL-REPL is entered. Should it not also be called when the TOPLEVEL restart is selected? Cheers, -- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs." |