Fix -Xint and -Xusejit interaction
- don't allow interpret and jit compilation at the same time
- make sure we -Xsaveprofileinfo works with -Xint.
Bug: 27916886
(cherry picked from commit 6caaa84947d5d207cde511978db327d95226e3ce)
Change-Id: Id5e7731653b322c25329b031561cfe150eb66522
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 44e8707..b25a1bb 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -474,6 +474,11 @@
LOG(INFO) << "setting boot class path to " << *args.Get(M::BootClassPath);
}
+ if (args.GetOrDefault(M::UseJitCompilation) && args.GetOrDefault(M::Interpret)) {
+ Usage("-Xusejit:true and -Xint cannot be specified together");
+ Exit(0);
+ }
+
// Set a default boot class path if we didn't get an explicit one via command line.
if (getenv("BOOTCLASSPATH") != nullptr) {
args.SetIfMissing(M::BootClassPath, std::string(getenv("BOOTCLASSPATH")));
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6f2ad5f..17b8a45 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1924,9 +1924,8 @@
void Runtime::CreateJit() {
CHECK(!IsAotCompiler());
- if (GetInstrumentation()->IsForcedInterpretOnly()) {
- // Don't create JIT if forced interpret only.
- return;
+ if (kIsDebugBuild && GetInstrumentation()->IsForcedInterpretOnly()) {
+ DCHECK(!jit_options_->UseJitCompilation());
}
std::string error_msg;
jit_.reset(jit::Jit::Create(jit_options_.get(), &error_msg));