summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_options.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-01-20 13:33:13 -0800
committer Andreas Gampe <agampe@google.com> 2016-01-27 15:39:30 -0800
commitace0dc1dd5480ad458e622085e51583653853fb9 (patch)
treede095794b5c92933ad667bff353045458bb1c633 /compiler/driver/compiler_options.h
parent8feb2cc26420f31e1805e57acddbb4ae303a2994 (diff)
ART: Add option to ensure deterministic compilation
To ensure reliable stable generation of a boot image, add a flag for forced determinism, trading compile time for a deterministic output. We have to run certain passes in the compiler-driver single-threaded. It is also necessary to try to make the heap layout deterministic. Switch to nonconcurrent GC, use the free-list implementation for LOS, and try to allocate the main space at a known location. This is best effort at the moment. To allow the compiler phase to be parallelized, const-strings need to be created beforehand. The identity hashcode seed needs to be pinned. Besides the Dex object we also need to null the DexFile pointer in dex caches. For classes, we need to remove the clinit thread ID. Fix oatdump alignment padding accounting. Bug: 26687569 Change-Id: Ia82120e8f715bb3691d861817b12778ac677355a
Diffstat (limited to 'compiler/driver/compiler_options.h')
-rw-r--r--compiler/driver/compiler_options.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index d47fc2ad4b..1a9bf4bb0b 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -85,7 +85,8 @@ class CompilerOptions FINAL {
std::ostream* init_failure_output,
bool abort_on_hard_verifier_failure,
const std::string& dump_cfg_file_name,
- bool dump_cfg_append);
+ bool dump_cfg_append,
+ bool force_determinism);
CompilerFilter GetCompilerFilter() const {
return compiler_filter_;
@@ -234,6 +235,10 @@ class CompilerOptions FINAL {
return dump_cfg_append_;
}
+ bool IsForceDeterminism() const {
+ return force_determinism_;
+ }
+
private:
void ParseDumpInitFailures(const StringPiece& option, UsageFn Usage);
void ParsePassOptions(const StringPiece& option, UsageFn Usage);
@@ -286,6 +291,10 @@ class CompilerOptions FINAL {
std::string dump_cfg_file_name_;
bool dump_cfg_append_;
+ // Whether the compiler should trade performance for determinism to guarantee exactly reproducable
+ // outcomes.
+ bool force_determinism_;
+
friend class Dex2Oat;
DISALLOW_COPY_AND_ASSIGN(CompilerOptions);