jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8295110: RISC-V: Mark out relocations as incompressible

Open zhengxiaolinX opened this issue 2 years ago • 9 comments

This patch marks all relocations incompressible as pre-discussions at [1] and converts instructions to their 2-byte compressible counterparts as much as possible when UseRVC is enabled.

Chaining PR #10421.

  1. Code size reduction rate: about ~17% now after this patch under RVC, meaning if there's a piece of code of 1000 bytes, it may shrink to 830 bytes when RVC is enabled. [2]
  2. Performance: conservatively no regressions observed. [3]

The overloaded relocate() methods hide IncompressibleRegions inside, to exclude instructions used at relocations from being compressed.

Having tested several times hotspot tier1~tier4; Testing another turn on board.

[1] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000615.html [2] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000633.html [3] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-October/000656.html


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-8295110: RISC-V: Mark out relocations as incompressible

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10643/head:pull/10643
$ git checkout pull/10643

Update a local copy of the PR:
$ git checkout pull/10643
$ git pull https://git.openjdk.org/jdk pull/10643/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10643

View PR using the GUI difftool:
$ git pr show -t 10643

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10643.diff

zhengxiaolinX avatar Oct 11 '22 05:10 zhengxiaolinX

:wave: Welcome back xlinzheng! 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.

bridgekeeper[bot] avatar Oct 11 '22 05:10 bridgekeeper[bot]

@zhengxiaolinX 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.

openjdk[bot] avatar Oct 11 '22 05:10 openjdk[bot]

Personally, I prefer the following style:

  __ relocate(spec, [&] {
      int32_t off = 0;
      la_patchable(t0, RuntimeAddress(entry), off);
      jalr(x1, t0, off);
  });

Then the code looks more unified to me. And we don't need to extend a new la_patchable interface.

RealFYang avatar Oct 12 '22 06:10 RealFYang

Personally, I prefer the following style:

  __ relocate(spec, [&] {
      int32_t off = 0;
      la_patchable(t0, RuntimeAddress(entry), off);
      jalr(x1, t0, off);
  });

Then the code looks more unified to me. And we don't need to extend a new la_patchable interface.

Done - code expands a little for the relocate() inside la_patchable() is extracted to their outer callers explicitly. The la_patchable only appears ~30 times in the backend so it's controllable.

zhengxiaolinX avatar Oct 12 '22 08:10 zhengxiaolinX

@zhengxiaolinX 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:

8295110: RISC-V: Mark out relocations as incompressible

Reviewed-by: fyang, yadongwang

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 19 new commits pushed to the master branch:

  • 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
  • 2087424736f15a5a80a0492993a6cd74da87188a: 8295370: Update java.io.ObjectStreamField to use Class.descriptorString
  • 8487c56f7ea224169d9d42efda9efb824266289f: 8295294: Misc cleanups in runtime/InvocationTests
  • 0043d58c5d52c3b299a4b6dfcec34a7db5041aea: 8293531: C2: some vectorapi tests fail assert "Not monotonic" with flag -XX:TypeProfileLevel=222
  • 2e2a51ee22068e847b36f9a5f20bd37050eaabf8: 8295267: Improve G1 scan to merge ratio calculation
  • dfcd9d538eba4b097083abe19d02d6d019236ac7: 8295320: [BACKOUT] 8276687 Remove support for JDK 1.4.1 PerfData shared memory files
  • 2da079c64e880835c9c0eb36f5e63a7752ebb328: 8294426: Two fingers tap generates wrong mouse modifiers on M2 MacBooks
  • 449b52fd230786e818cdaf5000213ea746802e4d: 8295158: G1: Increase card-based cost sample reporting threshold
  • ... and 9 more: https://git.openjdk.org/jdk/compare/3d75e88eb25f56ed2214496826004578c2c75012...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 (@RealFYang) 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).

openjdk[bot] avatar Oct 12 '22 09:10 openjdk[bot]

Thanks for reviewing! @RealFYang @yadongw

Will wait for #10697 to be merged first for it seems needs a redo if mine goes first.

zhengxiaolinX avatar Oct 14 '22 02:10 zhengxiaolinX

@zhengxiaolinX this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout riscv-rvc-checkin-second-half-part
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

openjdk[bot] avatar Oct 14 '22 09:10 openjdk[bot]

@zhengxiaolinX Please do not rebase or force-push to an active PR as it invalidates existing review comments. All changes will be squashed into a single commit automatically when integrating. See OpenJDK Developers’ Guide for more information.

openjdk-notifier[bot] avatar Oct 14 '22 09:10 openjdk-notifier[bot]

Test results (new code for refactoring in this patch) on QEMU & my board in the several days look okay.

/integrate

zhengxiaolinX avatar Oct 17 '22 04:10 zhengxiaolinX

@zhengxiaolinX Your change (at version b5315cf3e9fd5dc6fdeecb834ec6e8089e1500c4) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Oct 17 '22 04:10 openjdk[bot]

/sponsor

RealFYang avatar Oct 17 '22 05:10 RealFYang

Going to push as commit 9005af3b90fbd3607aeb83efe1c4a6ffa5d104f0. Since your change was applied there have been 20 commits pushed to the master branch:

  • 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
  • 2087424736f15a5a80a0492993a6cd74da87188a: 8295370: Update java.io.ObjectStreamField to use Class.descriptorString
  • 8487c56f7ea224169d9d42efda9efb824266289f: 8295294: Misc cleanups in runtime/InvocationTests
  • 0043d58c5d52c3b299a4b6dfcec34a7db5041aea: 8293531: C2: some vectorapi tests fail assert "Not monotonic" with flag -XX:TypeProfileLevel=222
  • 2e2a51ee22068e847b36f9a5f20bd37050eaabf8: 8295267: Improve G1 scan to merge ratio calculation
  • dfcd9d538eba4b097083abe19d02d6d019236ac7: 8295320: [BACKOUT] 8276687 Remove support for JDK 1.4.1 PerfData shared memory files
  • 2da079c64e880835c9c0eb36f5e63a7752ebb328: 8294426: Two fingers tap generates wrong mouse modifiers on M2 MacBooks
  • ... and 10 more: https://git.openjdk.org/jdk/compare/3d75e88eb25f56ed2214496826004578c2c75012...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 17 '22 05:10 openjdk[bot]

@RealFYang @zhengxiaolinX Pushed as commit 9005af3b90fbd3607aeb83efe1c4a6ffa5d104f0.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Oct 17 '22 05:10 openjdk[bot]