summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-11-16 22:39:44 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-11-16 22:39:44 +0000
commit96de579b8cb24e87ad0a0ec33b0507c95765a951 (patch)
tree1437a34fd4fb060222802b1b1b825c45c7ddcc6c
parent82d44f1408d0108270f4a305a7fe0123bcc53405 (diff)
parent1b0adbf7b14973c3f110976de046d75a7d4ed934 (diff)
Merge "Ensure CC GC is used for the read barrier config."
-rw-r--r--cmdline/cmdline_types.h10
-rw-r--r--runtime/gc/heap.cc4
-rw-r--r--runtime/runtime.cc6
3 files changed, 9 insertions, 11 deletions
diff --git a/cmdline/cmdline_types.h b/cmdline/cmdline_types.h
index 3f55eefa0e..156ca9ef3e 100644
--- a/cmdline/cmdline_types.h
+++ b/cmdline/cmdline_types.h
@@ -496,11 +496,7 @@ static gc::CollectorType ParseCollectorType(const std::string& option) {
struct XGcOption {
// These defaults are used when the command line arguments for -Xgc:
// are either omitted completely or partially.
- gc::CollectorType collector_type_ = kUseReadBarrier ?
- // If RB is enabled (currently a build-time decision),
- // use CC as the default GC.
- gc::kCollectorTypeCC :
- gc::kCollectorTypeDefault;
+ gc::CollectorType collector_type_ = gc::kCollectorTypeDefault;
bool verify_pre_gc_heap_ = false;
bool verify_pre_sweeping_heap_ = kIsDebugBuild;
bool verify_post_gc_heap_ = false;
@@ -580,10 +576,6 @@ struct BackgroundGcOption {
: background_collector_type_(background_collector_type) {}
BackgroundGcOption()
: background_collector_type_(gc::kCollectorTypeNone) {
-
- if (kUseReadBarrier) {
- background_collector_type_ = gc::kCollectorTypeCCBackground; // Background compaction for CC.
- }
}
operator gc::CollectorType() const { return background_collector_type_; }
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index ddc38526bd..f0e619dd35 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -264,6 +264,10 @@ Heap::Heap(size_t initial_size,
if (VLOG_IS_ON(heap) || VLOG_IS_ON(startup)) {
LOG(INFO) << "Heap() entering";
}
+ if (kUseReadBarrier) {
+ CHECK_EQ(foreground_collector_type_, kCollectorTypeCC);
+ CHECK_EQ(background_collector_type_, kCollectorTypeCCBackground);
+ }
CHECK_GE(large_object_threshold, kMinLargeObjectThreshold);
ScopedTrace trace(__FUNCTION__);
Runtime* const runtime = Runtime::Current();
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6177ef91d7..09a0462121 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1029,8 +1029,10 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
runtime_options.GetOrDefault(Opt::NonMovingSpaceCapacity),
runtime_options.GetOrDefault(Opt::Image),
runtime_options.GetOrDefault(Opt::ImageInstructionSet),
- xgc_option.collector_type_,
- runtime_options.GetOrDefault(Opt::BackgroundGc),
+ // Override the collector type to CC if the read barrier config.
+ kUseReadBarrier ? gc::kCollectorTypeCC : xgc_option.collector_type_,
+ kUseReadBarrier ? BackgroundGcOption(gc::kCollectorTypeCCBackground)
+ : runtime_options.GetOrDefault(Opt::BackgroundGc),
runtime_options.GetOrDefault(Opt::LargeObjectSpace),
runtime_options.GetOrDefault(Opt::LargeObjectThreshold),
runtime_options.GetOrDefault(Opt::ParallelGCThreads),