;;; 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))
+(def!constant n-fixnum-tag-bits
+ (if (= 64 sb!vm:n-word-bits)
+ ;; On 64-bit targets, this may be as low as 1 (for 63-bit
+ ;; fixnums) and as high as 3 (for 61-bit fixnums). The
+ ;; constraint on the low end is that we need at least one bit
+ ;; to determine if a value is a fixnum or not, and the
+ ;; constraint on the high end is that it must not exceed
+ ;; WORD-SHIFT (defined below) due to the use of unboxed
+ ;; word-aligned byte pointers as boxed values in various
+ ;; places. FIXME: This should possibly be exposed for
+ ;; configuration via customize-target-features.
+ 1
+ ;; On 32-bit targets, this may be as low as 2 (for 30-bit
+ ;; fixnums) and as high as 2 (for 30-bit fixnums). The
+ ;; constraint on the low end is simple overcrowding of the
+ ;; lowtag space, and the constraint on the high end is that it
+ ;; must not exceed WORD-SHIFT.
+ (1- n-lowtag-bits)))
;;; the fixnum tag mask
(def!constant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits)))
;;; the bit width of fixnums
void
gc_init_tables(void)
{
- unsigned long i;
+ unsigned long i, j;
/* Set default value in all slots of scavenge table. FIXME
* replace this gnarly sizeof with something based on
*/
for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
- scavtab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
+ for (j = 0; j < (1<<N_LOWTAG_BITS); j++) {
+ if (fixnump(j)) {
+ scavtab[j|(i<<N_LOWTAG_BITS)] = scav_immediate;
+ }
+ }
scavtab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_fun_pointer;
/* skipping OTHER_IMMEDIATE_0_LOWTAG */
scavtab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_list_pointer;
- scavtab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
scavtab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] =
scav_instance_pointer;
/* skipping OTHER_IMMEDIATE_1_LOWTAG */
for (i = 0; i < ((sizeof sizetab)/(sizeof sizetab[0])); i++)
sizetab[i] = size_lose;
for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
- sizetab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = size_immediate;
+ for (j = 0; j < (1<<N_LOWTAG_BITS); j++) {
+ if (fixnump(j)) {
+ sizetab[j|(i<<N_LOWTAG_BITS)] = size_immediate;
+ }
+ }
sizetab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
/* skipping OTHER_IMMEDIATE_0_LOWTAG */
sizetab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
- sizetab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = size_immediate;
sizetab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
/* skipping OTHER_IMMEDIATE_1_LOWTAG */
sizetab[OTHER_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
}
+static void print_unknown(lispobj obj)
+{
+ printf("unknown object: %p", (void *)obj);
+}
+
static void brief_fixnum(lispobj obj)
{
+ /* KLUDGE: Rather than update the tables in print_obj(), we
+ declare all fixnum-or-unknown tags to be fixnums and sort it
+ out here with a guard clause. */
+ if (!fixnump(obj)) return print_unknown(obj);
+
#ifndef LISP_FEATURE_ALPHA
printf("%ld", ((long)obj)>>2);
#else
static void print_fixnum(lispobj obj)
{
+ /* KLUDGE: Rather than update the tables in print_obj(), we
+ declare all fixnum-or-unknown tags to be fixnums and sort it
+ out here with a guard clause. */
+ if (!fixnump(obj)) return print_unknown(obj);
+
#ifndef LISP_FEATURE_ALPHA
printf(": %ld", ((long)obj)>>2);
#else
}
}
-#ifdef LISP_FEATURE_X86_64
-static void print_unknown(lispobj obj)
-{
- printf("unknown object: %p", (void *)obj);
-}
-#endif
-
static void print_list(lispobj obj)
{
if (!is_valid_lisp_addr((os_vm_address_t)native_pointer(obj))) {
{
#ifdef LISP_FEATURE_X86_64
static void (*verbose_fns[])(lispobj obj)
- = {print_fixnum, print_otherimm, print_unknown, print_struct,
- print_unknown, print_otherimm, print_unknown, print_list,
- print_fixnum, print_otherimm, print_unknown, print_otherptr,
- print_unknown, print_otherimm, print_unknown, print_otherptr};
+ = {print_fixnum, print_otherimm, print_fixnum, print_struct,
+ print_fixnum, print_otherimm, print_fixnum, print_list,
+ print_fixnum, print_otherimm, print_fixnum, print_otherptr,
+ print_fixnum, print_otherimm, print_fixnum, print_otherptr};
static void (*brief_fns[])(lispobj obj)
- = {brief_fixnum, brief_otherimm, print_unknown, brief_struct,
- print_unknown, brief_otherimm, print_unknown, brief_list,
- brief_fixnum, brief_otherimm, print_unknown, brief_otherptr,
- print_unknown, brief_otherimm, print_unknown, brief_otherptr};
+ = {brief_fixnum, brief_otherimm, brief_fixnum, brief_struct,
+ brief_fixnum, brief_otherimm, brief_fixnum, brief_list,
+ brief_fixnum, brief_otherimm, brief_fixnum, brief_otherptr,
+ brief_fixnum, brief_otherimm, brief_fixnum, brief_otherptr};
#else
static void (*verbose_fns[])(lispobj obj)
= {print_fixnum, print_struct, print_otherimm, print_list,