Raymond Toy pushed to branch rtoy-xoro-default at cmucl / cmucl

Commits:

3 changed files:

Changes:

  • src/bootfiles/21c/boot-21c-cross-sparc.lisp
    1
    +(in-package :cl-user)
    
    2
    +
    
    3
    +;;; Rename the SPARC package and backend so that new-backend does the
    
    4
    +;;; right thing.
    
    5
    +(rename-package "SPARC" "OLD-SPARC" '("OLD-VM"))
    
    6
    +(setf (c:backend-name c:*native-backend*) "OLD-SPARC")
    
    7
    +
    
    8
    +(c::new-backend "SPARC"
    
    9
    +   ;; Features to add here
    
    10
    +   '(:sparc
    
    11
    +     :sparc-v9				; For Ultrasparc processors
    
    12
    +     :complex-fp-vops			; Some slightly faster FP vops on complex numbers
    
    13
    +     :linkage-table
    
    14
    +     :stack-checking			; Throw error if we run out of stack
    
    15
    +     :heap-overflow-check		; Throw error if we run out of
    
    16
    +					; heap (This requires gencgc!)
    
    17
    +     :gencgc				; Generational GC
    
    18
    +     :relative-package-names		; Relative package names from Allegro
    
    19
    +     :conservative-float-type
    
    20
    +     :hash-new
    
    21
    +     :random-xoroshiro			; xoroshiro128+ RNG
    
    22
    +     :cmu				; Announce this is CMUCL
    
    23
    +     :cmu20 :cmu20a			; Current version identifier
    
    24
    +     :modular-arith			; Modular arithmetic
    
    25
    +     :double-double			; Double-double float support
    
    26
    +     )
    
    27
    +   ;; Features to remove from current *features* here
    
    28
    +   '(:sparc-v8 :sparc-v7		; Choose only one of :sparc-v7, :sparc-v8, :sparc-v9
    
    29
    +     ;; Other architectures we aren't using.
    
    30
    +     :x86 :x86-bootstrap
    
    31
    +     :alpha :osf1 :mips
    
    32
    +     ;; Really old stuff that should have been removed long ago.
    
    33
    +     :propagate-fun-type :propagate-float-type :constrain-float-type
    
    34
    +     ;; Other OSes were not using
    
    35
    +     :openbsd :freebsd :glibc2 :linux
    
    36
    +     :pentium
    
    37
    +     :long-float
    
    38
    +     :new-random
    
    39
    +     :random-mt19937			; MT-19937 generator
    
    40
    +     :small))
    
    41
    +
    
    42
    +;;; May need to add some symbols to *features* and
    
    43
    +;;; sys::*runtime-features* as well.  This might be needed even if we
    
    44
    +;;; have those listed above, because of the code checks for things in
    
    45
    +;;; *features* and not in the backend-features..  So do that here.
    
    46
    +
    
    47
    +
    
    48
    +;;; Extern-alien-name for the new backend.
    
    49
    +(in-package :vm)
    
    50
    +(defun extern-alien-name (name)
    
    51
    +  (declare (type simple-string name))
    
    52
    +  #+(and bsd (not elf))
    
    53
    +  (concatenate 'string "_" name)
    
    54
    +  #-(and bsd (not elf))
    
    55
    +  name)
    
    56
    +;; When compiling the compiler, vm:fixup-code-object and
    
    57
    +;; vm:sanctify-for-execution are undefined.  Import these to get rid
    
    58
    +;; of that error.
    
    59
    +(import 'old-vm::fixup-code-object)
    
    60
    +(import 'old-vm::sanctify-for-execution)
    
    61
    +(export 'extern-alien-name)
    
    62
    +(export 'fixup-code-object)
    
    63
    +(export 'sanctify-for-execution)
    
    64
    +
    
    65
    +(in-package :cl-user)
    
    66
    +
    
    67
    +;;; Compile the new backend.
    
    68
    +(pushnew :bootstrap *features*)
    
    69
    +(pushnew :building-cross-compiler *features*)
    
    70
    +(load "target:tools/comcom")
    
    71
    +
    
    72
    +;;; Load the new backend.
    
    73
    +(setf (search-list "c:")
    
    74
    +      '("target:compiler/"))
    
    75
    +(setf (search-list "vm:")
    
    76
    +      '("c:sparc/" "c:generic/"))
    
    77
    +(setf (search-list "assem:")
    
    78
    +      '("target:assembly/" "target:assembly/sparc/"))
    
    79
    +
    
    80
    +;; Load the backend of the compiler.
    
    81
    +
    
    82
    +(in-package "C")
    
    83
    +
    
    84
    +(load "vm:vm-macs")
    
    85
    +(load "vm:parms")
    
    86
    +(load "vm:objdef")
    
    87
    +(load "vm:interr")
    
    88
    +(load "assem:support")
    
    89
    +
    
    90
    +(load "target:compiler/srctran")
    
    91
    +(load "vm:vm-typetran")
    
    92
    +(load "target:compiler/float-tran")
    
    93
    +(load "target:compiler/saptran")
    
    94
    +
    
    95
    +(load "vm:macros")
    
    96
    +(load "vm:utils")
    
    97
    +
    
    98
    +(load "vm:vm")
    
    99
    +(load "vm:insts")
    
    100
    +(load "vm:primtype")
    
    101
    +(load "vm:move")
    
    102
    +(load "vm:sap")
    
    103
    +(load "vm:system")
    
    104
    +(load "vm:char")
    
    105
    +(load "vm:float")
    
    106
    +
    
    107
    +(load "vm:memory")
    
    108
    +(load "vm:static-fn")
    
    109
    +(load "vm:arith")
    
    110
    +(load "vm:cell")
    
    111
    +(load "vm:subprim")
    
    112
    +(load "vm:debug")
    
    113
    +(load "vm:c-call")
    
    114
    +(load "vm:print")
    
    115
    +(load "vm:alloc")
    
    116
    +(load "vm:call")
    
    117
    +(load "vm:nlx")
    
    118
    +(load "vm:values")
    
    119
    +(load "vm:array")
    
    120
    +(load "vm:pred")
    
    121
    +(load "vm:type-vops")
    
    122
    +
    
    123
    +(load "assem:assem-rtns")
    
    124
    +
    
    125
    +(load "assem:array")
    
    126
    +(load "assem:arith")
    
    127
    +(load "assem:alloc")
    
    128
    +
    
    129
    +(load "c:pseudo-vops")
    
    130
    +
    
    131
    +(check-move-function-consistency)
    
    132
    +
    
    133
    +(load "vm:new-genesis")
    
    134
    +
    
    135
    +;;; OK, the cross compiler backend is loaded.
    
    136
    +
    
    137
    +(setf *features* (remove :building-cross-compiler *features*))
    
    138
    +
    
    139
    +;;; Info environment hacks.
    
    140
    +(macrolet ((frob (&rest syms)
    
    141
    +	     `(progn ,@(mapcar #'(lambda (sym)
    
    142
    +				   `(defconstant ,sym
    
    143
    +				      (symbol-value
    
    144
    +				       (find-symbol ,(symbol-name sym)
    
    145
    +						    :vm))))
    
    146
    +			       syms))))
    
    147
    +  (frob OLD-VM:BYTE-BITS OLD-VM:WORD-BITS
    
    148
    +	OLD-VM:CHAR-BITS
    
    149
    +	OLD-VM:CHAR-BYTES
    
    150
    +	OLD-VM:LOWTAG-BITS
    
    151
    +	#+long-float OLD-VM:SIMPLE-ARRAY-LONG-FLOAT-TYPE 
    
    152
    +	OLD-VM:SIMPLE-ARRAY-DOUBLE-FLOAT-TYPE 
    
    153
    +	OLD-VM:SIMPLE-ARRAY-SINGLE-FLOAT-TYPE
    
    154
    +	#+long-float OLD-VM:SIMPLE-ARRAY-COMPLEX-LONG-FLOAT-TYPE 
    
    155
    +	OLD-VM:SIMPLE-ARRAY-COMPLEX-DOUBLE-FLOAT-TYPE 
    
    156
    +	OLD-VM:SIMPLE-ARRAY-COMPLEX-SINGLE-FLOAT-TYPE
    
    157
    +	OLD-VM:SIMPLE-ARRAY-UNSIGNED-BYTE-2-TYPE 
    
    158
    +	OLD-VM:SIMPLE-ARRAY-UNSIGNED-BYTE-4-TYPE
    
    159
    +	OLD-VM:SIMPLE-ARRAY-UNSIGNED-BYTE-8-TYPE 
    
    160
    +	OLD-VM:SIMPLE-ARRAY-UNSIGNED-BYTE-16-TYPE 
    
    161
    +	OLD-VM:SIMPLE-ARRAY-UNSIGNED-BYTE-32-TYPE 
    
    162
    +	OLD-VM:SIMPLE-ARRAY-SIGNED-BYTE-8-TYPE 
    
    163
    +	OLD-VM:SIMPLE-ARRAY-SIGNED-BYTE-16-TYPE
    
    164
    +	OLD-VM:SIMPLE-ARRAY-SIGNED-BYTE-30-TYPE 
    
    165
    +	OLD-VM:SIMPLE-ARRAY-SIGNED-BYTE-32-TYPE
    
    166
    +	OLD-VM:SIMPLE-BIT-VECTOR-TYPE
    
    167
    +	OLD-VM:SIMPLE-STRING-TYPE OLD-VM:SIMPLE-VECTOR-TYPE 
    
    168
    +	OLD-VM:SIMPLE-ARRAY-TYPE OLD-VM:VECTOR-DATA-OFFSET
    
    169
    +	OLD-VM:DOUBLE-FLOAT-DIGITS
    
    170
    +	old-vm:single-float-digits
    
    171
    +	OLD-VM:DOUBLE-FLOAT-EXPONENT-BYTE
    
    172
    +	OLD-VM:DOUBLE-FLOAT-NORMAL-EXPONENT-MAX
    
    173
    +	OLD-VM:DOUBLE-FLOAT-SIGNIFICAND-BYTE
    
    174
    +	OLD-VM:SINGLE-FLOAT-EXPONENT-BYTE
    
    175
    +	OLD-VM:SINGLE-FLOAT-NORMAL-EXPONENT-MAX
    
    176
    +	OLD-VM:SINGLE-FLOAT-SIGNIFICAND-BYTE
    
    177
    +	)
    
    178
    +  #+double-double
    
    179
    +  (frob OLD-VM:SIMPLE-ARRAY-COMPLEX-DOUBLE-DOUBLE-FLOAT-TYPE
    
    180
    +	OLD-VM:SIMPLE-ARRAY-DOUBLE-DOUBLE-FLOAT-TYPE)
    
    181
    +  )
    
    182
    +
    
    183
    +;; Modular arith hacks.  When cross-compiling, the compiler wants to
    
    184
    +;; constant-fold some stuff, and it needs the following functions to
    
    185
    +;; do so.  This just gets rid of the hundreds of errors that happen.
    
    186
    +(setf (fdefinition 'vm::ash-left-mod32) #'old-vm::ash-left-mod32)
    
    187
    +(setf (fdefinition 'vm::lognot-mod32) #'old-vm::lognot-mod32)
    
    188
    +;; End modular arith hacks
    
    189
    +
    
    190
    +(let ((function (symbol-function 'kernel:error-number-or-lose)))
    
    191
    +  (let ((*info-environment* (c:backend-info-environment c:*target-backend*)))
    
    192
    +    (setf (symbol-function 'kernel:error-number-or-lose) function)
    
    193
    +    (setf (info function kind 'kernel:error-number-or-lose) :function)
    
    194
    +    (setf (info function where-from 'kernel:error-number-or-lose) :defined)))
    
    195
    +
    
    196
    +(defun fix-class (name)
    
    197
    +  (let* ((new-value (find-class name))
    
    198
    +	 (new-layout (kernel::%class-layout new-value))
    
    199
    +	 (new-cell (kernel::find-class-cell name))
    
    200
    +	 (*info-environment* (c:backend-info-environment c:*target-backend*)))
    
    201
    +    (remhash name kernel::*forward-referenced-layouts*)
    
    202
    +    (kernel::%note-type-defined name)
    
    203
    +    (setf (info type kind name) :instance)
    
    204
    +    (setf (info type class name) new-cell)
    
    205
    +    (setf (info type compiler-layout name) new-layout)
    
    206
    +    new-value))
    
    207
    +(fix-class 'c::vop-parse)
    
    208
    +(fix-class 'c::operand-parse)
    
    209
    +
    
    210
    +#+random-mt19937
    
    211
    +(declaim (notinline kernel:random-chunk))
    
    212
    +
    
    213
    +(setf c:*backend* c:*target-backend*)
    
    214
    +
    
    215
    +;;; Extern-alien-name for the new backend.
    
    216
    +(in-package :vm)
    
    217
    +(defun extern-alien-name (name)
    
    218
    +  (declare (type simple-string name))
    
    219
    +  name)
    
    220
    +(export 'extern-alien-name)
    
    221
    +(export 'fixup-code-object)
    
    222
    +(export 'sanctify-for-execution)
    
    223
    +(in-package :cl-user)
    
    224
    +
    
    225
    +;;; Don't load compiler parts from the target compilation
    
    226
    +
    
    227
    +(defparameter *load-stuff* nil)
    
    228
    +
    
    229
    +;; Sometimes during cross-compile sparc::any-reg isn't defined during
    
    230
    +;; cross-compile.
    
    231
    +;;
    
    232
    +;; hack, hack, hack: Make old-vm::any-reg the same as
    
    233
    +;; sparc::any-reg as an SC.  Do this by adding old-vm::any-reg
    
    234
    +;; to the hash table with the same value as sparc::any-reg.
    
    235
    +(let ((ht (c::backend-sc-names c::*target-backend*)))
    
    236
    +  (setf (gethash 'old-vm::any-reg ht)
    
    237
    +	(gethash 'vm::any-reg ht)))

  • src/bootfiles/21c/boot-21c-cross-x86.lisp
    ... ... @@ -20,7 +20,7 @@
    20 20
          :gencgc				; Generational GC
    
    21 21
          :conservative-float-type
    
    22 22
          :hash-new
    
    23
    -     :random-xoroshiro
    
    23
    +     :random-xoroshiro			; xoroshiro128+ RNG
    
    24 24
          :cmu :cmu20 :cmu20a		; Version features
    
    25 25
          :double-double			; double-double float support
    
    26 26
          )
    

  • tests/rng.lisp
    ... ... @@ -20,6 +20,7 @@
    20 20
     
    
    21 21
     (defvar *test-state*)
    
    22 22
       
    
    23
    +#+random-xoroshiro
    
    23 24
     (define-test rng.initial-state
    
    24 25
       (setf *test-state*
    
    25 26
     	(kernel::make-random-object :state (kernel::init-random-state #x12345678)
    
    ... ... @@ -33,6 +34,7 @@
    33 34
         (assert-equal nil (kernel::random-state-cached-p *test-state*))))
    
    34 35
     
    
    35 36
     
    
    37
    +#+random-xoroshiro
    
    36 38
     (define-test rng.values-test
    
    37 39
       (assert-equal (list #x38f1dc39d1906b6f #xdfe4142236dd9517)
    
    38 40
     		(multiple-value-list (64-bit-rng-state *test-state*)))