diff options
author | 2024-02-21 18:28:06 +0800 | |
---|---|---|
committer | 2024-03-07 12:40:19 +0000 | |
commit | c8b6e26aa56bb6761bb781d1095b36f84c4c65d4 (patch) | |
tree | ff692b41c6022bdb576bcf5090b89a452608db9b /compiler/common_compiler_test.h | |
parent | 9e6eca71dc3aeeb7f92c40fb7a51d582af0610f0 (diff) |
Reuse boot JNI stub for native methods
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
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 9b49c93ea6..89f3fb40ad 100644 --- a/compiler/common_compiler_test.h +++ b/compiler/common_compiler_test.h @@ -89,10 +89,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_; }; |