X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Flocall.lisp;h=31e813631a276e921875d2e0b75bc22a2bda5022;hb=83ce01b419da19b549eb76b0c3451f2b32a266d5;hp=4fe1a0e3c9508d631ee70dda9bb3f7bc17221baa;hpb=6d69dfcc438b3530fa922e518919158ccf1af497;p=sbcl.git diff --git a/src/compiler/locall.lisp b/src/compiler/locall.lisp index 4fe1a0e..31e8136 100644 --- a/src/compiler/locall.lisp +++ b/src/compiler/locall.lisp @@ -43,22 +43,30 @@ (setf (car args) nil))) (values)) - -(defun handle-nested-dynamic-extent-lvars (arg) - (let ((use (lvar-uses arg))) +(defun handle-nested-dynamic-extent-lvars (lvar) + (let ((uses (lvar-uses lvar))) ;; Stack analysis wants DX value generators to end their ;; blocks. Uses of mupltiple used LVARs already end their blocks, ;; so we just need to process used-once LVARs. - (when (node-p use) - (node-ends-block use)) - ;; If the function result is DX, so are its arguments... This - ;; assumes that all our DX functions do not store their arguments - ;; anywhere -- just use, and maybe return. - (if (basic-combination-p use) - (cons arg (funcall (lambda (lists) - (reduce #'append lists)) - (mapcar #'handle-nested-dynamic-extent-lvars (basic-combination-args use)))) - (list arg)))) + (when (node-p uses) + (node-ends-block uses)) + ;; If this LVAR's USE is good for DX, it is either a CAST, or it + ;; must be a regular combination whose arguments are potentially DX as well. + (flet ((recurse (use) + (etypecase use + (cast + (handle-nested-dynamic-extent-lvars (cast-value use))) + (combination + (loop for arg in (combination-args use) + when (lvar-good-for-dx-p arg) + append (handle-nested-dynamic-extent-lvars arg)))))) + (cons lvar + (if (listp uses) + (loop for use in uses + when (use-good-for-dx-p use) + nconc (recurse use)) + (when (use-good-for-dx-p uses) + (recurse uses))))))) (defun recognize-dynamic-extent-lvars (call fun) (declare (type combination call) (type clambda fun)) @@ -592,7 +600,7 @@ (declare (ignorable ,@ignores)) (%funcall ,entry ,@args)) :debug-name (debug-name 'hairy-function-entry - (lvar-fun-name + (lvar-fun-debug-name (basic-combination-fun call))))))) (convert-call ref call new-fun) (dolist (ref (leaf-refs entry))