Skip to content

Commit 0b5a8fa

Browse files
mkustermannCommit Bot
authored and
Commit Bot
committed
[vm] Ensure hot-reload will allocate-finalize new classes if old ones were
This was missed when is_allocate_finalized() was introduced and is now revealed due to [0] having added ASSERT(cls.is_allocate_finalized()); into object allocation paths that were calling finalization code before. [0] https://dart-review.googlesource.com/c/sdk/+/241202 Fixes #48869 TEST=Fixes test failures. Change-Id: I5ff0491d4980630cbdbf799f15aa45089ee4d15f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242101 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 89e485c commit 0b5a8fa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

runtime/vm/object_reload.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,15 @@ void Class::CheckReload(const Class& replacement,
656656
TypeParametersChanged(context->zone(), *this, replacement));
657657
return;
658658
}
659+
}
660+
661+
if (is_finalized() || is_allocate_finalized()) {
662+
auto thread = Thread::Current();
659663

660664
// Ensure the replacement class is also finalized.
661-
const Error& error =
662-
Error::Handle(replacement.EnsureIsFinalized(Thread::Current()));
665+
const Error& error = Error::Handle(
666+
is_allocate_finalized() ? replacement.EnsureIsAllocateFinalized(thread)
667+
: replacement.EnsureIsFinalized(thread));
663668
if (!error.IsNull()) {
664669
context->group_reload_context()->AddReasonForCancelling(
665670
new (context->zone())

0 commit comments

Comments
 (0)