From a32e302e869993d89fd9c247d4f038fcc7dfdac9 Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Wed, 26 Oct 2011 10:38:15 -0400 Subject: [PATCH] Minor lowtag-handling cleanup in genesis. * Instead of explicitly testing a lowtag against two or four constants (with scary reader conditionals for making the decision) to determine if a given lowtag is an other-immediate, introduce a function, IS-OTHER-IMMEDIATE-LOWTAG, paralleling IS-FIXNUM-LOWTAG, with commentary, operating along the same lines as a similar function in runtime.h. --- src/compiler/generic/genesis.lisp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index 3dc5fd6..2e39c86 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -282,6 +282,13 @@ (defun is-fixnum-lowtag (lowtag) (zerop (logand lowtag sb!vm:fixnum-tag-mask))) +(defun is-other-immediate-lowtag (lowtag) + ;; The other-immediate lowtags are similar to the fixnum lowtags, in + ;; that they have an "effective length" that is shorter than is used + ;; for the pointer lowtags. Unlike the fixnum lowtags, however, the + ;; other-immediate lowtags are always effectively two bits wide. + (= (logand lowtag 3) sb!vm:other-immediate-0-lowtag)) + (defstruct (descriptor (:constructor make-descriptor (high low &optional gspace word-offset)) @@ -314,12 +321,7 @@ (if (> unsigned #x1FFFFFFF) (- unsigned #x40000000) unsigned)))) - ((or (= lowtag sb!vm:other-immediate-0-lowtag) - (= lowtag sb!vm:other-immediate-1-lowtag) - #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or)) - (= lowtag sb!vm:other-immediate-2-lowtag) - #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or)) - (= lowtag sb!vm:other-immediate-3-lowtag)) + ((is-other-immediate-lowtag lowtag) (format stream "for other immediate: #X~X, type #b~8,'0B" (ash (descriptor-bits des) (- sb!vm:n-widetag-bits)) -- 1.7.10.4