Skip to content

Commit

Permalink
0.pre7.135:
Browse files Browse the repository at this point in the history
	DO-FOO should be used for iteration names, not other things...
	...s/do-assembly/emit-assembly-code-not-vops-p/
	...s/do-truncate/return-quotient-leaving-remainder/
	...s/do-constant-bit-bash/constant-bit-bash/
	...s/do-unary-bit-bash/unary-bit-bash/
	...s/do-do-body/frob-do-body/
	...s/do-dd-inclusion-stuff/frob-dd-inclusion-stuff/
	...s/do-output/frob-output/
	...s/do-input/frob-input/
	...s/do-old-rename/rename-the-old-one/
	...s/do-load-verbose/maybe-announce-load/
	...s/do-nothing/no-op-placeholder/
	...s/do-pending-interrupt/receive-pending-interrupt/
	...s/do-load-time-code-fixup/envector-load-time-code-fixup/
	...s/do-type-warning/emit-type-warning/
	...s/do-the-stuff/ir1ize-the-or-values/
	...I'm not sure enough about behavior of VOP names to mess with
		DO-MAKE-VALUE-CELL immediately, but at least I can
		rename the MAKE-VALUE-CELL event to MAKE-VALUE-CELL-EVENT
		to start to untangle the names here.
	...s/do-save-p-stuff/conflictize-save-p-vop/
	...s/do-coerce-efficiency-note/maybe-emit-coerce-efficiency-note/
	...s/do-offs-hooks/call-offs-hooks/
	...s/do-fun-hooks/call-fun-hooks/
	...s/do-short-method-combination/short-combine-methods/
	...s/do-tests/run-tests/
	fixed dumb oversight in debug.impure.lisp
  • Loading branch information
