summaryrefslogtreecommitdiff
path: root/compiler/jni/jni_compiler_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-12-07 15:42:12 +0100
committer VladimĂ­r Marko <vmarko@google.com> 2023-04-04 07:25:29 +0000
commit41c3de26503b7e9ff8cd3dd480cf12a8cca8af83 (patch)
tree692424dc0ad7b5dbef26833e8e2ffbbeee23c5a3 /compiler/jni/jni_compiler_test.cc
parent39cbdab22265d0b20dca1941fdf240225c7f54f2 (diff)
JNI: Fast-path for decoding returned jobject.
Results for the timeGetBytesAscii#EMPTY benchmark from the libcore's StringToBytesBenchmark suite on blueline-userdebug with the cpu frequencies fixed at 1420800 (cpus 0-3; little) and 1459200 (cpus 4-7; big): 32-bit little: ~415 -> ~390 64-bit little: ~415 -> ~390 32-bit big: ~180 -> ~170 64-bit big: ~180 -> ~170 Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --debug --ndebug Test: run-gtests.sh Test: testrunner.py --target --optimizing --debug --ndebug Bug: 172332525 Change-Id: I0e19d583e5141e99a8b8c6fd9ae125fe7c9e02e7
Diffstat (limited to 'compiler/jni/jni_compiler_test.cc')
-rw-r--r--compiler/jni/jni_compiler_test.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index d1d31905c2..397db251b8 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -28,6 +28,7 @@
#include "common_compiler_test.h"
#include "compiler.h"
#include "dex/dex_file.h"
+#include "driver/compiler_options.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "gtest/gtest.h"
#include "indirect_reference_table.h"
@@ -1553,6 +1554,10 @@ jobject Java_MyClassNatives_staticMethodThatShouldReturnClass(JNIEnv* env, jclas
}
void JniCompilerTest::UpcallReturnTypeChecking_InstanceImpl() {
+ // Set debuggable so that the JNI compiler does not emit a fast-path that would skip the
+ // runtime call where we do these checks. Note that while normal gtests use the debug build
+ // which disables the fast path, `art_standalone_compiler_tests` run in the release build.
+ compiler_options_->SetDebuggable(true);
SetUpForTest(false, "instanceMethodThatShouldReturnClass", "()Ljava/lang/Class;",
CURRENT_JNI_WRAPPER(Java_MyClassNatives_instanceMethodThatShouldReturnClass));
@@ -1580,6 +1585,10 @@ void JniCompilerTest::UpcallReturnTypeChecking_InstanceImpl() {
JNI_TEST(UpcallReturnTypeChecking_Instance)
void JniCompilerTest::UpcallReturnTypeChecking_StaticImpl() {
+ // Set debuggable so that the JNI compiler does not emit a fast-path that would skip the
+ // runtime call where we do these checks. Note that while normal gtests use the debug build
+ // which disables the fast path, `art_standalone_compiler_tests` run in the release build.
+ compiler_options_->SetDebuggable(true);
SetUpForTest(true, "staticMethodThatShouldReturnClass", "()Ljava/lang/Class;",
CURRENT_JNI_WRAPPER(Java_MyClassNatives_staticMethodThatShouldReturnClass));