master: x86-64, struct-by-value: leave registers if a struct doesn't fit

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  5c866b5159ffda6f3f83c67c47b50dd113d539e7 (commit)
      from  e3d6e48da20817522949c41ffc44ea5ff805d9b4 (commit)

- Log -----------------------------------------------------------------
commit 5c866b5159ffda6f3f83c67c47b50dd113d539e7
Author: Stas Boukarev <[email protected]>
Date:   Sat Apr 25 21:06:13 2026 +0300

    x86-64, struct-by-value: leave registers if a struct doesn't fit
    
    Something else might go into that register.
---
 src/compiler/x86-64/c-call.lisp | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/compiler/x86-64/c-call.lisp b/src/compiler/x86-64/c-call.lisp
index e5af514fe..d6f9c09f8 100644
--- a/src/compiler/x86-64/c-call.lisp
+++ b/src/compiler/x86-64/c-call.lisp
@@ -403,17 +403,11 @@ Floats are passed in integer registers."
          (struct-size (sb-alien::struct-classification-size classification))
          (slots (sb-alien::struct-classification-register-slots classification)))
     (if (or (sb-alien::struct-classification-memory-p classification)
-            (let (stack
-                  (n-int (count :integer slots))
+            (let ((n-int (count :integer slots))
                   (n-fp (+ (count :single slots) (count :double slots))))
               ;; Don't split between registers/stack
-              (when (> (+ (arg-state-register-args state) n-int) max-int-args)
-                (setf (arg-state-register-args state) max-int-args
-                      stack t))
-              (when (> (+ (arg-state-xmm-args state) n-fp) max-xmm-args)
-                (setf (arg-state-xmm-args state) max-xmm-args
-                      stack t))
-              stack))
+              (or (> (+ (arg-state-register-args state) n-int) max-int-args)
+                  (> (+ (arg-state-xmm-args state) n-fp) max-xmm-args))))
         ;; Large struct: copy to stack (System V AMD64 ABI)
         ;; The struct is passed by value on the stack, not by pointer
         (let* ((words (ceiling struct-size 8))

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


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.