From 94d58fe6c99f83037e3b1587bf90c84c154f045a Mon Sep 17 00:00:00 2001 From: Mythri Alle Date: Mon, 15 May 2023 13:13:40 +0000 Subject: 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 Change-Id: Ia47f146834e0ae1aec2c5694d3d7a468be51435f --- compiler/optimizing/optimizing_compiler.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing') 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> roots; -- cgit v1.2.3-59-g8ed1b