summaryrefslogtreecommitdiffstats
path: root/dex2oat/dex2oat.cc
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2016-02-02 21:55:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-02-02 21:55:04 +0000
commit390f5b377af63bc22f0925cc0da9f67ae1eecec2 (patch)
treea8d558509cd6c2732f8388fcd55b8b92ce13dc37 /dex2oat/dex2oat.cc
parent24c11dcde9e8ed53813129b40f82a1af42b880b9 (diff)
parent6af5348449ccb86203d93dfbd0e5df318917721f (diff)
downloadandroid_art-390f5b377af63bc22f0925cc0da9f67ae1eecec2.tar.gz
android_art-390f5b377af63bc22f0925cc0da9f67ae1eecec2.tar.bz2
android_art-390f5b377af63bc22f0925cc0da9f67ae1eecec2.zip
Merge "Use SS/GSS collectors in dex2oat if they are the default."
Diffstat (limited to 'dex2oat/dex2oat.cc')
-rw-r--r--dex2oat/dex2oat.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 8e80961e43..b3e3ba68a0 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -928,16 +928,25 @@ class Dex2Oat FINAL {
// 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, except when read barriers are enabled, as the former
- // switches the GC to a non-concurrent one by passing the
- // option `-Xgc:nonconcurrent` (see below).
- if (!kIsTargetBuild && IsBootImage() && !kEmitCompilerReadBarrier) {
- force_determinism_ = true;
+ // Automatically force determinism for the boot image in a host build if the default GC is CMS
+ // or MS and read barriers are not enabled, as the former switches the GC to a non-concurrent
+ // one by passing the option `-Xgc:nonconcurrent` (see below).
+ if (!kIsTargetBuild && IsBootImage()) {
+ if (SupportsDeterministicCompilation()) {
+ force_determinism_ = true;
+ } else {
+ LOG(WARNING) << "Deterministic compilation is disabled.";
+ }
}
compiler_options_->force_determinism_ = force_determinism_;
}
+ static bool SupportsDeterministicCompilation() {
+ return (gc::kCollectorTypeDefault == gc::kCollectorTypeCMS ||
+ gc::kCollectorTypeDefault == gc::kCollectorTypeMS) &&
+ !kEmitCompilerReadBarrier;
+ }
+
void ExpandOatAndImageFilenames() {
std::string base_oat = oat_filenames_[0];
size_t last_oat_slash = base_oat.rfind('/');
@@ -1183,8 +1192,8 @@ class Dex2Oat FINAL {
} else if (option.starts_with("--no-inline-from=")) {
no_inline_from_string_ = option.substr(strlen("--no-inline-from=")).data();
} else if (option == "--force-determinism") {
- if (kEmitCompilerReadBarrier) {
- Usage("Cannot use --force-determinism with read barriers");
+ if (!SupportsDeterministicCompilation()) {
+ Usage("Cannot use --force-determinism with read barriers or non-CMS garbage collector");
}
force_determinism_ = true;
} else if (!compiler_options_->ParseCompilerOption(option, Usage)) {