diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-10-15 18:19:01 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-10-15 19:56:47 -0700 |
commit | ddb2a98fc557753a8080f23bea79bec3b89fee2c (patch) | |
tree | f621c2d16be4dc981d2e661888f741e288625d7c /compiler | |
parent | f015c2f4835a9985a8b31cfc810129b69865a6c4 (diff) | |
download | art-ddb2a98fc557753a8080f23bea79bec3b89fee2c.zip art-ddb2a98fc557753a8080f23bea79bec3b89fee2c.tar.gz art-ddb2a98fc557753a8080f23bea79bec3b89fee2c.tar.bz2 |
Parse runtime compiler options for JIT
For the case where the CppDefines do not match the device the JIT is
running on.
Sample logcat output to prove it works:
JIT instruction set variant krait
JIT instruction set features default
Bug: 24982714
(cherry picked from commit 085fc87e7ea42989a4a00cacb0c9c3a6d2590af6)
Change-Id: I1f4991a5d7cdc6101d1b0ecbcb39fb26dd20180a
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/jit/jit_compiler.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index 5ef744c..13825a7 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -19,6 +19,7 @@ #include "art_method-inl.h" #include "arch/instruction_set.h" #include "arch/instruction_set_features.h" +#include "base/stringpiece.h" #include "base/time_utils.h" #include "base/timing_logger.h" #include "compiler_callbacks.h" @@ -86,7 +87,37 @@ JitCompiler::JitCompiler() : total_time_(0) { nullptr, false)); const InstructionSet instruction_set = kRuntimeISA; - instruction_set_features_.reset(InstructionSetFeatures::FromCppDefines()); + for (const StringPiece option : Runtime::Current()->GetCompilerOptions()) { + VLOG(compiler) << "JIT compiler option " << option; + std::string error_msg; + if (option.starts_with("--instruction-set-variant=")) { + StringPiece str = option.substr(strlen("--instruction-set-variant=")).data(); + VLOG(compiler) << "JIT instruction set variant " << str; + instruction_set_features_.reset(InstructionSetFeatures::FromVariant( + instruction_set, str.as_string(), &error_msg)); + if (instruction_set_features_ == nullptr) { + LOG(WARNING) << "Error parsing " << option << " message=" << error_msg; + } + } else if (option.starts_with("--instruction-set-features=")) { + StringPiece str = option.substr(strlen("--instruction-set-features=")).data(); + VLOG(compiler) << "JIT instruction set features " << str; + if (instruction_set_features_.get() == nullptr) { + instruction_set_features_.reset(InstructionSetFeatures::FromVariant( + instruction_set, "default", &error_msg)); + if (instruction_set_features_ == nullptr) { + LOG(WARNING) << "Error parsing " << option << " message=" << error_msg; + } + } + instruction_set_features_.reset( + instruction_set_features_->AddFeaturesFromString(str.as_string(), &error_msg)); + if (instruction_set_features_ == nullptr) { + LOG(WARNING) << "Error parsing " << option << " message=" << error_msg; + } + } + } + if (instruction_set_features_ == nullptr) { + instruction_set_features_.reset(InstructionSetFeatures::FromCppDefines()); + } cumulative_logger_.reset(new CumulativeLogger("jit times")); verification_results_.reset(new VerificationResults(compiler_options_.get())); method_inliner_map_.reset(new DexFileToMethodInlinerMap); |