Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 ()
 

Detailed Description

Definition at line 7302 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ UnitDeserializationRoots()

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

Definition at line 7304 of file app_snapshot.cc.

7304: unit_(unit) {}

Member Function Documentation

◆ AddBaseObjects()

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

Implements dart::DeserializationRoots.

Definition at line 7306 of file app_snapshot.cc.

7306 {
7307 const Array& base_objects =
7308 Array::Handle(LoadingUnit::Handle(unit_.parent()).base_objects());
7309 for (intptr_t i = kFirstReference; i < base_objects.Length(); i++) {
7310 d->AddBaseObject(base_objects.At(i));
7311 }
7312 }
LoadingUnitPtr parent() const
Definition object.h:7951
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 7375 of file app_snapshot.cc.

7375 {
7376 d->EndInstructions();
7377 unit_.set_base_objects(refs);
7378 }
void set_base_objects(const Array &value) const
Definition object.cc:19750

◆ ReadRoots()

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

Implements dart::DeserializationRoots.

Definition at line 7314 of file app_snapshot.cc.

7314 {
7315 deferred_start_index_ = d->ReadUnsigned();
7316 deferred_stop_index_ = deferred_start_index_ + d->ReadUnsigned();
7317 for (intptr_t id = deferred_start_index_; id < deferred_stop_index_; id++) {
7318 CodePtr code = static_cast<CodePtr>(d->Ref(id));
7320 d->ReadInstructions(code, /*deferred=*/false);
7321 if (code->untag()->owner_->IsHeapObject() &&
7322 code->untag()->owner_->IsFunction()) {
7323 FunctionPtr func = static_cast<FunctionPtr>(code->untag()->owner_);
7324 uword entry_point = code->untag()->entry_point_;
7325 ASSERT(entry_point != 0);
7326 func->untag()->entry_point_ = entry_point;
7327 uword unchecked_entry_point = code->untag()->unchecked_entry_point_;
7328 ASSERT(unchecked_entry_point != 0);
7329 func->untag()->unchecked_entry_point_ = unchecked_entry_point;
7330#if defined(DART_PRECOMPILED_RUNTIME)
7331 if (func->untag()->data()->IsHeapObject() &&
7332 func->untag()->data()->IsClosureData()) {
7333 // For closure functions in bare instructions mode, also update the
7334 // cache inside the static implicit closure object, if any.
7335 auto data = static_cast<ClosureDataPtr>(func->untag()->data());
7336 if (data->untag()->closure() != Closure::null()) {
7337 // Closure functions only have one entry point.
7338 ASSERT_EQUAL(entry_point, unchecked_entry_point);
7339 data->untag()->closure()->untag()->entry_point_ = entry_point;
7340 }
7341 }
7342#endif
7343 }
7344 code->untag()->code_source_map_ =
7345 static_cast<CodeSourceMapPtr>(d->ReadRef());
7346 }
7347
7348 ObjectPoolPtr pool =
7349 d->isolate_group()->object_store()->global_object_pool();
7350 const intptr_t length = pool->untag()->length_;
7351 uint8_t* entry_bits = pool->untag()->entry_bits();
7352 for (intptr_t i = d->ReadUnsigned(); i < length; i += d->ReadUnsigned()) {
7353 auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
7354 ASSERT(entry_type == ObjectPool::EntryType::kTaggedObject);
7355 // The existing entry will usually be null, but it might also be an
7356 // equivalent object that was duplicated in another loading unit.
7357 pool->untag()->data()[i].raw_obj_ = d->ReadRef();
7358 }
7359
7360 // Reinitialize the dispatch table by rereading the table's serialization
7361 // in the root snapshot.
7362 auto isolate_group = d->isolate_group();
7363 if (isolate_group->dispatch_table_snapshot() != nullptr) {
7364 ReadStream stream(isolate_group->dispatch_table_snapshot(),
7365 isolate_group->dispatch_table_snapshot_size());
7366 const GrowableObjectArray& tables = GrowableObjectArray::Handle(
7367 isolate_group->object_store()->instructions_tables());
7368 InstructionsTable& root_table = InstructionsTable::Handle();
7369 root_table ^= tables.At(0);
7370 d->ReadDispatchTable(&stream, /*deferred=*/true, root_table,
7371 deferred_start_index_, deferred_stop_index_);
7372 }
7373 }
AutoreleasePool pool
#define ASSERT_EQUAL(expected, actual)
Definition assert.h:309
static constexpr T decode(S value)
Definition bitfield.h:173
bool IsUnknownDartCode() const
Definition object.h:7216
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: