master: Enable *derive-function-types* in PCL build

snuglas via Sbcl-commits <[email protected]> Sun, 12 Jul 2026 19:14:11 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  8aa85ec581b7fd31588ad47d5ec5f3411554d4da (commit)
      from  ba08d271de094d8ed823a95d4856e754bb8e6e41 (commit)

- Log -----------------------------------------------------------------
commit 8aa85ec581b7fd31588ad47d5ec5f3411554d4da
Author: Douglas Katzman <[email protected]>
Date:   Sun Jul 12 18:41:51 2026 +0000

    Enable *derive-function-types* in PCL build
    
    Trade one hack for another basically
---
 src/cold/warm.lisp      |  4 +---
 src/pcl/slots-boot.lisp | 10 ++++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/cold/warm.lisp b/src/cold/warm.lisp
index c941a33ae..052bc815a 100644
--- a/src/cold/warm.lisp
+++ b/src/cold/warm.lisp
@@ -164,9 +164,7 @@ sb-kernel::
                              (or (search "src/pcl" stem)
                                  (search "src/code/aprof" stem)
                                  (search "src/code/ntrace" stem)))
-                            (sb-ext:*derive-function-types*
-                              (unless (search "/pcl/" stem)
-                                t)))
+                            (sb-ext:*derive-function-types* t))
                         (ensure-directories-exist output)
                         ;; Like PROCLAIM-TARGET-OPTIMIZATION in 'compile-cold-sbcl'
                         ;; We should probably stash a copy of the POLICY instance from
diff --git a/src/pcl/slots-boot.lisp b/src/pcl/slots-boot.lisp
index 97eb62025..a992171fb 100644
--- a/src/pcl/slots-boot.lisp
+++ b/src/pcl/slots-boot.lisp
@@ -27,6 +27,16 @@
 (defun ensure-accessor (fun-name)
   (when (member fun-name *!temporary-ensure-accessor-functions* :test 'equal)
     (error "ENSURE-ACCESSOR ~S called more than once!?" fun-name))
+  ;; In order to allow building PCL with *DERIVE-FUNCTION-TYPES* we have to avoid ever
+  ;; calling SB-C::FTYPE-FROM-DEFINITION on a fake accessor. If that were to happen,
+  ;; the compiler would think the accessor is a non-returning function.
+  ;; These should all return a single value but they have to exacty match what
+  ;; gets derived later on, or else you cause a proclamation mismatch warning.
+  (proclaim `(ftype ,(ecase (car (last fun-name))
+                       (reader `(function (t) *))
+                       (writer `(function (t t) *))
+                       (boundp `(function (t) *)))
+                    ,fun-name))
   (push fun-name *!temporary-ensure-accessor-functions*)
   #| We don't really need "fast" global slot accessors while building PCL.
   ;; With few exceptions, all methods use a permutation vector for slot access.

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL