summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Shields <keepcalm444@gmail.com>2015-12-06 12:26:48 +1100
committerSimon Shields <keepcalm444@gmail.com>2015-12-06 21:40:28 +1100
commit29bd42b5eb0382360e3a8cb646ccf4de4b3b1d5a (patch)
tree55f88c2f7af8e45ac56367dc98032f8ff5a5a6bc
parent7890e2edd305ddacfe76b37337cdbe95bcd588f8 (diff)
downloadart-29bd42b5eb0382360e3a8cb646ccf4de4b3b1d5a.zip
art-29bd42b5eb0382360e3a8cb646ccf4de4b3b1d5a.tar.gz
art-29bd42b5eb0382360e3a8cb646ccf4de4b3b1d5a.tar.bz2
art: allow devices to disable CAF bailout patches
these patches seem to break dex2oat on some non-qcom boards Change-Id: Ib70ca7e12d45ea49cbfa3f6acd04fe4a7f015055
-rw-r--r--compiler/Android.mk5
-rw-r--r--compiler/dex/quick/quick_compiler.cc13
-rw-r--r--compiler/dex/quick/quick_compiler.h9
-rw-r--r--compiler/driver/compiler_driver.cc4
4 files changed, 31 insertions, 0 deletions
diff --git a/compiler/Android.mk b/compiler/Android.mk
index 5dbcd07..1ed0490 100644
--- a/compiler/Android.mk
+++ b/compiler/Android.mk
@@ -243,6 +243,11 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
endif
endif
+ ifneq ($(TARGET_HAVE_QC_PERF),true)
+ # CAF bailout patches break dex2oat on some devices - disable them if unneeded
+ LOCAL_CFLAGS += -DDISABLE_CAF_BAILOUT
+ endif
+
LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
ifeq ($$(art_target_or_host),host)
diff --git a/compiler/dex/quick/quick_compiler.cc b/compiler/dex/quick/quick_compiler.cc
index 4469b51..0e9d268 100644
--- a/compiler/dex/quick/quick_compiler.cc
+++ b/compiler/dex/quick/quick_compiler.cc
@@ -59,8 +59,10 @@ static_assert(5U == static_cast<size_t>(kX86_64), "kX86_64 not 5");
static_assert(6U == static_cast<size_t>(kMips), "kMips not 6");
static_assert(7U == static_cast<size_t>(kMips64), "kMips64 not 7");
+#ifndef DISABLE_CAF_BAILOUT
// check the pass status for early bail out
thread_local bool check_bail_out;
+#endif
// Additional disabled optimizations (over generally disabled) per instruction set.
static constexpr uint32_t kDisabledOptimizationsPerISA[] = {
@@ -732,11 +734,19 @@ CompiledMethod* QuickCompiler::Compile(const DexFile::CodeItem* code_item,
PassDriverMEOpts pass_driver(GetPreOptPassManager(), GetPostOptPassManager(), &cu);
pass_driver.Launch();
+#ifndef DISABLE_CAF_BAILOUT
if (check_bail_out && cu.mir_graph->PassFailed()) {
+#else
+ if (GetCheckBailOutFlag() && cu.mir_graph->PassFailed()) {
+#endif
return nullptr;
}
+#ifndef DISABLE_CAF_BAILOUT
if (check_bail_out) {
+#else
+ if (GetCheckBailOutFlag()) {
+#endif
VLOG(compiler) << "fast compile applied to " << PrettyMethod(method_idx, dex_file);
}
@@ -868,6 +878,9 @@ QuickCompiler::QuickCompiler(CompilerDriver* driver) : Compiler(driver, 100) {
if (pass_manager_options->GetPrintPassOptions()) {
PassDriverMEPostOpt::PrintPassOptions(post_opt_pass_manager_.get());
}
+#ifdef DISABLE_CAF_BAILOUT
+ check_bail_out_ = false;
+#endif
}
QuickCompiler::~QuickCompiler() {
diff --git a/compiler/dex/quick/quick_compiler.h b/compiler/dex/quick/quick_compiler.h
index e545b55..7d66901 100644
--- a/compiler/dex/quick/quick_compiler.h
+++ b/compiler/dex/quick/quick_compiler.h
@@ -73,12 +73,21 @@ class QuickCompiler : public Compiler {
bool CheckMoreConditions(CompilationUnit* cu) const QC_WEAK;
+#ifdef DISABLE_CAF_BAILOUT
+ void SetCheckBailOutFlag() { check_bail_out_ = true; }
+ void ResetCheckBailOutFlag() { check_bail_out_ = false; }
+ bool GetCheckBailOutFlag() const { return check_bail_out_; }
+#endif
+
protected:
explicit QuickCompiler(CompilerDriver* driver);
private:
std::unique_ptr<PassManager> pre_opt_pass_manager_;
std::unique_ptr<PassManager> post_opt_pass_manager_;
+#ifdef DISABLE_CAF_BAILOUT
+ bool check_bail_out_;
+#endif
DISALLOW_COPY_AND_ASSIGN(QuickCompiler);
};
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index cebe44f..f20a2c9 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -74,7 +74,9 @@
namespace art {
+#ifndef DISABLE_CAF_BAILOUT
extern thread_local bool check_bail_out;
+#endif
static constexpr bool kTimeCompileMethod = !kIsDebugBuild;
@@ -2294,7 +2296,9 @@ void CompilerDriver::CompileMethod(Thread* self, const DexFile::CodeItem* code_i
IsMethodToCompile(method_ref);
if (compile) {
// NOTE: if compiler declines to compile this method, it will return null.
+#ifndef DISABLE_CAF_BAILOUT
check_bail_out = false;
+#endif
compiled_method = compiler_->Compile(code_item, access_flags, invoke_type, class_def_idx,
method_idx, class_loader, dex_file);
}