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

Side by Side Diff: runtime/vm/isolate_reload.cc

Issue 2240283002: Reload: Don't free the saved class table while another thread may be reading it. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 4 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/isolate_reload.h" 5 #include "vm/isolate_reload.h"
6 6
7 #include "vm/become.h" 7 #include "vm/become.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 ASSERT(saved_num_cids_ > 0); 917 ASSERT(saved_num_cids_ > 0);
918 ASSERT(saved_class_table_ != NULL); 918 ASSERT(saved_class_table_ != NULL);
919 ClassTable* class_table = I->class_table(); 919 ClassTable* class_table = I->class_table();
920 class_table->SetNumCids(saved_num_cids_); 920 class_table->SetNumCids(saved_num_cids_);
921 // Overwrite classes in class table with the saved classes. 921 // Overwrite classes in class table with the saved classes.
922 for (intptr_t i = 0; i < saved_num_cids_; i++) { 922 for (intptr_t i = 0; i < saved_num_cids_; i++) {
923 if (class_table->IsValidIndex(i)) { 923 if (class_table->IsValidIndex(i)) {
924 class_table->SetAt(i, saved_class_table_[i]); 924 class_table->SetAt(i, saved_class_table_[i]);
925 } 925 }
926 } 926 }
927 free(saved_class_table_); 927
928 RawClass** local_saved_class_table = saved_class_table_;
928 saved_class_table_ = NULL; 929 saved_class_table_ = NULL;
929 saved_num_cids_ = 0; 930 // Can't free this table immediately as another thread (e.g., the sweeper) may
931 // be suspended between loading the table pointer and loading the table
932 // element. Table will be freed at the next major GC or isolate shutdown.
933 class_table->AddOldTable(local_saved_class_table);
siva 2016/08/12 21:10:45 When does saved_num_cids_ get set to 0?
rmacnak 2016/08/12 21:15:29 Never. We can't set it to zero here because anothe
930 } 934 }
931 935
932 936
933 void IsolateReloadContext::RollbackLibraries() { 937 void IsolateReloadContext::RollbackLibraries() {
934 TIR_Print("---- ROLLING BACK LIBRARY CHANGES\n"); 938 TIR_Print("---- ROLLING BACK LIBRARY CHANGES\n");
935 Thread* thread = Thread::Current(); 939 Thread* thread = Thread::Current();
936 Library& lib = Library::Handle(); 940 Library& lib = Library::Handle();
937 GrowableObjectArray& saved_libs = GrowableObjectArray::Handle( 941 GrowableObjectArray& saved_libs = GrowableObjectArray::Handle(
938 Z, saved_libraries()); 942 Z, saved_libraries());
939 if (!saved_libs.IsNull()) { 943 if (!saved_libs.IsNull()) {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 ASSERT(!super_cls.IsNull()); 1665 ASSERT(!super_cls.IsNull());
1662 super_cls.AddDirectSubclass(cls); 1666 super_cls.AddDirectSubclass(cls);
1663 } 1667 }
1664 } 1668 }
1665 } 1669 }
1666 } 1670 }
1667 1671
1668 #endif // !PRODUCT 1672 #endif // !PRODUCT
1669 1673
1670 } // namespace dart 1674 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698