master: Move some things

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  7376db7c79d4cbb7b4dafe8cab2fb80ce09a9c00 (commit)
      from  8f009e157941c12239e7ebc7a6af0cf61109f083 (commit)

- Log -----------------------------------------------------------------
commit 7376db7c79d4cbb7b4dafe8cab2fb80ce09a9c00
Author: Douglas Katzman <[email protected]>
Date:   Tue Apr 7 05:32:26 2026 -0400

    Move some things
    
    - put EMIT-SYMBOL-WRITE-BARRIER with EMIT-GENGC-BARRIER
    - decrease scope of ACCESS-WIRED-TLS-VAL macro
---
 src/compiler/x86-64/cell.lisp   | 12 ------------
 src/compiler/x86-64/memory.lisp | 23 +++++++++++++++++++++++
 src/compiler/x86-64/tls.lisp    |  5 ++---
 3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/src/compiler/x86-64/cell.lisp b/src/compiler/x86-64/cell.lisp
index 6f1585d0a..d56f04fc3 100644
--- a/src/compiler/x86-64/cell.lisp
+++ b/src/compiler/x86-64/cell.lisp
@@ -92,18 +92,6 @@
   (:generator 1
     (inst mov result unbound-marker-widetag)))
 
-(defun emit-symbol-write-barrier (vop symbol temp newval-tn-ref)
-  (declare (ignorable vop))
-  #+permgen
-  (when (require-gengc-barrier-p symbol newval-tn-ref)
-    (unless (and (sc-is symbol immediate) (static-symbol-p (tn-value symbol)))
-      (inst push symbol)
-      (invoke-asm-routine 'call 'gc-remember-symbol vop)))
-  ;; IMMEDIATE sc means that the symbol is static or immobile.
-  ;; Static symbols are roots, and immobile symbols use page fault handling.
-  (unless (sc-is symbol immediate)
-    (emit-gengc-barrier symbol nil temp newval-tn-ref)))
-
 ;; Return the effective address of the value slot of static SYMBOL.
 (defun static-symbol-value-ea (symbol &optional (byte 0))
   (ea (+ (static-symbol-offset symbol)
diff --git a/src/compiler/x86-64/memory.lisp b/src/compiler/x86-64/memory.lisp
index a95d48f69..94246e385 100644
--- a/src/compiler/x86-64/memory.lisp
+++ b/src/compiler/x86-64/memory.lisp
@@ -80,6 +80,29 @@
                      (setf value-tn-ref (tn-ref-across value-tn-ref))
                      while value-tn-ref)))))))
 
+(defun symbol-set-barrier-p (symbol newval-tn-ref)
+  (if (and (sc-is symbol immediate) (static-symbol-p (tn-value symbol)))
+      nil
+      (require-gengc-barrier-p symbol newval-tn-ref)))
+
+;;; There are 3 unused bits in the symbol-hash slot which I had intended
+;;; to use to indicate whether a symbol is in fixedobj space and whether the
+;;; containing card was marked since the last GC, to avoid repetitive
+;;; work - just do a bit test and skip.
+;;; Initially I'd like to just get this correct, and then see if it's worth
+;;; doing that optimization which will complicate the GC a little.
+(defun emit-symbol-write-barrier (vop symbol temp newval-tn-ref)
+  (declare (ignorable vop))
+  #+permgen
+  (when (require-gengc-barrier-p symbol newval-tn-ref)
+    (unless (and (sc-is symbol immediate) (static-symbol-p (tn-value symbol)))
+      (inst push symbol)
+      (invoke-asm-routine 'call 'gc-remember-symbol vop)))
+  ;; IMMEDIATE sc means that the symbol is static or immobile.
+  ;; Static symbols are roots, and immobile symbols use page fault handling.
+  (unless (sc-is symbol immediate)
+    (emit-gengc-barrier symbol nil temp newval-tn-ref)))
+
 #-soft-card-marks
 (defun emit-code-page-gengc-barrier (object scratch-reg)
   (inst mov scratch-reg object)
diff --git a/src/compiler/x86-64/tls.lisp b/src/compiler/x86-64/tls.lisp
index 910ed21e6..70124a978 100644
--- a/src/compiler/x86-64/tls.lisp
+++ b/src/compiler/x86-64/tls.lisp
@@ -39,9 +39,6 @@
       `(%cas-symbol-global-value symbol old new)
       (sb-c::give-up-ir1-transform)))
 
-(macrolet ((access-wired-tls-val (sym) ; SYM is a symbol
-             `(thread-tls-ea (load-time-tls-offset ,sym))))
-
 (flet ((emit-cas (ea symbol old new rax result vop &aux (node (sb-c::vop-node vop)))
          (if (sc-is old immediate) (move-immediate rax (immediate-tn-repr old)) (move rax old))
          (inst cmpxchg :lock ea new)
@@ -132,6 +129,8 @@
 ;;; symbol-value only about twice as often as BIND, which is not enough to outform
 ;;; a comparision and conditional move. But I suspect this situation is rare.
 
+(macrolet ((access-wired-tls-val (sym) ; SYM is a symbol
+             `(thread-tls-ea (load-time-tls-offset ,sym))))
 ;; This code is tested by 'codegen.impure.lisp'
 (defun emit-symeval (value symbol symbol-ref symbol-reg check-boundp vop)
   (let ((known-symbol (and (constant-tn-p symbol) (tn-value symbol))))

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


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.