Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8346832: runtime/CompressedOops/CompressedCPUSpecificClassSpaceReservation.java fails on RISC-V #22879

Closed
wants to merge 3 commits into from

Conversation

RealFYang
Copy link
Member

@RealFYang RealFYang commented Dec 25, 2024

Hi, please review this small change fixing a test failure.

This test first expects tryReserveForUnscaled and tryReserveForZeroBased from the process output. In addition, when test without CDS, it also expects reserve_between (range [0x0000000800000000-0x0000100000000000) which is not lower than zero-based limit. But the process output gives reserve_between (range [0x0000000100000000-0x0000100000000000), which is not expected.

Previously, we have the code handling this case in CompressedKlassPointers::reserve_address_space_for_compressed_classes.
But I find that the code is gone after JDK-8305895: Implement JEP 450: Compact Object Headers. This is the related change:

diff --git a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
index cffadb4189b..7c8d6b8f5bb 100644
--- a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
+++ b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
@@ -56,9 +56,9 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
     result = reserve_address_space_for_zerobased_encoding(size, aslr);
   }

-  // Failing that, optimize for case (3) - a base with only bits set between [33-44)
+  // Failing that, optimize for case (3) - a base with only bits set between [32-44)
   if (result == nullptr) {
-    const uintptr_t from = nth_bit(32 + (optimize_for_zero_base ? LogKlassAlignmentInBytes : 0));
+    const uintptr_t from = nth_bit(32);
     constexpr uintptr_t to = nth_bit(44);
     constexpr size_t alignment = nth_bit(32);
     result = reserve_address_space_X(from, to, size, alignment, aslr);

It seems to me more reasonable to add the optimize_for_zero_base check back and replace the LogKlassAlignmentInBytes with
CompressedKlassPointers::max_shift(). max_shift() is used in CompressedKlassPointers::reserve_address_space_for_zerobased_encoding to calculate zerobased_max as well [1].

Testing: same test passes with fastdebug build on linux-riscv64 platform. Tagging @tstuefe

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/oops/compressedKlass.cpp#L201


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8346832: runtime/CompressedOops/CompressedCPUSpecificClassSpaceReservation.java fails on RISC-V (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22879

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 25, 2024

👋 Welcome back fyang! 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.

@openjdk
Copy link

openjdk bot commented Dec 25, 2024

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

8346832: runtime/CompressedOops/CompressedCPUSpecificClassSpaceReservation.java fails on RISC-V

Reviewed-by: stuefe, fjiang

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

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Dec 25, 2024

@RealFYang The following label will be automatically applied to this pull request:

  • hotspot-compiler

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.

@RealFYang
Copy link
Member Author

/label remove hotspot-compiler

@RealFYang
Copy link
Member Author

/label add hotspot-runtime

@openjdk
Copy link

openjdk bot commented Dec 25, 2024

@RealFYang
The hotspot-compiler label was successfully removed.

@openjdk
Copy link

openjdk bot commented Dec 25, 2024

@RealFYang
The hotspot-runtime label was successfully added.

@RealFYang RealFYang marked this pull request as ready for review December 25, 2024 04:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 25, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 25, 2024

Webrevs

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @RealFYang!

Would not removing the zero-based search be simpler then? We would forfeit the search for an area within 4g-32g then, but if I recall correctly, for bases between 4G and 16TB we use addiw + slli. In other words, we don't take advantage of zero base nonzero shift.

If I recall that incorrectly, then you are right, we may just skip searching between 4Gb and 32Gb since we just did that in the zero-based step.

@RealFYang
Copy link
Member Author

RealFYang commented Dec 26, 2024

Hi Thomas,

Would not removing the zero-based search be simpler then? We would forfeit the search for an area within 4g-32g then, but if I recall correctly, for bases between 4G and 16TB we use addiw + slli. In other words, we don't take advantage of zero base nonzero shift.

Yes, I think you are right. I don't see why range 4g-32g is special here either. And I have updated accordingly. Thanks.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for fixing.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 28, 2024
Copy link
Member

@feilongjiang feilongjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, thanks!

@RealFYang
Copy link
Member Author

@tstuefe @feilongjiang : Thanks for the review!
/integrate

@openjdk
Copy link

openjdk bot commented Jan 7, 2025

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 7, 2025
@openjdk openjdk bot closed this Jan 7, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 7, 2025
@openjdk
Copy link

openjdk bot commented Jan 7, 2025

@RealFYang Pushed as commit de02503.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants