X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fltn.lisp;h=751d204cfed28a13638cf0fa88875b4fe960c813;hb=bf5a814edd504f1497ef1c04966d44310e54ef28;hp=4e7ff47926df0887c31c1474f9a0a23a958997c8;hpb=6053e7f804b430144bb09e2d107ad4ab3fb97db4;p=sbcl.git diff --git a/src/compiler/ltn.lisp b/src/compiler/ltn.lisp index 4e7ff47..751d204 100644 --- a/src/compiler/ltn.lisp +++ b/src/compiler/ltn.lisp @@ -159,7 +159,8 @@ ;;; can bail out to here. (defun ltn-default-call (call) (declare (type combination call)) - (let ((kind (basic-combination-kind call))) + (let ((kind (basic-combination-kind call)) + (info (basic-combination-fun-info call))) (annotate-fun-lvar (basic-combination-fun call)) (dolist (arg (basic-combination-args call)) @@ -169,8 +170,9 @@ (annotate-1-value-lvar arg)) (cond - ((and (fun-info-p kind) - (fun-info-ir2-convert kind)) + ((and (eq kind :known) + (fun-info-p info) + (fun-info-ir2-convert info)) (setf (basic-combination-info call) :funny) (setf (node-tail-p call) nil)) (t @@ -311,8 +313,7 @@ (setf (node-tail-p call) nil)) (t (setf (basic-combination-info call) :full) - (annotate-fun-lvar (basic-combination-fun call) - nil) + (annotate-fun-lvar (basic-combination-fun call) nil) (dolist (arg (reverse args)) (annotate-unknown-values-lvar arg)) (flush-full-call-tail-transfer call)))) @@ -432,6 +433,7 @@ (defun template-args-ok (template call safe-p) (declare (type template template) (type combination call)) + (declare (ignore safe-p)) (let ((mtype (template-more-args-type template))) (do ((args (basic-combination-args call) (cdr args)) (types (template-arg-types template) (cdr types))) @@ -566,7 +568,7 @@ (declare (type combination call) (type ltn-policy ltn-policy)) (let ((safe-p (ltn-policy-safe-p ltn-policy)) - (current (fun-info-templates (basic-combination-kind call))) + (current (fun-info-templates (basic-combination-fun-info call))) (fallback nil) (rejected nil)) (loop @@ -670,12 +672,18 @@ (or template (template-or-lose 'call-named))) *efficiency-note-cost-threshold*))) - (dolist (try (fun-info-templates (basic-combination-kind call))) + (dolist (try (fun-info-templates (basic-combination-fun-info call))) (when (> (template-cost try) max-cost) (return)) ; FIXME: UNLESS'd be cleaner. (let ((guard (template-guard try))) (when (and (or (not guard) (funcall guard)) (or (not safe-p) (ltn-policy-safe-p (template-ltn-policy try))) + ;; :SAFE is also considered to be :SMALL-SAFE, + ;; while the template cost describes time cost; + ;; so the fact that (< (t-cost try) (t-cost + ;; template)) does not mean that TRY is better + (not (and (eq ltn-policy :safe) + (eq (template-ltn-policy try) :fast-safe))) (or verbose-p (and (template-note try) (valid-fun-use @@ -734,7 +742,7 @@ (defun ltn-analyze-known-call (call) (declare (type combination call)) (let ((ltn-policy (node-ltn-policy call)) - (method (fun-info-ltn-annotate (basic-combination-kind call))) + (method (fun-info-ltn-annotate (basic-combination-fun-info call))) (args (basic-combination-args call))) (when method (funcall method call ltn-policy) @@ -762,7 +770,7 @@ (and (leaf-has-source-name-p funleaf) (eq (lvar-fun-name (combination-fun call)) (leaf-source-name funleaf)) - (let ((info (basic-combination-kind call))) + (let ((info (basic-combination-fun-info call))) (not (or (fun-info-ir2-convert info) (ir1-attributep (fun-info-attributes info) recursive)))))) @@ -838,20 +846,13 @@ (ctran-next ctran)) (ctran (node-next node) (node-next node))) (nil) - (let* ((lvar (when (valued-node-p node) - (node-lvar node))) - (dest (and lvar (lvar-dest lvar)))) - (when (and (cast-p dest) - (not (cast-type-check dest)) - (immediately-used-p lvar node)) - (derive-node-type node (cast-asserted-type dest)))) (etypecase node (ref) (combination - (case (basic-combination-kind node) + (ecase (basic-combination-kind node) (:local (ltn-analyze-local-call node)) ((:full :error) (ltn-default-call node)) - (t + (:known (ltn-analyze-known-call node)))) (cif (ltn-analyze-if node)) (creturn (ltn-analyze-return node))