Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::PrologueTask Class Reference
Inheritance diagram for dart::PrologueTask:
dart::ThreadPool::Task dart::IntrusiveDListEntry< Task >

Public Member Functions

 PrologueTask (ThreadBarrier *barrier, IsolateGroup *isolate_group, PageSpace *old_space, PrologueState *state)
 
void Run ()
 
void RunEnteredIsolateGroup ()
 
void MarkEvacuationCandidates ()
 
void PruneFreeLists ()
 
- Public Member Functions inherited from dart::ThreadPool::Task
virtual ~Task ()
 
virtual void Run ()=0
 
- Public Member Functions inherited from dart::IntrusiveDListEntry< Task >
 IntrusiveDListEntry ()
 
 ~IntrusiveDListEntry ()
 

Additional Inherited Members

- Protected Member Functions inherited from dart::ThreadPool::Task
 Task ()
 

Detailed Description

Definition at line 102 of file incremental_compactor.cc.

Constructor & Destructor Documentation

◆ PrologueTask()

dart::PrologueTask::PrologueTask ( ThreadBarrier barrier,
IsolateGroup isolate_group,
PageSpace old_space,
PrologueState state 
)
inline

Definition at line 104 of file incremental_compactor.cc.

108 : barrier_(barrier),
109 isolate_group_(isolate_group),
110 old_space_(old_space),
111 state_(state) {}
AtkStateType state

Member Function Documentation

◆ MarkEvacuationCandidates()

void dart::PrologueTask::MarkEvacuationCandidates ( )
inline

Definition at line 137 of file incremental_compactor.cc.

137 {
139 "MarkEvacuationCandidates");
140 for (;;) {
141 intptr_t page_index = state_->page_cursor.fetch_add(1);
142 if (page_index >= state_->page_limit) break;
143 Page* page = state_->pages[page_index].page;
144
145 // Already set, otherwise a barrier would be needed before moving onto
146 // freelists.
147 ASSERT(page->is_evacuation_candidate());
148
149 uword start = page->object_start();
150 uword end = page->object_end();
151 uword current = start;
152 while (current < end) {
153 ObjectPtr obj = UntaggedObject::FromAddr(current);
154 intptr_t cid = obj->untag()->GetClassId();
156 obj->untag()->SetIsEvacuationCandidateUnsynchronized();
157 }
158 current += obj->untag()->HeapSize();
159 }
160 }
161 }
T fetch_add(T arg, std::memory_order order=std::memory_order_relaxed)
Definition: atomic.h:35
static Thread * Current()
Definition: thread.h:362
static ObjectPtr FromAddr(uword addr)
Definition: raw_object.h:516
#define ASSERT(E)
glong glong end
@ kForwardingCorpse
Definition: class_id.h:225
@ kFreeListElement
Definition: class_id.h:224
uintptr_t uword
Definition: globals.h:501
const intptr_t cid
MallocGrowableArray< LiveBytes > pages
RelaxedAtomic< intptr_t > page_cursor
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
Definition: timeline.h:41

◆ PruneFreeLists()

void dart::PrologueTask::PruneFreeLists ( )
inline

Definition at line 163 of file incremental_compactor.cc.

163 {
165 for (;;) {
166 intptr_t chunk = state_->freelist_cursor.fetch_add(1);
167 if (chunk >= state_->freelist_limit) break;
168 intptr_t list_index = chunk / (FreeList::kNumLists + 1);
169 intptr_t size_class_index = chunk % (FreeList::kNumLists + 1);
170 FreeList* freelist = &old_space_->freelists_[list_index];
171
172 // Empty bump-region, no need to prune this.
173 ASSERT(freelist->top_ == freelist->end_);
174
175 FreeListElement* current = freelist->free_lists_[size_class_index];
176 freelist->free_lists_[size_class_index] = nullptr;
177 while (current != nullptr) {
178 FreeListElement* next = current->next();
179 if (!Page::Of(current)->is_evacuation_candidate()) {
180 current->set_next(freelist->free_lists_[size_class_index]);
181 freelist->free_lists_[size_class_index] = current;
182 }
183 current = next;
184 }
185 }
186 }
static float next(float f)
static Page * Of(ObjectPtr obj)
Definition: page.h:162
RelaxedAtomic< intptr_t > freelist_cursor

◆ Run()

void dart::PrologueTask::Run ( )
inlinevirtual

Implements dart::ThreadPool::Task.

Definition at line 113 of file incremental_compactor.cc.

113 {
114 if (!barrier_->TryEnter()) {
115 barrier_->Release();
116 return;
117 }
118
120 isolate_group_, Thread::kIncrementalCompactorTask,
121 /*bypass_safepoint=*/true);
122 ASSERT(result);
123
125
126 Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/true);
127
128 barrier_->Sync();
129 barrier_->Release();
130 }
@ kIncrementalCompactorTask
Definition: thread.h:354
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
Definition: thread.cc:499
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
Definition: thread.cc:481
GAsyncResult * result

◆ RunEnteredIsolateGroup()

void dart::PrologueTask::RunEnteredIsolateGroup ( )
inline

Definition at line 132 of file incremental_compactor.cc.


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