sbcl 注意“无法堆栈分配”

问题描述

为什么 sbcl (2.0.11) 给出这些编译器注释?这是否意味着这不是一种有效的方法?有什么你可以做的事情来堆栈分配谓词和键吗?或者另一种方法更好?

(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

最小可重复示例,应要求提供。该文件仅包含上面的函数定义。

$ /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
* 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)