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

Unified Diff: runtime/vm/class_table.h

Issue 816773005: Copy-on-write class table for concurrent reading. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | runtime/vm/class_table.cc » ('j') | runtime/vm/class_table.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_table.h
===================================================================
--- runtime/vm/class_table.h (revision 42760)
+++ runtime/vm/class_table.h (working copy)
@@ -15,6 +15,7 @@
class JSONArray;
class JSONObject;
class JSONStream;
+template<typename T> class MallocGrowableArray;
class ObjectPointerVisitor;
class RawClass;
@@ -121,11 +122,12 @@
class ClassTable {
public:
ClassTable();
- // Create a copy of the original class table only, without copying any of the
- // stats data.
+ // Creates a shallow copy of the original class table for some read-only
+ // access, without support for stats data.
explicit ClassTable(ClassTable* original);
~ClassTable();
+ // Thread-safe.
RawClass* At(intptr_t index) const {
ASSERT(IsValidIndex(index));
return table_[index];
@@ -189,6 +191,9 @@
void AllocationProfilePrintJSON(JSONStream* stream);
void ResetAllocationAccumulators();
+ // Deallocates table copies. Do not call during concurrent access to table.
+ void FreeOldTables();
+
private:
friend class MarkingVisitor;
friend class ScavengerVisitor;
@@ -201,7 +206,10 @@
intptr_t top_;
intptr_t capacity_;
+ // Copy-on-write is used for table_, with old copies stored in old_tables_.
RawClass** table_;
+ MallocGrowableArray<RawClass**>* old_tables_;
+
ClassHeapStats* class_heap_stats_table_;
ClassHeapStats* predefined_class_heap_stats_table_;
« no previous file with comments | « no previous file | runtime/vm/class_table.cc » ('j') | runtime/vm/class_table.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698