Skip to content

Commit

Permalink
Move marking code for dense slabs into extent for consistency. (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy authored Dec 2, 2024
1 parent f961950 commit 229c066
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
10 changes: 10 additions & 0 deletions sdlib/d/gc/extent.d
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,16 @@ public:
}
}

bool markDenseSlot(uint index) {
assert(extentClass.dense, "size class not dense!");
if (extentClass.supportsInlineMarking) {
return !slabMetadataMarks.setBitAtomic(index);
}

auto bmp = &outlineMarks;
return bmp !is null && !bmp.setBitAtomic(index);
}

@property
ref shared(Atomic!ulong) gcWord() {
assert(extentClass.sparse, "size class not sparse!");
Expand Down
13 changes: 1 addition & 12 deletions sdlib/d/gc/scanner.d
Original file line number Diff line number Diff line change
Expand Up @@ -454,18 +454,7 @@ private:
}

auto ec = pd.extentClass;
if (ec.supportsInlineMarking) {
if (e.slabMetadataMarks.setBitAtomic(index)) {
return false;
}
} else {
auto bmp = &e.outlineMarks;
if (bmp is null || bmp.setBitAtomic(index)) {
return false;
}
}

return true;
return e.markDenseSlot(index);
}

static bool markSparse(PageDescriptor pd, uint index, ubyte cycle) {
Expand Down

0 comments on commit 229c066

Please sign in to comment.