(type index offset)
(values sb!vm:word)
(optimize (speed 3) (safety 0) #-sb-xc-host (inhibit-warnings 3)))
- (sap-ref-word sap (the index (ash offset sb!vm:n-fixnum-tag-bits))))
+ (sap-ref-word sap (the index (ash offset sb!vm:word-shift))))
(defun %set-word-sap-ref (sap offset value)
(declare (type system-area-pointer sap)
(type index offset)
(type sb!vm:word value)
(values sb!vm:word)
(optimize (speed 3) (safety 0) (inhibit-warnings 3)))
- (setf (sap-ref-word sap (the index (ash offset sb!vm:n-fixnum-tag-bits)))
+ (setf (sap-ref-word sap (the index (ash offset sb!vm:word-shift)))
value))
\f
(declare (type system-area-pointer sap)
(type index offset)
(values system-area-pointer index))
- (let ((address (sap-int sap)))
- (values (int-sap #!-alpha (word-logical-andc2 address
- sb!vm:fixnum-tag-mask)
- #!+alpha (ash (ash address -2) 2))
+ (let ((address (sap-int sap))
+ (word-mask (1- (ash 1 word-shift))))
+ (values (int-sap #!-alpha (word-logical-andc2 address word-mask)
+ ;; KLUDGE: WORD-LOGICAL-ANDC2 is defined in
+ ;; terms of n-word-bits. On all systems
+ ;; where n-word-bits is not equal to
+ ;; n-machine-word-bits we have to do this
+ ;; another way. At this time, these
+ ;; systems are alphas, though there was
+ ;; some talk about an x86-64 build option.
+ #!+alpha (ash (ash address (- word-shift)) word-shift))
(+ ,(ecase bitsize
- (1 '(* (logand address sb!vm:fixnum-tag-mask) n-byte-bits))
- (2 '(* (logand address sb!vm:fixnum-tag-mask) (/ n-byte-bits 2)))
- (4 '(* (logand address sb!vm:fixnum-tag-mask) (/ n-byte-bits 4)))
- ((8 16 32 64) '(logand address sb!vm:fixnum-tag-mask)))
+ ((1 2 4) `(* (logand address word-mask)
+ (/ n-byte-bits ,bitsize)))
+ ((8 16 32 64) '(logand address word-mask)))
offset)))))))
;;; We cheat a little bit by using TRULY-THE in the copying function to
#!-stack-grows-downward-not-upward
(and (sap< x (current-sp))
(sap<= control-stack-start x)
- (or (not aligned) (zerop (logand (sap-int x) sb!vm:fixnum-tag-mask))))
+ (or (not aligned) (zerop (logand (sap-int x)
+ (1- (ash 1 sb!vm:word-shift))))))
#!+stack-grows-downward-not-upward
(and (sap>= x (current-sp))
(sap> control-stack-end x)
- (or (not aligned) (zerop (logand (sap-int x) sb!vm:fixnum-tag-mask))))))
+ (or (not aligned) (zerop (logand (sap-int x)
+ (1- (ash 1 sb!vm:word-shift))))))))
(declaim (inline component-ptr-from-pc))
(sb!alien:define-alien-routine component-ptr-from-pc (system-area-pointer)
;; it's hard to see how it could have been wrong, since CMU CL
;; genesis worked. It would be nice to understand how this came
;; to be.. -- WHN 19990901
- (logior (ash bits (- 1 sb!vm:n-lowtag-bits))
+ (logior (ash bits (- sb!vm:n-fixnum-tag-bits))
(ash -1 (1+ sb!vm:n-positive-fixnum-bits)))
- (ash bits (- 1 sb!vm:n-lowtag-bits)))))
+ (ash bits (- sb!vm:n-fixnum-tag-bits)))))
(defun descriptor-word-sized-integer (des)
;; Extract an (unsigned-byte 32), from either its fixnum or bignum
(defun make-fixnum-descriptor (num)
(when (>= (integer-length num)
- (1+ (- sb!vm:n-word-bits sb!vm:n-lowtag-bits)))
+ (- sb!vm:n-word-bits sb!vm:n-fixnum-tag-bits))
(error "~W is too big for a fixnum." num))
- (make-random-descriptor (ash num (1- sb!vm:n-lowtag-bits))))
+ (make-random-descriptor (ash num sb!vm:n-fixnum-tag-bits)))
(defun make-other-immediate-descriptor (data type)
(make-descriptor (ash data (- sb!vm:n-widetag-bits descriptor-low-bits))
(defun number-to-core (number)
(typecase number
(integer (if (< (integer-length number)
- (- (1+ sb!vm:n-word-bits) sb!vm:n-lowtag-bits))
+ (- sb!vm:n-word-bits sb!vm:n-fixnum-tag-bits))
(make-fixnum-descriptor number)
(bignum-to-core number)))
(ratio (number-pair-to-core (number-to-core (numerator number))
(* total-elements
(logior (ash (descriptor-high dim)
(- descriptor-low-bits
- (1- sb!vm:n-lowtag-bits)))
+ sb!vm:n-fixnum-tag-bits))
(ash (descriptor-low dim)
- (- 1 sb!vm:n-lowtag-bits)))))
+ sb!vm:n-fixnum-tag-bits))))
(write-wordindexed result
(+ sb!vm:array-dimensions-offset axis)
dim)))
;;; Make a fixnum out of NUM. (I.e. shift by two bits if it will fit.)
(defun fixnumize (num)
(if (fixnump num)
- (ash num (1- n-lowtag-bits))
+ (ash num n-fixnum-tag-bits)
(error "~W is too big for a fixnum." num)))
;;; Determining whether a constant offset fits in an addressing mode.
/* Coming in, boxed is the number of boxed words requested.
* Converting it to a fixnum makes it measured in bytes. It's also
* rounded up to double word along the way. */
- boxed = make_fixnum(boxed + 1 +
- (offsetof(struct code, trace_table_offset) >>
- WORD_SHIFT));
+ boxed = (boxed + 1 +
+ (offsetof(struct code, trace_table_offset) >>
+ WORD_SHIFT)) << WORD_SHIFT;
boxed &= ~LOWTAG_MASK;
/* Unboxed is in bytes, round it up to double word boundary. Now
lose("alloc_code_object called with GC enabled.");
boxed = boxed << (N_WIDETAG_BITS - WORD_SHIFT);
code->header = boxed | CODE_HEADER_WIDETAG;
- code->code_size = unboxed;
+ code->code_size = unboxed >> (WORD_SHIFT - N_FIXNUM_TAG_BITS);
code->entry_points = NIL;
code->debug_info = NIL;
return make_lispobj(code, OTHER_POINTER_LOWTAG);
return 0;
else {
unsigned long offset = pc - code_start;
- if (offset >= codeptr->code_size)
+ if (offset >= (N_WORD_BYTES * fixnum_value(codeptr->code_size)))
return 0;
else
return make_fixnum(offset);