Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::IncrementalForwardingVisitor Class Reference
Inheritance diagram for dart::IncrementalForwardingVisitor:
dart::ObjectPointerVisitor dart::PredicateObjectPointerVisitor dart::ObjectVisitor dart::HandleVisitor

Public Member Functions

 IncrementalForwardingVisitor (Thread *thread)
 
void VisitObject (ObjectPtr obj) override
 
void VisitPointers (ObjectPtr *first, ObjectPtr *last) override
 
bool PredicateVisitPointers (ObjectPtr *first, ObjectPtr *last) override
 
void VisitHandle (uword addr) override
 
void VisitTypedDataViewPointers (TypedDataViewPtr view, CompressedObjectPtr *first, CompressedObjectPtr *last) override
 
bool CanVisitSuspendStatePointers (SuspendStatePtr suspend_state) override
 
void UpdateViews ()
 
void UpdateSuspendStates ()
 
- Public Member Functions inherited from dart::ObjectPointerVisitor
 ObjectPointerVisitor (IsolateGroup *isolate_group)
 
virtual ~ObjectPointerVisitor ()
 
IsolateGroupisolate_group () const
 
virtual void VisitTypedDataViewPointers (TypedDataViewPtr view, CompressedObjectPtr *first, CompressedObjectPtr *last)
 
virtual void VisitPointers (ObjectPtr *first, ObjectPtr *last)=0
 
