0.9.2.36:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 11 Jul 2005 10:31:37 +0000 (10:31 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 11 Jul 2005 10:31:37 +0000 (10:31 +0000)
Fix for memory fault error in foreign.test.sh
... we need to be able to have two different linkage-table
entries for "address of data" and "instructions
to jump to address" (DATAP=NIL/T)
... use a cons as the hash key rather than just the name
... (this area is not my speciality, so this fix may be
suboptimal.  Adjust as necessary)

NEWS
src/code/foreign.lisp
src/code/linkage-table.lisp
tests/foreign.test.sh
version.lisp-expr

diff --git a/NEWS b/NEWS
index 3d4329f..356018a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ changes in sbcl-0.9.3 relative to sbcl-0.9.2:
   * optimizations: LOGNOR on fixnums is improved in the MIPS backend.
     (Thanks to Thiemo Seufer)
   * bug fix: nested reader invokations work correctly
+  * bug fix: it is possible to have simultaneous references to foreign
+    code and foreign data with the same name.
   * threads
     ** added x86-64 support
     ** incompatible change: the threading api now works with thread
index 247d09a..86b9752 100644 (file)
@@ -121,12 +121,12 @@ if the symbol isn't found."
     (when (<= sb!vm:linkage-table-space-start
              addr
              sb!vm:linkage-table-space-end)
-      (maphash (lambda (name info)
+      (maphash (lambda (name-and-datap info)
                 (let ((table-addr (linkage-info-address info)))
                   (when (<= table-addr
                             addr
                             (+ table-addr sb!vm:linkage-table-entry-size))
-                    (return-from sap-foreign-symbol name))))
+                    (return-from sap-foreign-symbol (car name-and-datap)))))
               *linkage-info*))
     #!+os-provides-dladdr
     (with-alien ((info (struct dl-info
index cb56720..aebb35b 100644 (file)
@@ -55,7 +55,7 @@
              (hash-table-count *linkage-info*)
              name))
     (write-linkage-table-entry table-address real-address datap)
-    (setf (gethash name *linkage-info*)
+    (setf (gethash (cons name datap) *linkage-info*)
           (make-linkage-info :address table-address :datap datap))))
 
 ;;; Add a foreign linkage entry if none exists, return the address
@@ -63,7 +63,7 @@
 (defun ensure-foreign-symbol-linkage (name datap)
   (/show0 "ensure-foreign-symbol-linkage")
   (sb!thread:with-mutex (*foreign-lock*)
-    (let ((info (or (gethash name *linkage-info*)
+    (let ((info (or (gethash (cons name datap) *linkage-info*)
                     (link-foreign-symbol name datap))))
       (linkage-info-address info))))
 
 ;;; shared libraries have been reopened, and after a previously loaded
 ;;; shared object is reloaded.
 (defun update-linkage-table ()
-  ;; Doesn't take care of it's own locking -- callers are responsible
-  (maphash (lambda (name info)
-             (let* ((datap (linkage-info-datap info))
+  ;; Doesn't take care of its own locking -- callers are responsible
+  (maphash (lambda (name-and-datap info)
+             (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)))
index b5176bd..edc251e 100644 (file)
@@ -217,7 +217,7 @@ fi
 
 echo missing ok
 
-rm $testfilestem.*
+rm -f $testfilestem.* $testfilestem-*
 
 # success convention for script
 exit 104 
index 170c71e..010c98d 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.2.35"
+"0.9.2.36"