Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

sorting - sbcl note "could not stack allocate"

Why is sbcl (2.0.11) giving these compiler notes? Does it mean that this is not an efficient approach? Is there something you can do to stack allocate the predicate and key? Or is another approach better?

(defun sort-on-car (x)
  (sort x #'> :key #'car))
; in: DEFUN SORT-ON-CAR
;     (SORT PLAGE::X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
; 
; compilation unit finished
;   printed 4 notes

Minimal reproducible example, provided on request. The file contains only the function definition above.

$ /usr/bin/sbcl --no-sysinit --no-userinit
This is SBCL 2.0.11, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (compile-file "/tmp/sortwarning.lisp")
; compiling file "/tmp/sortwarning.lisp" (written 13 JAN 2021 09:50:06 AM):
; processing (DEFUN SORT-ON-CAR ...)
; file: /tmp/sortwarning.lisp
; in: DEFUN SORT-ON-CAR
;     (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
; 
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
; 
; compilation unit finished
;   printed 4 notes


; wrote /tmp/sortwarning.fasl
; compilation finished in 0:00:00.050
#P"/tmp/sortwarning.fasl"
NIL
NIL
* 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...