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

Open
wants to merge 1 commit into
base: master
Choose a base branch
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)

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

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

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

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Dec 25, 2024
@RealFYang
Copy link
Member Author

/label remove hotspot-compiler

@RealFYang
Copy link
Member Author

/label add hotspot-runtime

@openjdk openjdk bot removed the hotspot-compiler hotspot-compiler-dev@openjdk.org label Dec 25, 2024
@openjdk
Copy link

openjdk bot commented Dec 25, 2024

@RealFYang
The hotspot-compiler label was successfully removed.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Dec 25, 2024
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants