[modular_aot] Serialization of type parameter declarations in module snapshots

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ia5646ec6e2133a2232ffbbdb4926d94296bcd690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505522
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Alexander Markov
2026-05-22 10:10:19 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 7d93f44c17
commit d7d723327f
3 changed files with 115 additions and 40 deletions
+26 -3
View File
@@ -931,6 +931,31 @@ class InstanceDeserializationCluster : public DeserializationCluster {
intptr_t instance_size_ = 0;
};
class TypeParametersDeserializationCluster : public DeserializationCluster {
public:
TypeParametersDeserializationCluster()
: DeserializationCluster("TypeParameters") {}
~TypeParametersDeserializationCluster() {}
void ReadAlloc(Deserializer* d) override {
ReadAllocFixedSize(d, TypeParameters::InstanceSize());
}
void ReadFill(Deserializer* d_) override {
Deserializer::Local d(d_);
for (intptr_t id = start_index_, n = stop_index_; id < n; id++) {
TypeParametersPtr tps = static_cast<TypeParametersPtr>(d.Ref(id));
Deserializer::InitializeHeader(tps, kTypeParametersCid,
TypeParameters::InstanceSize());
tps->untag()->names_ = static_cast<ArrayPtr>(d.ReadRef());
tps->untag()->flags_ = static_cast<ArrayPtr>(d.null());
tps->untag()->bounds_ = static_cast<TypeArgumentsPtr>(d.ReadRef());
tps->untag()->defaults_ = static_cast<TypeArgumentsPtr>(d.ReadRef());
}
}
};
class TypeArgumentsDeserializationCluster : public DeserializationCluster {
public:
TypeArgumentsDeserializationCluster()
@@ -1544,9 +1569,7 @@ DeserializationCluster* Deserializer::ReadCluster() {
UNIMPLEMENTED();
return nullptr;
case ModuleSnapshot::kTypeParameters:
// return new (Z) TypeParametersDeserializationCluster();
UNIMPLEMENTED();
return nullptr;
return new (Z) TypeParametersDeserializationCluster();
case ModuleSnapshot::kInterfaceTypes:
return new (Z) InterfaceTypeDeserializationCluster();
case ModuleSnapshot::kFunctionTypes:
+2
View File
@@ -63,6 +63,7 @@ class SetDeserializationCluster;
class SubtypeTestCacheDeserializationCluster;
class TypeArgumentsDeserializationCluster;
class TypeParameterTypeDeserializationCluster;
class TypeParametersDeserializationCluster;
} // namespace module_snapshot
#define DEFINE_CONTAINS_COMPRESSED(type) \
@@ -2951,6 +2952,7 @@ class UntaggedTypeParameters : public UntaggedObject {
CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
friend class Object;
friend class module_snapshot::TypeParametersDeserializationCluster;
};
class UntaggedAbstractType : public UntaggedInstance {