From 05e28b18c3fc2d697f04fb0393f51ce00147825e Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Mon, 16 Sep 2013 23:56:40 +0400 Subject: [PATCH] Remove a level of indirection in *linkage-info*. Don't store the address in a linkage-info structure, only the linkage-info-address slot was ever used. Store the address directly. --- src/code/foreign.lisp | 13 +++++-------- src/code/linkage-table.lisp | 13 ++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/code/foreign.lisp b/src/code/foreign.lisp index be46641..f8fb6b9 100644 --- a/src/code/foreign.lisp +++ b/src/code/foreign.lisp @@ -127,11 +127,10 @@ if the symbol isn't found." (when (<= sb!vm:linkage-table-space-start addr sb!vm:linkage-table-space-end) - (dohash ((name-and-datap info) *linkage-info* :locked t) - (let ((table-addr (linkage-info-address info))) - (when (and (<= table-addr addr) - (< addr (+ table-addr sb!vm:linkage-table-entry-size))) - (return-from sap-foreign-symbol (car name-and-datap)))))) + (dohash ((name-and-datap table-addr) *linkage-info* :locked t) + (when (and (<= table-addr addr) + (< addr (+ table-addr sb!vm:linkage-table-entry-size))) + (return-from sap-foreign-symbol (car name-and-datap))))) #!+os-provides-dladdr (with-alien ((info (struct dl-info (filename c-string) @@ -163,9 +162,7 @@ if the symbol isn't found." (loop for table-address from sb!vm::linkage-table-space-start by sb!vm::linkage-table-entry-size and reference in sb!vm::*required-runtime-c-symbols* - do (setf (gethash reference *linkage-info*) - (make-linkage-info :datap (cdr reference) - :address table-address))) + do (setf (gethash reference *linkage-info*) table-address)) #!+os-provides-dlopen (setf *runtime-dlhandle* (dlopen-or-lose)) #!+os-provides-dlopen diff --git a/src/code/linkage-table.lisp b/src/code/linkage-table.lisp index 61e21b5..e9fa8d4 100644 --- a/src/code/linkage-table.lisp +++ b/src/code/linkage-table.lisp @@ -29,8 +29,6 @@ (defvar *linkage-info* (make-hash-table :test 'equal :synchronized t)) -(defstruct linkage-info datap address) - (defun write-linkage-table-entry (table-address real-address datap) (/show0 "write-linkage-table-entry") (let ((reloc (int-sap table-address)) @@ -53,17 +51,15 @@ (hash-table-count *linkage-info*) name)) (write-linkage-table-entry table-address real-address datap) - (setf (gethash (cons name datap) *linkage-info*) - (make-linkage-info :address table-address :datap datap)))) + (setf (gethash (cons name datap) *linkage-info*) table-address))) ;;; Add a foreign linkage entry if none exists, return the address ;;; in the linkage table. (defun ensure-foreign-symbol-linkage (name datap) (/show0 "ensure-foreign-symbol-linkage") (with-locked-system-table (*linkage-info*) - (let ((info (or (gethash (cons name datap) *linkage-info*) - (link-foreign-symbol name datap)))) - (linkage-info-address info)))) + (or (gethash (cons name datap) *linkage-info*) + (link-foreign-symbol name datap)))) ;;; Update the linkage-table. Called during initialization after all ;;; shared libraries have been reopened, and after a previously loaded @@ -72,10 +68,9 @@ ;;; FIXME: Should figure out how to write only those entries that need ;;; updating. (defun update-linkage-table () - (dohash ((name-and-datap info) *linkage-info* :locked t) + (dohash ((name-and-datap table-address) *linkage-info* :locked t) (let* ((name (car name-and-datap)) (datap (cdr name-and-datap)) - (table-address (linkage-info-address info)) (real-address (ensure-dynamic-foreign-symbol-address name datap))) (aver (and table-address real-address)) -- 1.7.10.4