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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "vm/isolate_reload.h" 7 #include "vm/isolate_reload.h"
8 #include "vm/log.h" 8 #include "vm/log.h"
9 #include "vm/resolver.h" 9 #include "vm/resolver.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 ASSERT(is_finalized() == replacement.is_finalized()); 437 ASSERT(is_finalized() == replacement.is_finalized());
438 438
439 if (is_finalized()) { 439 if (is_finalized()) {
440 // Get the field maps for both classes. These field maps walk the class 440 // Get the field maps for both classes. These field maps walk the class
441 // hierarchy. 441 // hierarchy.
442 const Array& fields = 442 const Array& fields =
443 Array::Handle(OffsetToFieldMap()); 443 Array::Handle(OffsetToFieldMap());
444 const Array& replacement_fields = 444 const Array& replacement_fields =
445 Array::Handle(replacement.OffsetToFieldMap()); 445 Array::Handle(replacement.OffsetToFieldMap());
446 446
447 // Check that we have the same number of fields. 447 // Check that the size of the instance is the same.
448 if (fields.Length() != replacement_fields.Length()) { 448 if (fields.Length() != replacement_fields.Length()) {
449 IRC->ReportError(String::Handle(String::NewFormatted( 449 IRC->ReportError(String::Handle(String::NewFormatted(
450 "Number of instance fields changed in %s", ToCString()))); 450 "Number of instance fields changed in %s", ToCString())));
451 return false; 451 return false;
452 } 452 }
453 453
454 // Check that we have the same next field offset. This check is not
455 // redundant with the one above because the instance OffsetToFieldMap
456 // array length is based on the instance size (which may be aligned up).
457 if (next_field_offset() != replacement.next_field_offset()) {
458 IRC->ReportError(String::Handle(String::NewFormatted(
459 "Number of instance fields changed in %s", ToCString())));
460 return false;
461 }
462
454 if (NumTypeArguments() != replacement.NumTypeArguments()) { 463 if (NumTypeArguments() != replacement.NumTypeArguments()) {
455 IRC->ReportError(String::Handle(String::NewFormatted( 464 IRC->ReportError(String::Handle(String::NewFormatted(
456 "Number of type arguments changed in %s", ToCString()))); 465 "Number of type arguments changed in %s", ToCString())));
457 return false; 466 return false;
458 } 467 }
459 468
460 // Verify that field names / offsets match across the entire hierarchy. 469 // Verify that field names / offsets match across the entire hierarchy.
461 Field& field = Field::Handle(); 470 Field& field = Field::Handle();
462 String& field_name = String::Handle(); 471 String& field_name = String::Handle();
463 Field& replacement_field = Field::Handle(); 472 Field& replacement_field = Field::Handle();
(...skipping 12 matching lines...) Expand all
476 "Name of instance field changed ('%s' vs '%s') in '%s'", 485 "Name of instance field changed ('%s' vs '%s') in '%s'",
477 field_name.ToCString(), 486 field_name.ToCString(),
478 replacement_field_name.ToCString(), 487 replacement_field_name.ToCString(),
479 ToCString()))); 488 ToCString())));
480 return false; 489 return false;
481 } 490 }
482 } 491 }
483 } else if (is_prefinalized()) { 492 } else if (is_prefinalized()) {
484 if (!replacement.is_prefinalized()) { 493 if (!replacement.is_prefinalized()) {
485 IRC->ReportError(String::Handle(String::NewFormatted( 494 IRC->ReportError(String::Handle(String::NewFormatted(
486 "Original class ('%s') is prefinalized and replacement class ('%s')", 495 "Original class ('%s') is prefinalized and replacement class "
496 "('%s') is not ",
487 ToCString(), replacement.ToCString()))); 497 ToCString(), replacement.ToCString())));
488 return false; 498 return false;
489 } 499 }
490 if (instance_size() != replacement.instance_size()) { 500 if (instance_size() != replacement.instance_size()) {
491 IRC->ReportError(String::Handle(String::NewFormatted( 501 IRC->ReportError(String::Handle(String::NewFormatted(
492 "Instance size mismatch between '%s' (%" Pd ") and replacement " 502 "Instance size mismatch between '%s' (%" Pd ") and replacement "
493 "'%s' ( %" Pd ")", 503 "'%s' ( %" Pd ")",
494 ToCString(), 504 ToCString(),
495 instance_size(), 505 instance_size(),
496 replacement.ToCString(), 506 replacement.ToCString(),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 560 }
551 ClearAndSetStaticTarget(new_target); 561 ClearAndSetStaticTarget(new_target);
552 } else { 562 } else {
553 ClearWithSentinel(); 563 ClearWithSentinel();
554 } 564 }
555 } 565 }
556 566
557 #endif // !PRODUCT 567 #endif // !PRODUCT
558 568
559 } // namespace dart. 569 } // namespace dart.
OLDNEW
« 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