Skip to content

Commit

Permalink
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_art
Browse files Browse the repository at this point in the history
…into HEAD
  • Loading branch information
jgcaap committed Dec 7, 2015
2 parents d5b5dcb + 29bd42b commit 482d454
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions compiler/dex/quick/quick_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 9 additions & 0 deletions compiler/dex/quick/quick_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
4 changes: 4 additions & 0 deletions compiler/driver/compiler_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@

namespace art {

#ifndef DISABLE_CAF_BAILOUT
extern thread_local bool check_bail_out;
#endif

static constexpr bool kTimeCompileMethod = !kIsDebugBuild;

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 482d454

Please sign in to comment.