summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2023-05-15 13:13:40 +0000
committer Mythri Alle <mythria@google.com> 2023-05-17 10:26:54 +0000
commitfc23560817b4d39b7ea67d115c2af78c95c91aec (patch)
treedf88a83cdeef1422b11b1669a0d12d1cf7f36922 /compiler/optimizing/optimizing_compiler.cc
parent57b15d0ac767112d4c67035c0a3b7abffcaba315 (diff)
Always use debuggable from compiler options when JITing
We use two slightly different ways to check if we need to generate debuggable support for JITed code or not. We usually check for debuggable flag from the compiler options but also use Runtime::IsJavaDebuggable in some places. While these two usually match, it is possible to set compiler options independent of the runtime debuggability. So always use debuggable from compiler options when making decisions on JITed code. Bug: 282239094 Test: art/test.py (cherry picked from https://android-review.googlesource.com/q/commit:94d58fe6c99f83037e3b1587bf90c84c154f045a) Merged-In: Ia47f146834e0ae1aec2c5694d3d7a468be51435f Change-Id: Ia47f146834e0ae1aec2c5694d3d7a468be51435f Cherrypick a fix to avoid JITing critical native methods when compiling debuggable
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
-rw-r--r--compiler/optimizing/optimizing_compiler.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index b97dc881eb..00eb6e5c42 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -1255,10 +1255,15 @@ bool OptimizingCompiler::JitCompile(Thread* self,
// 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()) {
+ if (compiler_options.GetDebuggable() && method->IsCriticalNative()) {
DCHECK(compiler_options.IsJitCompiler());
return false;
}
+ // Java debuggable runtimes should set compiler options to debuggable, so that we either
+ // generate method entry / exit hooks or skip JITing. For critical native methods we don't
+ // generate method entry / exit hooks so we shouldn't JIT them in debuggable runtimes.
+ DCHECK_IMPLIES(method->IsCriticalNative(), !runtime->IsJavaDebuggable());
+
JniCompiledMethod jni_compiled_method = ArtQuickJniCompileMethod(
compiler_options, access_flags, method_idx, *dex_file, &allocator);
std::vector<Handle<mirror::Object>> roots;