Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
dart::BlockWorkList< Stack > Class Template Reference

#include <pointer_block.h>

Inheritance diagram for dart::BlockWorkList< Stack >:
dart::ValueObject

Public Types

typedef Stack::Block Block
 

Public Member Functions

 BlockWorkList (Stack *stack)
 
 ~BlockWorkList ()
 
bool Pop (ObjectPtr *object)
 
void Push (ObjectPtr raw_obj)
 
void Flush ()
 
bool WaitForWork (RelaxedAtomic< uintptr_t > *num_busy, bool abort=false)
 
void Finalize ()
 
void AbandonWork ()
 
bool IsLocalEmpty ()
 
bool IsEmpty ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

template<typename Stack>
class dart::BlockWorkList< Stack >

Definition at line 158 of file pointer_block.h.

Member Typedef Documentation

◆ Block

template<typename Stack >
typedef Stack::Block dart::BlockWorkList< Stack >::Block

Definition at line 160 of file pointer_block.h.

Constructor & Destructor Documentation

◆ BlockWorkList()

template<typename Stack >
dart::BlockWorkList< Stack >::BlockWorkList ( Stack *  stack)
inlineexplicit

Definition at line 162 of file pointer_block.h.

162 : stack_(stack) {
163 local_output_ = stack_->PopEmptyBlock();
164 local_input_ = stack_->PopEmptyBlock();
165 }

◆ ~BlockWorkList()

template<typename Stack >
dart::BlockWorkList< Stack >::~BlockWorkList ( )
inline

Definition at line 167 of file pointer_block.h.

167 {
168 ASSERT(local_output_ == nullptr);
169 ASSERT(local_input_ == nullptr);
170 ASSERT(stack_ == nullptr);
171 }
#define ASSERT(E)

Member Function Documentation

◆ AbandonWork()

template<typename Stack >
void dart::BlockWorkList< Stack >::AbandonWork ( )
inline

Definition at line 237 of file pointer_block.h.

237 {
238 stack_->PushBlock(local_output_);
239 local_output_ = nullptr;
240 stack_->PushBlock(local_input_);
241 local_input_ = nullptr;
242 stack_ = nullptr;
243 }

◆ Finalize()

template<typename Stack >
void dart::BlockWorkList< Stack >::Finalize ( )
inline

Definition at line 226 of file pointer_block.h.

226 {
227 ASSERT(local_output_->IsEmpty());
228 stack_->PushBlock(local_output_);
229 local_output_ = nullptr;
230 ASSERT(local_input_->IsEmpty());
231 stack_->PushBlock(local_input_);
232 local_input_ = nullptr;
233 // Fail fast on attempts to mark after finalizing.
234 stack_ = nullptr;
235 }

◆ Flush()

template<typename Stack >
void dart::BlockWorkList< Stack >::Flush ( )
inline

Definition at line 204 of file pointer_block.h.

204 {
205 if (!local_output_->IsEmpty()) {
206 stack_->PushBlock(local_output_);
207 local_output_ = stack_->PopEmptyBlock();
208 }
209 if (!local_input_->IsEmpty()) {
210 stack_->PushBlock(local_input_);
211 local_input_ = stack_->PopEmptyBlock();
212 }
213 }

◆ IsEmpty()

template<typename Stack >
bool dart::BlockWorkList< Stack >::IsEmpty ( )
inline

Definition at line 255 of file pointer_block.h.

255{ return IsLocalEmpty() && stack_->IsEmpty(); }

◆ IsLocalEmpty()

template<typename Stack >
bool dart::BlockWorkList< Stack >::IsLocalEmpty ( )
inline

Definition at line 245 of file pointer_block.h.

245 {
246 if (!local_input_->IsEmpty()) {
247 return false;
248 }
249 if (!local_output_->IsEmpty()) {
250 return false;
251 }
252 return true;
253 }

◆ Pop()

template<typename Stack >
bool dart::BlockWorkList< Stack >::Pop ( ObjectPtr object)
inline

Definition at line 174 of file pointer_block.h.

174 {
175 ASSERT(local_input_ != nullptr);
176 if (UNLIKELY(local_input_->IsEmpty())) {
177 if (!local_output_->IsEmpty()) {
178 auto temp = local_output_;
179 local_output_ = local_input_;
180 local_input_ = temp;
181 } else {
182 Block* new_work = stack_->PopNonEmptyBlock();
183 if (new_work == nullptr) {
184 return false;
185 }
186 stack_->PushBlock(local_input_);
187 local_input_ = new_work;
188 // Generated code appends to marking stacks; tell MemorySanitizer.
189 MSAN_UNPOISON(local_input_, sizeof(*local_input_));
190 }
191 }
192 *object = local_input_->Pop();
193 return true;
194 }
#define MSAN_UNPOISON(ptr, len)
#define UNLIKELY(cond)
Definition globals.h:261

◆ Push()

template<typename Stack >
void dart::BlockWorkList< Stack >::Push ( ObjectPtr  raw_obj)
inline

Definition at line 196 of file pointer_block.h.

196 {
197 if (UNLIKELY(local_output_->IsFull())) {
198 stack_->PushBlock(local_output_);
199 local_output_ = stack_->PopEmptyBlock();
200 }
201 local_output_->Push(raw_obj);
202 }

◆ WaitForWork()

template<typename Stack >
bool dart::BlockWorkList< Stack >::WaitForWork ( RelaxedAtomic< uintptr_t > *  num_busy,
bool  abort = false 
)
inline

Definition at line 215 of file pointer_block.h.

215 {
216 ASSERT(local_input_->IsEmpty() || abort);
217 Block* new_work = stack_->WaitForWork(num_busy, abort);
218 if (new_work == nullptr) {
219 return false;
220 }
221 stack_->PushBlock(local_input_);
222 local_input_ = new_work;
223 return true;
224 }

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