Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::GCIncrementalCompactor Class Reference

#include <incremental_compactor.h>

Inheritance diagram for dart::GCIncrementalCompactor:
dart::AllStatic

Static Public Member Functions

static void Prologue (PageSpace *old_space)
 
static bool Epilogue (PageSpace *old_space)
 
static void Abort (PageSpace *old_space)
 

Detailed Description

Definition at line 20 of file incremental_compactor.h.

Member Function Documentation

◆ Abort()

void dart::GCIncrementalCompactor::Abort ( PageSpace old_space)
static

Definition at line 47 of file incremental_compactor.cc.

47 {
48 ASSERT(Thread::Current()->OwnsGCSafepoint());
49 TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "AbortIncrementalCompact");
50
51 {
52 MonitorLocker ml(old_space->tasks_lock());
53 switch (old_space->phase()) {
55 return; // No incremental compact in progress.
58 // No incremental compact in progress, the page list is incomplete, and
59 // accessing page->next is a data race.
60 return;
63 break; // Incremental compact may be in progress.
64 default:
66 }
67 }
68
69 old_space->PauseConcurrentMarking();
70
71 for (Page* page = old_space->pages_; page != nullptr; page = page->next()) {
72 if (!page->is_evacuation_candidate()) continue;
73
74 page->set_evacuation_candidate(false);
75
76 uword start = page->object_start();
77 uword end = page->object_end();
78 uword current = start;
79 while (current < end) {
80 ObjectPtr obj = UntaggedObject::FromAddr(current);
81 obj->untag()->ClearIsEvacuationCandidateUnsynchronized();
82 current += obj->untag()->HeapSize();
83 }
84 }
85
86 old_space->ResumeConcurrentMarking();
87}
#define UNREACHABLE()
Definition: assert.h:248
@ kAwaitingFinalization
Definition: pages.h:133
@ kSweepingRegular
Definition: pages.h:135
@ kSweepingLarge
Definition: pages.h:134
static Thread * Current()
Definition: thread.h:362
static ObjectPtr FromAddr(uword addr)
Definition: raw_object.h:516
#define ASSERT(E)
glong glong end
uintptr_t uword
Definition: globals.h:501
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
Definition: timeline.h:41

◆ Epilogue()

bool dart::GCIncrementalCompactor::Epilogue ( PageSpace old_space)
static

Definition at line 30 of file incremental_compactor.cc.

30 {
31 ASSERT(Thread::Current()->OwnsGCSafepoint());
32 TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "FinishIncrementalCompact");
33 if (!HasEvacuationCandidates(old_space)) {
34 return false;
35 }
36 old_space->MakeIterable();
37 CheckFreeLists(old_space);
38 CheckPreEvacuate(old_space);
39 Evacuate(old_space);
40 CheckPostEvacuate(old_space);
41 CheckFreeLists(old_space);
42 FreeEvacuatedPages(old_space);
43 VerifyAfterIncrementalCompaction(old_space);
44 return true;
45}

◆ Prologue()

void dart::GCIncrementalCompactor::Prologue ( PageSpace old_space)
static

Definition at line 21 of file incremental_compactor.cc.

21 {
22 ASSERT(Thread::Current()->OwnsGCSafepoint());
23 TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "StartIncrementalCompact");
24 if (!SelectEvacuationCandidates(old_space)) {
25 return;
26 }
27 CheckFreeLists(old_space);
28}

The documentation for this class was generated from the following files: