0.7.3.22:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 20 May 2002 16:22:18 +0000 (16:22 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 20 May 2002 16:22:18 +0000 (16:22 +0000)
Test that the cross-compiler knows about constants on startup
... or at least at the end of being built
SunOS versions less than 5.8 now fully supported (thanks to Eric
Marsden for diagnosis and testing)

make-host-1.sh
src/runtime/sunos-os.c
tests/info.before-xc.lisp [new file with mode: 0644]
version.lisp-expr

index cb551ac..82ca185 100644 (file)
@@ -40,7 +40,8 @@ $SBCL_XC_HOST <<-'EOF' || exit 1
        ;; easy to spend a long time wandering around confused trying
        ;; to debug cross-compilation if it isn't.)
        (when (find :sb-test *shebang-features*)
-         (load "tests/type.before-xc.lisp"))
+         (load "tests/type.before-xc.lisp")
+         (load "tests/info.before-xc.lisp"))
         (host-cload-stem "src/compiler/generic/genesis")
        (sb!vm:genesis :c-header-file-name "src/runtime/sbcl.h")
        EOF
index d6d3215..4ed611d 100644 (file)
@@ -30,8 +30,13 @@ static os_vm_size_t real_page_size_difference=0;
    running on 5.8 to use MAP_ANON, but because of C's lack of
    introspection at runtime, we can't grab the right value because
    it's stuffed in a header file somewhere. We can, however, hardcode
-   it, and test at runtime for whether to use it... -- CSR, 2002-05-06 */
+   it, and test at runtime for whether to use it... -- CSR, 2002-05-06 
+
+   And, in fact, it sucks slightly more, as if you don't use MAP_ANON
+   you need to have /dev/zero open and pass the file descriptor to
+   mmap().  So overall, this counts as a KLUDGE. -- CSR, 2002-05-20 */
 int KLUDGE_MAYBE_MAP_ANON = 0x0;
+int kludge_mmap_fd = -1; /* default for MAP_ANON */
 
 void os_init(void)
 {
@@ -47,9 +52,15 @@ void os_init(void)
     minor_version = atoi(name.release+2);
     if (minor_version == 8) {
        KLUDGE_MAYBE_MAP_ANON = 0x100;
-    }
-    if (minor_version > 8) {
+    } else if (minor_version > 8) {
        FSHOW((stderr, "os_init: Solaris version greater than 8?\nUnknown MAP_ANON behaviour.\n"));
+       lose("Unknown mmap() interaction with MAP_ANON");
+    } else { /* minor_version < 8 */
+       kludge_mmap_fd = open("/dev/zero",O_RDONLY);
+       if (kludge_mmap_fd < 0) {
+           perror("open");
+           lose("Error in open(..)");
+       }
     }
 
     /* I do not understand this at all. FIXME. */
@@ -76,14 +87,14 @@ void os_init(void)
 os_vm_address_t os_validate(os_vm_address_t addr, os_vm_size_t len)
 {
     int flags = MAP_PRIVATE | MAP_NORESERVE | KLUDGE_MAYBE_MAP_ANON;
-    
     if (addr) 
        flags |= MAP_FIXED;
-    
+
     addr = mmap(addr, len, 
                OS_VM_PROT_ALL, 
                flags, 
-               -1, 0);
+               kludge_mmap_fd, 0);
+
     if (addr == MAP_FAILED) {
        perror("mmap");
        lose ("Error in mmap(..)");
@@ -162,8 +173,8 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
     os_vm_address_t addr;
 
     addr = arch_get_bad_addr(signal, info, context);
-       /* There's some complicated recovery code in linux-os.c here
-          that I'm currently too confused to understand. Fixme. */
+    /* There's some complicated recovery code in linux-os.c here
+       that I'm currently too confused to understand. FIXME. */
     if(!interrupt_maybe_gc(signal, info, context)) {
        interrupt_handle_now(signal, info, context);
     }
diff --git a/tests/info.before-xc.lisp b/tests/info.before-xc.lisp
new file mode 100644 (file)
index 0000000..4d91bfb
--- /dev/null
@@ -0,0 +1,29 @@
+;;;; tests of the INFO compiler database, initially with particular
+;;;; reference to knowledge of constants, intended to be executed as
+;;;; soon as the cross-compiler is built.
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;; 
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(in-package "SB!KERNEL")
+
+(/show "beginning tests/info.before-xc.lisp")
+
+(assert (eq (sb!int:info :variable :kind 'sb!vm:vector-data-offset)
+           :constant))
+;;; It's possible in general for a constant to have the value NIL, but
+;;; not for vector-data-offset, which must be a number:
+(multiple-value-bind (value successp)
+    (sb!int:info :variable :constant-value 'sb!vm:vector-data-offset)
+  (assert value)
+  (assert successp))
+
+(/show "done with tests/info.before-xc.lisp")
index e7b5ceb..ed76aaf 100644 (file)
@@ -18,4 +18,4 @@
 ;;; for internal versions, especially for internal versions off the
 ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.3.21"
+"0.7.3.22"