X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fltn.lisp;h=d2b162e7936d0111b712ddccce780b1e6b45f4d5;hb=HEAD;hp=b790f42a5bdf382fefc5626b3782f162fe249742;hpb=d604a358d8e5eb5587989e0a4f1d31dbe6ac5ffe;p=sbcl.git diff --git a/src/compiler/ltn.lisp b/src/compiler/ltn.lisp index b790f42..d2b162e 100644 --- a/src/compiler/ltn.lisp +++ b/src/compiler/ltn.lisp @@ -64,39 +64,18 @@ (declare (type lvar lvar)) (ir2-lvar-primitive-type (lvar-info lvar))) -;;; Return true if a constant LEAF is of a type which we can legally -;;; directly reference in code. Named constants with arbitrary pointer -;;; values cannot, since we must preserve EQLness. -;;; -;;; FIXME: why not? The values in a function's constant vector are -;;; subject to being moved by the garbage collector. Having arbitrary -;;; values in said vector doesn't seem like a problem. -(defun legal-immediate-constant-p (leaf) - (declare (type constant leaf)) - (or (not (leaf-has-source-name-p leaf)) - ;; Specialized arrays are legal, too. KLUDGE: this would be - ;; *much* cleaner if SIMPLE-UNBOXED-ARRAY was defined on the host. - #.(loop for saetp across sb!vm:*specialized-array-element-type-properties* - unless (eq t (sb!vm:saetp-specifier saetp)) - collect `((simple-array ,(sb!vm:saetp-specifier saetp) (*)) t) into cases - finally (return - `(typecase (constant-value leaf) - ((or number character) t) - (symbol (symbol-package (constant-value leaf))) - ,@cases - (t nil)))))) - ;;; If LVAR is used only by a REF to a leaf that can be delayed, then ;;; return the leaf, otherwise return NIL. (defun lvar-delayed-leaf (lvar) (declare (type lvar lvar)) - (let ((use (lvar-uses lvar))) - (and (ref-p use) - (let ((leaf (ref-leaf use))) - (etypecase leaf - (lambda-var (if (null (lambda-var-sets leaf)) leaf nil)) - (constant (if (legal-immediate-constant-p leaf) leaf nil)) - ((or functional global-var) nil)))))) + (unless (lvar-dynamic-extent lvar) + (let ((use (lvar-uses lvar))) + (and (ref-p use) + (let ((leaf (ref-leaf use))) + (etypecase leaf + (lambda-var (if (null (lambda-var-sets leaf)) leaf nil)) + (constant leaf) + ((or functional global-var) nil))))))) ;;; Annotate a normal single-value lvar. If its only use is a ref that ;;; we are allowed to delay the evaluation of, then we mark the lvar @@ -388,7 +367,7 @@ (unless (and (combination-p use) (let ((info (basic-combination-info use))) (and (template-p info) - (eq (template-result-types info) :conditional)))) + (template-conditional-p info)))) (annotate-ordinary-lvar test))) (values)) @@ -544,7 +523,7 @@ (if (and safe-p (template-args-ok template call nil)) :arg-check :arg-types))) - ((eq (template-result-types template) :conditional) + ((template-conditional-p template) (let ((dest (lvar-dest lvar))) (if (and (if-p dest) (immediately-used-p (if-test dest) call)) @@ -627,7 +606,7 @@ (defvar *efficiency-note-cost-threshold* 5 #!+sb-doc - "This is the minumum cost difference between the chosen implementation and + "This is the minimum cost difference between the chosen implementation and the next alternative that justifies an efficiency note.") (declaim (type index *efficiency-note-cost-threshold*))