Raymond Toy pushed to branch sparc64-dev at cmucl / cmucl

Commits:

7 changed files:

Changes:

  • bin/cross-build-world.sh
    1 1
     #!/bin/sh
    
    2 2
     
    
    3 3
     usage() {
    
    4
    -    echo "cross-build-world.sh [-crlX] [-B file] [-G Gnumake] target-dir cross-dir cross-compiler-script [build-binary [flags]]"
    
    4
    +    echo "cross-build-world.sh [-crlXi] [-B file] [-G Gnumake] target-dir cross-dir cross-compiler-script [build-binary [flags]]"
    
    5 5
         echo "  -c      Clean target and cross directories before compiling"
    
    6 6
         echo "  -r      Recompile lisp runtime"
    
    7 7
         echo "  -l      Load cross-compiled kernel to make a new lisp kernel"
    
    8 8
         echo "  -B file Use this as the cross bootstrap file." 
    
    9 9
         echo "  -G make Specifies the name of GNU make"
    
    10 10
         echo "  -X      (break) before quitting the cross compilation (for debugging)"
    
    11
    +    echo "  -i      Interactive compile when compiling cross-compiler"
    
    11 12
     }
    
    12 13
     
    
    13 14
     MAKE=make
    
    14 15
     BREAK=""
    
    16
    +INTERACTIVE=nil
    
    15 17
     
    
    16
    -while getopts "crlXB:G:" arg
    
    18
    +while getopts "crlXiB:G:" arg
    
    17 19
     do
    
    18 20
         case $arg in
    
    19 21
           c) CLEAN_DIR=yes ;;
    
    ... ... @@ -22,6 +24,7 @@ do
    22 24
           B) BOOTSTRAP=$OPTARG ;;
    
    23 25
           G) MAKE=$OPTARG ;;
    
    24 26
           X) BREAK="(break)" ;;
    
    27
    +      i) INTERACTIVE=t ;;
    
    25 28
           h | \?) usage; exit 1 ;;
    
    26 29
         esac
    
    27 30
     done
    
    ... ... @@ -98,7 +101,7 @@ $LISP "$@" -noinit -nositeinit <<EOF
    98 101
     (load "target:tools/setup" :if-source-newer :load-source)
    
    99 102
     (comf "target:tools/setup" :load t)
    
    100 103
     
    
    101
    -(setq *gc-verbose* nil *interactive* nil)
    
    104
    +(setq *gc-verbose* nil *interactive* ${INTERACTIVE})
    
    102 105
     
    
    103 106
     (load "$SCRIPT")
    
    104 107
     
    

  • src/code/unix.lisp
    ... ... @@ -2501,7 +2501,10 @@
    2501 2501
     (defconstant ms_invalidate 2)
    
    2502 2502
     
    
    2503 2503
     ;; The return value from mmap that means mmap failed.
    
    2504
    -(defconstant map_failed (int-sap (1- (ash 1 vm:word-bits))))
    
    2504
    +(defconstant map_failed
    
    2505
    +  #-sparc64 (int-sap (1- (ash 1 vm:word-bits)))
    
    2506
    +  #+sparc64 (ldb (byte 32 0) -1)
    
    2507
    +  )
    
    2505 2508
     
    
    2506 2509
     (defun unix-mmap (addr length prot flags fd offset)
    
    2507 2510
       (declare (type (or null system-area-pointer) addr)
    
    ... ... @@ -2522,11 +2525,13 @@
    2522 2525
     	(values nil (unix-errno))
    
    2523 2526
     	(values result 0))))
    
    2524 2527
     
    
    2528
    +#-sparc64
    
    2525 2529
     (defun unix-munmap (addr length)
    
    2526 2530
       (declare (type system-area-pointer addr)
    
    2527 2531
     	   (type (unsigned-byte 32) length))
    
    2528 2532
       (syscall ("munmap" system-area-pointer size-t) t addr length))
    
    2529 2533
     
    
    2534
    +#-sparc64
    
    2530 2535
     (defun unix-mprotect (addr length prot)
    
    2531 2536
       (declare (type system-area-pointer addr)
    
    2532 2537
     	   (type (unsigned-byte 32) length)
    
    ... ... @@ -2534,6 +2539,7 @@
    2534 2539
       (syscall ("mprotect" system-area-pointer size-t int)
    
    2535 2540
     	   t addr length prot))
    
    2536 2541
       
    
    2542
    +#-sparc64
    
    2537 2543
     (defun unix-msync (addr length flags)
    
    2538 2544
       (declare (type system-area-pointer addr)
    
    2539 2545
     	   (type (unsigned-byte 32) length)
    

  • src/compiler/generic/new-genesis.lisp
    ... ... @@ -290,17 +290,36 @@
    290 290
     
    
    291 291
     ;; TODO: make this work for 64-bit
    
    292 292
     (defun maybe-byte-swap (word)
    
    293
    +  (ecase vm:word-bits
    
    294
    +    (32 (maybe-byte-swap-32 word))
    
    295
    +    (64 (maybe-byte-swap-64 word))))
    
    296
    +
    
    297
    +(defun maybe-byte-swap-32 (word)
    
    293 298
       (if (eq (c:backend-byte-order c:*native-backend*)
    
    294 299
     	  (c:backend-byte-order c:*backend*))
    
    295 300
           word
    
    296 301
           (locally (declare (type (unsigned-byte 32) word))
    
    297
    -	(assert (= vm:word-bits 32))
    
    298 302
     	(assert (= vm:byte-bits 8))
    
    299 303
     	(logior (ash (ldb (byte 8 0) word) 24)
    
    300 304
     		(ash (ldb (byte 8 8) word) 16)
    
    301 305
     		(ash (ldb (byte 8 16) word) 8)
    
    302 306
     		(ldb (byte 8 24) word)))))
    
    303 307
     
    
    308
    +(defun maybe-byte-swap-64 (word)
    
    309
    +  (if (eq (c:backend-byte-order c:*native-backend*)
    
    310
    +	  (c:backend-byte-order c:*backend*))
    
    311
    +      word
    
    312
    +      (locally (declare (type (unsigned-byte 64) word))
    
    313
    +	(assert (= vm:byte-bits 8))
    
    314
    +	(logior (ash (ldb (byte 8 0) word) 56)
    
    315
    +		(ash (ldb (byte 8 8) word) 48)
    
    316
    +		(ash (ldb (byte 8 16) word) 40)
    
    317
    +		(ash (ldb (byte 8 24) word) 32)
    
    318
    +		(ash (ldb (byte 8 32) word) 24)
    
    319
    +		(ash (ldb (byte 8 40) word) 16)
    
    320
    +		(ash (ldb (byte 8 48) word) 8)
    
    321
    +		(ldb (byte 8 56) word)))))
    
    322
    +  
    
    304 323
     (defun maybe-byte-swap-short (short)
    
    305 324
       (if (eq (c:backend-byte-order c:*native-backend*)
    
    306 325
     	  (c:backend-byte-order c:*backend*))
    
    ... ... @@ -2275,7 +2294,7 @@
    2275 2294
     		 (ldb (byte 16 0) value))))))
    
    2276 2295
           ((#.c:sparc-fasl-file-implementation
    
    2277 2296
     	#.c:sparc64-fasl-file-implementation)
    
    2278
    -       (let ((inst (maybe-byte-swap (sap-ref-32 sap 0))))
    
    2297
    +       (let ((inst (maybe-byte-swap-32 (sap-ref-32 sap 0))))
    
    2279 2298
     	 (ecase kind
    
    2280 2299
     	   (:call
    
    2281 2300
     	    (error "Can't deal with call fixups yet."))
    
    ... ... @@ -2290,7 +2309,7 @@
    2290 2309
     		       (byte 10 0)
    
    2291 2310
     		       inst))))
    
    2292 2311
     	 (setf (sap-ref-32 sap 0)
    
    2293
    -	       (maybe-byte-swap inst))))
    
    2312
    +	       (maybe-byte-swap-32 inst))))
    
    2294 2313
           ((#.c:rt-fasl-file-implementation 
    
    2295 2314
     	#.c:rt-afpa-fasl-file-implementation)
    
    2296 2315
            (ecase kind
    

  • src/compiler/sparc64/arith.lisp
    ... ... @@ -1567,6 +1567,7 @@
    1567 1567
     ;;
    
    1568 1568
     ;; See generic/vm-tran.lisp for the algorithm.
    
    1569 1569
     
    
    1570
    +#+nil
    
    1570 1571
     (define-vop (signed-truncate-by-mult fast-signed-binop)
    
    1571 1572
       (:translate truncate)
    
    1572 1573
       (:args (x :scs (signed-reg)))
    
    ... ... @@ -1612,6 +1613,7 @@
    1612 1613
           (unless (location= quo q)
    
    1613 1614
             (move quo q)))))
    
    1614 1615
     
    
    1616
    +#+nil
    
    1615 1617
     (define-vop (unsigned-truncate-by-mult fast-signed-binop)
    
    1616 1618
       (:translate truncate)
    
    1617 1619
       (:args (x :scs (unsigned-reg)))
    

  • src/compiler/sparc64/parms.lisp
    ... ... @@ -92,7 +92,7 @@
    92 92
     
    
    93 93
     (eval-when (compile load eval)
    
    94 94
     
    
    95
    -(defconstant word-bits 32
    
    95
    +(defconstant word-bits 64
    
    96 96
       "Number of bits per word where a word holds one lisp descriptor.")
    
    97 97
     
    
    98 98
     (defconstant byte-bits 8
    
    ... ... @@ -163,7 +163,7 @@
    163 163
       (+ (byte-size single-float-significand-byte) 1))
    
    164 164
     
    
    165 165
     (defconstant double-float-digits
    
    166
    -  (+ (byte-size double-float-significand-byte) word-bits 1))
    
    166
    +  53)
    
    167 167
     
    
    168 168
     (defconstant long-float-digits
    
    169 169
       (+ (byte-size long-float-significand-byte) word-bits 1))
    

  • src/lisp/Config.sparc64_sunc
    ... ... @@ -20,8 +20,8 @@ include Config.sparc_common
    20 20
     ifdef FEATURE_SPARC_V9
    
    21 21
     # For SunStudio 11, use -xarch=v8plus.  For SunStudio 12, that is
    
    22 22
     # deprecated; use -m32 -xarch=sparc.
    
    23
    -CC_V8PLUS = -xarch=sparc
    
    24
    -AS_V8PLUS = -xarch=sparc
    
    23
    +CC_V8PLUS = -m64
    
    24
    +AS_V8PLUS = -m64
    
    25 25
     endif
    
    26 26
     
    
    27 27
     ASSEM_SRC = sparc64-assem.S
    

  • src/tools/cross-scripts/cross-x86-sparc64.lisp
    1 1
     ;;; Cross-compile script to build a sparc core using x86 as the
    
    2 2
     ;;; compiling system.  This needs work!
    
    3 3
     
    
    4
    +(in-package "LISP")
    
    5
    +(defun c::%%defconstant (name value doc source-location)
    
    6
    +  (when doc
    
    7
    +    (setf (documentation name 'variable) doc))
    
    8
    +  (when (boundp name)
    
    9
    +    (unless (equalp (symbol-value name) value)
    
    10
    +      (warn "Constant ~S being redefined." name)))
    
    11
    +  (setf (symbol-value name) value)
    
    12
    +  (setf (info variable kind name) :constant)
    
    13
    +  (clear-info variable constant-value name)
    
    14
    +  (set-defvar-source-location name source-location)
    
    15
    +  name)
    
    16
    +
    
    4 17
     (in-package :cl-user)
    
    5 18
     
    
    6 19
     ;;; Rename the X86 package and backend so that new-backend does the
    
    ... ... @@ -191,7 +204,7 @@
    191 204
     						    :vm))))
    
    192 205
     			       syms))))
    
    193 206
       (frob OLD-VM:BYTE-BITS
    
    194
    -	OLD-VM:WORD-BITS
    
    207
    +	;;OLD-VM:WORD-BITS
    
    195 208
     	OLD-VM:CHAR-BITS
    
    196 209
     	OLD-VM:CHAR-BYTES
    
    197 210
     	OLD-VM:LOWTAG-BITS