[vm, gc] Mark through new-space.

- Initial and final marking no longer visit all of new-space, reducing the STW pause for major GC.
 - A scavenge during concurrent marking must forward / filter objects in the marking worklist that are moved / collected, increasing the STW pause for minor GC.
 - Unreachable intergenerational cycles and weak references are collected in the next mark-sweep instead of first requiring enough scavenges to promote the whole cycle or weak target into old-space.
 - Artificial minor GCs are no longer needed to avoid memory leaks from back-to-back major GCs.
 - reachabilityBarrier is now just a count of major GCs.

TEST=ci
Change-Id: I1e653c9b5d3e02e45b280302c832157a75788db6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345350
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Ryan Macnak
2024-01-26 18:58:54 +00:00
committed by Commit Queue
parent bc96411921
commit 4e6cd29eef
44 changed files with 912 additions and 529 deletions
+10 -8
View File
@@ -37,11 +37,14 @@ namespace compiler {
// WARNING: This might clobber all registers except for [R0], [THR] and [FP].
// The caller should simply call LeaveStubFrame() and return.
void StubCodeCompiler::EnsureIsNewOrRemembered() {
// If the object is not remembered we call a leaf-runtime to add it to the
// remembered set.
// If the object is not in an active TLAB, we call a leaf-runtime to add it to
// the remembered set and/or deferred marking worklist. This test assumes a
// Page's TLAB use is always ascending.
Label done;
__ tst(R0, Operand(1 << target::ObjectAlignment::kNewObjectBitPosition));
__ BranchIf(NOT_ZERO, &done);
__ AndImmediate(TMP, R0, target::kPageMask);
__ LoadFromOffset(TMP, Address(TMP, target::Page::original_top_offset()));
__ CompareRegisters(R0, TMP);
__ BranchIf(UNSIGNED_GREATER_EQUAL, &done);
{
LeafRuntimeScope rt(assembler,
@@ -1680,16 +1683,16 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler,
__ b(&skip_marking, ZERO);
{
// Atomically clear kOldAndNotMarkedBit.
// Atomically clear kNotMarkedBit.
Label retry, done;
__ PushList((1 << R2) | (1 << R3) | (1 << R4)); // Spill.
__ AddImmediate(R3, R0, target::Object::tags_offset() - kHeapObjectTag);
// R3: Untagged address of header word (ldrex/strex do not support offsets).
__ Bind(&retry);
__ ldrex(R2, R3);
__ tst(R2, Operand(1 << target::UntaggedObject::kOldAndNotMarkedBit));
__ tst(R2, Operand(1 << target::UntaggedObject::kNotMarkedBit));
__ b(&done, ZERO); // Marked by another thread.
__ bic(R2, R2, Operand(1 << target::UntaggedObject::kOldAndNotMarkedBit));
__ bic(R2, R2, Operand(1 << target::UntaggedObject::kNotMarkedBit));
__ strex(R4, R2, R3);
__ cmp(R4, Operand(1));
__ b(&retry, EQ);
@@ -1713,7 +1716,6 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler,
__ Bind(&done);
__ clrex();
__ PopList((1 << R2) | (1 << R3) | (1 << R4)); // Unspill.
__ Ret();
}
Label add_to_remembered_set, remember_card;