From: William Harold Newman Date: Thu, 7 Feb 2002 23:33:50 +0000 (+0000) Subject: 0.7.1.14: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=85f9c92558538b85540ff420fa8970af91e241a2;p=sbcl.git 0.7.1.14: wrote and used wrapped_environ() to try to break the cycle of abuse made TAIL-ANNOTATE suppress tail calls unless DEBUG optimization has a low priority --- diff --git a/NEWS b/NEWS index d0b5a6f..73e0a38 100644 --- a/NEWS +++ b/NEWS @@ -1005,13 +1005,18 @@ changes in sbcl-0.7.1 relative to sbcl-0.7.0: file format number to change again. changes in sbcl-0.7.2 relative to sbcl-0.7.1: - ?? incompatible change: The compiler is now less aggressive about - tail call optimization, doing it only when (> SPACE DEBUG). (This - is an incompatible change because there are programs which depended - on the old CMU-CL-style behavior to optimize away their unbounded - recursion which will now die of stack overflow.) + * incompatible change: The compiler is now less aggressive about + tail call optimization, doing it only when (> SPACE DEBUG) or + (> SPEED DEBUG). (This is an incompatible change because there are + programs which relied on the old CMU-CL-style behavior to optimize + away their unbounded recursion which will now die of stack overflow.) + * bug fixes: + ** The system now hunts for the C variable "environ" in a more + devious way, to avoid segfaults when the C library version + differs between compile time and run time. (thanks to Christophe + Rhodes) * several changes related to debugging: - ?? suppression of tail recursion, as noted above + ** suppression of tail recursion, as noted above ** The default implementation of TRACE has changed. :ENCAPSULATE T is now the default. (For some time encapsulation has been more reliable than the breakpoint-based :ENCAPSULATE NIL diff --git a/src/code/inspect.lisp b/src/code/inspect.lisp index 2fe8ca2..f143295 100644 --- a/src/code/inspect.lisp +++ b/src/code/inspect.lisp @@ -41,7 +41,7 @@ evaluated expressions. ") (defun %inspect (*inspected* s) - (named-let redisplay () ; "lambda, the ultimate GOTO":-| + (named-let redisplay () ; "LAMBDA, the ultimate GOTO":-| (multiple-value-bind (description named-p elements) (inspected-parts *inspected*) (tty-display-inspected-parts description named-p elements s) diff --git a/src/code/run-program.lisp b/src/code/run-program.lisp index 9bd487d..286fdc6 100644 --- a/src/code/run-program.lisp +++ b/src/code/run-program.lisp @@ -45,26 +45,10 @@ ;;;; which (at least in sbcl-0.6.10 on Red Hat Linux 6.2) is not ;;;; visible at GENESIS time. -(define-alien-variable "environ" (* c-string)) -(push (lambda () - ;; We redo this here to protect ourselves from this scenario: - ;; * Build under one version of shared lib, save a core. - ;; * Load core under another version of shared lib. ("Now - ;; where was environ again?" SIGSEGV, etc.) - ;; Obviously it's a KLUDGE to do this hack for every alien - ;; variable, but as it happens, as of sbcl-0.7.0 this is the - ;; only alien variable used to implement SBCL, so it's not - ;; worth coming up with a general solution. (A general - ;; solution would be nice for users who want to have their - ;; alien code be preserved across a save/load cycle, but this - ;; problem with alien variables is only one of several - ;; problems which'd need to be solved before that can happen.) - (define-alien-variable "environ" (* c-string))) - *after-save-initializations*) - +(define-alien-routine wrapped-environ (* c-string)) (defun posix-environ () "Return the Unix environment (\"man environ\") as a list of SIMPLE-STRINGs." - (c-strings->string-list environ)) + (c-strings->string-list (wrapped-environ))) ;;; Convert as best we can from a SBCL representation of a Unix ;;; environment to a CMU CL representation. @@ -108,7 +92,7 @@ ;;;; Import wait3(2) from Unix. -(sb-alien:define-alien-routine ("wait3" c-wait3) sb-alien:int +(define-alien-routine ("wait3" c-wait3) sb-alien:int (status sb-alien:int :out) (options sb-alien:int) (rusage sb-alien:int)) @@ -202,12 +186,12 @@ #-hpux ;;; Find the current foreground process group id. (defun find-current-foreground-process (proc) - (sb-alien:with-alien ((result sb-alien:int)) + (with-alien ((result sb-alien:int)) (multiple-value-bind (wonp error) (sb-unix:unix-ioctl (sb-sys:fd-stream-fd (process-pty proc)) sb-unix:TIOCGPGRP - (sb-alien:alien-sap (sb-alien:addr result))) + (alien-sap (sb-alien:addr result))) (unless wonp (error "TIOCPGRP ioctl failed: ~S" (strerror error))) result)) diff --git a/src/cold/warm.lisp b/src/cold/warm.lisp index 7a615fc..05c7539 100644 --- a/src/cold/warm.lisp +++ b/src/cold/warm.lisp @@ -27,17 +27,18 @@ ;;;; do belong in cold load and will hopefully make it back there reasonably ;;;; soon). -- WHN 19991207 -(dolist (stem '(;; FIXME: The files here from outside the src/pcl directory - ;; probably belong in cold load instead of warm load. They - ;; ended up here as a quick hack to work around the - ;; consequences of my misunderstanding how ASSEMBLE-FILE works - ;; when I wrote the cold build code. The cold build code - ;; expects only one FASL filename per source file, when it - ;; turns out we really need one FASL file for ASSEMBLE-FILE - ;; output and another for COMPILE-FILE output. It would - ;; probably be good to redo the cold build code so that the - ;; COMPILE-FILE stuff generated here can be loaded at the same - ;; time as the ASSEMBLE-FILE stuff generated there. +(dolist (stem '(;; FIXME: The assembly files here probably belong in + ;; cold load instead of warm load. They ended up here + ;; as a quick hack to work around the consequences of + ;; my misunderstanding how ASSEMBLE-FILE works when I + ;; wrote the cold build code. The cold build code + ;; expects only one FASL filename per source file, + ;; when it turns out we really need one FASL file for + ;; ASSEMBLE-FILE output and another for COMPILE-FILE + ;; output. It would probably be good to redo the cold + ;; build code so that the COMPILE-FILE stuff generated + ;; here can be loaded at the same time as the + ;; ASSEMBLE-FILE stuff generated there. "src/assembly/target/assem-rtns" "src/assembly/target/array" "src/assembly/target/arith" diff --git a/src/compiler/physenvanal.lisp b/src/compiler/physenvanal.lisp index ef0257f..120133f 100644 --- a/src/compiler/physenvanal.lisp +++ b/src/compiler/physenvanal.lisp @@ -402,20 +402,29 @@ (emit-cleanups block1 block2))))))) (values)) -;;; Mark all tail-recursive uses of function result continuations with -;;; the corresponding TAIL-SET. Nodes whose type is NIL (i.e. don't -;;; return) such as calls to ERROR are never annotated as tail in -;;; order to preserve debugging information. +;;; Mark optimizable tail-recursive uses of function result continuations with +;;; the corresponding TAIL-SET. (defun tail-annotate (component) (declare (type component component)) (dolist (fun (component-lambdas component)) (let ((ret (lambda-return fun))) + ;; Nodes whose type is NIL (i.e. don't return) such as calls to + ;; ERROR are never annotated as TAIL-P, in order to preserve + ;; debugging information. + ;; + ;; FIXME: It might be better to add another DEFKNOWN property + ;; (e.g. NO-TAIL-RECURSION) and use it for error-handling + ;; functions like ERROR, instead of spreading this special case + ;; net so widely. (when ret (let ((result (return-result ret))) (do-uses (use result) - (when (and (immediately-used-p result use) + (when (and (policy use + (or (> space debug) + (> speed debug))) + (immediately-used-p result use) (or (not (eq (node-derived-type use) *empty-type*)) (not (basic-combination-p use)) (eq (basic-combination-kind use) :local))) - (setf (node-tail-p use) t))))))) + (setf (node-tail-p use) t))))))) (values)) diff --git a/src/runtime/wrap.c b/src/runtime/wrap.c index 1331e6d..c7c878c 100644 --- a/src/runtime/wrap.c +++ b/src/runtime/wrap.c @@ -31,10 +31,13 @@ #include #include - #include "runtime.h" #include "sbcl.h" #include "util.h" + +/* KLUDGE: Neither the OpenBSD nor the Linux man page give a header + * file to find this in (?). -- WHN 2002-02-07 */ +extern char **environ; /* * stuff needed by CL:DIRECTORY and other Lisp directory operations @@ -250,3 +253,17 @@ uid_username(int uid) return 0; } } + +/* + * functions to get miscellaneous C-level variables + * + * (Doing this by calling functions lets us borrow the smarts of the C + * linker, so that things don't blow up when libc versions and thus + * variable locations change between compile time and run time.) + */ + +char ** +wrapped_environ() +{ + return environ; +} diff --git a/version.lisp-expr b/version.lisp-expr index 8d0c3cb..72adcb0 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.1.13" +"0.7.1.14"