master: arm64: fix alien-struct-by-value copying
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 4b3abf2f8c99f6a4a13c41b2b57b3a0ed326549e (commit)
from da85ccc9b4fad0fb8a17d4b52432f8d3c5de9dd8 (commit)
- Log -----------------------------------------------------------------
commit 4b3abf2f8c99f6a4a13c41b2b57b3a0ed326549e
Author: Stas Boukarev <[email protected]>
Date: Thu Apr 23 07:48:01 2026 +0300
arm64: fix alien-struct-by-value copying
Don't stop too early.
---
src/compiler/arm64/c-call.lisp | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/compiler/arm64/c-call.lisp b/src/compiler/arm64/c-call.lisp
index 18caae592..511d5ab33 100644
--- a/src/compiler/arm64/c-call.lisp
+++ b/src/compiler/arm64/c-call.lisp
@@ -703,14 +703,17 @@
do (cond ((>= remaining 8)
(inst ldr temp-tn (@ ptr-tn off))
(inst str temp-tn (@ nsp-tn (+ frame-offset off))))
- ((>= remaining 4)
- (inst ldr (32-bit-reg temp-tn) (@ ptr-tn off))
- (inst str (32-bit-reg temp-tn) (@ nsp-tn (+ frame-offset off))))
(t
+ (when (>= remaining 4)
+ (inst ldr (32-bit-reg temp-tn) (@ ptr-tn off))
+ (inst str (32-bit-reg temp-tn) (@ nsp-tn (+ frame-offset off)))
+ (decf remaining 4)
+ (incf off 4))
;; Copy remaining bytes one by one
(loop for b from 0 below remaining
do (inst ldrb (32-bit-reg temp-tn) (@ ptr-tn (+ off b)))
- (inst strb (32-bit-reg temp-tn) (@ nsp-tn (+ frame-offset off b)))))))))
+ (inst strb (32-bit-reg temp-tn) (@ nsp-tn (+ frame-offset off b))))
+ (return))))))
;; HFA: passed in floating-point registers
((multiple-value-bind (hfa-type hfa-count) (hfa-base-type type)
(when hfa-type
@@ -780,13 +783,16 @@
do (cond ((>= remaining 8)
(inst ldr temp-tn (@ nsp-tn off))
(inst str temp-tn (@ x8-save-tn off)))
- ((>= remaining 4)
- (inst ldr (32-bit-reg temp-tn) (@ nsp-tn off))
- (inst str (32-bit-reg temp-tn) (@ x8-save-tn off)))
(t
+ (when (>= remaining 4)
+ (inst ldr (32-bit-reg temp-tn) (@ nsp-tn off))
+ (inst str (32-bit-reg temp-tn) (@ x8-save-tn off))
+ (decf remaining 4)
+ (incf off 4))
(loop for b from 0 below remaining
do (inst ldrb (32-bit-reg temp-tn) (@ nsp-tn (+ off b)))
- (inst strb (32-bit-reg temp-tn) (@ x8-save-tn (+ off b)))))))
+ (inst strb (32-bit-reg temp-tn) (@ x8-save-tn (+ off b))))
+ (return))))
;; Return the pointer in x0
(inst mov r0-tn x8-save-tn)))
;; HFA: load into floating-point registers
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL