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

Unified Diff: runtime/vm/isolate_reload.cc

Issue 2142913002: Fix uncommon GC related reload crash (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: asiva review Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload.cc
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 7a867d2d8e0b00ebf29c0429e6d56f49d846df0e..71d8387b44f9bea59598051f833a7a461daf5dc0 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -190,17 +190,9 @@ IsolateReloadContext::IsolateReloadContext(Isolate* isolate, bool test_mode)
become_map_storage_(Array::null()),
saved_root_library_(Library::null()),
saved_libraries_(GrowableObjectArray::null()) {
- // Preallocate storage for maps.
- old_classes_set_storage_ =
- HashTables::New<UnorderedHashSet<ClassMapTraits> >(4);
- class_map_storage_ =
- HashTables::New<UnorderedHashMap<ClassMapTraits> >(4);
- old_libraries_set_storage_ =
- HashTables::New<UnorderedHashSet<LibraryMapTraits> >(4);
- library_map_storage_ =
- HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4);
- become_map_storage_ =
- HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4);
+ // NOTE: DO NOT ALLOCATE ANY RAW OBJECTS HERE. The IsolateReloadContext is not
+ // associated with the isolate yet and if a GC is triggered here the raw
+ // objects will not be properly accounted for.
}
@@ -234,12 +226,25 @@ void IsolateReloadContext::ReportSuccess() {
void IsolateReloadContext::StartReload() {
TIMELINE_SCOPE(Reload);
Thread* thread = Thread::Current();
+ ASSERT(isolate() == thread->isolate());
// Grab root library before calling CheckpointBeforeReload.
const Library& root_lib = Library::Handle(object_store()->root_library());
ASSERT(!root_lib.IsNull());
const String& root_lib_url = String::Handle(root_lib.url());
+ // Preallocate storage for maps.
+ old_classes_set_storage_ =
+ HashTables::New<UnorderedHashSet<ClassMapTraits> >(4);
+ class_map_storage_ =
+ HashTables::New<UnorderedHashMap<ClassMapTraits> >(4);
+ old_libraries_set_storage_ =
+ HashTables::New<UnorderedHashSet<LibraryMapTraits> >(4);
+ library_map_storage_ =
+ HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4);
+ become_map_storage_ =
+ HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4);
+
// Disable the background compiler while we are performing the reload.
BackgroundCompiler::Disable();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698