(node-derived-type (continuation-use cont)))))
;;; Our best guess for the type of this continuation's value. Note
-;;; that this may be Values or Function type, which cannot be passed
+;;; that this may be VALUES or FUNCTION type, which cannot be passed
;;; as an argument to the normal type operations. See
-;;; Continuation-Type. This may be called on deleted continuations,
+;;; CONTINUATION-TYPE. This may be called on deleted continuations,
;;; always returning *.
;;;
;;; What we do is call CONTINUATION-PROVEN-TYPE and check whether the
(cond ((values-subtypep proven asserted)
(setf (continuation-%type-check cont) nil)
(setf (continuation-%derived-type cont) proven))
+ ((and (values-subtypep proven (specifier-type 'function))
+ (values-subtypep asserted (specifier-type 'function)))
+ ;; It's physically impossible for a runtime type check to
+ ;; distinguish between the various subtypes of FUNCTION, so
+ ;; it'd be pointless to do more type checks here.
+ (setf (continuation-%type-check cont) nil)
+ (setf (continuation-%derived-type cont)
+ ;; FIXME: This should depend on optimization
+ ;; policy. This is for SPEED > SAFETY:
+ #+nil (values-type-intersection asserted proven)
+ ;; and this is for SAFETY >= SPEED:
+ #-nil proven))
(t
(unless (or (continuation-%type-check cont)
(not (continuation-dest cont))
(values))
-;;; Loop over the nodes in Block, looking for stuff that needs to be
+;;; Loop over the nodes in BLOCK, looking for stuff that needs to be
;;; optimized. We dispatch off of the type of each node with its
;;; reoptimize flag set:
-;;; -- With a combination, we call Propagate-Function-Change whenever
-;;; the function changes, and call IR1-Optimize-Combination if any
+;;; -- With a COMBINATION, we call PROPAGATE-FUN-CHANGE whenever
+;;; the function changes, and call IR1-OPTIMIZE-COMBINATION if any
;;; argument changes.
-;;; -- With an Exit, we derive the node's type from the Value's type.
-;;; We don't propagate Cont's assertion to the Value, since if we
-;;; did, this would move the checking of Cont's assertion to the
-;;; exit. This wouldn't work with Catch and UWP, where the Exit
+;;; -- With an EXIT, we derive the node's type from the VALUE's type.
+;;; We don't propagate CONT's assertion to the VALUE, since if we
+;;; did, this would move the checking of CONT's assertion to the
+;;; exit. This wouldn't work with CATCH and UWP, where the EXIT
;;; node is just a placeholder for the actual unknown exit.
;;;
;;; Note that we clear the node & block reoptimize flags *before*
(ir1-optimize-set node)))))
(values))
+;;; Try to join with a successor block. If we succeed, we return true,
+;;; otherwise false.
+;;;
;;; We cannot combine with a successor block if:
;;; 1. The successor has more than one predecessor.
;;; 2. The last node's CONT is also used somewhere else.
;;; 5. The next block has a different home lambda, and thus the
;;; control transfer is a non-local exit.
;;;
-;;; If we succeed, we return true, otherwise false.
-;;;
-;;; Joining is easy when the successor's Start continuation is the
-;;; same from our Last's Cont. If they differ, then we can still join
+;;; Joining is easy when the successor's START continuation is the
+;;; same from our LAST's CONT. If they differ, then we can still join
;;; when the last continuation has no next and the next continuation
;;; has no uses. In this case, we replace the next continuation with
;;; the last before joining the blocks.
((and (null (block-start-uses next))
(eq (continuation-kind last-cont) :inside-block))
(let ((next-node (continuation-next next-cont)))
- ;; If next-cont does have a dest, it must be
+ ;; If NEXT-CONT does have a dest, it must be
;; unreachable, since there are no uses.
;; DELETE-CONTINUATION will mark the dest block as
;; DELETE-P [and also this block, unless it is no
nil))))))
;;; Join together two blocks which have the same ending/starting
-;;; continuation. The code in Block2 is moved into Block1 and Block2
+;;; continuation. The code in BLOCK2 is moved into BLOCK1 and BLOCK2
;;; is deleted from the DFO. We combine the optimize flags for the two
;;; blocks so that any indicated optimization gets done.
(defun join-blocks (block1 block2)
(unlink-node node))
(combination
(let ((info (combination-kind node)))
- (when (function-info-p info)
- (let ((attr (function-info-attributes info)))
+ (when (fun-info-p info)
+ (let ((attr (fun-info-attributes info)))
(when (and (ir1-attributep attr flushable)
(not (ir1-attributep attr call)))
(flush-dest (combination-fun node))
(declaim (ftype (function (combination) (values)) ir1-optimize-combination))
(defun ir1-optimize-combination (node)
(when (continuation-reoptimize (basic-combination-fun node))
- (propagate-function-change node))
+ (propagate-fun-change node))
(let ((args (basic-combination-args node))
(kind (basic-combination-kind node)))
(case kind
(when arg
(setf (continuation-reoptimize arg) nil)))
- (let ((attr (function-info-attributes kind)))
+ (let ((attr (fun-info-attributes kind)))
(when (and (ir1-attributep attr foldable)
;; KLUDGE: The next test could be made more sensitive,
;; only suppressing constant-folding of functions with
(constant-fold-call node)
(return-from ir1-optimize-combination)))
- (let ((fun (function-info-derive-type kind)))
+ (let ((fun (fun-info-derive-type kind)))
(when fun
(let ((res (funcall fun node)))
(when res
(derive-node-type node res)
(maybe-terminate-block node nil)))))
- (let ((fun (function-info-optimizer kind)))
+ (let ((fun (fun-info-optimizer kind)))
(unless (and fun (funcall fun node))
- (dolist (x (function-info-transforms kind))
+ (dolist (x (fun-info-transforms kind))
#!+sb-show
(when *show-transforms-p*
(let* ((cont (basic-combination-fun node))
;;; if necessary. We claim that the parent form is LABELS for
;;; context declarations, since we don't want it to be considered
;;; a real global function.
-;;; -- In addition to a direct check for the function name in the
-;;; table, we also must check for slot accessors. If the function
-;;; is a slot accessor, then we set the combination kind to the
-;;; function info of %SLOT-SETTER or %SLOT-ACCESSOR, as
-;;; appropriate.
;;; -- If it is a known function, mark it as such by setting the KIND.
;;;
;;; We return the leaf referenced (NIL if not a leaf) and the
-;;; FUNCTION-INFO assigned.
+;;; FUN-INFO assigned.
;;;
;;; FIXME: The IR1-CONVERTING-NOT-OPTIMIZING-P argument is what the
;;; old CMU CL code called IR1-P, without explanation. My (WHN
(values (ref-leaf (continuation-use (basic-combination-fun call)))
nil))
(t
- (let* ((name (leaf-source-name leaf))
- (info (info :function :info
- (if (slot-accessor-p leaf)
- (if (consp source-name) ; i.e. if SETF function
- '%slot-setter
- '%slot-accessor)
- name))))
+ (let ((info (info :function :info (leaf-source-name leaf))))
(if info
(values leaf (setf (basic-combination-kind call) info))
(values leaf nil)))))))
(csubtypep type (specifier-type 'function))
(or val (not win))))
(recognize-known-call call ir1-converting-not-optimizing-p))
- ((valid-function-use call type
- :argument-test #'always-subtypep
- :result-test #'always-subtypep
- ;; KLUDGE: Common Lisp is such a dynamic
- ;; language that all we can do here in
- ;; general is issue a STYLE-WARNING. It
- ;; would be nice to issue a full WARNING
- ;; in the special case of of type
- ;; mismatches within a compilation unit
- ;; (as in section 3.2.2.3 of the spec)
- ;; but at least as of sbcl-0.6.11, we
- ;; don't keep track of whether the
- ;; mismatched data came from the same
- ;; compilation unit, so we can't do that.
- ;; -- WHN 2001-02-11
- ;;
- ;; FIXME: Actually, I think we could
- ;; issue a full WARNING if the call
- ;; violates a DECLAIM FTYPE.
- :lossage-fun #'compiler-style-warn
- :unwinnage-fun #'compiler-note)
+ ((valid-fun-use call type
+ :argument-test #'always-subtypep
+ :result-test #'always-subtypep
+ ;; KLUDGE: Common Lisp is such a dynamic
+ ;; language that all we can do here in
+ ;; general is issue a STYLE-WARNING. It
+ ;; would be nice to issue a full WARNING
+ ;; in the special case of of type
+ ;; mismatches within a compilation unit
+ ;; (as in section 3.2.2.3 of the spec)
+ ;; but at least as of sbcl-0.6.11, we
+ ;; don't keep track of whether the
+ ;; mismatched data came from the same
+ ;; compilation unit, so we can't do that.
+ ;; -- WHN 2001-02-11
+ ;;
+ ;; FIXME: Actually, I think we could
+ ;; issue a full WARNING if the call
+ ;; violates a DECLAIM FTYPE.
+ :lossage-fun #'compiler-style-warn
+ :unwinnage-fun #'compiler-note)
(assert-call-type call type)
(maybe-terminate-block call ir1-converting-not-optimizing-p)
(recognize-known-call call ir1-converting-not-optimizing-p))
;;; expansion, etc. If a call to a predicate in a non-conditional
;;; position or to a function with a source transform, then we
;;; reconvert the form to give IR1 another chance.
-(defun propagate-function-change (call)
+(defun propagate-fun-change (call)
(declare (type combination call))
(let ((*compiler-error-context* call)
(fun-cont (basic-combination-fun call)))
((not leaf))
((or (info :function :source-transform (leaf-source-name leaf))
(and info
- (ir1-attributep (function-info-attributes info)
+ (ir1-attributep (fun-info-attributes info)
predicate)
(let ((dest (continuation-dest (node-cont call))))
(and dest (not (if-p dest))))))
(eq when :native))))
t)
((or (not constrained)
- (valid-function-use node type :strict-result t))
+ (valid-fun-use node type :strict-result t))
(multiple-value-bind (severity args)
(catch 'give-up-ir1-transform
(transform-call node (funcall fun node))
(remhash node table)
nil))))
((and flame
- (valid-function-use node
- type
- :argument-test #'types-equal-or-intersect
- :result-test
- #'values-types-equal-or-intersect))
+ (valid-fun-use node
+ type
+ :argument-test #'types-equal-or-intersect
+ :result-test #'values-types-equal-or-intersect))
(record-optimization-failure node transform type)
t)
(t
(eq (continuation-fun-name (combination-fun use))
'list))
(change-ref-leaf (continuation-use (combination-fun node))
- (find-free-function 'values "in a strange place"))
+ (find-free-fun 'values "in a strange place"))
(setf (combination-kind node) :full)
(let ((args (combination-args use)))
(dolist (arg args)