summaryrefslogtreecommitdiff
path: root/compiler/jit/jit_compiler.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-09-29 13:12:40 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-10-02 09:08:01 +0000
commitf221e75a1abbddef0bc319062db9953a44a2ada7 (patch)
tree356130c99dbd02efb0dcd8a78b96d21568b269d8 /compiler/jit/jit_compiler.cc
parentcd3b2b6a8d2b3faff34c649d4023c05021fd280a (diff)
Reland "Add a small pattern matcher to JIT compilation.""
This reverts commit 1017823d56e821f29606e5b08f4bf51078c257a9. Reason for revert: Fix included in aosp/2761728 Change-Id: Ia59648bb27dc8bbb5659b1ee88b71a7647b9b158
Diffstat (limited to 'compiler/jit/jit_compiler.cc')
-rw-r--r--compiler/jit/jit_compiler.cc14
1 files changed, 14 insertions, 0 deletions
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();