Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static 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 ()
 
DART_FORCE_INLINE 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 ()
 

Static Public Member Functions

static DART_FORCE_INLINE bool Pop (BlockWorkList *first_choice, BlockWorkList *second_choice, ObjectPtr *object)
 

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 260 of file pointer_block.h.

260 {
261 stack_->PushBlock(local_output_);
262 local_output_ = nullptr;
263 stack_->PushBlock(local_input_);
264 local_input_ = nullptr;
265 stack_ = nullptr;
266 }

◆ Finalize()

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

Definition at line 249 of file pointer_block.h.

249 {
250 ASSERT(local_output_->IsEmpty());
251 stack_->PushBlock(local_output_);
252 local_output_ = nullptr;
253 ASSERT(local_input_->IsEmpty());
254 stack_->PushBlock(local_input_);
255 local_input_ = nullptr;
256 // Fail fast on attempts to mark after finalizing.
257 stack_ = nullptr;
258 }

◆ Flush()

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

Definition at line 227 of file pointer_block.h.

227 {
228 if (!local_output_->IsEmpty()) {
229 stack_->PushBlock(local_output_);
230 local_output_ = stack_->PopEmptyBlock();
231 }
232 if (!local_input_->IsEmpty()) {
233 stack_->PushBlock(local_input_);
234 local_input_ = stack_->PopEmptyBlock();
235 }
236 }

◆ IsEmpty()

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

Definition at line 278 of file pointer_block.h.

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

◆ IsLocalEmpty()

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

Definition at line 268 of file pointer_block.h.

268 {
269 if (!local_input_->IsEmpty()) {
270 return false;
271 }
272 if (!local_output_->IsEmpty()) {
273 return false;
274 }
275 return true;
276 }

◆ Pop() [1/2]

template<typename Stack >
static DART_FORCE_INLINE bool dart::BlockWorkList< Stack >::Pop ( BlockWorkList< Stack > *  first_choice,
BlockWorkList< Stack > *  second_choice,
ObjectPtr object 
)
inlinestatic

Definition at line 199 of file pointer_block.h.

201 {
202 if (!first_choice->local_input_->IsEmpty()) {
203 *object = first_choice->local_input_->Pop();
204 return true;
205 }
206 if (!second_choice->local_input_->IsEmpty()) {
207 *object = second_choice->local_input_->Pop();
208 return true;
209 }
210 if (first_choice->Pop(object)) {
211 return true;
212 }
213 if (second_choice->Pop(object)) {
214 return true;
215 }
216 return false;
217 }

◆ Pop() [2/2]

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

Definition at line 175 of file pointer_block.h.

175 {
176 ASSERT(local_input_ != nullptr);
177 if (UNLIKELY(local_input_->IsEmpty())) {
178 if (!local_output_->IsEmpty()) {
179 auto temp = local_output_;
180 local_output_ = local_input_;
181 local_input_ = temp;
182 } else {
183 Block* new_work = stack_->PopNonEmptyBlock();
184 if (new_work == nullptr) {
185 return false;
186 }
187 stack_->PushBlock(local_input_);
188 local_input_ = new_work;
189 // Generated code appends to marking stacks; tell MemorySanitizer.
190 MSAN_UNPOISON(local_input_, sizeof(*local_input_));
191 }
192 }
193 *object = local_input_->Pop();
194 return true;
195 }
#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 219 of file pointer_block.h.

219 {
220 if (UNLIKELY(local_output_->IsFull())) {
221 stack_->PushBlock(local_output_);
222 local_output_ = stack_->PopEmptyBlock();
223 }
224 local_output_->Push(raw_obj);
225 }

◆ WaitForWork()

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

Definition at line 238 of file pointer_block.h.

238 {
239 ASSERT(local_input_->IsEmpty() || abort);
240 Block* new_work = stack_->WaitForWork(num_busy, abort);
241 if (new_work == nullptr) {
242 return false;
243 }
244 stack_->PushBlock(local_input_);
245 local_input_ = new_work;
246 return true;
247 }

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