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

Side by Side Diff: runtime/vm/class_table.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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/class_table.h" 5 #include "vm/class_table.h"
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/freelist.h" 9 #include "vm/freelist.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 NOT_IN_PRODUCT(free(predefined_class_heap_stats_table_)); 76 NOT_IN_PRODUCT(free(predefined_class_heap_stats_table_));
77 NOT_IN_PRODUCT(free(class_heap_stats_table_)); 77 NOT_IN_PRODUCT(free(class_heap_stats_table_));
78 } else { 78 } else {
79 // This instance was a shallow copy. It doesn't own any memory. 79 // This instance was a shallow copy. It doesn't own any memory.
80 NOT_IN_PRODUCT(ASSERT(predefined_class_heap_stats_table_ == NULL)); 80 NOT_IN_PRODUCT(ASSERT(predefined_class_heap_stats_table_ == NULL));
81 NOT_IN_PRODUCT(ASSERT(class_heap_stats_table_ == NULL)); 81 NOT_IN_PRODUCT(ASSERT(class_heap_stats_table_ == NULL));
82 } 82 }
83 } 83 }
84 84
85 85
86 void ClassTable::AddOldTable(RawClass** old_table) {
87 ASSERT(Thread::Current()->IsMutatorThread());
88 old_tables_->Add(old_table);
89 }
90
91
86 void ClassTable::FreeOldTables() { 92 void ClassTable::FreeOldTables() {
87 while (old_tables_->length() > 0) { 93 while (old_tables_->length() > 0) {
88 free(old_tables_->RemoveLast()); 94 free(old_tables_->RemoveLast());
89 } 95 }
90 } 96 }
91 97
92 98
93 #ifndef PRODUCT 99 #ifndef PRODUCT
94 void ClassTable::SetTraceAllocationFor(intptr_t cid, bool trace) { 100 void ClassTable::SetTraceAllocationFor(intptr_t cid, bool trace) {
95 ClassHeapStats* stats = PreliminaryStatsAt(cid); 101 ClassHeapStats* stats = PreliminaryStatsAt(cid);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { 576 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) {
571 ClassHeapStats* stats = PreliminaryStatsAt(cid); 577 ClassHeapStats* stats = PreliminaryStatsAt(cid);
572 ASSERT(stats != NULL); 578 ASSERT(stats != NULL);
573 ASSERT(size >= 0); 579 ASSERT(size >= 0);
574 stats->post_gc.AddNew(size); 580 stats->post_gc.AddNew(size);
575 } 581 }
576 #endif // !PRODUCT 582 #endif // !PRODUCT
577 583
578 584
579 } // namespace dart 585 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_table.h ('k') | runtime/vm/isolate.cc » ('j') | runtime/vm/isolate_reload.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698