summaryrefslogtreecommitdiff
path: root/dex2oat/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2020-06-08 09:00:33 +0100
committer Vladimir Marko <vmarko@google.com> 2020-06-08 14:56:13 +0000
commit6bc480b56e8bf070eb425b792757c62ca8fd38b2 (patch)
treeb00302f3be9f3ca54b4d0e870e47d14dcd97705f /dex2oat/driver/compiler_driver.cc
parent66704db5967a8eed64f53d82594205d6d48a953d (diff)
Fix dlsym lookup trampoline for @CriticalNative.
For @CriticalNative we do not have the JniEnv* argument to retrieve the Thread*, we must use the thread register. The test 178-app-image-native-method was supposed to cover this but the profile was missing the necessary references. We add those references and add $noinline$opt$ tags to make sure the test actually runs the way it was supposed to and add extra calls to the critical methods as they can take different paths on subsequent execution. Also add an extra test for class initialization checks that ensures correct behavior for planned direct calls from compiled managed code to registered @CriticalNative code. Test: testrunner.py --target --optimizing -t 178 Bug: 112189621 Change-Id: I6a63d990bc08236ebaac7dacb0f5979d835ee321
Diffstat (limited to 'dex2oat/driver/compiler_driver.cc')
-rw-r--r--dex2oat/driver/compiler_driver.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index 40b999b3c1..1b29e3b77a 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -301,7 +301,9 @@ std::unique_ptr<const std::vector<uint8_t>> CompilerDriver::CreateJniDlsymLookup
std::unique_ptr<const std::vector<uint8_t>>
CompilerDriver::CreateJniDlsymLookupCriticalTrampoline() const {
- CREATE_TRAMPOLINE(JNI, kJniAbi, pDlsymLookupCritical)
+ // @CriticalNative calls do not have the `JNIEnv*` parameter, so this trampoline uses the
+ // architecture-dependent access to `Thread*` using the managed code ABI, i.e. `kQuickAbi`.
+ CREATE_TRAMPOLINE(JNI, kQuickAbi, pDlsymLookupCritical)
}
std::unique_ptr<const std::vector<uint8_t>> CompilerDriver::CreateQuickGenericJniTrampoline()