0.7.1.46:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 18 Mar 2002 19:08:00 +0000 (19:08 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 18 Mar 2002 19:08:00 +0000 (19:08 +0000)
Merged patches from CSR "pseudo-atomic magic constant propagation"
sbcl-devel 2002-03-12
... first patch for PSEUDO-ATOMIC-TRAP propagation on SPARC
... second patch for various #+ -> #!+ changes in library and
alpha port
Also other SPARC cleanups
... implemented suggestion from DB for ldso-stubs.S, allowing
the SPARC port to be dynamically linked
... fprintf -> FSHOW

14 files changed:
src/code/debug-int.lisp
src/code/gc.lisp
src/compiler/alpha/arith.lisp
src/compiler/alpha/array.lisp
src/compiler/alpha/cell.lisp
src/compiler/alpha/macros.lisp
src/compiler/alpha/type-vops.lisp
src/compiler/generic/genesis.lisp
src/runtime/Config.sparc-linux
src/runtime/ldso-stubs.S
src/runtime/linux-os.c
src/runtime/sparc-arch.c
src/runtime/sparc-assem.S
version.lisp-expr

index d261c82..c0a1517 100644 (file)
                                (format t
                                       "debug: both still valid ~S ~S ~S ~S~%"
                                        lisp-ocfp lisp-ra c-ocfp c-ra))
-                     #+freebsd
+                     #!+freebsd
                      (if (sap> lisp-ocfp c-ocfp)
                         (values lisp-ra lisp-ocfp)
                        (values c-ra c-ocfp))
