diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-11-17 10:31:09 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-19 11:57:36 -0500 |
commit | 097f807214d5f4422a1d2cbacd8bc89908eddbdb (patch) | |
tree | 16355bc7df7181c42ae57c13d093ba21d31c597d /rts/sm/NonMovingMark.h | |
parent | deed8e310cecb2491e5c333afc58cb720a39b565 (diff) | |
download | haskell-097f807214d5f4422a1d2cbacd8bc89908eddbdb.tar.gz |
nonmoving: Rework mark queue representation
The previous representation needlessly limited the array length to
16-bits on 32-bit platforms.
Diffstat (limited to 'rts/sm/NonMovingMark.h')
-rw-r--r-- | rts/sm/NonMovingMark.h | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/rts/sm/NonMovingMark.h b/rts/sm/NonMovingMark.h index 36158ec917..1e3fb01bd2 100644 --- a/rts/sm/NonMovingMark.h +++ b/rts/sm/NonMovingMark.h @@ -18,8 +18,8 @@ enum EntryType { NULL_ENTRY = 0, - MARK_CLOSURE, - MARK_ARRAY + MARK_CLOSURE = 1, + MARK_ARRAY = 2 }; /* Note [Origin references in the nonmoving collector] @@ -43,13 +43,10 @@ enum EntryType { */ typedef struct { - // Which kind of mark queue entry we have is determined by the low bits of - // the second word: they must be zero in the case of a mark_closure entry - // (since the second word of a mark_closure entry points to a pointer and - // pointers must be word-aligned). In the case of a mark_array we set them - // to 0x3 (the value of start_index is shifted to the left to accomodate - // this). null_entry where p==NULL is used to indicate the end of the queue. + // Which kind of mark queue entry we have is determined by the tag bits of + // the first word (using the tags defined by the EntryType enum). union { + // A null_entry indicates the end of the queue. struct { void *p; // must be NULL } null_entry; @@ -67,14 +64,9 @@ typedef struct { INLINE_HEADER enum EntryType nonmovingMarkQueueEntryType(MarkQueueEnt *ent) { - if (ent->null_entry.p == NULL) { - return NULL_ENTRY; - } else if (((uintptr_t) ent->mark_closure.origin & TAG_MASK) == 0) { - return MARK_CLOSURE; - } else { - ASSERT((ent->mark_array.start_index & TAG_MASK) == 0x3); - return MARK_ARRAY; - } + uintptr_t tag = (uintptr_t) ent->null_entry.p & TAG_MASK; + ASSERT(tag <= MARK_ARRAY); + return tag; } typedef struct { |