Remove GC type restrictions on --force-determinism.
These restrictions are obsolete after
https://android-review.googlesource.com/983105 .
Test: ART_USE_READ_BARRIER=false ART_DEFAULT_GC_TYPE=SS \
m test-art-host-gtest-dex2oat_test
Test: ART_USE_READ_BARRIER=false ART_DEFAULT_GC_TYPE=SS \
m test-art-host-gtest
Change-Id: Ia2ccee857b6e2db6512649b418a53b60efc6741c
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index ec5faad..9581947 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -937,16 +937,9 @@
// Fill some values into the key-value store for the oat header.
key_value_store_.reset(new SafeMap<std::string, std::string>());
- // Automatically force determinism for the boot image in a host build if read barriers
- // are enabled, or if the default GC is CMS or MS. When the default GC is CMS
- // (Concurrent Mark-Sweep), the GC is switched to a non-concurrent one by passing the
- // option `-Xgc:nonconcurrent` (see below).
+ // Automatically force determinism for the boot image in a host build.
if (!kIsTargetBuild && IsBootImage()) {
- if (SupportsDeterministicCompilation()) {
- force_determinism_ = true;
- } else {
- LOG(WARNING) << "Deterministic compilation is disabled.";
- }
+ force_determinism_ = true;
}
compiler_options_->force_determinism_ = force_determinism_;
@@ -964,12 +957,6 @@
CompilerOptions::IsCoreImageFilename(boot_image_filename_);
}
- static bool SupportsDeterministicCompilation() {
- return (kUseReadBarrier ||
- gc::kCollectorTypeDefault == gc::kCollectorTypeCMS ||
- gc::kCollectorTypeDefault == gc::kCollectorTypeMS);
- }
-
void ExpandOatAndImageFilenames() {
if (image_filenames_[0].rfind('/') == std::string::npos) {
Usage("Unusable boot image filename %s", image_filenames_[0].c_str());
@@ -1151,9 +1138,6 @@
AssignIfExists(args, M::CopyDexFiles, ©_dex_files_);
if (args.Exists(M::ForceDeterminism)) {
- if (!SupportsDeterministicCompilation()) {
- Usage("Option --force-determinism requires read barriers or a CMS/MS garbage collector");
- }
force_determinism_ = true;
}
@@ -2437,26 +2421,6 @@
raw_options.push_back(std::make_pair("-XX:DisableHSpaceCompactForOOM", nullptr));
if (compiler_options_->IsForceDeterminism()) {
- // If we're asked to be deterministic, ensure non-concurrent GC for determinism.
- //
- // Note that with read barriers, this option is ignored, because Runtime::Init
- // overrides the foreground GC to be gc::kCollectorTypeCC when instantiating
- // gc::Heap. This is fine, as concurrent GC requests are not honored in dex2oat,
- // which uses an unstarted runtime.
- raw_options.push_back(std::make_pair("-Xgc:nonconcurrent", nullptr));
-
- // The default LOS implementation (map) is not deterministic. So disable it.
- raw_options.push_back(std::make_pair("-XX:LargeObjectSpace=disabled", nullptr));
-
- // We also need to turn off the nonmoving space. For that, we need to disable HSpace
- // compaction (done above) and ensure that neither foreground nor background collectors
- // are concurrent.
- //
- // Likewise, this option is ignored with read barriers because Runtime::Init
- // overrides the background GC to be gc::kCollectorTypeCCBackground, but that's
- // fine too, for the same reason (see above).
- raw_options.push_back(std::make_pair("-XX:BackgroundGC=nonconcurrent", nullptr));
-
// To make identity hashcode deterministic, set a known seed.
mirror::Object::SetHashCodeSeed(987654321U);
}
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index 0792a85..8c03307 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -1262,12 +1262,6 @@
class Dex2oatDeterminism : public Dex2oatTest {};
TEST_F(Dex2oatDeterminism, UnloadCompile) {
- if (!kUseReadBarrier &&
- gc::kCollectorTypeDefault != gc::kCollectorTypeCMS &&
- gc::kCollectorTypeDefault != gc::kCollectorTypeMS) {
- LOG(INFO) << "Test requires determinism support.";
- return;
- }
Runtime* const runtime = Runtime::Current();
std::string out_dir = GetScratchDir();
const std::string base_oat_name = out_dir + "/base.oat";