Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::ObjectPoolSerializationCluster Class Reference
Inheritance diagram for dart::ObjectPoolSerializationCluster:
dart::SerializationCluster dart::ZoneAllocated

Public Member Functions

 ObjectPoolSerializationCluster ()
 
 ~ObjectPoolSerializationCluster ()
 
void Trace (Serializer *s, ObjectPtr object)
 
void WriteAlloc (Serializer *s)
 
void WriteFill (Serializer *s)
 
- Public Member Functions inherited from dart::SerializationCluster
 SerializationCluster (const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)
 
virtual ~SerializationCluster ()
 
void WriteAndMeasureAlloc (Serializer *serializer)
 
void WriteAndMeasureFill (Serializer *serializer)
 
const char * name () const
 
intptr_t cid () const
 
bool is_canonical () const
 
bool is_immutable () const
 
intptr_t size () const
 
intptr_t num_objects () const
 
intptr_t target_memory_size () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::SerializationCluster
static constexpr intptr_t kSizeVaries = -1
 
- Protected Attributes inherited from dart::SerializationCluster
const char *const name_
 
const intptr_t cid_
 
const intptr_t target_instance_size_
 
const bool is_canonical_
 
const bool is_immutable_
 
intptr_t size_ = 0
 
intptr_t num_objects_ = 0
 
intptr_t target_memory_size_ = 0
 

Detailed Description

Definition at line 3146 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ ObjectPoolSerializationCluster()

dart::ObjectPoolSerializationCluster::ObjectPoolSerializationCluster ( )
inline

Definition at line 3148 of file app_snapshot.cc.

3149 : SerializationCluster("ObjectPool", kObjectPoolCid) {}
SerializationCluster(const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)

◆ ~ObjectPoolSerializationCluster()

dart::ObjectPoolSerializationCluster::~ObjectPoolSerializationCluster ( )
inline

Definition at line 3150 of file app_snapshot.cc.

3150{}

Member Function Documentation

◆ Trace()

void dart::ObjectPoolSerializationCluster::Trace ( Serializer s,
ObjectPtr  object 
)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 3152 of file app_snapshot.cc.

3152 {
3153 ObjectPoolPtr pool = ObjectPool::RawCast(object);
3154 objects_.Add(pool);
3155
3156 if (s->kind() != Snapshot::kFullAOT) {
3157 const intptr_t length = pool->untag()->length_;
3158 uint8_t* entry_bits = pool->untag()->entry_bits();
3159 for (intptr_t i = 0; i < length; i++) {
3160 auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
3161 if (entry_type == ObjectPool::EntryType::kTaggedObject) {
3162 s->Push(pool->untag()->data()[i].raw_obj_);
3163 }
3164 }
3165 }
3166 }
AutoreleasePool pool
void Add(const T &value)
static constexpr T decode(S value)
Definition bitfield.h:173
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
struct MyStruct s
size_t length

◆ WriteAlloc()

void dart::ObjectPoolSerializationCluster::WriteAlloc ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 3168 of file app_snapshot.cc.

3168 {
3169 const intptr_t count = objects_.length();
3170 s->WriteUnsigned(count);
3171 for (intptr_t i = 0; i < count; i++) {
3172 ObjectPoolPtr pool = objects_[i];
3173 s->AssignRef(pool);
3175 const intptr_t length = pool->untag()->length_;
3176 s->WriteUnsigned(length);
3177 target_memory_size_ += compiler::target::ObjectPool::InstanceSize(length);
3178 }
3179 }
int count
#define AutoTraceObject(obj)
intptr_t length() const

◆ WriteFill()

void dart::ObjectPoolSerializationCluster::WriteFill ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 3181 of file app_snapshot.cc.

3181 {
3182 bool weak = s->kind() == Snapshot::kFullAOT;
3183
3184 const intptr_t count = objects_.length();
3185 for (intptr_t i = 0; i < count; i++) {
3186 ObjectPoolPtr pool = objects_[i];
3188 const intptr_t length = pool->untag()->length_;
3189 s->WriteUnsigned(length);
3190 uint8_t* entry_bits = pool->untag()->entry_bits();
3191 for (intptr_t j = 0; j < length; j++) {
3192 UntaggedObjectPool::Entry& entry = pool->untag()->data()[j];
3193 uint8_t bits = entry_bits[j];
3195 auto snapshot_behavior = ObjectPool::SnapshotBehaviorBits::decode(bits);
3196 ASSERT(snapshot_behavior !=
3197 ObjectPool::SnapshotBehavior::kNotSnapshotable);
3198 s->Write<uint8_t>(bits);
3199 if (snapshot_behavior != ObjectPool::SnapshotBehavior::kSnapshotable) {
3200 // The deserializer will reset this to a specific value, no need to
3201 // write anything.
3202 continue;
3203 }
3204 switch (type) {
3205 case ObjectPool::EntryType::kTaggedObject: {
3206 if (weak && !s->HasRef(entry.raw_obj_)) {
3207 // Any value will do, but null has the shortest id.
3208 s->WriteElementRef(Object::null(), j);
3209 } else {
3210 s->WriteElementRef(entry.raw_obj_, j);
3211 }
3212 break;
3213 }
3214 case ObjectPool::EntryType::kImmediate: {
3215 s->Write<intptr_t>(entry.raw_value_);
3216 break;
3217 }
3218 case ObjectPool::EntryType::kNativeFunction: {
3219 // Write nothing. Will initialize with the lazy link entry.
3220 break;
3221 }
3222 default:
3223 UNREACHABLE();
3224 }
3225 }
3226 }
3227 }
#define UNREACHABLE()
Definition assert.h:248
compiler::ObjectPoolBuilderEntry::EntryType EntryType
Definition object.h:5523
static ObjectPtr null()
Definition object.h:433
#define ASSERT(E)

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