gencgc: Make MAKE-LISP-OBJ of SIMPLE-FUN object addresses work.
authorAlastair Bridgewater <nyef@arisu.lisphacker.com>
Wed, 9 Nov 2011 16:48:19 +0000 (11:48 -0500)
committerAlastair Bridgewater <nyef@arisu.lisphacker.com>
Thu, 10 Nov 2011 19:43:48 +0000 (14:43 -0500)
  * This turned out to be a bug in the gencgc guts,
looks_like_valid_lisp_pointer_p() was doing pointer arithmetic
when it should have been converting the pointer to an integer.

NEWS
src/runtime/gencgc.c
tests/debug.impure.lisp

diff --git a/NEWS b/NEWS
index 9c29c28..ff33e74 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ changes relative to sbcl-1.0.53:
     correctly, even on wide-fixnum builds. (lp#887220)
   * bug fix: (directory "foo/*/*.*") did not follow symlinks in foo/ that
     resolved to directories.
+  * bug fix: SB-KERNEL:MAKE-LISP-OBJ on GENCGC no longer categorically
+    refuses to create SIMPLE-FUN objects.
 
 changes in sbcl-1.0.53 relative to sbcl-1.0.52:
   * enhancement: on 64-bit targets, in src/compiler/generic/early-vm.lisp,
index ecced08..1023b6f 100644 (file)
@@ -2130,7 +2130,7 @@ looks_like_valid_lisp_pointer_p(lispobj *pointer, lispobj *start_addr)
         case CODE_HEADER_WIDETAG:
           /* Make sure we actually point to a function in the code object,
            * as opposed to a random point there. */
-          if (SIMPLE_FUN_HEADER_WIDETAG==widetag_of(*(pointer-FUN_POINTER_LOWTAG)))
+          if (SIMPLE_FUN_HEADER_WIDETAG==widetag_of(*((lispobj *)(((unsigned long)pointer)-FUN_POINTER_LOWTAG))))
             return 1;
           else
             return 0;
index c3c5a3b..9d8c34b 100644 (file)
 
 ;; unconditional, in case either previous left it enabled
 (disable-debugger)
+\f
+;;;; test some limitations of MAKE-LISP-OBJ
+
+;;; Older GENCGC systems had a bug in the pointer validation used by
+;;; MAKE-LISP-OBJ that made SIMPLE-FUN objects always fail to
+;;; validate.
+(with-test (:name (make-lisp-obj :simple-funs))
+  (sb-sys:without-gcing
+    (assert (eq #'identity
+                (sb-kernel:make-lisp-obj
+                 (sb-kernel:get-lisp-obj-address
+                  #'identity))))))
 
 (write-line "/debug.impure.lisp done")