diff options
| -rw-r--r-- | compiler/dex/dex_to_dex_compiler.cc | 12 | ||||
| -rw-r--r-- | compiler/dex/dex_to_dex_compiler.h | 3 | ||||
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 9 |
3 files changed, 8 insertions, 16 deletions
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc index 808e28c9ea..538fe93793 100644 --- a/compiler/dex/dex_to_dex_compiler.cc +++ b/compiler/dex/dex_to_dex_compiler.cc @@ -70,10 +70,6 @@ class DexCompiler { return *unit_.GetDexFile(); } - bool PerformOptimizations() const { - return dex_to_dex_compilation_level_ >= DexToDexCompilationLevel::kOptimize; - } - // Compiles a RETURN-VOID into a RETURN-VOID-BARRIER within a constructor where // a barrier is required. void CompileReturnVoid(Instruction* inst, uint32_t dex_pc); @@ -114,7 +110,7 @@ class DexCompiler { }; void DexCompiler::Compile() { - DCHECK_GE(dex_to_dex_compilation_level_, DexToDexCompilationLevel::kRequired); + DCHECK_EQ(dex_to_dex_compilation_level_, DexToDexCompilationLevel::kOptimize); const DexFile::CodeItem* code_item = unit_.GetCodeItem(); const uint16_t* insns = code_item->insns_; const uint32_t insns_size = code_item->insns_size_in_code_units_; @@ -221,7 +217,7 @@ void DexCompiler::CompileReturnVoid(Instruction* inst, uint32_t dex_pc) { } Instruction* DexCompiler::CompileCheckCast(Instruction* inst, uint32_t dex_pc) { - if (!kEnableCheckCastEllision || !PerformOptimizations()) { + if (!kEnableCheckCastEllision) { return inst; } if (!driver_.IsSafeCast(&unit_, dex_pc)) { @@ -254,7 +250,7 @@ void DexCompiler::CompileInstanceFieldAccess(Instruction* inst, uint32_t dex_pc, Instruction::Code new_opcode, bool is_put) { - if (!kEnableQuickening || !PerformOptimizations()) { + if (!kEnableQuickening) { return; } uint32_t field_idx = inst->VRegC_22c(); @@ -279,7 +275,7 @@ void DexCompiler::CompileInstanceFieldAccess(Instruction* inst, void DexCompiler::CompileInvokeVirtual(Instruction* inst, uint32_t dex_pc, Instruction::Code new_opcode, bool is_range) { - if (!kEnableQuickening || !PerformOptimizations()) { + if (!kEnableQuickening) { return; } uint32_t method_idx = is_range ? inst->VRegB_3rc() : inst->VRegB_35c(); diff --git a/compiler/dex/dex_to_dex_compiler.h b/compiler/dex/dex_to_dex_compiler.h index 00c596d60e..87ddb395ad 100644 --- a/compiler/dex/dex_to_dex_compiler.h +++ b/compiler/dex/dex_to_dex_compiler.h @@ -34,8 +34,7 @@ namespace optimizer { enum class DexToDexCompilationLevel { kDontDexToDexCompile, // Only meaning wrt image time interpretation. - kRequired, // Dex-to-dex compilation required for correctness. - kOptimize // Perform required transformation and peep-hole optimizations. + kOptimize // Perform peep-hole optimizations. }; std::ostream& operator<<(std::ostream& os, const DexToDexCompilationLevel& rhs); diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 995098799c..e823f67d3c 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -532,16 +532,13 @@ static optimizer::DexToDexCompilationLevel GetDexToDexCompilationLevel( if (driver.GetCompilerOptions().GetDebuggable()) { // We are debuggable so definitions of classes might be changed. We don't want to do any // optimizations that could break that. - max_level = optimizer::DexToDexCompilationLevel::kRequired; + max_level = optimizer::DexToDexCompilationLevel::kDontDexToDexCompile; } if (klass->IsVerified()) { // Class is verified so we can enable DEX-to-DEX compilation for performance. return max_level; - } else if (klass->ShouldVerifyAtRuntime()) { - // Class verification has soft-failed. Anyway, ensure at least correctness. - return optimizer::DexToDexCompilationLevel::kRequired; } else { - // Class verification has failed: do not run DEX-to-DEX compilation. + // Class verification has failed: do not run DEX-to-DEX optimizations. return optimizer::DexToDexCompilationLevel::kDontDexToDexCompile; } } @@ -611,7 +608,7 @@ static void CompileMethod(Thread* self, dex_file, (verified_method != nullptr) ? dex_to_dex_compilation_level - : optimizer::DexToDexCompilationLevel::kRequired); + : optimizer::DexToDexCompilationLevel::kDontDexToDexCompile); } } else if ((access_flags & kAccNative) != 0) { // Are we extracting only and have support for generic JNI down calls? |