Commit [959057] Maximize Restore History

0.pre7.29:

merged MNA EVAL-WHEN patch from sbcl-devel 2001-08-31 (doing
nothing at toplevel unless :EXECUTE)
rewrote the logic in the rest of the same EVAL-WHEN clause (not
trying to change its behavior, just to express it more
nicely)
The implementation of EVAL doesn't actually belong IN-PACKAGE
SB!BYTECODE. Put it in SB!IMPL instead.
deleted duplicate definition of SB-KERNEL:*EVAL-STACK-TOP*
moved definition of IGNORE-ERRORS src/code/macros (as
DEFMACRO-MUNDANELY at build-the-cross-compiler time) so
it can be used in target code in src/code/extensions
(although that turns out not to help, since it expands
into HANDLER-CASE, which wants to be defined later..)
added src/code/late-extensions.lisp to hold things like
LIST-WITH-LENGTH-P which want to have some of the
Lisp system set up before they're defined
renamed src/code/extensions.lisp to
src/code/early-extensions.lisp (since now there's
a corresponding late-extensions.lisp again)
moved POSITIVE-PRIMEP to src/code/late-extensions.lisp,
deleted src/code/numbers.lisp
limited POSITIVE-PRIMEP to FIXNUM and moved it to SB!INT
merged MNA "eval-when problems -- fix" patch from sbcl-devel
2001-09-01 (IR1-converting EVAL-WHEN (with no forms)
even in "the forms in the body are ignored" case,
instead of just skipping IR1 conversion completely
and leaving START and CONT dangling in the wind)
since I'm doing related filename and stems-and-flags cleanup
anyway..
..renamed src/code/early-target-error.lisp to
src/code/target-error.lisp
..renamed src/code/late-target-error.lisp to
src/code/condition.lisp

William Harold Newman William Harold Newman 2001-09-02

changed src/code/byte-interp.lisp
changed src/code/eval.lisp
changed src/code/macros.lisp
changed src/code/parse-defmacro-errors.lisp
changed src/compiler/globaldb.lisp
changed src/compiler/ir1tran.lisp
changed NEWS
changed clean.sh
changed package-data-list.lisp-expr
changed stems-and-flags.lisp-expr
changed version.lisp-expr
copied src/code/early-target-error.lisp -> src/code/target-error.lisp
copied src/code/extensions.lisp -> src/code/early-extensions.lisp
copied src/code/late-target-error.lisp -> src/code/condition.lisp
copied src/code/numbers.lisp -> src/code/late-extensions.lisp
src/code/byte-interp.lisp Diff Switch to side-by-side view
Loading...
src/code/eval.lisp Diff Switch to side-by-side view
Loading...
src/code/macros.lisp Diff Switch to side-by-side view
Loading...
src/code/parse-defmacro-errors.lisp Diff Switch to side-by-side view
Loading...
src/compiler/globaldb.lisp Diff Switch to side-by-side view
Loading...
src/compiler/ir1tran.lisp Diff Switch to side-by-side view
Loading...
NEWS Diff Switch to side-by-side view
Loading...
clean.sh Diff Switch to side-by-side view
Loading...
package-data-list.lisp-expr Diff Switch to side-by-side view
Loading...
stems-and-flags.lisp-expr Diff Switch to side-by-side view
Loading...
version.lisp-expr Diff Switch to side-by-side view
Loading...
src/code/early-target-error.lisp to src/code/target-error.lisp
--- a/src/code/early-target-error.lisp
+++ b/src/code/target-error.lisp
@@ -319,7 +319,7 @@
        ;; Wait for any float exceptions.
        #!+x86 (float-wait))))
 
