From f221e75a1abbddef0bc319062db9953a44a2ada7 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 29 Sep 2023 13:12:40 +0000 Subject: Reland "Add a small pattern matcher to JIT compilation."" This reverts commit 1017823d56e821f29606e5b08f4bf51078c257a9. Reason for revert: Fix included in aosp/2761728 Change-Id: Ia59648bb27dc8bbb5659b1ee88b71a7647b9b158 --- compiler/jit/jit_compiler.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'compiler/jit/jit_compiler.cc') diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index e67236769e..aafdfcf22e 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -33,6 +33,7 @@ #include "jit/jit.h" #include "jit/jit_code_cache.h" #include "jit/jit_logger.h" +#include "jit/small_pattern_matcher.h" namespace art HIDDEN { namespace jit { @@ -181,6 +182,19 @@ bool JitCompiler::CompileMethod( DCHECK(!method->IsProxyMethod()); DCHECK(method->GetDeclaringClass()->IsResolved()); + // Try to pattern match the method. Only on arm and arm64 for now as we have + // sufficiently similar calling convention between C++ and managed code. + if (kRuntimeISA == InstructionSet::kArm || kRuntimeISA == InstructionSet::kArm64) { + if (!GetCompilerOptions().GetDebuggable() && compilation_kind == CompilationKind::kBaseline) { + const void* pattern = SmallPatternMatcher::TryMatch(method); + if (pattern != nullptr) { + VLOG(jit) << "Successfully pattern matched " << method->PrettyMethod(); + Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(method, pattern); + return true; + } + } + } + TimingLogger logger( "JIT compiler timing logger", true, VLOG_IS_ON(jit), TimingLogger::TimingKind::kThreadCpu); self->AssertNoPendingException(); -- cgit v1.2.3-59-g8ed1b