Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: runtime/vm/object_reload.cc

Issue 2070873002: Bug fixes for hot reload (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix an error message Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object_reload.cc
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index ba5098a05b62c66449661e430a21bd44d7834d95..f9c5ad9869e4fffd1c825f305413977bfb0a8bb2 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -444,13 +444,22 @@ bool Class::CanReload(const Class& replacement) const {
const Array& replacement_fields =
Array::Handle(replacement.OffsetToFieldMap());
- // Check that we have the same number of fields.
+ // Check that the size of the instance is the same.
if (fields.Length() != replacement_fields.Length()) {
IRC->ReportError(String::Handle(String::NewFormatted(
"Number of instance fields changed in %s", ToCString())));
return false;
}
+ // Check that we have the same next field offset. This check is not
+ // redundant with the one above because the instance OffsetToFieldMap
+ // array length is based on the instance size (which may be aligned up).
+ if (next_field_offset() != replacement.next_field_offset()) {
+ IRC->ReportError(String::Handle(String::NewFormatted(
+ "Number of instance fields changed in %s", ToCString())));
+ return false;
+ }
+
if (NumTypeArguments() != replacement.NumTypeArguments()) {
IRC->ReportError(String::Handle(String::NewFormatted(
"Number of type arguments changed in %s", ToCString())));
@@ -483,7 +492,8 @@ bool Class::CanReload(const Class& replacement) const {
} else if (is_prefinalized()) {
if (!replacement.is_prefinalized()) {
IRC->ReportError(String::Handle(String::NewFormatted(
- "Original class ('%s') is prefinalized and replacement class ('%s')",
+ "Original class ('%s') is prefinalized and replacement class "
+ "('%s') is not ",
ToCString(), replacement.ToCString())));
return false;
}
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service.cc » ('j') | runtime/vm/service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698