\f
;;;; conflict determination
-;;; Return true if the element at the specified offset in SB has a conflict
-;;; with TN:
-;;; -- If an component-live TN (:component kind), then iterate over all the
-;;; blocks. If the element at Offset is used anywhere in any of the
-;;; component's blocks (always-live /= 0), then there is a conflict.
-;;; -- If TN is global (Confs true), then iterate over the blocks TN is live in
-;;; (using TN-Global-Conflicts). If the TN is live everywhere in the block
-;;; (:Live), then there is a conflict if the element at offset is used
-;;; anywhere in the block (Always-Live /= 0). Otherwise, we use the local
-;;; TN number for TN in block to find whether TN has a conflict at Offset in
+;;; Return true if the element at the specified offset in SB has a
+;;; conflict with TN:
+;;; -- If a component-live TN (:component kind), then iterate over
+;;; all the blocks. If the element at Offset is used anywhere in
+;;; any of the component's blocks (always-live /= 0), then there
+;;; is a conflict.
+;;; -- If TN is global (Confs true), then iterate over the blocks TN
+;;; is live in (using TN-Global-Conflicts). If the TN is live
+;;; everywhere in the block (:LIVE), then there is a conflict
+;;; if the element at offset is used anywhere in the block
+;;; (Always-Live /= 0). Otherwise, we use the local TN number for
+;;; TN in block to find whether TN has a conflict at Offset in
;;; that block.
-;;; -- If TN is local, then we just check for a conflict in the block it is
-;;; local to.
+;;; -- If TN is local, then we just check for a conflict in the block
+;;; it is local to.
(defun offset-conflicts-in-sb (tn sb offset)
(declare (type tn tn) (type finite-sb sb) (type index offset))
(let ((confs (tn-global-conflicts tn))
(when (offset-conflicts-in-sb tn sb (+ offset i))
(return t)))))
-;;; Add TN's conflicts into the conflicts for the location at Offset in SC.
-;;; We iterate over each location in TN, adding to the conflicts for that
-;;; location:
-;;; -- If TN is a :Component TN, then iterate over all the blocks, setting
-;;; all of the local conflict bits and the always-live bit. This records a
-;;; conflict with any TN that has a LTN number in the block, as well as with
-;;; :Always-Live and :Environment TNs.
+;;; Add TN's conflicts into the conflicts for the location at OFFSET
+;;; in SC. We iterate over each location in TN, adding to the
+;;; conflicts for that location:
+;;; -- If TN is a :COMPONENT TN, then iterate over all the blocks,
+;;; setting all of the local conflict bits and the always-live bit.
+;;; This records a conflict with any TN that has a LTN number in
+;;; the block, as well as with :ALWAYS-LIVE and :ENVIRONMENT TNs.
;;; -- If TN is global, then iterate over the blocks TN is live in. In
-;;; addition to setting the always-live bit to represent the conflict with
-;;; TNs live throughout the block, we also set bits in the local conflicts.
-;;; If TN is :Always-Live in the block, we set all the bits, otherwise we or
-;;; in the local conflict bits.
-;;; -- If the TN is local, then we just do the block it is local to, setting
-;;; always-live and OR'ing in the local conflicts.
+;;; addition to setting the always-live bit to represent the conflict
+;;; with TNs live throughout the block, we also set bits in the
+;;; local conflicts. If TN is :ALWAYS-LIVE in the block, we set all
+;;; the bits, otherwise we OR in the local conflict bits.
+;;; -- If the TN is local, then we just do the block it is local to,
+;;; setting always-live and OR'ing in the local conflicts.
(defun add-location-conflicts (tn sc offset)
(declare (type tn tn) (type sc sc) (type index offset))
(let ((confs (tn-global-conflicts tn))
(setf (finite-sb-last-offset sb) 0))))))
;;; Expand the :Unbounded SB backing SC by either the initial size or
-;;; the SC element size, whichever is larger. If Needed-Size is
+;;; the SC element size, whichever is larger. If NEEDED-SIZE is
;;; larger, then use that size.
(defun grow-sc (sc &optional (needed-size 0))
(declare (type sc sc) (type index needed-size))
(make-array size
:initial-element
#-sb-xc #*
- ;; The cross-compiler isn't very good at dumping
- ;; specialized arrays, so we delay construction of
- ;; this SIMPLE-BIT-VECTOR until runtime.
+ ;; The cross-compiler isn't very good at
+ ;; dumping specialized arrays, so we delay
+ ;; construction of this SIMPLE-BIT-VECTOR
+ ;; until runtime.
#+sb-xc (make-array 0 :element-type 'bit)))
(fill nil (finite-sb-conflicts sb))
\f
;;;; internal errors
-;;; Give someone a hard time because there isn't any load function defined
-;;; to move from Src to Dest.
+;;; Give someone a hard time because there isn't any load function
+;;; defined to move from SRC to DEST.
(defun no-load-function-error (src dest)
(let* ((src-sc (tn-sc src))
(src-name (sc-name src-sc))
(pushnew tn (gethash vop (ir2-component-spilled-vops 2comp)))))
(values))
-;;; Make a save TN for TN, pack it, and return it. We copy various conflict
-;;; information from the TN so that pack does the right thing.
+;;; Make a save TN for TN, pack it, and return it. We copy various
+;;; conflict information from the TN so that pack does the right
+;;; thing.
(defun pack-save-tn (tn)
(declare (type tn tn))
(let ((res (make-tn 0 :save nil nil)))
vop))
(emit-operand-load node block save tn next)))
-;;; Return a VOP after which is an o.k. place to save the value of TN.
+;;; Return a VOP after which is an OK place to save the value of TN.
;;; For correctness, it is only required that this location be after
;;; any possible write and before any possible restore location.
;;;
(save-complex-writer-tn tn vop))))
(values))
-;;; Scan over the VOPs in Block, emiting saving code for TNs noted in the
-;;; codegen info that are packed into saved SCs.
+;;; Scan over the VOPs in BLOCK, emiting saving code for TNs noted in
+;;; the codegen info that are packed into saved SCs.
(defun emit-saves (block)
(declare (type ir2-block block))
(do ((vop (ir2-block-start-vop block) (vop-next vop)))
;;; -- If there isn't any NLX-Info entry in the environment, make
;;; an entry stub, otherwise just move the exit block link to
;;; the component tail.
-;;; -- Close over the NLX-Info in the exit environment.
-;;; -- If the exit is from an :Escape function, then substitute a
+;;; -- Close over the NLX-INFO in the exit environment.
+;;; -- If the exit is from an :ESCAPE function, then substitute a
;;; constant reference to NLX-Info structure for the escape
;;; function reference. This will cause the escape function to
;;; be deleted (although not removed from the DFO.) The escape
(let ((entry (exit-entry exit))
(cont (node-cont exit))
(exit-fun (node-home-lambda exit)))
-
(if (find-nlx-info entry cont)
(let ((block (node-block exit)))
(aver (= (length (block-succ block)) 1))
(unlink-blocks block (first (block-succ block)))
(link-blocks block (component-tail (block-component block))))
(insert-nlx-entry-stub exit env))
-
(let ((info (find-nlx-info entry cont)))
(aver info)
(close-over info (node-physenv exit) env)
(let ((node (block-last (nlx-info-target info))))
(delete-continuation-use node)
(add-continuation-use node (nlx-info-continuation info))))))
-
(values))
;;; Iterate over the EXITs in COMPONENT, calling NOTE-NON-LOCAL-EXIT
(dolist (lambda (component-lambdas component))
(dolist (entry (lambda-entries lambda))
(dolist (exit (entry-exits entry))
- (let ((target-env (node-physenv entry)))
- (if (eq (node-physenv exit) target-env)
+ (let ((target-physenv (node-physenv entry)))
+ (if (eq (node-physenv exit) target-physenv)
(maybe-delete-exit exit)
- (note-non-local-exit target-env exit))))))
-
+ (note-non-local-exit target-physenv exit))))))
(values))
\f
;;;; cleanup emission
;;; in an implicit MV-PROG1. We have to force local call analysis of
;;; new references to UNWIND-PROTECT cleanup functions. If we don't
;;; actually have to do anything, then we don't insert any cleanup
-;;; code.
+;;; code. (FIXME: There's some confusion here, left over from CMU CL
+;;; comments. CLEANUP1 isn't mentioned in the code of this function.
+;;; It is in code elsewhere, but if the comments for this function
+;;; mention it they should explain the relationship to the other code.)
;;;
;;; If we do insert cleanup code, we check that BLOCK1 doesn't end in
;;; a "tail" local call.