Fix running some run-tests with -Xjitthreshold:0
Do not JIT non-compilable methods. Honor the $noinline$
directive for JIT and fix core image recognition.
Make sure the 597-deopt-invoke-stub that actually relies on
its own -Xjitthreshold: overrides the threshold we pass,
work around already running compiled code in 570-checker-osr
(and drop obsolete "doThrow" pattern replaced by $noinline$)
and add a few necessary $noinline$ directives.
Test: for t in \
461-get-reference-vreg \
536-checker-needs-access-check \
570-checker-osr \
597-deopt-invoke-stub \
655-jit-clinit \
; do \
art/test/run-test --host --jit $t \
--runtime-option -Xjitthreshold:0; \
done
Test: testrunner.py --host --jit
Bug: 62611253
Change-Id: Ia0a05c93e3fc8d913fe8556d3d7f23e7e61076c2
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 4fc7262..8b10a78 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -147,10 +147,11 @@
// that this method is actually inlined;
// - if a method's name contains the substring "$noinline$", do not
// inline that method.
- // We limit this to AOT compilation, as the JIT may or may not inline
+ // We limit the latter to AOT compilation, as the JIT may or may not inline
// depending on the state of classes at runtime.
- const bool honor_inlining_directives =
- IsCompilingWithCoreImage() && Runtime::Current()->IsAotCompiler();
+ const bool honor_noinline_directives = IsCompilingWithCoreImage();
+ const bool honor_inline_directives =
+ honor_noinline_directives && Runtime::Current()->IsAotCompiler();
// Keep a copy of all blocks when starting the visit.
ArenaVector<HBasicBlock*> blocks = graph_->GetReversePostOrder();
@@ -164,18 +165,19 @@
HInvoke* call = instruction->AsInvoke();
// As long as the call is not intrinsified, it is worth trying to inline.
if (call != nullptr && call->GetIntrinsic() == Intrinsics::kNone) {
- if (honor_inlining_directives) {
+ if (honor_noinline_directives) {
// Debugging case: directives in method names control or assert on inlining.
std::string callee_name = outer_compilation_unit_.GetDexFile()->PrettyMethod(
call->GetDexMethodIndex(), /* with_signature */ false);
// Tests prevent inlining by having $noinline$ in their method names.
if (callee_name.find("$noinline$") == std::string::npos) {
- if (!TryInline(call)) {
+ if (!TryInline(call) && honor_inline_directives) {
bool should_have_inlined = (callee_name.find("$inline$") != std::string::npos);
CHECK(!should_have_inlined) << "Could not inline " << callee_name;
}
}
} else {
+ DCHECK(!honor_inline_directives);
// Normal case: try to inline.
TryInline(call);
}