[vm] Simplify root unit checks in snapshot deserialization.

Previously, there were two ways to determine whether a deserialization
cluster was being deserialized for the root loading unit or a non-root
loading unit:

* some deserialization clusters (those deriving from
  CanonicalSetDeserializationCluster) took a boolean at construction
  time, and
* all deserialization clusters took an additional boolean argument to
  ReadFill and PostLoad on whether the loading unit was primary (i.e.,
  the root) or not.

Since only clusters that deal with canonical values need to worry about
whether the deserializing loading unit is the root or not, standardize
on the first, where clusters that need to know take the boolean in their
constructor and store it in a field, and remove the boolean argument to
ReadFill and PostLoad.

Have DeserializationCluster::PostLoad just check is_canonical() to
determine whether to throw an error if not overridden in the base class,
so that any deserialization cluster that may operate on canonical
objects needs to explicitly make a choice about whether they need to
recanonicalize or not. This check only happens in the precompiled
runtime, as otherwise there are no non-root loading units.

In particular, this fixes an issue where symbols (canonical strings)
in non-root loading units weren't marked as canonical, even though
they do not need recanonicalization (since symbol tables are
per-isolate group, and thus per-loading unit).

TEST=ci (refactoring, test of symbol fix coming in followup CL)

Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try
Change-Id: I411a254767653da82631abc1fcc687ae4259e0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363321
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Tess Strickland
2024-04-17 18:30:20 +00:00
committed by Commit Queue
parent 226f862be1
commit 2d49ca0204
+240 -209
View File
File diff suppressed because it is too large Load Diff