;;; the number of bits at the low end of a pointer used for type
;;; information
-(def!constant n-lowtag-bits #!+x86-64 4 #!-x86-64 3)
+(def!constant n-lowtag-bits
+ (integer-length (1- (/ (* 2 n-word-bits) n-byte-bits))))
;;; a mask to extract the low tag bits from a pointer
(def!constant lowtag-mask (1- (ash 1 n-lowtag-bits)))
;;; the exclusive upper bound on the value of the low tag bits from a
;;; pointer
(def!constant lowtag-limit (ash 1 n-lowtag-bits))
+;;; the number of tag bits used for a fixnum
+(def!constant n-fixnum-tag-bits (1- n-lowtag-bits))
+;;; the fixnum tag mask
+(def!constant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits)))
+;;; the bit width of positive fixnums
+(def!constant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1))
;;; the number of bits used in the header word of a data block to store
;;; the type
;; we can save a register on the x86.
:variant simple
;; we can save a couple of instructions and a branch on the ppc.
- ;; FIXME: make this be FIXNUM-MASK
- :mask (ash lowtag-mask -1))
+ :mask fixnum-tag-mask)
(!define-type-vops functionp check-fun function object-not-fun-error
(fun-pointer-lowtag)
\f
(defun %test-fixnum (value target not-p &key temp)
(assemble ()
- ;; FIXME: again, this 3 should be FIXNUM-MASK
- (inst andi. temp value 3)
+ (inst andi. temp value fixnum-tag-mask)
(inst b? (if not-p :ne :eq) target)))
(defun %test-fixnum-and-headers (value target not-p headers &key temp)
(let ((drop-through (gen-label)))
(assemble ()
- (inst andi. temp value 3)
+ (inst andi. temp value fixnum-tag-mask)
(inst beq (if not-p drop-through target)))
(%test-headers value target not-p nil headers
:drop-through drop-through :temp temp)))
,@(if mask
`((inst andi. temp value ,mask)
(inst twi 0 value (error-number-or-lose ',error-code))
- (inst twi :ne temp ,@(if ;; KLUDGE: At
- ;; present, MASK is
- ;; 3 or LOWTAG-MASK
- (eql mask 3)
- ;; KLUDGE
- `(0)
- type-codes))
+ (inst twi :ne temp ,@(ecase mask
+ ((fixnum-tag-mask) `(0))
+ ((lowtag-mask) type-codes)))
(move result value))
`((let ((err-lab
(generate-error-code vop ,error-code value)))
#!+sb-doc
"Number of bytes in a word.")
-(def!constant n-fixnum-tag-bits (1- n-lowtag-bits)
- #!+sb-doc
- "Number of tag bits used for a fixnum")
-
-(def!constant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits))
- #!+sb-doc
- "Mask to get the fixnum tag")
-
-(def!constant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1)
- #!+sb-doc
- "Maximum number of bits in a positive fixnum")
-
(def!constant float-sign-shift 31)
(def!constant single-float-bias 126)
;;; 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.9.27"
+"0.8.9.28"