jdk
jdk copied to clipboard
8295023: Interpreter(AArch64): Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options
In this patch, we implement functions histogram_bytecode() and histogram_bytecode_pair() for interpreter AArch64 part. Similar to count_bytecode(), we use atomic operations to update the counters as well.
Here shows part of the message produced with -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options after this patch.
$ java -XX:+PrintBytecodeHistogram --version | head -20
openjdk 20-internal 2023-03-21
OpenJDK Runtime Environment (fastdebug build 20-internal-adhoc.haosun.jdk-src-dev)
OpenJDK 64-Bit Server VM (fastdebug build 20-internal-adhoc.haosun.jdk-src-dev, mixed mode)
Histogram of 5004099 executed bytecodes:
absolute relative code name
----------------------------------------------------------------------
319124 6.38% dc fast_aload_0
313397 6.26% e0 fast_iload
251436 5.02% b6 invokevirtual
227428 4.54% 19 aload
166054 3.32% a7 goto
159167 3.18% 2b aload_1
151803 3.03% de fast_aaccess_0
136787 2.73% 1b iload_1
124037 2.48% 36 istore
118791 2.37% 84 iinc
118121 2.36% 1c iload_2
110484 2.21% a2 if_icmpge
$ java -XX:+PrintBytecodePairHistogram --version | head -20
openjdk 20-internal 2023-03-21
OpenJDK Runtime Environment (fastdebug build 20-internal-adhoc.haosun.jdk-src-dev)
OpenJDK 64-Bit Server VM (fastdebug build 20-internal-adhoc.haosun.jdk-src-dev, mixed mode)
Histogram of 4804441 executed bytecode pairs:
absolute relative codes 1st bytecode 2nd bytecode
----------------------------------------------------------------------
77602 1.615% 84 a7 iinc goto
49749 1.035% 36 e0 istore fast_iload
48931 1.018% e0 10 fast_iload bipush
46294 0.964% e0 b6 fast_iload invokevirtual
42661 0.888% a7 e0 goto fast_iload
42243 0.879% 3a 19 astore aload
40138 0.835% 19 b9 aload invokeinterface
36617 0.762% dc 2b fast_aload_0 aload_1
35745 0.744% b7 dc invokespecial fast_aload_0
35384 0.736% 19 b6 aload invokevirtual
35035 0.729% b6 de invokevirtual fast_aaccess_0
34667 0.722% dc b6 fast_aload_0 invokevirtual
In order to verfiy the correctness, I took the trace information produced by -XX:+TraceBytecodes as a cross reference. The hit times for some bytecodes/bytecode pairs can be obtained via parsing the trace. Then I compared the hit times with the corresponding "absolute" columns. I randomly selected several bytecodes/bytecode pairs, and the manual comparion results showed that "absolute" columns are correct.
Note-1: count_bytecode() is updated. 1) caller-saved registers are used as temporary registers and there is no need to save/restore them. 2) atomic_addw() should be used since the counter is of int type.
Note-2: As shown by the update in file templateInterpreterGenerator.cpp, function histogram_bytecode() should be invoked only inside !PRODUCT scope.
Progress
- [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8295023: Interpreter(AArch64): Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options
Reviewers
- Andrew Haley (@theRealAph - Reviewer)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10642/head:pull/10642
$ git checkout pull/10642
Update a local copy of the PR:
$ git checkout pull/10642
$ git pull https://git.openjdk.org/jdk pull/10642/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10642
View PR using the GUI difftool:
$ git pr show -t 10642
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10642.diff
:wave: Welcome back haosun! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@shqking The following label will be automatically applied to this pull request:
hotspot
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.
Webrevs
- 03: Full - Incremental (84556aeb)
- 02: Full - Incremental (bbbc3020)
- 01: Full - Incremental (0db39758)
- 00: Full (7e8b738a)
@shqking This change now passes all automated pre-integration checks.
ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.
After integration, the commit message for the final commit will be:
8295023: Interpreter(AArch64): Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options
Reviewed-by: aph, ngasson
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.
At the time when this comment was updated there had been 89 new commits pushed to the master branch:
- 172006c0e9433046252bd79e8864890ab7c0ce56: 8295333: G1: Remove unnecessary check in G1Policy::calculate_desired_eden_length_by_mmu
- 7743345f6f73398f280fd18364b4cea10a6b0f2f: 8294314: Minimize disabled warnings in hotspot
- 552d8a2821f03046896a728d6e4cec0ef754d3f4: 8295192: Use original configure command line when called from a script
- cf07eaeb9291da725181832b8bb1dc54957ba886: 8295020: javac emits incorrect code for for-each on an intersection type.
- b3bb3e6ed89f3abcaae584fcbe75688141e886cb: 8295325: tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java fails on Linux ppc64le
- 9005af3b90fbd3607aeb83efe1c4a6ffa5d104f0: 8295110: RISC-V: Mark out relocations as incompressible
- 74a51ccc86525eb4b1eb2e5cb11e605ca9e9fc5d: 8292698: Improve performance of DataInputStream
- d3781ac8a38943d8a20304e770b01d5418ee33d0: 8295009: RISC-V: Interpreter intrinsify Thread.currentThread()
- e7d0ab227ff86bb65abf7fbeb135ce657454200b: 8295379: ProblemList java/lang/Float/Binary16Conversion.java in Xcomp mode on x64
- 404e8de1559adade31df98a83919841f080b5b89: 8294865: x86: Improve the code generation of MulVB and MulVL
- ... and 79 more: https://git.openjdk.org/jdk/compare/4b17d28a6d56726d49090bfd05d945e8f688fe53...master
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@theRealAph, @nick-arm) but any other Committer may sponsor as well.
➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).
@nick-arm Could you help take a look at this patch when you have spare time? Thanks.
Thanks for your reviews! @theRealAph and @nick-arm /integrate
@shqking Your change (at version 84556aebd2d34840083c52726d99a76512e68b80) is now ready to be sponsored by a Committer.
/sponsor
Going to push as commit ae60599e2ba75d80c3b4279903137b2c549f8066.
Since your change was applied there have been 93 commits pushed to the master branch:
- 4d37ef2d545c016e6c3ad52171ea961d4406726f: 8295262: Build binutils out of source tree
- 0919a3a0c198a5234b5ed9a3bb999564d2382a56: 8294186: AArch64: VectorMaskToLong failed on SVE2 machine with -XX:UseSVE=1
- ec2981b83bc3ef6977b5f16d5222eb49b0ea49ad: 8293711: Factor out size parsing functions from arguments.cpp
- 5d273b9f040a9884e2ae5b0f1409a3f9075c51c9: 8295278: Add parallel class loading tests
- 172006c0e9433046252bd79e8864890ab7c0ce56: 8295333: G1: Remove unnecessary check in G1Policy::calculate_desired_eden_length_by_mmu
- 7743345f6f73398f280fd18364b4cea10a6b0f2f: 8294314: Minimize disabled warnings in hotspot
- 552d8a2821f03046896a728d6e4cec0ef754d3f4: 8295192: Use original configure command line when called from a script
- cf07eaeb9291da725181832b8bb1dc54957ba886: 8295020: javac emits incorrect code for for-each on an intersection type.
- b3bb3e6ed89f3abcaae584fcbe75688141e886cb: 8295325: tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java fails on Linux ppc64le
- 9005af3b90fbd3607aeb83efe1c4a6ffa5d104f0: 8295110: RISC-V: Mark out relocations as incompressible
- ... and 83 more: https://git.openjdk.org/jdk/compare/4b17d28a6d56726d49090bfd05d945e8f688fe53...master
Your commit was automatically rebased without conflicts.
@nick-arm @shqking Pushed as commit ae60599e2ba75d80c3b4279903137b2c549f8066.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.