summaryrefslogtreecommitdiff
path: root/test/MyClassNatives/MyClassNatives.java
AgeCommit message (Collapse)Author
2024-03-21Reuse boot JNI stub for native methods (reland). hangl
Different native methods can share the same JNI stub as long as they have the same flag and shorty. Boot images loaded by zygote contain lots of JNI stubs that already compiled, so we can reuse them for native methods loaded later. For those methods having a matching JNI stub, we no longer need the GenericJNI and following JIT/AOT, which will bring an increase in program speed. Since there are many optimizations in JniCompile, we can also optimize the "shorty equals" criteria for some archs to let more methods find their matching stubs. Test performance improvement: run a simple addOne(Object, int) native method for multiple times at startup (microsecond, lower is better): Number of runs before after 5000 398.70 124.94 10000 792.21 234.23 50000 3919.20 1065.30 Test feature coverage: start and run the app for 30 seconds (top 10 apps in Chinese market, the closer to 100% the better): (count of native methods that reuse boot JNI stub / total count of app native methods = percentage) app1: 1055/1206 = 87.48% app2: 765/884 = 86.54% app3: 1267/1414 = 89.60% app4: 1577/1759 = 89.65% app5: 1698/1860 = 91.29% app6: 2528/2787 = 90.71% app7: 1058/1218 = 86.86% app8: 952/1092 = 87.18% app9: 1343/1483 = 90.56% app10: 2990/3492 = 85.62% This relands commit c8b6e26aa56bb6761bb781d1095b36f84c4c65d4. Reason for reland: - Fix the stack unwind issue of Thumb2. - We never use AOT code in debuggable. So restrict this optimization only to non-debuggable. - The original CL has conflict with aosp/2988923. That other CL is relanded so we can reland after resolving the conflict. Test: m test-art-host-gtest Test: run-gtest.sh Test: testrunner.py --host --all-debuggable Test: testrunner.py --target --all-debuggable Bug: 288983053 Change-Id: If7ba92d8a5f4bb9903b407d4f625e085de80cad7
2024-03-08Revert "Reuse boot JNI stub for native methods" Nicolas Geoffray
This reverts commit c8b6e26aa56bb6761bb781d1095b36f84c4c65d4. Bug: 288983053 Reason for revert: Failure on luci bots. Change-Id: Ieae0f47f2114efbfcb0bc4d8ffb0868001c22653
2024-03-07Reuse boot JNI stub for native methods hangl
Different native methods can share the same JNI stub as long as they have the same flag and shorty. Boot images loaded by zygote contain lots of JNI stubs that already compiled, so we can reuse them for native methods loaded later. For those methods having a matching JNI stub, we no longer need the GenericJNI and following JIT/AOT, which will bring an increase in program speed. Since there are many optimizations in JniCompile, we also optimize the "shorty equals" criteria for some archs to let more methods find their matching stubs. Test performance improvement: run a simple addOne(Object, int) native method for multiple times at startup (microsecond, lower is better): Number of runs before after 5000 398.70 124.94 10000 792.21 234.23 50000 3919.20 1065.30 Test feature coverage: start and run the app for 30 seconds (top 10 apps in Chinese market, higher percentage is better): (count of native methods that reuse boot JNI stub / total count of app native methods = percentage) app1: 1055/1206 = 87.48% app2: 765/884 = 86.54% app3: 1267/1414 = 89.60% app4: 1577/1759 = 89.65% app5: 1698/1860 = 91.29% app6: 2528/2787 = 90.71% app7: 1058/1218 = 86.86% app8: 952/1092 = 87.18% app9: 1343/1483 = 90.56% app10: 2990/3492 = 85.62% Test: m test-art-host-gtest Test: testrunner.py --host Test: run-gtest.sh Test: testrunner.py --target Bug: 288983053 Change-Id: I72f27bcfcd4d4a360bd5d9478b8f7687f087e431
2021-12-08JNI: Fix failure to unlock for pending exception. Vladimir Marko
And add a regression test. This was broken by https://android-review.googlesource.com/1898923 but it was not caught by any direct tests. Test: Additional test in JniCompilerTest. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 172332525 Bug: 208831945 Change-Id: I41d4999bbf43f8e58c88b87da47be6f7409d9ce1
2020-12-14Make it a verification error to misuse FastNative and CriticalNative. Nicolas Geoffray
Bug: 175016705 Test: 004-JniTest Change-Id: I10a1d6d29ebab105a2dd55ed796742c13c221ae2 Merged-In: I10a1d6d29ebab105a2dd55ed796742c13c221ae2 (cherry picked from commit 80f8973cb13feff2336345719066e0a65eb48ca7)
2020-02-20Remove remaining MIPS support. Vladimir Marko
With the exception of dwarf support in libelffile. Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 147346243 Change-Id: Ib25acbc98aa7f63ce49a7ed2f81a4a64d48eac39
2020-02-19Allow late lookup for @CriticalNative methods. Vladimir Marko
Test: Add and enable tests in 178-app-image-native-method Test: Add and enable tests in jni_compiler_test Test: Manually step through the new stub in GDB and check that backtrace works at various points. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 112189621 Change-Id: If094e5062acbb99eefa88f2afb4815f93730cb82
2016-11-17[MIPS64] JNI Compiler: compiler independent test Pavle Batuta
Fixed MIPS64 stackArgsSignExtendedTest that did not work properly when code was built with clang. The the test is now written in an asm stub and should be completely compiler indepedent. Test: mma test-art-target-gtest-jni_compiler_test Change-Id: Idefef3a8414dd8b88a28d2d8862a724bc72402a7
2016-09-09jni: Add @CriticalNative optimization to speed up JNI transitions Igor Murashkin
Change-Id: I963059ac3a72dd8e6a867596c356d7062deb6da7
2016-08-16jni: Fast path for @FastNative annotated java methods Igor Murashkin
Adds a faster path for java methods annotated with dalvik.annotation.optimization.FastNative . Intended to replace usage of fast JNI (registering with "!(FOO)BAR" descriptors). Performance Microbenchmark Results (Angler): * Regular JNI cost in nanoseconds: 115 * Fast JNI cost in nanoseconds: 60 * @FastNative cost in nanoseconds: 36 Summary: Up to 67% faster (vs fast jni) JNI transition cost Change-Id: Ic23823ae0f232270c068ec999fd89aa993894b0e
2016-07-22ART: Fix type parameter in tests Andreas Gampe
Move Class to Class<?>, Constructor to Constructor<?>, and in general clean up reflection. Test: m test-art-host-run-test Change-Id: I3a4223ee8d14d032015edf34bf27135757f7138c
2015-06-24[MIPS64] JNI Compiler: Sign-extend int function arguments Lazar Trsic
MIPS n64 ABI differs from arm64. Arguments smaller than the 8B stack slot need to be sign-extended. Use combination (lw,sd), instead of (lw,sw) for 4B values. Change fixes software keyboard crash on mips64. Change-Id: I7574d37f6039e9e8c9e0047254be71d28d4c829a
2015-04-10ART: Ignore result for exception-case JNIEndWithReference Andreas Gampe
The value may not contain a valid jobject, so ignore and use null directly. Refactor a bit to have one common function for both synchronized and non-synchronized case. Add a test to the JNI compiler tests. Bug: 18135031 Change-Id: If2f004a112f36f4ff68172a946dec67ce561ae4d
2014-08-14Fix bugs in the x86 and arm versions of generic JNI. Nicolas Geoffray
Also fix the run script of 116-nodex2oat to use the non-prebuild script for target. Bug: 17000769 Change-Id: I439fcd710fb8bb408f3288ff8fb34fef23890adb
2014-04-07ART: A workaround for a wrongly-read caller's frame Vladimir Kostyukov
The quick-trampoline treats caller's frame in a different way then it was formed by quck-invoke stub for hard float ABI targets such as x86_64 and aarch64. The patch workarounds the issue of wrongly-read stack arguments due to no contract between quick-invoke stub and quick-trampoline/shadow-frame-builder regarding the reg- spill area. Change-Id: I302f212b4ea5e38632527a5ace03f136b21ef806 Signed-off-by: Vladimir Kostyukov <vladimir.kostyukov@intel.com>
2014-04-04Fix wrong handling of Generic JNI not finding native method. Andreas Gampe
Code did not properly call JNIMethodEnd, such that locks etc where not correctly handled. Add a test case to jni_compiler_test. Change-Id: If2d5c628517d65a56dd6bb5c4cabdff77c7664a1
2014-03-10More JNI compiler tests and small fix Andreas Gampe
Add checks for alignment, floats, and maximum number of parameters Fixed x86_64 ABI wrong interpretation (floats not widened in registers) Change-Id: I6c09af4914b7675ac0275ce21003e317ca44a403
2012-08-27Fix JNI Compiler for x86 target Brian Carlstrom
Change-Id: Ia247de328d234c4a57ddd93f394cad2c63e48153
2012-05-21Fix JNI stubs for synchronized native methods with double/long arguments in ↵ Elliott Hughes
low registers. Change-Id: I3639f7a7a9564630ae01651119fcad237a5e675d
2012-04-09Implement native method return value and upcall argument type checking. Elliott Hughes
Also clean up the CheckJNI testing a bit. I still need to do some work so that JniAbort catches more of the detail, but this is a step forward. Change-Id: Ibf5e32867d56123cff902ebf602406b731f567d2
2012-03-03Fix bug in JNI compiler AAPCS padding calculation Ian Rogers
Fixes bug found in Google Earth. Change-Id: I54beb05a67e77a004052b567c11837cc6f2c18fe
2012-02-29Test invocation of static methods through JNI stub Ian Rogers
Additional unit test to avoid regressions like Change I707f8e64. Change-Id: Ic343bf5273ca06b646f0235c88d6edbe3d20d448
2012-01-30Fix copyright headers. Elliott Hughes
Change-Id: I5b7bc76a370238d810d78522bd5531600746700f
2011-09-17Support for exception throwing from JNI. Ian Rogers
This change modifies the exception throwing JNI unit test to be realistic and implements the missing exception throwing pieces on X86. It also corrects some issues on ARM including methods with arguments LJII (such as compareAndSwapInt). Change-Id: I375f6efe2edeebb8007d7aa12c10b49742a8f119
2011-09-12Generating stub code for registering a jni function at runtime. Shih-wei Liao
On ARM and x86. Added a unit test. Change-Id: I6b1ee09ad18295108f406ce21d73555796ecbba6
2011-09-07Fix various JNI compiler bugs/unimplementeds. Ian Rogers
For both x86 and arm we were under computing the outgoing argument size. For ARM the managed double/long passing had been assumed to be following AAPCS, however, currently we split long/doubles across R1_R2 and R3 and the stack. Add support for this in the managed register and jni compiler code. Add test and various other clean ups to jni compiler code. Change-Id: I4129076d052a8bce42304f5331b71aa3ac50210f
2011-09-05Test arg passing for arraycopy. Ian Rogers
Change-Id: Id0a6b6043b9604aa3bb077af0ed858be9bfa5407
2011-09-04Fix bug in long arguments for JNI on x86 Ian Rogers
Also add new unit test. Change-Id: I226501dbfec6e207318d8063b5daf53b7b606ee4
2011-09-02Testing the decoding of JObject. Shih-wei Liao
Change-Id: Ie539275592fbb7b648f9ce5e4a619aecc576768c
2011-09-01Fix the "mov R1, R2; mov R2, R3" bug in jni_compiler. Shih-wei Liao
Should be "mov R2, R3; mov R1, R2" instead. Change-Id: Ie5264c3fe38486781e09f54e1e6d1fdcf7a2d4e5
2011-08-29Add -Xcheck:jni. Elliott Hughes
I think this is as complete as possible right now. The remaining two #if 0 sections require: 1. a way to get the Method* of the current native method. 2. a way to get the Class* of the type of a given Field*. Change-Id: I331586022095fb36ccc10c9ac1890a59a9224d01
2011-08-29Externalize test code Brian Carlstrom
Change-Id: Iab19397c7a72fb9a3ca63bfd0bc4eaf1a98138ba