Replace the hardcoded 32s in the function with N-WORD-BITS. This in turn
allows SOURCE-TRANSFORM-NUMERIC-TYPEP to find better transformations
for type checks for types larger than fixnum but smaller than a machine
word also under 64-bit word size. The most important improvement this
achieves is to avoid generic arithmetic for the bounds tests in these
cases.
For example, the test (TYPEP X '(UNSIGNED-BYTE 63)) runs about four
times as fast on x86-64 with this change.
(Tests for the exact types (SIGNED-BYTE 64) and (UNSIGNED-BYTE 64) are
unaffected as compiling them takes another code path, which already
generates well optimized code.)
* optimization: faster and smaller INTEGER-LENGTH on fixnums on x86-64.
* optimization: On x86-64, the number of multi-byte NOP instructions used
for code alignment is now always minimal.
+ * optimization: On 64-bit targets, the compiler generates much faster
+ code for type checks for types known at compile time that are smaller
+ than (SIGNED-BYTE 64) or (UNSIGNED-BYTE 64) and larger than FIXNUM, and
+ their COMPLEX variants.
changes in sbcl-1.1.7 relative to sbcl-1.1.6:
* enhancement: TRACE :PRINT-ALL handles multiple-valued forms.
;;; Return the most specific integer type that can be quickly checked that
;;; includes the given type.
(defun containing-integer-type (subtype)
- (dolist (type '(fixnum
- (signed-byte 32)
- (unsigned-byte 32)
+ (dolist (type `(fixnum
+ (signed-byte ,sb!vm:n-word-bits)
+ (unsigned-byte ,sb!vm:n-word-bits)
integer)
(error "~S isn't an integer type?" subtype))
(when (csubtypep subtype (specifier-type type))