0.pre7.83:
[sbcl.git] / src / compiler / ir1opt.lisp
index 7d9bebd..e8b26bf 100644 (file)
 ;;; assumed that the call is legal and has only constants in the
 ;;; keyword positions.
 (defun assert-call-type (call type)
-  (declare (type combination call) (type function-type type))
-  (derive-node-type call (function-type-returns type))
+  (declare (type combination call) (type fun-type type))
+  (derive-node-type call (fun-type-returns type))
   (let ((args (combination-args call)))
-    (dolist (req (function-type-required type))
+    (dolist (req (fun-type-required type))
       (when (null args) (return-from assert-call-type))
       (let ((arg (pop args)))
        (assert-continuation-type arg req)))
-    (dolist (opt (function-type-optional type))
+    (dolist (opt (fun-type-optional type))
       (when (null args) (return-from assert-call-type))
       (let ((arg (pop args)))
        (assert-continuation-type arg opt)))
 
-    (let ((rest (function-type-rest type)))
+    (let ((rest (fun-type-rest type)))
       (when rest
        (dolist (arg args)
          (assert-continuation-type arg rest))))
 
-    (dolist (key (function-type-keywords type))
+    (dolist (key (fun-type-keywords type))
       (let ((name (key-info-name key)))
        (do ((arg args (cddr arg)))
            ((null arg))
             #!+sb-show 
             (when *show-transforms-p*
               (let* ((cont (basic-combination-fun node))
-                     (fname (continuation-function-name cont t)))
+                     (fname (continuation-fun-name cont t)))
                 (/show "trying transform" x (transform-function x) "for" fname)))
             (unless (ir1-transform node x)
               #!+sb-show
 ;;; wondering if something should be done to special-case the call. If
 ;;; CALL is a call to a global function, then see whether it defined
 ;;; or known:
-;;; -- If a DEFINED-FUNCTION should be inline expanded, then convert
+;;; -- If a DEFINED-FUN should be inline expanded, then convert
 ;;;    the expansion and change the call to call it. Expansion is
 ;;;    enabled if :INLINE or if SPACE=0. If the FUNCTIONAL slot is
 ;;;    true, we never expand, since this function has already been
   (declare (type combination call))
   (let* ((ref (continuation-use (basic-combination-fun call)))
         (leaf (when (ref-p ref) (ref-leaf ref)))
-        (inlinep (if (and (defined-function-p leaf)
-                          (not (byte-compiling)))
-                     (defined-function-inlinep leaf)
+        (inlinep (if (defined-fun-p leaf)
+                     (defined-fun-inlinep leaf)
                      :no-chance)))
     (cond
      ((eq inlinep :notinline) (values nil nil))
             (:inline t)
             (:no-chance nil)
             ((nil :maybe-inline) (policy call (zerop space))))
-          (defined-function-inline-expansion leaf)
-          (let ((fun (defined-function-functional leaf)))
+          (defined-fun-inline-expansion leaf)
+          (let ((fun (defined-fun-functional leaf)))
             (or (not fun)
                 (and (eq inlinep :inline) (functional-kind fun))))
           (inline-expansion-ok call))
       (flet ((frob ()
               (let ((res (ir1-convert-lambda-for-defun
-                          (defined-function-inline-expansion leaf)
+                          (defined-fun-inline-expansion leaf)
                           leaf t
                           #'ir1-convert-inline-lambda)))
-                (setf (defined-function-functional leaf) res)
+                (setf (defined-fun-functional leaf) res)
                 (change-ref-leaf ref res))))
        (if ir1-p
            (frob)
       (let* ((name (leaf-name leaf))
             (info (info :function :info
                         (if (slot-accessor-p leaf)
-                          (if (consp name)
-                            '%slot-setter
-                            '%slot-accessor)
-                          name))))
+                            (if (consp name)
+                                '%slot-setter
+                                '%slot-accessor)
+                            name))))
        (if info
            (values leaf (setf (basic-combination-kind call) info))
            (values leaf nil)))))))
 ;;; and that checking is done by local call analysis.
 (defun validate-call-type (call type ir1-p)
   (declare (type combination call) (type ctype type))
-  (cond ((not (function-type-p type))
+  (cond ((not (fun-type-p type))
         (aver (multiple-value-bind (val win)
                   (csubtypep type (specifier-type 'function))
                 (or val (not win))))
 ;;; replace it, otherwise add a new one.
 (defun record-optimization-failure (node transform args)
   (declare (type combination node) (type transform transform)
-          (type (or function-type list) args))
+          (type (or fun-type list) args))
   (let* ((table (component-failed-optimizations *component-being-compiled*))
         (found (assoc transform (gethash node table))))
     (if found
   (declare (type combination node) (type transform transform))
   (let* ((type (transform-type transform))
         (fun (transform-function transform))
-        (constrained (function-type-p type))
+        (constrained (fun-type-p type))
         (table (component-failed-optimizations *component-being-compiled*))
         (flame (if (transform-important transform)
                    (policy node (>= speed inhibit-warnings))
                    (policy node (> speed inhibit-warnings))))
         (*compiler-error-context* node))
     (cond ((not (member (transform-when transform)
-                       (if *byte-compiling*
-                           '(:byte   :both)
-                           '(:native :both))))
+                       '(:native :both)))
           ;; FIXME: Make sure that there's a transform for
           ;; (MEMBER SYMBOL ..) into MEMQ.
           ;; FIXME: Note that when/if I make SHARE operation to shared
           ;; '(:BOTH) tail sublists.
           (let ((when (transform-when transform)))
             (not (or (eq when :both)
-                     (eq when (if *byte-compiling* :byte :native)))))
+                     (eq when :native))))
           t)
          ((or (not constrained)
               (valid-function-use node type :strict-result t))
 (defun propagate-to-refs (leaf type)
   (declare (type leaf leaf) (type ctype type))
   (let ((var-type (leaf-type leaf)))
-    (unless (function-type-p var-type)
+    (unless (fun-type-p var-type)
       (let ((int (type-approx-intersection2 var-type type)))
        (when (type/= int var-type)
          (setf (leaf-type leaf) int)
       ((or constant functional) t)
       (lambda-var
        (null (lambda-var-sets leaf)))
-      (defined-function
-       (not (eq (defined-function-inlinep leaf) :notinline)))
+      (defined-fun
+       (not (eq (defined-fun-inlinep leaf) :notinline)))
       (global-var
        (case (global-var-kind leaf)
         (:global-function t)
                   leaf var))
                t)))))
        ((and (null (rest (leaf-refs var)))
-            (not *byte-compiling*)
             (substitute-single-use-continuation arg var)))
        (t
        (propagate-to-refs var (continuation-type arg))))))
        (when fun-changed
         (setf (continuation-reoptimize fun) nil)
         (let ((type (continuation-type fun)))
-          (when (function-type-p type)
-            (derive-node-type node (function-type-returns type))))
+          (when (fun-type-p type)
+            (derive-node-type node (fun-type-returns type))))
         (maybe-terminate-block node nil)
         (let ((use (continuation-use fun)))
           (when (and (ref-p use) (functional-p (ref-leaf use)))
             (when (eq (basic-combination-kind node) :local)
               (maybe-let-convert (ref-leaf use))))))
        (unless (or (eq (basic-combination-kind node) :local)
-                  (eq (continuation-function-name fun) '%throw))
+                  (eq (continuation-fun-name fun) '%throw))
         (ir1-optimize-mv-call node))
        (dolist (arg args)
         (setf (continuation-reoptimize arg) nil))))
       (return-from ir1-optimize-mv-call))
 
     (multiple-value-bind (min max)
-       (function-type-nargs (continuation-type fun))
+       (fun-type-nargs (continuation-type fun))
       (let ((total-nvals
             (multiple-value-bind (types nvals)
                 (values-types (continuation-derived-type (first args)))
   (let* ((arg (first (basic-combination-args call)))
         (use (continuation-use arg)))
     (when (and (combination-p use)
-              (eq (continuation-function-name (combination-fun use))
+              (eq (continuation-fun-name (combination-fun use))
                   'values))
       (let* ((fun (combination-lambda call))
             (vars (lambda-vars fun))
 (defoptimizer (values-list optimizer) ((list) node)
   (let ((use (continuation-use list)))
     (when (and (combination-p use)
-              (eq (continuation-function-name (combination-fun use))
+              (eq (continuation-fun-name (combination-fun use))
                   'list))
       (change-ref-leaf (continuation-use (combination-fun node))
                       (find-free-function 'values "in a strange place"))