[PATCH] Re: freeze for sbcl-2.6.2

Andreas Franke via Sbcl-devel <[email protected]> Wed, 25 Feb 2026 01:00:16 +0000
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <trinity-f161c887-ab06-4f42-8ded-9fb5f4718678-1771981216293@trinity-msg-rest-gmx-gmx-live-8d9bc96fb-j4q5g>
- It's only :allocation-size-histogram that's the problem. :cons-profiling is not factor.

- My focus is on the per-thread allocation-tracking (not using the full histograms).

- Asking the AI to bisect leads it to suggest the attached fix. (I really didn't add anything meaningful, just upgraded the "co-author" to "author".)

- On my machine, both tests that fail on current master=sbcl-2.6.1-221-g5e6717f7e appear to succeed with this patch applied.

I could make them mutually exclusive selections in src/cold/shared, but let me guess: you use both. Is making that restriction a problem?

I think it's possible to derive the histogram from the raw allocations.

On Sun, Feb 22, 2026 at 9:07 PM Andreas Franke via Sbcl-devel <[email protected] > wrote:

Building with both :allocation-size-histogram and :cons-profiling on linux x86-64,
I'm seeing unexpected test failures on current master (sbcl-2.6.1-205-gb46b7221f),
both pointing to the same issue:

_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
0001-Fix-allocation-size-histogram-for-large-constant-siz.patch (text/x-patch, 1.6 KB)
From 486e103947a664b7f706470c542157f04023a5aa Mon Sep 17 00:00:00 2001
From: "Claude Opus 4.6" <[email protected]>
Date: Wed, 25 Feb 2026 00:37:40 +0000
Subject: [PATCH] Fix allocation-size-histogram for large constant sizes

When a constant allocation size exceeds (SIGNED-BYTE 32), the histogram
large-bin branch tried to use it as an immediate operand to ADD, which
x86-64 doesn't support (ADD r/m64,imm only sign-extends from 32 bits).
Load the size into a temp register first, as already done for the
boxed/unboxed byte-count tallying a few lines above.

Fixes array.pure / LARGE-INDEX test failure when :allocation-size-histogram
is enabled. The failure was a TYPE-ERROR binding SB-X86-64-ASM::VALUE to
4294967328, triggered by (make-array (1+ (ash 1 32)) :element-type 'base-char).

Introduced by de5809667 ("Improve allocator histogram", 2023-06-06).
---
 src/compiler/x86-64/alloc.lisp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/x86-64/alloc.lisp b/src/compiler/x86-64/alloc.lisp
index 11c45d9ab..b0d2538e4 100644
--- a/src/compiler/x86-64/alloc.lisp
+++ b/src/compiler/x86-64/alloc.lisp
@@ -153,7 +153,8 @@
             (t
              (let ((index (+ (- (integer-length size) minlog2) vector-data-offset n-bins-small)))
                (inst add :qword (object-slot-ea data (+ index n-bins-large) other-pointer-lowtag)
-                     size)
+                     (cond (use-size-temp (inst mov temp size) temp)
+                           (t size)))
                (inst inc :qword (object-slot-ea data index other-pointer-lowtag)))))
       (inst pop data)))) ; restore the primive thread
 
-- 
2.34.1