master: Guard a thing with backend-subfeatures

snuglas via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  40aa19c16995d8e83be62a924644fc6f012f3ca7 (commit)
      from  4d06d766bb133ab113458de91bf71424a5b2aa84 (commit)

- Log -----------------------------------------------------------------
commit 40aa19c16995d8e83be62a924644fc6f012f3ca7
Author: Douglas Katzman <[email protected]>
Date:   Thu Aug 6 01:42:54 2026 +0000

    Guard a thing with backend-subfeatures
---
 src/code/setf-funs.lisp | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/code/setf-funs.lisp b/src/code/setf-funs.lisp
index ab49e56f0..17a5b3071 100644
--- a/src/code/setf-funs.lisp
+++ b/src/code/setf-funs.lisp
@@ -92,27 +92,29 @@
                     instance-pointer-lowtag))
            (type (dsd-type dsd)))
       (declare (ignorable disp type))
-      #+(or arm64 riscv64 x86-64)
-      (multiple-value-bind (sc primtype)
-          (ecase (dsd-raw-type dsd)
-            (t (if (eq type 'fixnum)
-                   (values 'any-reg 'tagged-num)
-                   (values 'descriptor-reg 't)))
-            (signed-word (values 'signed-reg 'signed-num))
-            (word (values 'unsigned-reg 'unsigned-num)))
-        `(truly-the ,type
-          (inline-vop (((instance descriptor-reg t) (the ,(dd-name (car info)) ,instance))
-                       ((val ,sc ,primtype) (the ,type ,value))
-                       ((temp)))
-                      ((res ,sc ,primtype))
-           #+arm64 (progn (inst add temp instance ,disp)
-                          (inst swpal val res temp))
-           #+riscv (progn (inst addi temp instance ,disp)
-                          (inst amoswap res val temp :aq :rl))
-           #+x86-64 (progn (move temp val)
-                           (inst xchg temp (ea ,disp instance)) ; LOCK is implicit
-                           (move res temp)))))
-      #-(or arm64 riscv64 x86-64)
+      (when (or #+(or riscv64 x86-64) t
+                #+arm64 (member :arm-v8.1 *backend-subfeatures*))
+        (return-from %atomic-exchange
+          (multiple-value-bind (sc primtype)
+              (ecase (dsd-raw-type dsd)
+                (t (if (eq type 'fixnum)
+                       (values 'any-reg 'tagged-num)
+                       (values 'descriptor-reg 't)))
+                (signed-word (values 'signed-reg 'signed-num))
+                (word (values 'unsigned-reg 'unsigned-num)))
+            `(truly-the ,type
+              (inline-vop (((instance descriptor-reg t) (the ,(dd-name (car info)) ,instance))
+                           ((val ,sc ,primtype) (the ,type ,value))
+                           ((temp)))
+                          ((res ,sc ,primtype))
+               #+arm64 (progn (inst add temp instance ,disp)
+                              (inst swpal val res temp))
+               #+riscv (progn (inst addi temp instance ,disp)
+                              (inst amoswap res val temp :aq :rl))
+               #+x86-64 (progn (move temp val)
+                               (inst xchg temp (ea ,disp instance)) ; LOCK is implicit
+                               (move res temp)))))))
+      ;; fallback variant
       `(let* ((.instance. ,instance) ; GET-CAS-EXPANSION exists. I don't care
               (.new. ,value)
               (.old. (,accessor .instance.)))

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


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.