master: Mention foreign-symbol-address less
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 473201d8fd0cec719fd7f0e1f2713d23b59ccbd3 (commit)
from 03acc09c68b294905c4b14b6d38973d559f97f03 (commit)
- Log -----------------------------------------------------------------
commit 473201d8fd0cec719fd7f0e1f2713d23b59ccbd3
Author: Douglas Katzman <[email protected]>
Date: Tue Apr 14 14:42:47 2026 -0400
Mention foreign-symbol-address less
It has the same number of uses, but because the function name is wrong,
I don't like seeing it all over the place.
---
src/code/foreign.lisp | 10 ++++------
src/compiler/arm/c-call.lisp | 2 +-
src/compiler/arm64/c-call.lisp | 2 +-
src/compiler/generic/utils.lisp | 3 +++
src/compiler/loongarch64/c-call.lisp | 2 +-
src/compiler/mips/c-call.lisp | 2 +-
src/compiler/ppc/c-call.lisp | 6 ++----
src/compiler/ppc64/c-call.lisp | 8 ++------
src/compiler/x86/c-call.lisp | 2 +-
9 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/code/foreign.lisp b/src/code/foreign.lisp
index 191962122..cd9afafb2 100644
--- a/src/code/foreign.lisp
+++ b/src/code/foreign.lisp
@@ -117,14 +117,12 @@ symbol in the linkage table, and never returns an address in the linkage-table."
;;; It's not our problem that shared objects aren't loadable, but we get the
;;; flexibility of recompiling C without recompiling Lisp.
;;;
-;;; This function is somewhat badly named, because when DATAP is true,
-;;; the answer is not really the address of NAME, but rather the address
-;;; of the word in the alien-linkage-table holding the address of NAME.
-;;; (This would be better off named ALIEN-LINKAGE-ADDRESS)
+;;; This would be better off named ALIEN-LINKAGE-ADDRESS because the answer is not
+;;; the address of NAME, but rather the address of the word in the alien-linkage-table
+;;; holding the address of NAME, or a callable address in the linkage table.
;;; Unfortunately we can not rename it, because CFFI uses it, which is weird
;;; because the use is from a function named %FOREIGN-SYMBOL-POINTER which is
-;;; documented to return "a pointer to a foreign symbol NAME."
-;;; which it certainly does not do in all cases.
+;;; documented to return "a pointer to a foreign symbol NAME." which this isn't.
(defun foreign-symbol-address (name &optional datap)
"Returns the address of the foreign symbol NAME. DATAP must be true if the
symbol designates a variable.
diff --git a/src/compiler/arm/c-call.lisp b/src/compiler/arm/c-call.lisp
index 60f110696..c6228be26 100644
--- a/src/compiler/arm/c-call.lisp
+++ b/src/compiler/arm/c-call.lisp
@@ -505,7 +505,7 @@
(inst mov r2-tn nsp-tn)
;; Call
- (load-immediate-word r3-tn (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-immediate-word r3-tn (callback_wrapper_trampoline))
(inst blx r3-tn)
;; Result now on top of stack, put it in the right register
diff --git a/src/compiler/arm64/c-call.lisp b/src/compiler/arm64/c-call.lisp
index 03843f4e4..18caae592 100644
--- a/src/compiler/arm64/c-call.lisp
+++ b/src/compiler/arm64/c-call.lisp
@@ -745,7 +745,7 @@
(inst mov-sp r2-tn nsp-tn)
;; Call
- (load-immediate-word r3-tn (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-immediate-word r3-tn (callback_wrapper_trampoline))
(inst blr r3-tn)
;; Result now on top of stack, put it in the right register
diff --git a/src/compiler/generic/utils.lisp b/src/compiler/generic/utils.lisp
index 8a627e432..4a8a39cc1 100644
--- a/src/compiler/generic/utils.lisp
+++ b/src/compiler/generic/utils.lisp
@@ -671,3 +671,6 @@
`(let ((*location-context* ',value))
(emit-error-break sb-assem::*current-vop* cerror-trap (error-number-or-lose 'sb-kernel::mprint-error)
(list ,value))))
+
+(defmacro callback_wrapper_trampoline ()
+ '(foreign-symbol-address "callback_wrapper_trampoline"))
diff --git a/src/compiler/loongarch64/c-call.lisp b/src/compiler/loongarch64/c-call.lisp
index 11c24abfc..eec1a40d1 100644
--- a/src/compiler/loongarch64/c-call.lisp
+++ b/src/compiler/loongarch64/c-call.lisp
@@ -303,7 +303,7 @@
(mapcar #'make-gpr '(4 5 6 7 1 3))
(inst addi.d sp sp (- n-frame-bytes))
(inst st.d ra sp (- n-frame-bytes n-word-bytes))
- (inst li a3 (foreign-symbol-address "callback_wrapper_trampoline"))
+ (inst li a3 (callback_wrapper_trampoline))
(inst li a0 (fixnumize index))
(inst addi.d a1 sp n-frame-bytes)
(inst addi.d a2 sp n-callee-register-args-bytes)
diff --git a/src/compiler/mips/c-call.lisp b/src/compiler/mips/c-call.lisp
index 581c4f14d..1811ef175 100644
--- a/src/compiler/mips/c-call.lisp
+++ b/src/compiler/mips/c-call.lisp
@@ -426,7 +426,7 @@ and a pointer to the arguments."
(inst sw ra sp (- n-frame-bytes n-word-bytes))
;; Setup the args and make the call.
- (inst li t9 (foreign-symbol-address "callback_wrapper_trampoline"))
+ (inst li t9 (callback_wrapper_trampoline))
(inst li a0 (fixnumize index))
(inst addu a1 sp n-frame-bytes)
(inst jal t9)
diff --git a/src/compiler/ppc/c-call.lisp b/src/compiler/ppc/c-call.lisp
index e03716eb2..b34fd4697 100644
--- a/src/compiler/ppc/c-call.lisp
+++ b/src/compiler/ppc/c-call.lisp
@@ -642,9 +642,7 @@
(inst stwu stack-pointer stack-pointer (- frame-size))
;; And make the call.
- (load-address-into
- r0
- (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-address-into r0 (callback_wrapper_trampoline))
(inst mtlr r0)
(inst blrl)
@@ -786,7 +784,7 @@
(inst stw r0 sp (* 2 n-word-bytes)) ; FIXME: magic constant
(inst stwu sp sp (- frame-size))
;; Make the call
- (load-address-into r0 (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-address-into r0 (callback_wrapper_trampoline))
(inst mtlr r0)
(inst blrl))
;; We're back! Restore sp and lr, load the return value from just
diff --git a/src/compiler/ppc64/c-call.lisp b/src/compiler/ppc64/c-call.lisp
index f62de1b26..25f667d78 100644
--- a/src/compiler/ppc64/c-call.lisp
+++ b/src/compiler/ppc64/c-call.lisp
@@ -412,14 +412,10 @@
;; And make the call.
#+little-endian
- (load-address-into
- r0
- (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-address-into r0 (callback_wrapper_trampoline))
#+big-endian
(destructuring-bind (r2 r12) (mapcar #'make-gpr '(2 12))
- (load-address-into
- r12
- (foreign-symbol-address "callback_wrapper_trampoline"))
+ (load-address-into r12 (callback_wrapper_trampoline))
(inst ld r0 r12 0)
(inst ld r2 r12 8))
(inst mtlr r0)
diff --git a/src/compiler/x86/c-call.lisp b/src/compiler/x86/c-call.lisp
index 75a20ac69..b8a48d07b 100644
--- a/src/compiler/x86/c-call.lisp
+++ b/src/compiler/x86/c-call.lisp
@@ -407,7 +407,7 @@ pointer to the arguments."
(inst push eax) ; arg1
(inst push (ash index 2)) ; arg0
- (inst mov eax (foreign-symbol-address "callback_wrapper_trampoline"))
+ (inst mov eax (callback_wrapper_trampoline))
(inst call eax)
;; now put the result into the right register
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL