From cd26f5e1cc5c82ec5453a5770bf2f7c95b6e4d5f Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 21 Apr 2026 10:13:04 -0700 Subject: [PATCH] [vm] Add missing serialization clusters for VM isolate objects. TEST=ci Change-Id: I738cf1a189accd2e449728bb599b6b92b5797924 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496800 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- .../lib/runtime/vm_offsets.g.dart | 13 + runtime/vm/app_snapshot.cc | 235 ++++++++++++++++++ runtime/vm/compiler/runtime_api.cc | 4 - runtime/vm/compiler/runtime_api.h | 2 + .../vm/compiler/runtime_offsets_extracted.h | 120 +++++++++ runtime/vm/compiler/runtime_offsets_list.h | 2 + runtime/vm/object.cc | 1 + runtime/vm/object.h | 16 +- runtime/vm/raw_object.h | 6 + 9 files changed, 390 insertions(+), 9 deletions(-) diff --git a/pkg/native_compiler/lib/runtime/vm_offsets.g.dart b/pkg/native_compiler/lib/runtime/vm_offsets.g.dart index fa6d1f2608e..6f1bc2cdab5 100644 --- a/pkg/native_compiler/lib/runtime/vm_offsets.g.dart +++ b/pkg/native_compiler/lib/runtime/vm_offsets.g.dart @@ -505,6 +505,11 @@ base class VMOffsets { int get ContextScope_elementSize => throw 'Unknown'; int ContextScope_elementOffset(int index) => ContextScope_elementsStartOffset + index * ContextScope_elementSize; + int get LocalVarDescriptors_elementsStartOffset => throw 'Unknown'; + int get LocalVarDescriptors_elementSize => throw 'Unknown'; + int LocalVarDescriptors_elementOffset(int index) => + LocalVarDescriptors_elementsStartOffset + + index * LocalVarDescriptors_elementSize; int get ExceptionHandlers_elementsStartOffset => throw 'Unknown'; int get ExceptionHandlers_elementSize => throw 'Unknown'; int ExceptionHandlers_elementOffset(int index) => @@ -573,6 +578,10 @@ final class Arm64VMOffsets extends VMOffsets { @override int get ContextScope_elementSize => 0x50; @override + int get LocalVarDescriptors_elementsStartOffset => 0x10; + @override + int get LocalVarDescriptors_elementSize => 0x1c; + @override int get ExceptionHandlers_elementsStartOffset => 0x18; @override int get ExceptionHandlers_elementSize => 0xc; @@ -1536,6 +1545,10 @@ final class Arm64ProductVMOffsets extends VMOffsets { @override int get ContextScope_elementSize => 0x50; @override + int get LocalVarDescriptors_elementsStartOffset => 0x10; + @override + int get LocalVarDescriptors_elementSize => 0x1c; + @override int get ExceptionHandlers_elementsStartOffset => 0x18; @override int get ExceptionHandlers_elementSize => 0xc; diff --git a/runtime/vm/app_snapshot.cc b/runtime/vm/app_snapshot.cc index 0c438edddab..4a017bd7c37 100644 --- a/runtime/vm/app_snapshot.cc +++ b/runtime/vm/app_snapshot.cc @@ -3756,6 +3756,103 @@ class RODataDeserializationCluster }; #endif // !DART_COMPRESSED_POINTERS +#if !defined(DART_PRECOMPILED_RUNTIME) +class LocalVarDescriptorsSerializationCluster : public SerializationCluster { + public: + LocalVarDescriptorsSerializationCluster() + : SerializationCluster("LocalVarDescriptors", kLocalVarDescriptorsCid) {} + ~LocalVarDescriptorsSerializationCluster() {} + + void Trace(Serializer* s, ObjectPtr object) { + LocalVarDescriptorsPtr handlers = LocalVarDescriptors::RawCast(object); + objects_.Add(handlers); + + const intptr_t length = handlers->untag()->num_entries_; + for (intptr_t i = 0; i < length; i++) { + s->Push(handlers->untag()->name(i)); + } + } + + void WriteAlloc(Serializer* s) { + const intptr_t count = objects_.length(); + s->WriteUnsigned(count); + for (intptr_t i = 0; i < count; i++) { + LocalVarDescriptorsPtr handlers = objects_[i]; + s->AssignRef(handlers); + AutoTraceObject(handlers); + const intptr_t length = handlers->untag()->num_entries_; + s->WriteUnsigned(length); + target_memory_size_ += + compiler::target::LocalVarDescriptors::InstanceSize(length); + } + } + + void WriteFill(Serializer* s) { + const intptr_t count = objects_.length(); + for (intptr_t i = 0; i < count; i++) { + LocalVarDescriptorsPtr handlers = objects_[i]; + AutoTraceObject(handlers); + const intptr_t length = handlers->untag()->num_entries_; + s->WriteUnsigned(length); + WriteFromTo(handlers, length); + for (intptr_t j = 0; j < length; j++) { + UntaggedLocalVarDescriptors::VarInfo& info = + handlers->untag()->data()[j]; + s->Write(info.index_kind); + s->WriteTokenPosition(info.declaration_pos); + s->WriteTokenPosition(info.begin_pos); + s->WriteTokenPosition(info.end_pos); + s->Write(info.scope_id); + } + } + } + + private: + GrowableArray objects_; +}; +#endif // !DART_PRECOMPILED_RUNTIME + +class LocalVarDescriptorsDeserializationCluster + : public DeserializationCluster { + public: + LocalVarDescriptorsDeserializationCluster() + : DeserializationCluster("LocalVarDescriptors") {} + ~LocalVarDescriptorsDeserializationCluster() {} + + void ReadAlloc(Deserializer* d) override { + start_index_ = d->next_index(); + const intptr_t count = d->ReadUnsigned(); + for (intptr_t i = 0; i < count; i++) { + const intptr_t length = d->ReadUnsigned(); + d->AssignRef(d->Allocate(LocalVarDescriptors::InstanceSize(length))); + } + stop_index_ = d->next_index(); + } + + void ReadFill(Deserializer* d_) override { + Deserializer::Local d(d_); + + ASSERT(!is_canonical()); // Never canonical. + for (intptr_t id = start_index_, n = stop_index_; id < n; id++) { + LocalVarDescriptorsPtr handlers = + static_cast(d.Ref(id)); + const intptr_t length = d.ReadUnsigned(); + Deserializer::InitializeHeader(handlers, kLocalVarDescriptorsCid, + LocalVarDescriptors::InstanceSize(length)); + d.ReadFromTo(handlers, length); + for (intptr_t j = 0; j < length; j++) { + UntaggedLocalVarDescriptors::VarInfo& info = + handlers->untag()->data()[j]; + info.index_kind = d.Read(); + info.declaration_pos = d.ReadTokenPosition(); + info.begin_pos = d.ReadTokenPosition(); + info.end_pos = d.ReadTokenPosition(); + info.scope_id = d.Read(); + } + } + } +}; + #if !defined(DART_PRECOMPILED_RUNTIME) class ExceptionHandlersSerializationCluster : public SerializationCluster { public: @@ -4341,6 +4438,66 @@ class LoadingUnitDeserializationCluster : public DeserializationCluster { } }; +#if !defined(DART_PRECOMPILED_RUNTIME) +class ApiErrorSerializationCluster : public SerializationCluster { + public: + ApiErrorSerializationCluster() + : SerializationCluster("ApiError", + kApiErrorCid, + compiler::target::ApiError::InstanceSize()) {} + ~ApiErrorSerializationCluster() {} + + void Trace(Serializer* s, ObjectPtr object) { + ApiErrorPtr error = ApiError::RawCast(object); + objects_.Add(error); + PushFromTo(error); + } + + void WriteAlloc(Serializer* s) { + const intptr_t count = objects_.length(); + s->WriteUnsigned(count); + for (intptr_t i = 0; i < count; i++) { + ApiErrorPtr error = objects_[i]; + s->AssignRef(error); + } + } + + void WriteFill(Serializer* s) { + const intptr_t count = objects_.length(); + for (intptr_t i = 0; i < count; i++) { + ApiErrorPtr error = objects_[i]; + AutoTraceObject(error); + WriteFromTo(error); + } + } + + private: + GrowableArray objects_; +}; +#endif // !DART_PRECOMPILED_RUNTIME + +class ApiErrorDeserializationCluster : public DeserializationCluster { + public: + ApiErrorDeserializationCluster() : DeserializationCluster("ApiError") {} + ~ApiErrorDeserializationCluster() {} + + void ReadAlloc(Deserializer* d) override { + ReadAllocFixedSize(d, ApiError::InstanceSize()); + } + + void ReadFill(Deserializer* d_) override { + Deserializer::Local d(d_); + + ASSERT(!is_canonical()); // Never canonical. + for (intptr_t id = start_index_, n = stop_index_; id < n; id++) { + ApiErrorPtr error = static_cast(d.Ref(id)); + Deserializer::InitializeHeader(error, kApiErrorCid, + ApiError::InstanceSize()); + d.ReadFromTo(error); + } + } +}; + #if !defined(DART_PRECOMPILED_RUNTIME) class LanguageErrorSerializationCluster : public SerializationCluster { public: @@ -4471,6 +4628,68 @@ class UnhandledExceptionDeserializationCluster : public DeserializationCluster { } }; +#if !defined(DART_PRECOMPILED_RUNTIME) +class UnwindErrorSerializationCluster : public SerializationCluster { + public: + UnwindErrorSerializationCluster() + : SerializationCluster("UnwindError", + kUnwindErrorCid, + compiler::target::UnwindError::InstanceSize()) {} + ~UnwindErrorSerializationCluster() {} + + void Trace(Serializer* s, ObjectPtr object) { + UnwindErrorPtr error = UnwindError::RawCast(object); + objects_.Add(error); + PushFromTo(error); + } + + void WriteAlloc(Serializer* s) { + const intptr_t count = objects_.length(); + s->WriteUnsigned(count); + for (intptr_t i = 0; i < count; i++) { + UnwindErrorPtr error = objects_[i]; + s->AssignRef(error); + } + } + + void WriteFill(Serializer* s) { + const intptr_t count = objects_.length(); + for (intptr_t i = 0; i < count; i++) { + UnwindErrorPtr error = objects_[i]; + AutoTraceObject(error); + WriteFromTo(error); + s->Write(error->untag()->is_user_initiated_); + } + } + + private: + GrowableArray objects_; +}; +#endif // !DART_PRECOMPILED_RUNTIME + +class UnwindErrorDeserializationCluster : public DeserializationCluster { + public: + UnwindErrorDeserializationCluster() : DeserializationCluster("UnwindError") {} + ~UnwindErrorDeserializationCluster() {} + + void ReadAlloc(Deserializer* d) override { + ReadAllocFixedSize(d, UnwindError::InstanceSize()); + } + + void ReadFill(Deserializer* d_) override { + Deserializer::Local d(d_); + + ASSERT(!is_canonical()); // Never canonical. + for (intptr_t id = start_index_, n = stop_index_; id < n; id++) { + UnwindErrorPtr error = static_cast(d.Ref(id)); + Deserializer::InitializeHeader(error, kUnwindErrorCid, + UnwindError::InstanceSize()); + d.ReadFromTo(error); + error->untag()->is_user_initiated_ = d.Read(); + } + } +}; + #if !defined(DART_PRECOMPILED_RUNTIME) class InstanceSerializationCluster : public SerializationCluster { public: @@ -8058,10 +8277,14 @@ SerializationCluster* Serializer::NewClusterForClass(intptr_t cid, return new (Z) SubtypeTestCacheSerializationCluster(); case kLoadingUnitCid: return new (Z) LoadingUnitSerializationCluster(); + case kApiErrorCid: + return new (Z) ApiErrorSerializationCluster(); case kLanguageErrorCid: return new (Z) LanguageErrorSerializationCluster(); case kUnhandledExceptionCid: return new (Z) UnhandledExceptionSerializationCluster(); + case kUnwindErrorCid: + return new (Z) UnwindErrorSerializationCluster(); case kLibraryPrefixCid: return new (Z) LibraryPrefixSerializationCluster(); case kTypeCid: @@ -9270,6 +9493,10 @@ DeserializationCluster* Deserializer::ReadCluster() { ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); return new (Z) CompressedStackMapsDeserializationCluster(); + case kLocalVarDescriptorsCid: + ASSERT(!is_canonical); + ASSERT(!is_deeply_immutable); + return new (Z) LocalVarDescriptorsDeserializationCluster(); case kExceptionHandlersCid: ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); @@ -9302,6 +9529,10 @@ DeserializationCluster* Deserializer::ReadCluster() { ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); return new (Z) LoadingUnitDeserializationCluster(); + case kApiErrorCid: + ASSERT(!is_canonical); + ASSERT(!is_deeply_immutable); + return new (Z) ApiErrorDeserializationCluster(); case kLanguageErrorCid: ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); @@ -9310,6 +9541,10 @@ DeserializationCluster* Deserializer::ReadCluster() { ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); return new (Z) UnhandledExceptionDeserializationCluster(); + case kUnwindErrorCid: + ASSERT(!is_canonical); + ASSERT(!is_deeply_immutable); + return new (Z) UnwindErrorDeserializationCluster(); case kLibraryPrefixCid: ASSERT(!is_canonical); ASSERT(!is_deeply_immutable); diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc index c2f9fb6b297..7f3fe599b89 100644 --- a/runtime/vm/compiler/runtime_api.cc +++ b/runtime/vm/compiler/runtime_api.cc @@ -1038,10 +1038,6 @@ word String::InstanceSize(word payload_size) { return RoundedAllocationSize(String::InstanceSize() + payload_size); } -word LocalVarDescriptors::InstanceSize() { - return 0; -} - word Integer::NextFieldOffset() { return TranslateOffsetInWords(dart::Integer::NextFieldOffset()); } diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index 641b9355359..89068624eed 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -916,6 +916,8 @@ class CompressedStackMaps : public AllStatic { class LocalVarDescriptors : public AllStatic { public: + static word element_offset(intptr_t index); + static word InstanceSize(intptr_t length); static word InstanceSize(); FINAL_CLASS(); }; diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index fc9509e6ab0..f9f098d0059 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -41,6 +41,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -805,6 +809,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -1580,6 +1588,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -2343,6 +2355,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -3121,6 +3137,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -3893,6 +3913,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -4666,6 +4690,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -5431,6 +5459,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -6204,6 +6236,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -6960,6 +6996,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -7727,6 +7767,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -8482,6 +8526,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -9252,6 +9300,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -10016,6 +10068,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -10781,6 +10837,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x4; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -11538,6 +11598,10 @@ static constexpr dart::compiler::target::word Context_element_size = 0x8; static constexpr dart::compiler::target::word ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word LocalVarDescriptors_element_size = + 0x1c; static constexpr dart::compiler::target::word ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word ExceptionHandlers_element_size = @@ -12306,6 +12370,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word @@ -13155,6 +13223,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word @@ -14015,6 +14087,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word @@ -14871,6 +14947,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word @@ -15727,6 +15807,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word @@ -16585,6 +16669,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word @@ -17435,6 +17523,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word @@ -18287,6 +18379,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word @@ -19127,6 +19223,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word @@ -19978,6 +20078,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word @@ -20825,6 +20929,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word @@ -21672,6 +21780,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x10; static constexpr dart::compiler::target::word @@ -22521,6 +22633,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0xc; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x28; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x8; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x18; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0xc; static constexpr dart::compiler::target::word @@ -23362,6 +23478,10 @@ static constexpr dart::compiler::target::word AOT_ContextScope_elements_start_offset = 0x10; static constexpr dart::compiler::target::word AOT_ContextScope_element_size = 0x50; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_elements_start_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_LocalVarDescriptors_element_size = 0x1c; static constexpr dart::compiler::target::word AOT_ExceptionHandlers_elements_start_offset = 0x18; static constexpr dart::compiler::target::word diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index e3000a5e25d..af2c8f4740d 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -64,6 +64,7 @@ ARRAY(Code, element_offset) \ ARRAY(Context, variable_offset) \ ARRAY(ContextScope, element_offset) \ + ARRAY(LocalVarDescriptors, element_offset) \ ARRAY(ExceptionHandlers, element_offset) \ ARRAY(ObjectPool, element_offset) \ ARRAY(OneByteString, element_offset) \ @@ -76,6 +77,7 @@ ARRAY_SIZEOF(Code, InstanceSize, element_offset) \ ARRAY_SIZEOF(Context, InstanceSize, variable_offset) \ ARRAY_SIZEOF(ContextScope, InstanceSize, element_offset) \ + ARRAY_SIZEOF(LocalVarDescriptors, InstanceSize, element_offset) \ ARRAY_SIZEOF(ExceptionHandlers, InstanceSize, element_offset) \ ARRAY_SIZEOF(ObjectPool, InstanceSize, element_offset) \ ARRAY_SIZEOF(OneByteString, InstanceSize, element_offset) \ diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 0af3fd5d1ab..6851623badd 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -1111,6 +1111,7 @@ void Object::Init(IsolateGroup* isolate_group) { static_cast(address + kHeapObjectTag)); Roots::empty_type_arguments().untag()->set_length(Smi::New(0)); Roots::empty_type_arguments().untag()->set_hash(Smi::New(0)); + Roots::empty_type_arguments().untag()->set_nullability(Smi::New(0)); Roots::empty_type_arguments().ComputeHash(); Roots::empty_type_arguments().SetCanonical(); } diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 46de032f0cf..bc11f517cec 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -6203,10 +6203,18 @@ class LocalVarDescriptors : public Object { UntaggedLocalVarDescriptors::VarInfo* info) const; static constexpr intptr_t kBytesPerElement = - sizeof(UntaggedLocalVarDescriptors::VarInfo); + sizeof(UntaggedLocalVarDescriptors::VarInfo) + + sizeof(CompressedStringPtr); static constexpr intptr_t kMaxElements = UntaggedLocalVarDescriptors::VarInfo::kMaxIndex; + struct ArrayTraits { + static intptr_t elements_start_offset() { + return sizeof(UntaggedLocalVarDescriptors); + } + static constexpr intptr_t kElementSize = kBytesPerElement; + }; + static intptr_t InstanceSize() { ASSERT(sizeof(UntaggedLocalVarDescriptors) == OFFSET_OF_RETURNED_VALUE(UntaggedLocalVarDescriptors, names)); @@ -6214,10 +6222,8 @@ class LocalVarDescriptors : public Object { } static intptr_t InstanceSize(intptr_t len) { ASSERT(0 <= len && len <= kMaxElements); - return RoundedAllocationSize( - sizeof(UntaggedLocalVarDescriptors) + - (len * kWordSize) // RawStrings for names. - + (len * sizeof(UntaggedLocalVarDescriptors::VarInfo))); + return RoundedAllocationSize(sizeof(UntaggedLocalVarDescriptors) + + len * kBytesPerElement); } static LocalVarDescriptorsPtr New(intptr_t num_variables); diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 43c1b43e9d3..6c2f226dca0 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -2556,6 +2556,10 @@ class UntaggedLocalVarDescriptors : public UntaggedObject { return reinterpret_cast(nameAddrAt(num_entries_)); } + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind, intptr_t num_entries) { + return to(num_entries); + } + friend class Object; }; @@ -2831,6 +2835,7 @@ class UntaggedApiError : public UntaggedError { COMPRESSED_POINTER_FIELD(StringPtr, message) VISIT_FROM(message) VISIT_TO(message) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } }; class UntaggedLanguageError : public UntaggedError { @@ -2867,6 +2872,7 @@ class UntaggedUnwindError : public UntaggedError { VISIT_FROM(message) VISIT_TO(message) bool is_user_initiated_; + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } }; class UntaggedInstance : public UntaggedObject {