William Harold Newman committed Jan 15, 2002
1 parent 66187cb commit 0830796
Show file tree
Hide file tree
Showing 30 changed files with 158 additions and 138 deletions.
2 changes: 1 addition & 1 deletion doc/compiler.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ gives this error:
(DO ((CURRENT L #) (# NIL)) (WHEN (EQ # E) (RETURN CURRENT)) )
caught ERROR: (during macroexpansion)

error in function LISP::DO-DO-BODY:
error in function LISP::FROB-DO-BODY:
DO step variable is not a symbol: (ATOM CURRENT)</screen>
</para>

Expand Down
2 changes: 1 addition & 1 deletion package-data-list.lisp-expr
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ SB-KERNEL) have been undone, but probably more remain."
"DEALLOCATE-SYSTEM-MEMORY"
"DEFAULT-INTERRUPT"
"DEPORT-BOOLEAN" "DEPORT-INTEGER"
"DO-DO-BODY" "DOUBLE-FLOAT-RADIX"
"FROB-DO-BODY" "DOUBLE-FLOAT-RADIX"
"ENABLE-INTERRUPT" "ENUMERATION"
"FD-STREAM" "FD-STREAM-FD"
"FD-STREAM-P"
Expand Down
6 changes: 3 additions & 3 deletions src/assembly/assemfile.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(in-package "SB!C")

;;; If non-NIL, emit assembly code. If NIL, emit VOP templates.
(defvar *do-assembly* nil)
(defvar *emit-assembly-code-not-vops-p* nil)

;;; a list of (NAME . LABEL) for every entry point
(defvar *entry-points* nil)
Expand All @@ -31,7 +31,7 @@
(output-file (make-pathname :defaults name
:type "assem")))
;; FIXME: Consider nuking the filename defaulting logic here.
(let* ((*do-assembly* t)
(let* ((*emit-assembly-code-not-vops-p* t)
(name (pathname name))
;; the fasl file currently being output to
(lap-fasl-output (open-fasl-output (pathname output-file) name))
Expand Down Expand Up @@ -191,6 +191,6 @@
(values (car name&options)
(cdr name&options)))
(let ((regs (mapcar (lambda (var) (apply #'parse-reg-spec var)) vars)))
(if *do-assembly*
(if *emit-assembly-code-not-vops-p*
(emit-assemble name options regs code)
(emit-vop name options regs)))))
2 changes: 1 addition & 1 deletion src/code/ansi-stream.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
(sout #'ill-out :type function) ; string output function

;; other, less-used methods
(misc #'do-nothing :type function))
(misc #'no-op-placeholder :type function))

(def!method print-object ((x ansi-stream) stream)
(print-unreadable-object (x stream :type t :identity t)))
73 changes: 42 additions & 31 deletions src/code/bignum.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,12 +1702,13 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
(defvar *truncate-x*)
(defvar *truncate-y*)

;;; This divides x by y returning the quotient and remainder. In the general
;;; case, we shift y to setup for the algorithm, and we use two buffers to save
;;; consing intermediate values. X gets destructively modified to become the
;;; remainder, and we have to shift it to account for the initial Y shift.
;;; After we multiple bind q and r, we first fix up the signs and then return
;;; the normalized results.
;;; Divide X by Y returning the quotient and remainder. In the
;;; general case, we shift Y to set up for the algorithm, and we use
;;; two buffers to save consing intermediate values. X gets
;;; destructively modified to become the remainder, and we have to
;;; shift it to account for the initial Y shift. After we multiple
;;; bind q and r, we first fix up the signs and then return the
;;; normalized results.
(defun bignum-truncate (x y)
(declare (type bignum-type x y))
(let* ((x-plusp (%bignum-0-or-plusp x (%bignum-length x)))
Expand All @@ -1730,8 +1731,10 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
(*truncate-y* (1+ len-y)))
(let ((y-shift (shift-y-for-truncate y)))
(shift-and-store-truncate-buffers x len-x y len-y y-shift)
(values (do-truncate len-x+1 len-y)
;; DO-TRUNCATE must execute first.
(values (return-quotient-leaving-remainder len-x+1 len-y)
;; Now that RETURN-QUOTIENT-LEAVING-REMAINDER
;; has executed, we just tidy up the remainder
;; (in *TRUNCATE-X*) and return it.
(cond
((zerop y-shift)
(let ((res (%allocate-bignum len-y)))
Expand Down Expand Up @@ -1760,13 +1763,15 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
rem
(%normalize-bignum rem (%bignum-length rem))))))))

;;; This divides x by y when y is a single bignum digit. BIGNUM-TRUNCATE fixes
;;; up the quotient and remainder with respect to sign and normalization.
;;; Divide X by Y when Y is a single bignum digit. BIGNUM-TRUNCATE
;;; fixes up the quotient and remainder with respect to sign and
;;; normalization.
;;;
;;; We don't have to worry about shifting y to make its most significant digit
;;; sufficiently large for %FLOOR to return 32-bit quantities for the q-digit
;;; and r-digit. If y is a single digit bignum, it is already large enough
;;; for %FLOOR. That is, it has some bits on pretty high in the digit.
;;; We don't have to worry about shifting Y to make its most
;;; significant digit sufficiently large for %FLOOR to return 32-bit
;;; quantities for the q-digit and r-digit. If Y is a single digit
;;; bignum, it is already large enough for %FLOOR. That is, it has
;;; some bits on pretty high in the digit.
(defun bignum-truncate-single-digit (x len-x y)
(declare (type bignum-index len-x))
(let ((q (%allocate-bignum len-x))
Expand All @@ -1783,14 +1788,18 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
(setf (%bignum-ref rem 0) r)
(values q rem))))

;;; This divides *truncate-x* by *truncate-y*, and len-x and len-y tell us how
;;; much of the buffers we care about. TRY-BIGNUM-TRUNCATE-GUESS modifies
;;; *truncate-x* on each interation, and this buffer becomes our remainder.
;;; a helper function for BIGNUM-TRUNCATE
;;;
;;; *truncate-x* definitely has at least three digits, and it has one more than
;;; *truncate-y*. This keeps i, i-1, i-2, and low-x-digit happy. Thanks to
;;; SHIFT-AND-STORE-TRUNCATE-BUFFERS.
(defun do-truncate (len-x len-y)
;;; Divide *TRUNCATE-X* by *TRUNCATE-Y*, returning the quotient
;;; and destructively modifying *TRUNCATE-X* so that it holds
;;; the remainder.
;;;
;;; LEN-X and LEN-Y tell us how much of the buffers we care about.
;;;
;;; *TRUNCATE-X* definitely has at least three digits, and it has one
;;; more than *TRUNCATE-Y*. This keeps i, i-1, i-2, and low-x-digit
;;; happy. Thanks to SHIFT-AND-STORE-TRUNCATE-BUFFERS.
(defun return-quotient-leaving-remainder (len-x len-y)
(declare (type bignum-index len-x len-y))
(let* ((len-q (- len-x len-y))
;; Add one for extra sign digit in case high bit is on.
Expand All @@ -1807,7 +1816,7 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
(loop
(setf (%bignum-ref q k)
(try-bignum-truncate-guess
;; This modifies *truncate-x*. Must access elements each pass.
;; This modifies *TRUNCATE-X*. Must access elements each pass.
(bignum-truncate-guess y1 y2
(%bignum-ref *truncate-x* i)
(%bignum-ref *truncate-x* i-1)
Expand All @@ -1819,15 +1828,17 @@ IS LESS EFFICIENT BUT EASIER TO MAINTAIN. BILL SAYS THIS CODE CERTAINLY WORKS!
(shiftf i i-1 i-2 (1- i-2)))))
q))

;;; This takes a digit guess, multiplies it by *truncate-y* for a result one
;;; greater in length than len-y, and subtracts this result from *truncate-x*.
;;; Low-x-digit is the first digit of x to start the subtraction, and we know x
;;; is long enough to subtract a len-y plus one length bignum from it. Next we
;;; check the result of the subtraction, and if the high digit in x became
;;; negative, then our guess was one too big. In this case, return one less
;;; than guess passed in, and add one value of y back into x to account for
;;; subtracting one too many. Knuth shows that the guess is wrong on the order
;;; of 3/b, where b is the base (2 to the digit-size power) -- pretty rarely.
;;; This takes a digit guess, multiplies it by *TRUNCATE-Y* for a
;;; result one greater in length than LEN-Y, and subtracts this result
;;; from *TRUNCATE-X*. LOW-X-DIGIT is the first digit of X to start
;;; the subtraction, and we know X is long enough to subtract a LEN-Y
;;; plus one length bignum from it. Next we check the result of the
;;; subtraction, and if the high digit in X became negative, then our
;;; guess was one too big. In this case, return one less than GUESS
;;; passed in, and add one value of Y back into X to account for
;;; subtracting one too many. Knuth shows that the guess is wrong on
;;; the order of 3/b, where b is the base (2 to the digit-size power)
;;; -- pretty rarely.
(defun try-bignum-truncate-guess (guess len-y low-x-digit)
(declare (type bignum-index low-x-digit len-y)
(type bignum-element-type guess))
Expand Down
42 changes: 21 additions & 21 deletions src/code/bit-bash.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@
(optimize (speed 3) (safety 0) (inhibit-warnings 3)))
(setf (sap-ref-32 sap (the index (ash offset 2))) value))

;;;; DO-CONSTANT-BIT-BASH
;;;; CONSTANT-BIT-BASH

;;; Fill DST with VALUE starting at DST-OFFSET and continuing for
;;; LENGTH bits.
#!-sb-fluid (declaim (inline do-constant-bit-bash))
(defun do-constant-bit-bash (dst dst-offset length value dst-ref-fn dst-set-fn)
#!-sb-fluid (declaim (inline constant-bit-bash))
(defun constant-bit-bash (dst dst-offset length value dst-ref-fn dst-set-fn)
(declare (type offset dst-offset) (type unit value)
(type function dst-ref-fn dst-set-fn))
(multiple-value-bind (dst-word-offset dst-bit-offset)
Expand Down Expand Up @@ -181,11 +181,11 @@
mask)))))))))
(values))

;;;; DO-UNARY-BIT-BASH
;;;; UNARY-BIT-BASH

#!-sb-fluid (declaim (inline do-unary-bit-bash))
(defun do-unary-bit-bash (src src-offset dst dst-offset length
dst-ref-fn dst-set-fn src-ref-fn)
#!-sb-fluid (declaim (inline unary-bit-bash))
(defun unary-bit-bash (src src-offset dst dst-offset length
dst-ref-fn dst-set-fn src-ref-fn)
;; FIXME: Declaring these bit indices to be of type OFFSET, then
;; using the inline expansion in SPEED 3 SAFETY 0 functions, is not
;; a good thing. At the very least, we should make sure that the
Expand Down Expand Up @@ -448,24 +448,24 @@
(declare (type unit value) (type offset dst-offset length))
(locally
(declare (optimize (speed 3) (safety 0)))
(do-constant-bit-bash dst dst-offset length value
#'%raw-bits #'%set-raw-bits)))
(constant-bit-bash dst dst-offset length value
#'%raw-bits #'%set-raw-bits)))

(defun system-area-fill (value dst dst-offset length)
(declare (type unit value) (type offset dst-offset length))
(locally
(declare (optimize (speed 3) (safety 0)))
(multiple-value-bind (dst dst-offset) (fix-sap-and-offset dst dst-offset)
(do-constant-bit-bash dst dst-offset length value
#'word-sap-ref #'%set-word-sap-ref))))
(constant-bit-bash dst dst-offset length value
#'word-sap-ref #'%set-word-sap-ref))))

(defun bit-bash-copy (src src-offset dst dst-offset length)
(declare (type offset src-offset dst-offset length))
(locally
(declare (optimize (speed 3) (safety 0))
(inline do-unary-bit-bash))
(do-unary-bit-bash src src-offset dst dst-offset length
#'%raw-bits #'%set-raw-bits #'%raw-bits)))
(inline unary-bit-bash))
(unary-bit-bash src src-offset dst dst-offset length
#'%raw-bits #'%set-raw-bits #'%raw-bits)))

(defun system-area-copy (src src-offset dst dst-offset length)
(declare (type offset src-offset dst-offset length))
Expand All @@ -475,25 +475,25 @@
(declare (type system-area-pointer src))
(multiple-value-bind (dst dst-offset) (fix-sap-and-offset dst dst-offset)
(declare (type system-area-pointer dst))
(do-unary-bit-bash src src-offset dst dst-offset length
#'word-sap-ref #'%set-word-sap-ref
#'word-sap-ref)))))
(unary-bit-bash src src-offset dst dst-offset length
#'word-sap-ref #'%set-word-sap-ref
#'word-sap-ref)))))

(defun copy-to-system-area (src src-offset dst dst-offset length)
(declare (type offset src-offset dst-offset length))
(locally
(declare (optimize (speed 3) (safety 0)))
(multiple-value-bind (dst dst-offset) (fix-sap-and-offset dst dst-offset)
(do-unary-bit-bash src src-offset dst dst-offset length
#'word-sap-ref #'%set-word-sap-ref #'%raw-bits))))
(unary-bit-bash src src-offset dst dst-offset length
#'word-sap-ref #'%set-word-sap-ref #'%raw-bits))))

(defun copy-from-system-area (src src-offset dst dst-offset length)
(declare (type offset src-offset dst-offset length))
(locally
(declare (optimize (speed 3) (safety 0)))
(multiple-value-bind (src src-offset) (fix-sap-and-offset src src-offset)
(do-unary-bit-bash src src-offset dst dst-offset length
#'%raw-bits #'%set-raw-bits #'word-sap-ref))))
(unary-bit-bash src src-offset dst dst-offset length
#'%raw-bits #'%set-raw-bits #'word-sap-ref))))

;;; a common idiom for calling COPY-TO-SYSTEM-AREA
;;;
Expand Down
8 changes: 4 additions & 4 deletions src/code/cold-init.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@
(svref *!load-time-values* (third toplevel-thing)))))
#!+(and x86 gencgc)
(:load-time-code-fixup
(sb!vm::!do-load-time-code-fixup (second toplevel-thing)
(third toplevel-thing)
(fourth toplevel-thing)
(fifth toplevel-thing)))
(sb!vm::!envector-load-time-code-fixup (second toplevel-thing)
(third toplevel-thing)
(fourth toplevel-thing)
(fifth toplevel-thing)))
(t
(!cold-lose "bogus fixup code in *!REVERSED-COLD-TOPLEVELS*"))))
(t (!cold-lose "bogus function in *!REVERSED-COLD-TOPLEVELS*")))))
Expand Down
10 changes: 5 additions & 5 deletions src/code/defboot.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@

;;;; iteration constructs

;;; (These macros are defined in terms of a function DO-DO-BODY which
;;; (These macros are defined in terms of a function FROB-DO-BODY which
;;; is also used by SB!INT:DO-ANONYMOUS. Since these macros should not
;;; be loaded on the cross-compilation host, but SB!INT:DO-ANONYMOUS
;;; and DO-DO-BODY should be, these macros can't conveniently be in
;;; the same file as DO-DO-BODY.)
;;; and FROB-DO-BODY should be, these macros can't conveniently be in
;;; the same file as FROB-DO-BODY.)
(defmacro-mundanely do (varlist endlist &body body)
#!+sb-doc
"DO ({(Var [Init] [Step])}*) (Test Exit-Form*) Declaration* Form*
Expand All @@ -298,7 +298,7 @@
are evaluated as a PROGN, with the result being the value of the DO. A block
named NIL is established around the entire expansion, allowing RETURN to be
used as an alternate exit mechanism."
(do-do-body varlist endlist body 'let 'psetq 'do nil))
(frob-do-body varlist endlist body 'let 'psetq 'do nil))
(defmacro-mundanely do* (varlist endlist &body body)
#!+sb-doc
"DO* ({(Var [Init] [Step])}*) (Test Exit-Form*) Declaration* Form*
Expand All @@ -309,7 +309,7 @@
the Exit-Forms are evaluated as a PROGN, with the result being the value
of the DO. A block named NIL is established around the entire expansion,
allowing RETURN to be used as an laternate exit mechanism."
(do-do-body varlist endlist body 'let* 'setq 'do* nil))
(frob-do-body varlist endlist body 'let* 'setq 'do* nil))

;;; DOTIMES and DOLIST could be defined more concisely using
;;; destructuring macro lambda lists or DESTRUCTURING-BIND, but then
Expand Down
4 changes: 2 additions & 2 deletions src/code/defstruct.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@
(when offset (incf (dd-length dd) offset)))))

(when (dd-include dd)
(do-dd-inclusion-stuff dd))
(frob-dd-inclusion-stuff dd))

dd)))

Expand Down Expand Up @@ -676,7 +676,7 @@

;;; Process any included slots pretty much like they were specified.
;;; Also inherit various other attributes.
(defun do-dd-inclusion-stuff (dd)
(defun frob-dd-inclusion-stuff (dd)
(destructuring-bind (included-name &rest modified-slots) (dd-include dd)
(let* ((type (dd-type dd))
(included-structure
Expand Down
Loading

0 comments on commit 0830796

Please sign in to comment.