From 6fb0acc14459a856c35b642e3368aff853259260 Mon Sep 17 00:00:00 2001 From: Mythri Alle Date: Mon, 27 Jun 2022 11:09:49 +0000 Subject: Reland "Don't use instrumentation stubs for native methods in debuggable" This reverts commit 5c9b55aa95295a287abd86f1e7fbe98c3f35ffd6. Reason for revert: Relanding with fixes for failure Fixes: 1. Arm64 needs to use 64-bit registers 2. We cannot deoptimize directly from GenericJniEndTrampoline since we only have a refs and args frame. So call the method exit hooks from art_quick_generic_jni_trampoline. Change-Id: If1f08eca69626f60f42f10205b482a3764610846 --- compiler/optimizing/optimizing_compiler.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing/optimizing_compiler.cc') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 6eb3d01e42..a499c55757 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -1233,6 +1233,14 @@ bool OptimizingCompiler::JitCompile(Thread* self, ArenaAllocator allocator(runtime->GetJitArenaPool()); if (UNLIKELY(method->IsNative())) { + // Use GenericJniTrampoline for critical native methods in debuggable runtimes. We don't + // support calling method entry / exit hooks for critical native methods yet. + // TODO(mythria): Add support for calling method entry / exit hooks in JITed stubs for critical + // native methods too. + if (runtime->IsJavaDebuggable() && method->IsCriticalNative()) { + DCHECK(compiler_options.IsJitCompiler()); + return false; + } JniCompiledMethod jni_compiled_method = ArtQuickJniCompileMethod( compiler_options, access_flags, method_idx, *dex_file, &allocator); std::vector> roots; -- cgit v1.2.3-59-g8ed1b