master: Clean up sap-foreign-symbol
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 2993d7965c2c0172a9df29faae1b3799c36ed411 (commit)
from f7767f081ea7628a5e1b549160b743530834a5e3 (commit)
- Log -----------------------------------------------------------------
commit 2993d7965c2c0172a9df29faae1b3799c36ed411
Author: Douglas Katzman <[email protected]>
Date: Mon Apr 13 17:57:46 2026 -0400
Clean up sap-foreign-symbol
Remove maybe-inline, remove old comments
---
src/code/foreign.lisp | 18 +++++-------------
src/compiler/generic/utils.lisp | 2 +-
src/compiler/x86-64/target-insts.lisp | 2 +-
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/code/foreign.lisp b/src/code/foreign.lisp
index ab890d0a1..429437a30 100644
--- a/src/code/foreign.lisp
+++ b/src/code/foreign.lisp
@@ -173,17 +173,14 @@ symbol designates a variable. May enter the symbol into the linkage-table."
(when (= value index) (return-from found key))))))))
(if (listp key) (car key) key)))
-(declaim (maybe-inline sap-foreign-symbol))
(defun sap-foreign-symbol (sap)
- (declare (ignorable sap))
(let ((addr (sap-int sap)))
- (declare (ignorable addr))
(when (<= sb-vm:alien-linkage-space-start
addr
- (+ sb-vm:alien-linkage-space-start sb-vm:alien-linkage-space-size))
+ (+ sb-vm:alien-linkage-space-start (1- sb-vm:alien-linkage-space-size)))
(return-from sap-foreign-symbol
(alien-linkage-index-to-name
- (sb-vm::alien-linkage-table-index-from-address addr))))
+ (sb-vm::alien-linkage-index-from-address addr))))
#+os-provides-dladdr
(with-alien ((info (struct dl-info
(filename c-string)
@@ -201,14 +198,9 @@ symbol designates a variable. May enter the symbol into the linkage-table."
;; However: We now try to allow libdl to acquire its internal locks in a GCing
;; thread, which means that we need all user threads to agree not to stop
;; for GC in the midst of _any_ libdl call.
- (let ((err (sb-vm:with-pseudo-atomic-foreign-calls
- (alien-funcall dladdr addr (addr info)))))
- (if (zerop err)
- nil
- (slot info 'symbol))))
- ;; FIXME: Even in the absence of dladdr we could search the
- ;; static foreign symbols (and *linkage-info*, for that matter).
- ))
+ (unless (zerop (sb-vm:with-pseudo-atomic-foreign-calls
+ (alien-funcall dladdr addr (addr info))))
+ (slot info 'symbol)))))
;;; There 2 vars are not defglobal, as defglobal implies always-bound.
(declaim (global *runtime-dlhandle* *shared-objects*))
diff --git a/src/compiler/generic/utils.lisp b/src/compiler/generic/utils.lisp
index 8fd5efa05..51bc861f6 100644
--- a/src/compiler/generic/utils.lisp
+++ b/src/compiler/generic/utils.lisp
@@ -81,7 +81,7 @@
(:down (- space-end (* (1+ i) alien-linkage-table-entry-size)))))
#-sb-xc-host
-(defun alien-linkage-table-index-from-address (addr)
+(defun alien-linkage-index-from-address (addr)
(ecase alien-linkage-table-growth-direction
(:up (floor (- addr alien-linkage-space-start) alien-linkage-table-entry-size))
(:down (1- (floor (- space-end addr) space-end))))))
diff --git a/src/compiler/x86-64/target-insts.lisp b/src/compiler/x86-64/target-insts.lisp
index ad2bd2c44..5dea78053 100644
--- a/src/compiler/x86-64/target-insts.lisp
+++ b/src/compiler/x86-64/target-insts.lisp
@@ -490,7 +490,7 @@
(or (when (<= sb-vm:alien-linkage-space-start addr
(+ sb-vm:alien-linkage-space-start
(1- sb-vm:alien-linkage-space-size)))
- (let* ((index (sb-vm::alien-linkage-table-index-from-address addr))
+ (let* ((index (sb-vm::alien-linkage-index-from-address addr))
(name (sb-impl::alien-linkage-index-to-name index)))
(note (lambda (s) (format s "&~A" name)) dstate)))
(unless (sb-kernel:immobile-space-addr-p addr)
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL