From 8e1b05fa04bfb1c2da7a766143792ae8b68a78d4 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 9 Dec 2011 11:53:18 +0200 Subject: [PATCH 1/1] better "cannot stack allocate" compiler notes When the note refers to failure to allocate an argument, say so -- instead of claiming to be unable to stack allocate the entire function, which is both silly and wrong. Also prettier formatting. --- NEWS | 2 ++ src/compiler/ir1util.lisp | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f1498bf..f082d0d 100644 --- a/NEWS +++ b/NEWS @@ -74,6 +74,8 @@ changes relative to sbcl-1.0.54: (regression since 1.0.53) * bug fix: attempts to stack allocate a required argument to a function with an external entry point caused compiler-errors. + * bug fix: compiler notes for failed stack allocation for a function argument + no longer claim to be unable to stack allocate the function. changes in sbcl-1.0.54 relative to sbcl-1.0.53: * minor incompatible changes: diff --git a/src/compiler/ir1util.lisp b/src/compiler/ir1util.lisp index 5959b9f..964a23f 100644 --- a/src/compiler/ir1util.lisp +++ b/src/compiler/ir1util.lisp @@ -456,6 +456,14 @@ ;;;; DYNAMIC-EXTENT related +(defun lambda-var-original-name (leaf) + (let* ((home (lambda-var-home leaf))) + (if (eq :external (lambda-kind home)) + (let ((p (1- (position leaf (lambda-vars home))))) + (leaf-debug-name + (elt (lambda-vars (lambda-entry-fun home)) p))) + (leaf-debug-name leaf)))) + (defun note-no-stack-allocation (lvar &key flush) (do-uses (use (principal-lvar lvar)) (unless (or @@ -464,8 +472,12 @@ ;; If we're flushing, don't complain if we can flush the combination. (and flush (combination-p use) (flushable-combination-p use))) (let ((*compiler-error-context* use)) - (compiler-notify "could not stack allocate the result of ~S" - (find-original-source (node-source-path use))))))) + (if (and (ref-p use) (lambda-var-p (ref-leaf use))) + (compiler-notify "~@" + (lambda-var-original-name (ref-leaf use)) + (find-original-source (node-source-path use))) + (compiler-notify "~@" + (find-original-source (node-source-path use)))))))) (defun use-good-for-dx-p (use dx &optional component) ;; FIXME: Can casts point to LVARs in other components? -- 1.7.10.4