-                       #-freebsd
+                       #!-freebsd
                        (values lisp-ra lisp-ocfp))
                     (lisp-path-fp
                      ;; The lisp convention is looking good.
             (sb!vm:context-float-register
              escaped (sb!c:sc-offset-offset sc-offset) 'double-float)
             (sb!vm:context-float-register
-             escaped (+ (sb!c:sc-offset-offset sc-offset) #!+sparc 2 #-sparc 1)
+             escaped (+ (sb!c:sc-offset-offset sc-offset) #!+sparc 2 #!-sparc 1)
              'double-float))
            :invalid-value-for-unescaped-register-storage))
       #!+long-float
     (do ((frame frame (frame-down frame)))
        ((not frame) nil)
       (when (and (compiled-frame-p frame)
-                 (#-x86 eq #+x86 sap=
+                 (#!-x86 eq #!+x86 sap=
                  lra
                  (get-context-value frame lra-save-offset lra-sc-offset)))
        (return t)))))
index e623c9e..8bf7ee3 100644 (file)
@@ -143,13 +143,13 @@ and submit it as a patch."
 ;;; Unlike CMU CL, we don't export this variable. (There's no need to,
 ;;; since our BYTES-CONSED-BETWEEN-GCS function is SETFable.)
 (defvar *bytes-consed-between-gcs*
-  #+gencgc (* 4 (expt 10 6))
+  #!+gencgc (* 4 (expt 10 6))
   ;; Stop-and-copy GC is really really slow when used too often. CSR
   ;; reported that even on his old 64 Mb SPARC, 20 Mb is much faster
   ;; than 4 Mb when rebuilding SBCL ca. 0.7.1. For modern machines
   ;; with >> 128 Mb memory, the optimum could be significantly more
   ;; than this, but at least 20 Mb should be better than 4 Mb.
-  #-gencgc (* 20 (expt 10 6)))
+  #!-gencgc (* 20 (expt 10 6)))
 (declaim (type index *bytes-consed-between-gcs*))
 
 ;;;; GC hooks
index 9c96308..42af22a 100644 (file)
   (unsigned-reg) unsigned-num sb!bignum::%bignum-ref)
 
 (define-full-setter bignum-set * bignum-digits-offset other-pointer-lowtag
-  (unsigned-reg) unsigned-num sb!bignum::%bignum-set #+gengc nil)
+  (unsigned-reg) unsigned-num sb!bignum::%bignum-set #!+gengc nil)
 
 (define-vop (digit-0-or-plus)
   (:translate sb!bignum::%digit-0-or-plusp)
index ab99060..cf3af86 100644 (file)
@@ -52,7 +52,7 @@
 
 (define-full-setter %set-array-dimension *
   array-dimensions-offset other-pointer-lowtag
-  (any-reg) positive-fixnum sb!impl::%set-array-dimension #+gengc nil)
+  (any-reg) positive-fixnum sb!impl::%set-array-dimension #!+gengc nil)
 
 
 (defknown sb!impl::%array-rank (t) index (flushable))
index 93592cf..22a2734 100644 (file)
 (define-vop (set-slot)
   (:args (object :scs (descriptor-reg))
         (value :scs (descriptor-reg any-reg null zero)))
-  (:info name offset lowtag #+gengc remember)
+  (:info name offset lowtag #!+gengc remember)
   (:ignore name)
   (:results)
   (:generator 1
-    #+gengc
+    #!+gengc
     (if remember
        (storew-and-remember-slot value object offset lowtag)
        (storew value object offset lowtag))
-    #-gengc
+    #!-gengc
     (storew value object offset lowtag)))
 \f
 ;;;; symbol hacking VOPs
     (inst addq bsp-tn (* 2 n-word-bytes) bsp-tn)
     (storew temp bsp-tn (- binding-value-slot binding-size))
     (storew symbol bsp-tn (- binding-symbol-slot binding-size))
-    (#+gengc storew-and-remember-slot #-gengc storew
+    (#!+gengc storew-and-remember-slot #!-gengc storew
             val symbol symbol-value-slot other-pointer-lowtag)))
 
 
   (:generator 0
     (loadw symbol bsp-tn (- binding-symbol-slot binding-size))
     (loadw value bsp-tn (- binding-value-slot binding-size))
-    (#+gengc storew-and-remember-slot #-gengc storew
+    (#!+gengc storew-and-remember-slot #!-gengc storew
             value symbol symbol-value-slot other-pointer-lowtag)
     (storew zero-tn bsp-tn (- binding-symbol-slot binding-size))
     (inst subq bsp-tn (* 2 n-word-bytes) bsp-tn)))
       (loadw symbol bsp-tn (- binding-symbol-slot binding-size))
       (loadw value bsp-tn (- binding-value-slot binding-size))
       (inst beq symbol skip)
-      (#+gengc storew-and-remember-slot #-gengc storew
+      (#!+gengc storew-and-remember-slot #!-gengc storew
               value symbol symbol-value-slot other-pointer-lowtag)
       (storew zero-tn bsp-tn (- binding-symbol-slot binding-size))
 
 \f
 ;;;; mutator accessing
 
-#+gengc
+#!+gengc
 (progn
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
index c6a2de8..b3e2624 100644 (file)
             '((inst mskll value 4 value)))))))
 
 (defmacro define-full-setter (name type offset lowtag scs el-type
-                                  &optional translate #+gengc (remember t))
+                                  &optional translate #!+gengc (remember t))
   `(progn
      (define-vop (,name)
        ,@(when translate
index 010d84e..2105967 100644 (file)
 ;;; XXX
 #|
 (def-type-vops scavenger-hook-p nil nil nil
-  #-gengc 0 #+gengc scavenger-hook-type)
+  #!-gengc 0 #!+gengc scavenger-hook-type)
 |#
 
 (def-type-vops code-component-p nil nil nil
   code-header-widetag)
 
 (def-type-vops lra-p nil nil nil
-  #-gengc return-pc-header-widetag #+gengc 0)
+  #!-gengc return-pc-header-widetag #!+gengc 0)
 
 (def-type-vops fdefn-p nil nil nil
   fdefn-widetag)
index 4eca659..a7c39ee 100644 (file)
                   i)))))
   (terpri)
 
+  ;; FIXME: The SPARC has a PSEUDO-ATOMIC-TRAP that differs between
+  ;; platforms. If we export this from the SB!VM package, it gets
+  ;; written out as #define trap_PseudoAtomic, which is confusing as
+  ;; the runtime treats trap_ as the prefix for illegal instruction
+  ;; type things. We therefore don't export it, but instead do
+  (when (boundp 'sb!vm::pseudo-atomic-trap)
+    (format t "#define PSEUDO_ATOMIC_TRAP ~D /* 0x~:*~X */~%" sb!vm::pseudo-atomic-trap)
+    (terpri))
+  ;; possibly this is another candidate for a rename (to
+  ;; pseudo-atomic-trap-number or pseudo-atomic-magic-constant
+  ;; [possibly applicable to other platforms])
+
   ;; writing primitive object layouts
   (let ((structs (sort (copy-list sb!vm:*primitive-objects*) #'string<
                       :key (lambda (obj)
index bf3f108..284d40a 100644 (file)
@@ -16,12 +16,12 @@ LINKFLAGS = -v -g
 NM = nm -p
 
 ASSEM_SRC = sparc-assem.S 
-ARCH_SRC = sparc-arch.c undefineds.c 
-#ARCH_SRC = sparc-arch.c ldso-stubs.S
+#ARCH_SRC = sparc-arch.c undefineds.c 
+ARCH_SRC = sparc-arch.c ldso-stubs.S
 
 OS_SRC = linux-os.c  sparc-linux-os.c os-common.c 
-LINKFLAGS+=-static 
-#LINKFLAGS+=-rdynamic
+#LINKFLAGS+=-static 
+LINKFLAGS+=-rdynamic
 OS_LIBS= -ldl
 
 GC_SRC= gc.c
index 40ce64d..736edab 100644 (file)
@@ -59,6 +59,20 @@ ldso_stub__ ## fct: ;                           \
 .L ## fct ## e1: ;                              \
         .size    ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
        
+#elif defined sparc
+       
+       /* This is an attempt to follow DB's hint of sbcl-devel
+        * 2001-09-18. -- CSR */
+#define LDSO_STUBIFY(fct)                       \
+.globl ldso_stub__ ## fct ;                     \
+       .type    ldso_stub__ ## fct,@function ; \
+ldso_stub__ ## fct: ;                           \
+       sethi %hi(fct),%g1      ;               \
+       jmpl %g1+%lo(fct),%g0   ;               \
+       nop /* delay slot*/     ;               \
+.L ## fct ## e1: ;                              \
+       .size    ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
+       
 #else
 #error unsupported CPU architecture
 #endif
index 69d5a41..8de2f3c 100644 (file)
@@ -73,7 +73,7 @@ void os_init(void)
         * that has more than one digit initially -- CSR, 2002-02-12 */
        minor_version = atoi(name.release+2);
        if (minor_version < 4) {
-           fprintf(stderr,"linux minor version=%d;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", minor_version);
+           FSHOW((stderr,"linux minor version=%d;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", minor_version));
            early_kernel = 1;
        }
 #endif
index 6f6cde2..f6e7928 100644 (file)
@@ -157,15 +157,9 @@ static int pseudo_atomic_trap_p(os_context_t *context)
   badinst = *pc;
   result = 0;
 
-  /* Check to see if the current instruction is a trap #x40 */
-  /* FIXME: As written, this will not work when someone comes to port
-     this to Solaris. We have chosen trap 0x40 on SPARC Linux because
-     trap 0x10, used in CMUCL/Solaris, generates a sigtrap rather than
-     a sigill. This number should not be hardcoded, but should come,
-     if possible, from src/compiler/target/parms.lisp via sbcl.h --
-     CSR */
+  /* Check to see if the current instruction is a pseudo-atomic-trap */
   if (((badinst >> 30) == 2) && (((badinst >> 19) & 0x3f) == 0x3a)
-      && (((badinst >> 13) & 1) == 1) && ((badinst & 0x7f) == 0x40))
+      && (((badinst >> 13) & 1) == 1) && ((badinst & 0x7f) == PSEUDO_ATOMIC_TRAP))
     {
       unsigned int previnst;
       previnst = pc[-1];
@@ -183,9 +177,7 @@ static int pseudo_atomic_trap_p(os_context_t *context)
         }
       else
         {
-         /* FIXME: in the light of the comment above, this fprintf is
-             bogus. CSR */
-          fprintf(stderr, "Oops!  Got a trap 16 without a preceeding andcc!\n");
+          fprintf(stderr, "Oops!  Got a PSEUDO-ATOMIC-TRAP without a preceeding andcc!\n");
         }
     }
   return result;
index 804497f..a18bdc2 100644 (file)
@@ -16,7 +16,6 @@
 /* FIXME */
 #define FRAMESIZE 0x48
 #define ST_FLUSH_WINDOWS 0x03
-#define PSEUDO_ATOMIC_TRAP_NUMBER 64
        .seg    "text"
         .global call_into_lisp
        FUNCDEF(call_into_lisp)
@@ -61,11 +60,7 @@ call_into_lisp:
        sub     reg_ALLOC, 4, reg_ALLOC
        andcc   reg_ALLOC, 3, reg_ZERO
        
-       /* OK, this is ridiculous. We badly urgently need this to be
-       centralized, because that's now _three_ places where this
-       number is used. CSR, 2002-02-09 */
-
-       tne     64
+       tne     PSEUDO_ATOMIC_TRAP
         /* Pass in the args. */
         sll     %i2, 2, reg_NARGS
         mov     %i1, reg_CFP
@@ -113,7 +108,7 @@ lra:
         /* Were we interrupted? */
        sub     reg_ALLOC, 4, reg_ALLOC
        andcc   reg_ALLOC, 3, reg_ZERO
-       tne     PSEUDO_ATOMIC_TRAP_NUMBER
+       tne     PSEUDO_ATOMIC_TRAP
 
         /* Back to C we go. */
        ld      [%sp+FRAMESIZE-4], %i7
@@ -153,7 +148,7 @@ call_into_c:
         /* Were we interrupted? */
        sub     reg_ALLOC, 4, reg_ALLOC
        andcc   reg_ALLOC, 3, reg_ZERO
-       tne     PSEUDO_ATOMIC_TRAP_NUMBER
+       tne     PSEUDO_ATOMIC_TRAP
 
         /* Into C we go. */
         call    reg_CFUNC
@@ -191,7 +186,7 @@ call_into_c:
         /* No longer atomic. */
        sub     reg_ALLOC, 4, reg_ALLOC
        andcc   reg_ALLOC, 3, reg_ZERO
-       tne     PSEUDO_ATOMIC_TRAP_NUMBER
+       tne     PSEUDO_ATOMIC_TRAP
 
         /* Reset the lisp stack. */
         /* Note: OCFP is in one of the locals, it gets preserved across C. */
index 4120a1c..0a3d994 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.1.45"
+"0.7.1.46"