X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fgtn.lisp;h=3d6c0c857974250e7b65e4d8ed2f985ffb3b5c5d;hb=7b384da95e6a30e1434523213aeeed3a90448c78;hp=400ee93de0166f248e90298e2fa28fa8f104cce4;hpb=1a6def3955b715472eb2c75b15660912b9f90173;p=sbcl.git diff --git a/src/compiler/gtn.lisp b/src/compiler/gtn.lisp index 400ee93..3d6c0c8 100644 --- a/src/compiler/gtn.lisp +++ b/src/compiler/gtn.lisp @@ -73,9 +73,9 @@ reversed-ir2-physenv-alist))) (let ((res (make-ir2-physenv - :environment (nreverse reversed-ir2-physenv-alist) + :closure (nreverse reversed-ir2-physenv-alist) :return-pc-pass (make-return-pc-passing-location - (external-entry-point-p clambda))))) + (xep-p clambda))))) (setf (physenv-info lambda-physenv) res) (setf (ir2-physenv-old-fp res) (make-old-fp-save-location lambda-physenv)) @@ -84,12 +84,11 @@ (values)) -;;; Return true if FUN's result continuation is used in a -;;; tail-recursive full call. We only consider explicit :FULL calls. -;;; It is assumed that known calls are never part of a tail-recursive -;;; loop, so we don't need to enforce tail-recursion. In any case, we -;;; don't know which known calls will actually be full calls until -;;; after LTN. +;;; Return true if FUN's result is used in a tail-recursive full +;;; call. We only consider explicit :FULL calls. It is assumed that +;;; known calls are never part of a tail-recursive loop, so we don't +;;; need to enforce tail-recursion. In any case, we don't know which +;;; known calls will actually be full calls until after LTN. (defun has-full-call-use (fun) (declare (type clambda fun)) (let ((return (lambda-return fun))) @@ -110,18 +109,17 @@ ;;; a non-standard convention. (defun use-standard-returns (tails) (declare (type tail-set tails)) - (let ((funs (tail-set-functions tails))) - (or (and (find-if #'external-entry-point-p funs) + (let ((funs (tail-set-funs tails))) + (or (and (find-if #'xep-p funs) (find-if #'has-full-call-use funs)) (block punt (dolist (fun funs t) (dolist (ref (leaf-refs fun)) - (let* ((cont (node-cont ref)) - (dest (continuation-dest cont))) - (when (and dest + (let* ((lvar (node-lvar ref)) + (dest (and lvar (lvar-dest lvar)))) + (when (and (basic-combination-p dest) (not (node-tail-p dest)) - (basic-combination-p dest) - (eq (basic-combination-fun dest) cont) + (eq (basic-combination-fun dest) lvar) (eq (basic-combination-kind dest) :local)) (return-from punt nil))))))))) @@ -131,13 +129,13 @@ ;;; there is no such function, then be more vague. (defun return-value-efficiency-note (tails) (declare (type tail-set tails)) - (let ((funs (tail-set-functions tails))) + (let ((funs (tail-set-funs tails))) (when (policy (lambda-bind (first funs)) (> (max speed space) inhibit-warnings)) (dolist (fun funs (let ((*compiler-error-context* (lambda-bind (first funs)))) - (compiler-note + (compiler-notify "Return value count mismatch prevents known return ~ from these functions:~ ~{~% ~A~}" @@ -150,7 +148,7 @@ (declare (ignore ignore)) (when (eq count :unknown) (let ((*compiler-error-context* (lambda-bind fun))) - (compiler-note + (compiler-notify "Return type not fixed values, so can't use known return ~ convention:~% ~S" (type-specifier rtype))) @@ -167,7 +165,8 @@ (multiple-value-bind (types count) (values-types (tail-set-type tails)) (let ((ptypes (mapcar #'primitive-type types)) (use-standard (use-standard-returns tails))) - (when (and (eq count :unknown) (not use-standard)) + (when (and (eq count :unknown) (not use-standard) + (not (eq (tail-set-type tails) *empty-type*))) (return-value-efficiency-note tails)) (if (or (eq count :unknown) use-standard) (make-return-info :kind :unknown @@ -192,7 +191,7 @@ (return (lambda-return fun))) (when (and return (not (eq (return-info-kind returns) :unknown)) - (external-entry-point-p fun)) + (xep-p fun)) (do-uses (use (return-result return)) (setf (node-tail-p use) nil)))) (values))