Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::UnitDeserializationRoots Class Reference
Inheritance diagram for dart::UnitDeserializationRoots:
dart::DeserializationRoots

Public Member Functions

 UnitDeserializationRoots (const LoadingUnit &unit)
 
void AddBaseObjects (Deserializer *d) override
 
void ReadRoots (Deserializer *d) override
 
void PostLoad (Deserializer *d, const Array &refs) override
 
- Public Member Functions inherited from dart::DeserializationRoots
virtual ~DeserializationRoots ()
 
virtual void AddBaseObjects (Deserializer *deserializer)=0
 
virtual void ReadRoots (Deserializer *deserializer)=0
 
virtual void PostLoad (Deserializer *deserializer, const Array &refs)=0
 

Detailed Description

Definition at line 7334 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ UnitDeserializationRoots()

dart::UnitDeserializationRoots::UnitDeserializationRoots ( const LoadingUnit unit)
inlineexplicit

Definition at line 7336 of file app_snapshot.cc.

7336: unit_(unit) {}

Member Function Documentation

◆ AddBaseObjects()

void dart::UnitDeserializationRoots::AddBaseObjects ( Deserializer d)
inlineoverridevirtual

Implements dart::DeserializationRoots.

Definition at line 7338 of file app_snapshot.cc.

7338 {
7339 const Array& base_objects =
7340 Array::Handle(LoadingUnit::Handle(unit_.parent()).base_objects());
7341 for (intptr_t i = kFirstReference; i < base_objects.Length(); i++) {
7342 d->AddBaseObject(base_objects.At(i));
7343 }
7344 }
LoadingUnitPtr parent() const
Definition: object.h:7980
static Object & Handle()
Definition: object.h:407
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
static constexpr intptr_t kFirstReference

◆ PostLoad()

void dart::UnitDeserializationRoots::PostLoad ( Deserializer d,
const Array refs 
)
inlineoverridevirtual

Implements dart::DeserializationRoots.

Definition at line 7407 of file app_snapshot.cc.

7407 {
7408 d->EndInstructions();
7409 unit_.set_base_objects(refs);
7410 }
void set_base_objects(const Array &value) const
Definition: object.cc:19700

◆ ReadRoots()

void dart::UnitDeserializationRoots::ReadRoots ( Deserializer d)
inlineoverridevirtual

Implements dart::DeserializationRoots.

Definition at line 7346 of file app_snapshot.cc.

7346 {
7347 deferred_start_index_ = d->ReadUnsigned();
7348 deferred_stop_index_ = deferred_start_index_ + d->ReadUnsigned();
7349 for (intptr_t id = deferred_start_index_; id < deferred_stop_index_; id++) {
7350 CodePtr code = static_cast<CodePtr>(d->Ref(id));
7352 d->ReadInstructions(code, /*deferred=*/false);
7353 if (code->untag()->owner_->IsHeapObject() &&
7354 code->untag()->owner_->IsFunction()) {
7355 FunctionPtr func = static_cast<FunctionPtr>(code->untag()->owner_);
7356 uword entry_point = code->untag()->entry_point_;
7357 ASSERT(entry_point != 0);
7358 func->untag()->entry_point_ = entry_point;
7359 uword unchecked_entry_point = code->untag()->unchecked_entry_point_;
7360 ASSERT(unchecked_entry_point != 0);
7361 func->untag()->unchecked_entry_point_ = unchecked_entry_point;
7362#if defined(DART_PRECOMPILED_RUNTIME)
7363 if (func->untag()->data()->IsHeapObject() &&
7364 func->untag()->data()->IsClosureData()) {
7365 // For closure functions in bare instructions mode, also update the
7366 // cache inside the static implicit closure object, if any.
7367 auto data = static_cast<ClosureDataPtr>(func->untag()->data());
7368 if (data->untag()->closure() != Closure::null()) {
7369 // Closure functions only have one entry point.
7370 ASSERT_EQUAL(entry_point, unchecked_entry_point);
7371 data->untag()->closure()->untag()->entry_point_ = entry_point;
7372 }
7373 }
7374#endif
7375 }
7376 code->untag()->code_source_map_ =
7377 static_cast<CodeSourceMapPtr>(d->ReadRef());
7378 }
7379
7380 ObjectPoolPtr pool =
7381 d->isolate_group()->object_store()->global_object_pool();
7382 const intptr_t length = pool->untag()->length_;
7383 uint8_t* entry_bits = pool->untag()->entry_bits();
7384 for (intptr_t i = d->ReadUnsigned(); i < length; i += d->ReadUnsigned()) {
7385 auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
7386 ASSERT(entry_type == ObjectPool::EntryType::kTaggedObject);
7387 // The existing entry will usually be null, but it might also be an
7388 // equivalent object that was duplicated in another loading unit.
7389 pool->untag()->data()[i].raw_obj_ = d->ReadRef();
7390 }
7391
7392 // Reinitialize the dispatch table by rereading the table's serialization
7393 // in the root snapshot.
7394 auto isolate_group = d->isolate_group();
7395 if (isolate_group->dispatch_table_snapshot() != nullptr) {
7396 ReadStream stream(isolate_group->dispatch_table_snapshot(),
7397 isolate_group->dispatch_table_snapshot_size());
7398 const GrowableObjectArray& tables = GrowableObjectArray::Handle(
7399 isolate_group->object_store()->instructions_tables());
7400 InstructionsTable& root_table = InstructionsTable::Handle();
7401 root_table ^= tables.At(0);
7402 d->ReadDispatchTable(&stream, /*deferred=*/true, root_table,
7403 deferred_start_index_, deferred_stop_index_);
7404 }
7405 }
AutoreleasePool pool
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
static constexpr T decode(S value)
Definition: bitfield.h:171
bool IsUnknownDartCode() const
Definition: object.h:7245
static ObjectPtr null()
Definition: object.h:433
#define ASSERT(E)
size_t length
uintptr_t uword
Definition: globals.h:501
static int8_t data[kExtLength]

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