Only warn if a pre-P app overrides inlined methods at runtime
CL Ibe9792f952d0c963b8560f10d57a951e227b24aa increased strictness of
a check that an inlined method did not cross a dex file boundary. For
app compat reasons, turn this into a warning if the app targets SDK
version < 28 (P). The warning makes it clear that the runtime is in an
unsafe state, but this was the case before P too. Developers will have
time to fix the issue until they start targetting P.
Bug: 74410240
Bug: 110985613
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing --jit
Merged-In: Id1e159449a3766335de0913b94cdb240c1484a33
Change-Id: Id1e159449a3766335de0913b94cdb240c1484a33
(cherry picked from commit 855549b9e3be1abea4edd847cd4c14a0283f12e1)
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 137eb4f..7953616 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -91,15 +91,17 @@
// even going back from boot image methods to the same oat file. However, this is
// not currently implemented in the compiler. Therefore crossing dex file boundary
// indicates that the inlined definition is not the same as the one used at runtime.
- LOG(FATAL) << "Inlined method resolution crossed dex file boundary: from "
- << method->PrettyMethod()
- << " in " << method->GetDexFile()->GetLocation() << "/"
- << static_cast<const void*>(method->GetDexFile())
- << " to " << inlined_method->PrettyMethod()
- << " in " << inlined_method->GetDexFile()->GetLocation() << "/"
- << static_cast<const void*>(inlined_method->GetDexFile()) << ". "
- << "This must be due to duplicate classes or playing wrongly with class loaders";
- UNREACHABLE();
+ bool target_sdk_pre_p = Runtime::Current()->GetTargetSdkVersion() < 28;
+ LOG(target_sdk_pre_p ? WARNING : FATAL)
+ << "Inlined method resolution crossed dex file boundary: from "
+ << method->PrettyMethod()
+ << " in " << method->GetDexFile()->GetLocation() << "/"
+ << static_cast<const void*>(method->GetDexFile())
+ << " to " << inlined_method->PrettyMethod()
+ << " in " << inlined_method->GetDexFile()->GetLocation() << "/"
+ << static_cast<const void*>(inlined_method->GetDexFile()) << ". "
+ << "This must be due to duplicate classes or playing wrongly with class loaders. "
+ << "The runtime is in an unsafe state.";
}
method = inlined_method;
}