diff options
author | 2024-03-12 15:38:01 +0800 | |
---|---|---|
committer | 2024-03-21 16:13:57 +0000 | |
commit | 700002ee909f6575b2c8a23725493da523ae5a5f (patch) | |
tree | 2d7bc17b3b10074b9719eefaa7a6db31573471fe /compiler/common_compiler_test.h | |
parent | e67193fe33f6aaf336715aab04bdca8bf95acdb6 (diff) |
Reuse boot JNI stub for native methods (reland).
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
Diffstat (limited to 'compiler/common_compiler_test.h')
-rw-r--r-- | compiler/common_compiler_test.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h index 2a1c2d21f1..30d5734ba3 100644 --- a/compiler/common_compiler_test.h +++ b/compiler/common_compiler_test.h @@ -84,10 +84,10 @@ class EXPORT CommonCompilerTestImpl { protected: virtual ClassLinker* GetClassLinker() = 0; virtual Runtime* GetRuntime() = 0; + class OneCompiledMethodStorage; private: class CodeAndMetadata; - class OneCompiledMethodStorage; std::vector<CodeAndMetadata> code_and_metadata_; }; |