-;;;; HANDLER-CASE and IGNORE-ERRORS
+;;;; HANDLER-CASE
 
 (defmacro handler-case (form &rest cases)
   "(HANDLER-CASE form
@@ -444,13 +444,6 @@
 				       (t
 					`(progn ,@body)))))))
 		   annotated-cases))))))))
-
-(defmacro ignore-errors (&rest forms)
-  #!+sb-doc
-  "Execute FORMS handling ERROR conditions, returning the result of the last
-  form, or (VALUES NIL the-ERROR-that-was-caught) if an ERROR was handled."
-  `(handler-case (progn ,@forms)
-     (error (condition) (values nil condition))))
 
 ;;;; helper functions for restartable error handling which couldn't be
 ;;;; defined 'til now 'cause they use the RESTART-CASE macro
src/code/extensions.lisp to src/code/early-extensions.lisp
--- a/src/code/extensions.lisp
+++ b/src/code/early-extensions.lisp
@@ -75,15 +75,14 @@
 
 ;;; a helper function for various macros which expect clauses of a
 ;;; given length, etc.
-;;;
-;;; FIXME: This implementation will hang on circular list structure.
-;;; Since this is an error-checking utility, i.e. its job is to deal
-;;; with screwed-up input, it'd be good style to fix it so that it can
-;;; deal with circular list structure.
 (eval-when (:compile-toplevel :load-toplevel :execute)
   ;; Return true if X is a proper list whose length is between MIN and
   ;; MAX (inclusive).
   (defun proper-list-of-length-p (x min &optional (max min))
+    ;; FIXME: This implementation will hang on circular list
+    ;; structure. Since this is an error-checking utility, i.e. its
+    ;; job is to deal with screwed-up input, it'd be good style to fix
+    ;; it so that it can deal with circular list structure.
     (cond ((minusp max)
 	   nil)
 	  ((null x)
@@ -114,6 +113,25 @@
   (or (zerop n) ; since anything can be considered an improper list of length 0
       (and (consp x)
 	   (list-of-length-at-least-p (cdr x) (1- n)))))
+
+;;; Is X is a positive prime integer? 
+(defun positive-primep (x)
+  ;; This happens to be called only from one place in sbcl-0.7.0, and
+  ;; only for fixnums, we can limit it to fixnums for efficiency. (And
+  ;; if we didn't limit it to fixnums, we should use a cleverer
+  ;; algorithm, since this one scales pretty badly for huge X.)
+  (declare (fixnum x))
+  (if (<= x 5)
+      (and (>= x 2) (/= x 4))
+      (and (not (evenp x))
+	   (not (zerop (rem x 3)))
+	   (do ((q 6)
+		(r 1)
+		(inc 2 (logxor inc 6)) ;; 2,4,2,4...
+		(d 5 (+ d inc)))
+	       ((or (= r 0) (> d q)) (/= r 0))
+	     (declare (fixnum inc))
+	     (multiple-value-setq (q r) (truncate x d))))))
 
 ;;;; the COLLECT macro
 ;;;;
src/code/numbers.lisp to src/code/late-extensions.lisp
--- a/src/code/numbers.lisp
+++ b/src/code/late-extensions.lisp
@@ -1,4 +1,8 @@
-;;;; numeric things needed within the cross-compiler
+;;;; various extensions (including SB-INT "internal extensions")
+;;;; available both in the cross-compilation host Lisp and in the
+;;;; target SBCL, but which can't be defined on the target until until
+;;;; some significant amount of machinery (e.g. error-handling) is
+;;;; defined
 
 ;;;; This software is part of the SBCL system. See the README file for
 ;;;; more information.
@@ -9,22 +13,9 @@
 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
 ;;;; files for more information.
 
-(in-package "SB!KERNEL")
+(in-package "SB!IMPL")
 
-;;; FIXME: This probably belongs in SB-INT instead of SB-KERNEL.
-;;; And couldn't it be limited to FIXNUM arguments?
-(defun positive-primep (x)
-  #!+sb-doc
-  "Returns T iff X is a positive prime integer."
-  (declare (integer x))
-  (if (<= x 5)
-      (and (>= x 2) (/= x 4))
-      (and (not (evenp x))
-	   (not (zerop (rem x 3)))
-	   (do ((q 6)
-		(r 1)
-		(inc 2 (logxor inc 6)) ;; 2,4,2,4...
-		(d 5 (+ d inc)))
-	       ((or (= r 0) (> d q)) (/= r 0))
-	     (declare (fixnum inc))
-	     (multiple-value-setq (q r) (truncate x d))))))
+;;; Is X a list for which LENGTH is meaningful, i.e. a list which is
+;;; not improper and which is not circular?
+(defun list-with-length-p (x)
+  (values (ignore-errors (list-length x))))