From ee94b07644c1130e1dcadcfd2bd581bf641fa58e Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 6 Aug 2004 22:55:16 +0000 Subject: [PATCH] 0.8.13.34: * Start using Helmut Eller's cute computed features expression to distinguish between 32-bit and 64-bit pieces of code. Particularly useful because architecture names are not hardcoded; this idiom may have to be squirreled away in a function somewhere. * SB!VM:WORD-SHIFT and SB!VM:N-WORD-BYTES were being defined the same way in every backend; move their definitions to generic/early-vm for MORE OOAO. Tidy up comments in various backends for remaining constants--you can almost see the common code cut-and-pasted in each backend... --- src/compiler/alpha/parms.lisp | 19 +++++-------------- src/compiler/generic/early-objdef.lisp | 4 ++-- src/compiler/generic/early-vm.lisp | 6 ++++++ src/compiler/generic/genesis.lisp | 16 ++++++++++++---- src/compiler/hppa/parms.lisp | 15 +++++---------- src/compiler/mips/parms.lisp | 15 +++++---------- src/compiler/ppc/parms.lisp | 15 +++++---------- src/compiler/sparc/parms.lisp | 18 ++++-------------- src/compiler/x86-64/parms.lisp | 6 ------ src/compiler/x86/parms.lisp | 6 ------ version.lisp-expr | 2 +- 11 files changed, 45 insertions(+), 77 deletions(-) diff --git a/src/compiler/alpha/parms.lisp b/src/compiler/alpha/parms.lisp index b13e2de..a19fc93 100644 --- a/src/compiler/alpha/parms.lisp +++ b/src/compiler/alpha/parms.lisp @@ -11,25 +11,16 @@ (eval-when (:compile-toplevel :load-toplevel :execute) -(def!constant n-word-bits 32 - #!+sb-doc - "Number of bits per word where a word holds one lisp descriptor.") +;;; number of bits per word where a word holds one lisp descriptor +(def!constant n-word-bits 32) ;;; the natural width of a machine word (as seen in e.g. register width, ;;; address space) (def!constant n-machine-word-bits 64) -(def!constant n-byte-bits 8 - #!+sb-doc - "Number of bits per byte where a byte is the smallest addressable object.") - -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))) - #!+sb-doc - "Number of bits to shift between word addresses and byte addresses.") - -(def!constant n-word-bytes (/ n-word-bits n-byte-bits) - #!+sb-doc - "Number of bytes in a word.") +;;; number of bits per byte where a byte is the smallest addressable +;;; object +(def!constant n-byte-bits 8) (def!constant float-sign-shift 31) diff --git a/src/compiler/generic/early-objdef.lisp b/src/compiler/generic/early-objdef.lisp index 2b1cff0..090decb 100644 --- a/src/compiler/generic/early-objdef.lisp +++ b/src/compiler/generic/early-objdef.lisp @@ -43,7 +43,7 @@ ;; The EVAL-WHEN is necessary (at least for Lispworks), because the ;; second DEFENUM uses the value of OTHER-IMMEDIATE-0-LOWTAG, which is ;; defined in the first DEFENUM. -- AL 20000216 - #!+x86-64 + #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or)) (defenum (:suffix -lowtag) even-fixnum instance-pointer @@ -57,7 +57,7 @@ pad3 pad4 pad5 other-immediate-3 other-pointer) - #!-x86-64 + #!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or)) (defenum (:suffix -lowtag) even-fixnum instance-pointer diff --git a/src/compiler/generic/early-vm.lisp b/src/compiler/generic/early-vm.lisp index 1e7ec1c..9b854ea 100644 --- a/src/compiler/generic/early-vm.lisp +++ b/src/compiler/generic/early-vm.lisp @@ -25,6 +25,12 @@ ;;; the bit width of positive fixnums (def!constant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1)) +;;; the number of bits to shift between word addresses and byte addresses +(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits)))) + +;;; the number of bytes in a word +(def!constant n-word-bytes (/ n-word-bits n-byte-bits)) + ;;; the number of bits used in the header word of a data block to store ;;; the type (def!constant n-widetag-bits 8) diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index 7ef58ec..a5bbe1f 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -199,13 +199,21 @@ (make-bvref-n 64)) ;; lispobj-sized word, whatever that may be +;; hopefully nobody ever wants a 128-bit SBCL... +#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or)) +(progn (defun bvref-word (bytes index) - #!+x86-64 (bvref-64 bytes index) - #!-x86-64 (bvref-32 bytes index)) + (bvref-64 bytes index)) +(defun (setf bvref-word) (new-val bytes index) + (setf (bvref-64 bytes index) new-val))) +#!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or)) +(progn +(defun bvref-word (bytes index) + (bvref-32 bytes index)) (defun (setf bvref-word) (new-val bytes index) - #!+x86-64 (setf (bvref-64 bytes index) new-val) - #!-x86-64 (setf (bvref-32 bytes index) new-val)) + (setf (bvref-32 bytes index) new-val))) + ;;;; representation of spaces in the core diff --git a/src/compiler/hppa/parms.lisp b/src/compiler/hppa/parms.lisp index af2c41b..53bc314 100644 --- a/src/compiler/hppa/parms.lisp +++ b/src/compiler/hppa/parms.lisp @@ -3,21 +3,16 @@ ;;;; Machine Architecture parameters: -(def!constant n-word-bits 32 - "Number of bits per word where a word holds one lisp descriptor.") +;;; number of bits per word where a word holds one lisp descriptor +(def!constant n-word-bits 32) ;;; the natural width of a machine word (as seen in e.g. register width, ;;; address space) (def!constant n-machine-word-bits 32) -(def!constant n-byte-bits 8 - "Number of bits per byte where a byte is the smallest addressable object.") - -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))) - "Number of bits to shift between word addresses and byte addresses.") - -(def!constant n-word-bytes (/ n-word-bits n-byte-bits) - "Number of bytes in a word.") +;;; number of bits per byte where a byte is the smallest addressable +;;; object +(def!constant n-byte-bits 8) (def!constant float-sign-shift 31) diff --git a/src/compiler/mips/parms.lisp b/src/compiler/mips/parms.lisp index 4989172..6095c53 100644 --- a/src/compiler/mips/parms.lisp +++ b/src/compiler/mips/parms.lisp @@ -1,20 +1,15 @@ (in-package "SB!VM") -(def!constant n-word-bits 32 - "Number of bits per word where a word holds one lisp descriptor.") +;;; number of bits per word where a word holds one lisp descriptor +(def!constant n-word-bits 32) ;;; the natural width of a machine word (as seen in e.g. register width, ;;; address space) (def!constant n-machine-word-bits 32) -(def!constant n-byte-bits 8 - "Number of bits per byte where a byte is the smallest addressable object.") - -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))) - "Number of bits to shift between word addresses and byte addresses.") - -(def!constant n-word-bytes (/ n-word-bits n-byte-bits) - "Number of bytes in a word.") +;;; number of bits per byte where a byte is the smallest addressable +;;; object +(def!constant n-byte-bits 8) (def!constant float-sign-shift 31) diff --git a/src/compiler/ppc/parms.lisp b/src/compiler/ppc/parms.lisp index 4e05dd7..86a439d 100644 --- a/src/compiler/ppc/parms.lisp +++ b/src/compiler/ppc/parms.lisp @@ -13,21 +13,16 @@ (in-package "SB!VM") -(def!constant n-word-bits 32 - "Number of bits per word where a word holds one lisp descriptor.") +;;; number of bits per word where a word holds one lisp descriptor +(def!constant n-word-bits 32) ;;; the natural width of a machine word (as seen in e.g. register width, ;;; address space) (def!constant n-machine-word-bits 32) -(def!constant n-byte-bits 8 - "Number of bits per byte where a byte is the smallest addressable object.") - -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))) - "Number of bits to shift between word addresses and byte addresses.") - -(def!constant n-word-bytes (/ n-word-bits n-byte-bits) - "Number of bytes in a word.") +;;; number of bits per byte where a byte is the smallest addressable +;;; object +(def!constant n-byte-bits 8) (def!constant float-sign-shift 31) diff --git a/src/compiler/sparc/parms.lisp b/src/compiler/sparc/parms.lisp index 4e4461e..897048b 100644 --- a/src/compiler/sparc/parms.lisp +++ b/src/compiler/sparc/parms.lisp @@ -12,25 +12,15 @@ ;;;; Machine Architecture parameters: (eval-when (:compile-toplevel :load-toplevel :execute) -(def!constant n-word-bits 32 - #!+sb-doc - "Number of bits per word where a word holds one lisp descriptor.") +;;; number of bits per word where a word holds one lisp descriptor +(def!constant n-word-bits 32) ;;; the natural width of a machine word (as seen in e.g. register width, ;;; address space) (def!constant n-machine-word-bits 32) -(def!constant n-byte-bits 8 - #!+sb-doc - "Number of bits per byte where a byte is the smallest addressable object.") - -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))) - #!+sb-doc - "Number of bits to shift between word addresses and byte addresses.") - -(def!constant n-word-bytes (/ n-word-bits n-byte-bits) - #!+sb-doc - "Number of bytes in a word.") +;;; number of bits per byte where a byte is the smallest addressable object +(def!constant n-byte-bits 8) (def!constant float-sign-shift 31) diff --git a/src/compiler/x86-64/parms.lisp b/src/compiler/x86-64/parms.lisp index 702b334..ae33140 100644 --- a/src/compiler/x86-64/parms.lisp +++ b/src/compiler/x86-64/parms.lisp @@ -35,12 +35,6 @@ ;;; addressable object (def!constant n-byte-bits 8) -;;; the number of bits to shift between word addresses and byte addresses -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits)))) - -;;; the number of bytes in a word -(def!constant n-word-bytes (/ n-word-bits n-byte-bits)) - (def!constant float-sign-shift 31) ;;; comment from CMU CL: diff --git a/src/compiler/x86/parms.lisp b/src/compiler/x86/parms.lisp index 27d9cd3..cb4d029 100644 --- a/src/compiler/x86/parms.lisp +++ b/src/compiler/x86/parms.lisp @@ -35,12 +35,6 @@ ;;; addressable object (def!constant n-byte-bits 8) -;;; the number of bits to shift between word addresses and byte addresses -(def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits)))) - -;;; the number of bytes in a word -(def!constant n-word-bytes (/ n-word-bits n-byte-bits)) - (def!constant float-sign-shift 31) ;;; comment from CMU CL: diff --git a/version.lisp-expr b/version.lisp-expr index f6417b5..e0c261c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.13.33" +"0.8.13.34" -- 1.7.10.4