summaryrefslogtreecommitdiff
path: root/test/178-app-image-native-method/native_methods.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 /test/178-app-image-native-method/native_methods.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 'test/178-app-image-native-method/native_methods.cc')
-rw-r--r--test/178-app-image-native-method/native_methods.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/178-app-image-native-method/native_methods.cc b/test/178-app-image-native-method/native_methods.cc
index becda8189e..0669deb4b3 100644
--- a/test/178-app-image-native-method/native_methods.cc
+++ b/test/178-app-image-native-method/native_methods.cc
@@ -609,4 +609,33 @@ extern "C" JNIEXPORT jint JNICALL Java_CriticalSignatures_nativeFullArgs(
return 42;
}
+extern "C" JNIEXPORT jint JNICALL Java_CriticalClinitCheck_nativeMethodVoid() {
+ return 42;
+}
+
+extern "C" JNIEXPORT jint JNICALL Java_CriticalClinitCheck_nativeMethod(jint i) {
+ return i;
+}
+
+extern "C" JNIEXPORT jint JNICALL Java_CriticalClinitCheck_nativeMethodWithManyParameters(
+ jint i1, jlong l1, jfloat f1, jdouble d1,
+ jint i2, jlong l2, jfloat f2, jdouble d2,
+ jint i3, jlong l3, jfloat f3, jdouble d3,
+ jint i4, jlong l4, jfloat f4, jdouble d4,
+ jint i5, jlong l5, jfloat f5, jdouble d5,
+ jint i6, jlong l6, jfloat f6, jdouble d6,
+ jint i7, jlong l7, jfloat f7, jdouble d7,
+ jint i8, jlong l8, jfloat f8, jdouble d8) {
+ bool ok = VerifyManyParameters(
+ i1, l1, f1, d1,
+ i2, l2, f2, d2,
+ i3, l3, f3, d3,
+ i4, l4, f4, d4,
+ i5, l5, f5, d5,
+ i6, l6, f6, d6,
+ i7, l7, f7, d7,
+ i8, l8, f8, d8);
+ return ok ? 42 : -1;
+}
+
} // namespace art