GSS: Fix the bump pointer space only collection.
Fixes b/13912464 where the clear soft reference behavior accidentally
disabled the bump pointer space only collection.
Changed the collector name so that the GC logs would indicate the
generational mode and the collection mode.
Peformance enhancement: instead of triggering the whole heap
collection every 5 collections, count the bytes promoted since the
last whole heap collection and use it to decide when to trigger the
whole heap collection. This improves MemAllocTest by 5-10% (N4 and
host).
Bug: 13912464
Bug: 11650816
Bug: 9986565
Change-Id: I653a0dca62a8b54adf69abe2940a41eac70f809b
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 915e54f..daf0fb3 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -326,7 +326,8 @@
if (kMovingCollector) {
// TODO: Clean this up.
bool generational = post_zygote_collector_type_ == kCollectorTypeGSS;
- semi_space_collector_ = new collector::SemiSpace(this, generational);
+ semi_space_collector_ = new collector::SemiSpace(this, generational,
+ generational ? "generational" : "");
garbage_collectors_.push_back(semi_space_collector_);
concurrent_copying_collector_ = new collector::ConcurrentCopying(this);
@@ -1859,9 +1860,6 @@
<< "Could not find garbage collector with collector_type="
<< static_cast<size_t>(collector_type_) << " and gc_type=" << gc_type;
ATRACE_BEGIN(StringPrintf("%s %s GC", PrettyCause(gc_cause), collector->GetName()).c_str());
- if (!clear_soft_references) {
- clear_soft_references = gc_type != collector::kGcTypeSticky; // TODO: GSS?
- }
collector->Run(gc_cause, clear_soft_references || runtime->IsZygote());
total_objects_freed_ever_ += collector->GetFreedObjects();
total_bytes_freed_ever_ += collector->GetFreedBytes();