void VisitCompressedPointers (uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
 
void VisitPointers (ObjectPtr *p, intptr_t len)
 
void VisitPointer (ObjectPtr *p)
 
const char * gc_root_type () const
 
void set_gc_root_type (const char *gc_root_type)
 
void clear_gc_root_type ()
 
virtual bool visit_weak_persistent_handles () const
 
virtual bool trace_values_through_fields () const
 
const ClassTableclass_table () const
 
virtual bool CanVisitSuspendStatePointers (SuspendStatePtr suspend_state)
 
- Public Member Functions inherited from dart::PredicateObjectPointerVisitor
 PredicateObjectPointerVisitor ()
 
virtual ~PredicateObjectPointerVisitor ()
 
virtual bool PredicateVisitPointers (ObjectPtr *first, ObjectPtr *last)=0
 
bool PredicateVisitCompressedPointers (uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
 
- Public Member Functions inherited from dart::ObjectVisitor
 ObjectVisitor ()
 
virtual ~ObjectVisitor ()
 
virtual void VisitObject (ObjectPtr obj)=0
 
- Public Member Functions inherited from dart::HandleVisitor
 HandleVisitor (Thread *thread)
 
virtual ~HandleVisitor ()
 
Threadthread () const
 
virtual void VisitHandle (uword addr)=0
 

Detailed Description

Definition at line 367 of file incremental_compactor.cc.

Constructor & Destructor Documentation

◆ IncrementalForwardingVisitor()

dart::IncrementalForwardingVisitor::IncrementalForwardingVisitor ( Thread thread)
inlineexplicit

Definition at line 372 of file incremental_compactor.cc.

HandleVisitor(Thread *thread)
Thread * thread() const
ObjectPointerVisitor(IsolateGroup *isolate_group)
Definition: visitor.cc:11
IsolateGroup * isolate_group() const
Definition: thread.h:541

Member Function Documentation

◆ CanVisitSuspendStatePointers()

bool dart::IncrementalForwardingVisitor::CanVisitSuspendStatePointers ( SuspendStatePtr  suspend_state)
inlineoverridevirtual

Reimplemented from dart::ObjectPointerVisitor.

Definition at line 465 of file incremental_compactor.cc.

465 {
466 if ((suspend_state->untag()->pc() != 0) && !can_visit_stack_frames_) {
467 // Visiting pointers of SuspendState objects with copied stack frame
468 // needs to query stack map, which can touch other Dart objects
469 // (such as GrowableObjectArray of InstructionsTable).
470 // Those objects may have an inconsistent state during compaction,
471 // so processing of SuspendState objects is postponed to the later
472 // stage of compaction.
473 suspend_states_.Add(suspend_state);
474 return false;
475 }
476 return true;
477 }
void Add(const T &value)

◆ PredicateVisitPointers()

bool dart::IncrementalForwardingVisitor::PredicateVisitPointers ( ObjectPtr first,
ObjectPtr last 
)
inlineoverridevirtual

Implements dart::PredicateObjectPointerVisitor.

Definition at line 384 of file incremental_compactor.cc.

384 {
385 bool has_new_target = false;
386 for (ObjectPtr* ptr = first; ptr <= last; ptr++) {
387 ObjectPtr target = *ptr;
388 if (target->IsImmediateObject()) continue;
389 if (target->IsNewObject()) {
390 has_new_target = true;
391 continue;
392 }
393
394 if (target->IsForwardingCorpse()) {
395 ASSERT(!target->untag()->IsMarked());
396 ASSERT(!target->untag()->IsEvacuationCandidate());
398 ForwardingCorpse* forwarder = reinterpret_cast<ForwardingCorpse*>(addr);
399 *ptr = forwarder->target();
400 } else {
401 ASSERT(target->untag()->IsMarked());
402 ASSERT(!target->untag()->IsEvacuationCandidate());
403 }
404 }
405 return has_new_target;
406 }
static uword ToAddr(const UntaggedObject *raw_obj)
Definition: raw_object.h:522
#define ASSERT(E)
uint32_t * target
uintptr_t uword
Definition: globals.h:501

◆ UpdateSuspendStates()

void dart::IncrementalForwardingVisitor::UpdateSuspendStates ( )
inline

Definition at line 496 of file incremental_compactor.cc.

496 {
497 can_visit_stack_frames_ = true;
498 const intptr_t length = suspend_states_.length();
499 for (intptr_t i = 0; i < length; ++i) {
500 auto suspend_state = suspend_states_[i];
501 suspend_state->untag()->VisitPointers(this);
502 }
503 }
intptr_t length() const
size_t length

◆ UpdateViews()

void dart::IncrementalForwardingVisitor::UpdateViews ( )
inline

Definition at line 479 of file incremental_compactor.cc.

479 {
480 const intptr_t length = typed_data_views_.length();
481 for (intptr_t i = 0; i < length; ++i) {
482 auto raw_view = typed_data_views_[i];
483 const classid_t cid =
484 raw_view->untag()->typed_data()->GetClassIdMayBeSmi();
485 // If we have external typed data we can simply return, since the backing
486 // store lives in C-heap and will not move. Otherwise we have to update
487 // the inner pointer.
488 if (IsTypedDataClassId(cid)) {
489 raw_view->untag()->RecomputeDataFieldForInternalTypedData();
490 } else {
492 }
493 }
494 }
bool IsTypedDataClassId(intptr_t index)
Definition: class_id.h:433
int32_t classid_t
Definition: globals.h:524
const intptr_t cid
bool IsExternalTypedDataClassId(intptr_t index)
Definition: class_id.h:447

◆ VisitHandle()

void dart::IncrementalForwardingVisitor::VisitHandle ( uword  addr)
inlineoverridevirtual

Implements dart::HandleVisitor.

Definition at line 441 of file incremental_compactor.cc.

441 {
442 FinalizablePersistentHandle* handle =
443 reinterpret_cast<FinalizablePersistentHandle*>(addr);
444 ObjectPtr target = handle->ptr();
445 if (target->IsHeapObject() && target->IsForwardingCorpse()) {
447 ForwardingCorpse* forwarder = reinterpret_cast<ForwardingCorpse*>(addr);
448 *handle->ptr_addr() = forwarder->target();
449 }
450 }

◆ VisitObject()

void dart::IncrementalForwardingVisitor::VisitObject ( ObjectPtr  obj)
inlineoverridevirtual

Implements dart::ObjectVisitor.

Definition at line 375 of file incremental_compactor.cc.

375 {
376 if (obj->untag()->IsMarked()) {
377 obj->untag()->VisitPointers(this);
378 }
379 }

◆ VisitPointers()

void dart::IncrementalForwardingVisitor::VisitPointers ( ObjectPtr first,
ObjectPtr last 
)
inlineoverridevirtual

Implements dart::ObjectPointerVisitor.

Definition at line 381 of file incremental_compactor.cc.

381 {
382 PredicateVisitPointers(first, last);
383 }
bool PredicateVisitPointers(ObjectPtr *first, ObjectPtr *last) override

◆ VisitTypedDataViewPointers()

void dart::IncrementalForwardingVisitor::VisitTypedDataViewPointers ( TypedDataViewPtr  view,
CompressedObjectPtr first,
CompressedObjectPtr last 
)
inlineoverridevirtual

Reimplemented from dart::ObjectPointerVisitor.

Definition at line 452 of file incremental_compactor.cc.

454 {
455 ObjectPtr old_backing = view->untag()->typed_data();
456 VisitCompressedPointers(view->heap_base(), first, last);
457 ObjectPtr new_backing = view->untag()->typed_data();
458
459 const bool backing_moved = old_backing != new_backing;
460 if (backing_moved) {
461 typed_data_views_.Add(view);
462 }
463 }
void VisitCompressedPointers(uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
Definition: visitor.h:43

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