diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-06-10 11:22:31 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-06-19 12:57:05 -0700 |
commit | 52e4b43d62896b56f8c2bd041e528472bb4a0d8d (patch) | |
tree | 3a9367c391418c1375a6c86f678b3f047cacc03f /runtime/gc/heap.h | |
parent | ef38670cae8462d579da983c1863f96717cccee6 (diff) | |
download | art-52e4b43d62896b56f8c2bd041e528472bb4a0d8d.zip art-52e4b43d62896b56f8c2bd041e528472bb4a0d8d.tar.gz art-52e4b43d62896b56f8c2bd041e528472bb4a0d8d.tar.bz2 |
Add mark compact collector.
The mark compact collector is a 4 phase collection, doing a normal
full mark_sweep, calculating forwarding addresses of objects in the
from space, updating references of objects in the from space, and
moving the objects in the from space.
Support is diabled by default since it needs to have non movable
classes and field arrays. Performance numbers is around 50% as fast.
The main advantage that this has over semispace is that the worst
case memory usage is 50% since we only need one space isntead of two.
TODO: Make field arrays and classes movable. This causes complication
since Object::VisitReferences relies on these, so if we update the
fields of an object but another future object uses this object to
figure out what fields are reference fields it doesn't work.
Bug: 14059466
Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
Diffstat (limited to 'runtime/gc/heap.h')
-rw-r--r-- | runtime/gc/heap.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index 9b49373..368a20c 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -66,6 +66,7 @@ namespace accounting { namespace collector { class ConcurrentCopying; class GarbageCollector; + class MarkCompact; class MarkSweep; class SemiSpace; } // namespace collector @@ -573,7 +574,7 @@ class Heap { } static bool IsMovingGc(CollectorType collector_type) { return collector_type == kCollectorTypeSS || collector_type == kCollectorTypeGSS || - collector_type == kCollectorTypeCC; + collector_type == kCollectorTypeCC || collector_type == kCollectorTypeMC; } bool ShouldAllocLargeObject(mirror::Class* c, size_t byte_count) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -952,12 +953,14 @@ class Heap { std::vector<collector::GarbageCollector*> garbage_collectors_; collector::SemiSpace* semi_space_collector_; + collector::MarkCompact* mark_compact_collector_; collector::ConcurrentCopying* concurrent_copying_collector_; const bool running_on_valgrind_; const bool use_tlab_; friend class collector::GarbageCollector; + friend class collector::MarkCompact; friend class collector::MarkSweep; friend class collector::SemiSpace; friend class ReferenceQueue; |