diff options
author | 2014-04-16 09:48:48 -0700 | |
---|---|---|
committer | 2014-04-17 19:01:34 -0700 | |
commit | bbd695c71e0bf518f582e84524e1cdeb3de3896c (patch) | |
tree | 6fe6a128b629abc6a396a192b2e8da1180afeded /runtime/gc/accounting/heap_bitmap.h | |
parent | a092ee404ababbf8fc945111dc4a571284c9f02f (diff) |
Replace ObjectSet with LargeObjectBitmap.
Speeds up large object marking since large objects no longer required
a lock. Changed the GCs to use the heap bitmap for marking objects
which aren't in the fast path. This eliminates the need for a
MarkLargeObject function.
Maps before (10 GC iterations):
Mean partial time: 180ms
Mean sticky time: 151ms
Maps after:
Mean partial time: 161ms
Mean sticky time: 101ms
Note: the GC durations are long due to recent ergonomic changes and
because the fast bulk free hasn't yet been enabled. Over 50% of the
GC time is spent in RosAllocSpace::FreeList.
Bug: 13571028
Change-Id: Id8f94718aeaa13052672ccbae1e8edf77d653f62
Diffstat (limited to 'runtime/gc/accounting/heap_bitmap.h')
-rw-r--r-- | runtime/gc/accounting/heap_bitmap.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/gc/accounting/heap_bitmap.h b/runtime/gc/accounting/heap_bitmap.h index 61a24298d7..814dc0632b 100644 --- a/runtime/gc/accounting/heap_bitmap.h +++ b/runtime/gc/accounting/heap_bitmap.h @@ -33,9 +33,13 @@ class HeapBitmap { public: bool Test(const mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); void Clear(const mirror::Object* obj) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); - void Set(const mirror::Object* obj) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); + template<typename LargeObjectSetVisitor> + bool Set(const mirror::Object* obj, const LargeObjectSetVisitor& visitor) + EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) ALWAYS_INLINE; + template<typename LargeObjectSetVisitor> + bool AtomicTestAndSet(const mirror::Object* obj, const LargeObjectSetVisitor& visitor) + EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) ALWAYS_INLINE; ContinuousSpaceBitmap* GetContinuousSpaceBitmap(const mirror::Object* obj) const; - ObjectSet* GetDiscontinuousSpaceObjectSet(const mirror::Object* obj) const; void Walk(ObjectCallback* callback, void* arg) SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); @@ -50,7 +54,7 @@ class HeapBitmap { EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); // Find and replace a object set pointer, this is used by for the bitmap swapping in the GC. - void ReplaceObjectSet(ObjectSet* old_set, ObjectSet* new_set) + void ReplaceLargeObjectBitmap(LargeObjectBitmap* old_bitmap, LargeObjectBitmap* new_bitmap) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); explicit HeapBitmap(Heap* heap) : heap_(heap) {} @@ -60,15 +64,15 @@ class HeapBitmap { void AddContinuousSpaceBitmap(ContinuousSpaceBitmap* bitmap); void RemoveContinuousSpaceBitmap(ContinuousSpaceBitmap* bitmap); - void AddDiscontinuousObjectSet(ObjectSet* set); - void RemoveDiscontinuousObjectSet(ObjectSet* set); + void AddLargeObjectBitmap(LargeObjectBitmap* bitmap); + void RemoveLargeObjectBitmap(LargeObjectBitmap* bitmap); // Bitmaps covering continuous spaces. std::vector<ContinuousSpaceBitmap*, GcAllocator<ContinuousSpaceBitmap*>> continuous_space_bitmaps_; // Sets covering discontinuous spaces. - std::vector<ObjectSet*, GcAllocator<ObjectSet*>> discontinuous_space_sets_; + std::vector<LargeObjectBitmap*, GcAllocator<LargeObjectBitmap*>> large_object_bitmaps_; friend class art::gc::Heap; }; |