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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread Created 3 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/object.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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 } 1250 }
1251 1251
1252 // Rehash constants map for all classes. 1252 // Rehash constants map for all classes.
1253 RehashConstants(); 1253 RehashConstants();
1254 1254
1255 #ifdef DEBUG 1255 #ifdef DEBUG
1256 // Verify that all canonical instances are correctly setup in the 1256 // Verify that all canonical instances are correctly setup in the
1257 // corresponding canonical tables. 1257 // corresponding canonical tables.
1258 Thread* thread = Thread::Current(); 1258 Thread* thread = Thread::Current();
1259 I->heap()->CollectAllGarbage(); 1259 I->heap()->CollectAllGarbage();
1260 HeapIterationScope iteration(thread);
1260 VerifyCanonicalVisitor check_canonical(thread); 1261 VerifyCanonicalVisitor check_canonical(thread);
1261 I->heap()->IterateObjects(&check_canonical); 1262 iteration.IterateObjects(&check_canonical);
1262 #endif // DEBUG 1263 #endif // DEBUG
1263 } 1264 }
1264 1265
1265 void IsolateReloadContext::RehashConstants() { 1266 void IsolateReloadContext::RehashConstants() {
1266 TIMELINE_SCOPE(RehashConstants); 1267 TIMELINE_SCOPE(RehashConstants);
1267 ClassTable* class_table = I->class_table(); 1268 ClassTable* class_table = I->class_table();
1268 Class& cls = Class::Handle(zone_); 1269 Class& cls = Class::Handle(zone_);
1269 const intptr_t top = class_table->NumCids(); 1270 const intptr_t top = class_table->NumCids();
1270 for (intptr_t cid = kInstanceCid; cid < top; cid++) { 1271 for (intptr_t cid = kInstanceCid; cid < top; cid++) {
1271 if (!class_table->IsValidIndex(cid) || !class_table->HasValidClassAt(cid)) { 1272 if (!class_table->IsValidIndex(cid) || !class_table->HasValidClassAt(cid)) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if (FLAG_trace_reload) { 1349 if (FLAG_trace_reload) {
1349 LogBlock blocker; 1350 LogBlock blocker;
1350 TIR_Print("MorphInstance: \n"); 1351 TIR_Print("MorphInstance: \n");
1351 for (intptr_t i = 0; i < instance_morphers_.length(); i++) { 1352 for (intptr_t i = 0; i < instance_morphers_.length(); i++) {
1352 instance_morphers_.At(i)->Dump(); 1353 instance_morphers_.At(i)->Dump();
1353 } 1354 }
1354 } 1355 }
1355 1356
1356 // Find all objects that need to be morphed. 1357 // Find all objects that need to be morphed.
1357 ObjectLocator locator(this); 1358 ObjectLocator locator(this);
1358 isolate()->heap()->VisitObjects(&locator); 1359 {
1360 HeapIterationScope iteration(Thread::Current());
1361 iteration.IterateObjects(&locator);
1362 }
1359 1363
1360 // Return if no objects are located. 1364 // Return if no objects are located.
1361 intptr_t count = locator.count(); 1365 intptr_t count = locator.count();
1362 if (count == 0) return; 1366 if (count == 0) return;
1363 1367
1364 TIR_Print("Found %" Pd " object%s subject to morphing.\n", count, 1368 TIR_Print("Found %" Pd " object%s subject to morphing.\n", count,
1365 (count > 1) ? "s" : ""); 1369 (count > 1) ? "s" : "");
1366 1370
1367 Array& before = Array::Handle(); 1371 Array& before = Array::Handle();
1368 Array& after = Array::Handle(); 1372 Array& after = Array::Handle();
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 IsolateReloadContext* reload_context_; 1613 IsolateReloadContext* reload_context_;
1610 Zone* zone_; 1614 Zone* zone_;
1611 }; 1615 };
1612 1616
1613 void IsolateReloadContext::MarkAllFunctionsForRecompilation() { 1617 void IsolateReloadContext::MarkAllFunctionsForRecompilation() {
1614 TIMELINE_SCOPE(MarkAllFunctionsForRecompilation); 1618 TIMELINE_SCOPE(MarkAllFunctionsForRecompilation);
1615 TIR_Print("---- MARKING ALL FUNCTIONS FOR RECOMPILATION\n"); 1619 TIR_Print("---- MARKING ALL FUNCTIONS FOR RECOMPILATION\n");
1616 Thread* thread = Thread::Current(); 1620 Thread* thread = Thread::Current();
1617 StackZone stack_zone(thread); 1621 StackZone stack_zone(thread);
1618 Zone* zone = stack_zone.GetZone(); 1622 Zone* zone = stack_zone.GetZone();
1619 NoSafepointScope no_safepoint; 1623 HeapIterationScope iteration(thread);
1620 HeapIterationScope heap_iteration_scope;
1621 MarkFunctionsForRecompilation visitor(isolate_, this, zone); 1624 MarkFunctionsForRecompilation visitor(isolate_, this, zone);
1622 isolate_->heap()->VisitObjects(&visitor); 1625 iteration.IterateObjects(&visitor);
1623 } 1626 }
1624 1627
1625 void IsolateReloadContext::InvalidateWorld() { 1628 void IsolateReloadContext::InvalidateWorld() {
1626 TIR_Print("---- INVALIDATING WORLD\n"); 1629 TIR_Print("---- INVALIDATING WORLD\n");
1627 ResetMegamorphicCaches(); 1630 ResetMegamorphicCaches();
1628 DeoptimizeFunctionsOnStack(); 1631 DeoptimizeFunctionsOnStack();
1629 ResetUnoptimizedICsOnStack(); 1632 ResetUnoptimizedICsOnStack();
1630 MarkAllFunctionsForRecompilation(); 1633 MarkAllFunctionsForRecompilation();
1631 } 1634 }
1632 1635
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 ASSERT(!super_cls.IsNull()); 1825 ASSERT(!super_cls.IsNull());
1823 super_cls.AddDirectSubclass(cls); 1826 super_cls.AddDirectSubclass(cls);
1824 } 1827 }
1825 } 1828 }
1826 } 1829 }
1827 } 1830 }
1828 1831
1829 #endif // !PRODUCT 1832 #endif // !PRODUCT
1830 1833
1831 } // namespace dart 1834 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698