Skip to content

Conversation

@Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented Feb 14, 2025

Hi,
Can you help to review this patch?

Currently, string_compare code is a bit complicated, main reasons include:

  1. it has 2 piece of code respectively for LU and UL case, this is not necessary, basically LU and UL behaviour quite similar.
  2. it mixed LL/UU and LU/UL case together, better to separate them, as they are quite different from each other.

This is not good for code reading and maintaining.

So, this patch does following refactoring:

  1. merge LU and UL code into one, i.e. remove UL code.
  2. seperate the code into 2 methods: LL/UU and LU/UL.
  3. some other misc improvement.

I could do the following refactoring in another following pr, as in this pr I'm just moving code and removing code, it's easier to do it and review it. In particular the first one, as it needs to rewrite the existing code for UL/LU case.

  1. move alignment code of generate_compare_long_string_different_encoding upwards to string_compare_long_LU.
  2. make SHORT_STRING case simpler.

Thanks


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-8350095: RISC-V: Refactor string_compare (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23633

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 14, 2025

👋 Welcome back mli! 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 Feb 14, 2025

@Hamlin-Li 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:

8350095: RISC-V: Refactor string_compare

Reviewed-by: fyang

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

  • 885338b: 8323582: C2 SuperWord AlignVector: misaligned vector memory access with unaligned native memory
  • bb48b73: 8350723: RISC-V: debug.cpp help() is missing riscv line for pns
  • b29f8b0: 8350665: SIZE_FORMAT_HEX macro undefined in gtest
  • 78c18cf: 8349399: GHA: Add static-jdk build on linux-x64
  • e43960a: 8350616: Skip ValidateHazardPtrsClosure in non-debug builds
  • 9ec4696: 8350313: Include timings for leaving safepoint in safepoint logging
  • ec6624b: 8350649: Class unloading accesses/resurrects dead Java mirror after JDK-8346567
  • 9477c70: 8024695: new File("").exists() returns false whereas it is the current working directory
  • 3e46480: 8350770: [BACKOUT] Protection zone for easier detection of accidental zero-nKlass use
  • bd112c4: 8350443: GHA: Split static-libs-bundles into a separate job
  • ... and 54 more: https://git.openjdk.org/jdk/compare/dfcd0df60c60cf89dc01682264a573ad39e61a17...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.

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 14, 2025
@openjdk
Copy link

openjdk bot commented Feb 14, 2025

@Hamlin-Li 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 Feb 14, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 14, 2025

@RealFYang
Copy link
Member

RealFYang commented Feb 18, 2025

Hi, there is a difference between LU and UL when calculating the difference [1]. The tmp1 and tmp2 here represent characters from the first and second string respectively. So the order of the two strings matters here. But that doesn't seem to be reflected by this change?

BTW: Seems more readable if we move the difference calcuation code to string_compare_long_LU and string_compare_long_LL_UU at the same time.

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1571

@Hamlin-Li
Copy link
Author

Thanks for catching and suggestion, I'll modify it accordingly.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Thanks for the update. A couple of comments remain.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Do you mind several more tweaks? Looks good otherwise. Thanks.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Latest version looks good to me. Thanks!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 27, 2025
@Hamlin-Li
Copy link
Author

Latest version looks good to me. Thanks!

Thank you!

@Hamlin-Li
Copy link
Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 3, 2025

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

  • f53de92: 8350931: RISC-V: remove unnecessary src register for fp_sqrt_d/f
  • e1fc14f: 8350940: RISC-V: remove unnecessary assert_different_registers in minmax_fp
  • 79880e5: 8351033: RISC-V: TestFloat16ScalarOperations asserts with offset (4210) is too large to be patched in one beq/bge/bgeu/blt/bltu/bne instruction!
  • bb70896: 8350903: Remove explicit libjvm.so dependency for libVThreadEventTest
  • 7c187b5: 8338737: Shenandoah: Reset marking bitmaps after the cycle
  • 3602c8c: 8350955: Fix repetitions of the word "the" in runtime component comments
  • c988d7d: 8350767: Fix -Wzero-as-null-pointer-constant warnings in nsk jni stress tests
  • 67dfdfa: 8350623: Fix -Wzero-as-null-pointer-constant warnings in nsk native test utilities
  • 4a51c61: 8350567: NMT: update VMATree::register_mapping to copy the existing tag of the region
  • db69ec9: 8344009: Improve compiler memory statistics
  • ... and 105 more: https://git.openjdk.org/jdk/compare/dfcd0df60c60cf89dc01682264a573ad39e61a17...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 3, 2025

@Hamlin-Li Pushed as commit e470f47.

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

@Hamlin-Li Hamlin-Li deleted the refactor-string-compare branch March 3, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants