Skip to content

8337780: RISC-V: C2: Change C calling convention for sp to NS #20449

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

Closed
wants to merge 1 commit into from

Conversation

feilongjiang
Copy link
Member

@feilongjiang feilongjiang commented Aug 3, 2024

Hi, please review this patch that changes the C calling convention for sp to NS as sp is always saved and restored by the prolog/epilog code..
This could reduce the frame size by 16 bytes for those C2 runtime stubs [1] as we do not have to save sp on the method entry.

I also checked the calling convention type for sp on other platforms (AArch64, PPC, x86, x64, S390), and they are all treated as NS.

Testing:

  • tier1~3 & hotspot:tier4 with release build

1:

gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true, false);
gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true, false);
gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true, false);
gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true, false);
gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true, false);
gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true, false);
gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true, false);
gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true, false);
#if INCLUDE_JVMTI
gen(env, _notify_jvmti_vthread_start , notify_jvmti_vthread_Type , SharedRuntime::notify_jvmti_vthread_start, 0, true, false);
gen(env, _notify_jvmti_vthread_end , notify_jvmti_vthread_Type , SharedRuntime::notify_jvmti_vthread_end, 0, true, false);
gen(env, _notify_jvmti_vthread_mount , notify_jvmti_vthread_Type , SharedRuntime::notify_jvmti_vthread_mount, 0, true, false);
gen(env, _notify_jvmti_vthread_unmount , notify_jvmti_vthread_Type , SharedRuntime::notify_jvmti_vthread_unmount, 0, true, false);
#endif
gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false);
gen(env, _monitor_notify_Java , monitor_notify_Type , monitor_notify_C , 0 , false, false);
gen(env, _monitor_notifyAll_Java , monitor_notify_Type , monitor_notifyAll_C , 0 , false, false);
gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , true );
gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false);
gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false);


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-8337780: RISC-V: C2: Change C calling convention for sp to NS (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20449

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 3, 2024

👋 Welcome back fjiang! 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 Aug 3, 2024

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

8337780: RISC-V: C2: Change C calling convention for sp to NS

Reviewed-by: fyang, rehn

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

  • fbe8a81: 8333144: docker tests do not work when ubsan is configured
  • dabdae6: 8334599: Improve code from JDK-8302671
  • 8bd3cd5: 8337716: ByteBuffer hashCode implementations are inconsistent
  • 367e0a6: 8334755: Asymptotically faster implementation of square root algorithm

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 openjdk bot added the rfr Pull request is ready for review label Aug 3, 2024
@openjdk
Copy link

openjdk bot commented Aug 3, 2024

@feilongjiang 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 Aug 3, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 3, 2024

Webrevs

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.

Looks good. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 5, 2024
Copy link
Contributor

@robehn robehn left a comment

Choose a reason for hiding this comment

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

Thanks!

@feilongjiang
Copy link
Member Author

@RealFYang @robehn -- Thanks for the review!
/integrate

@openjdk
Copy link

openjdk bot commented Aug 6, 2024

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

  • ab509f1: 8337654: Relocate uncommon trap stub from SharedRuntime to OptoRuntime
  • 1348ece: 8332120: Potential compilation failure in istream.cpp:205 - loss of data on conversion
  • ef909bd: 8335121: Native memory leak when not recording any events
  • a117945: 8337344: Redundant javadoc at RasterPrinterJob.isCancelled
  • f9b8a22: 8337798: JFR: Remove jdk/jfr/api/consumer/recordingstream/TestOnEvent.java from ProblemList.txt
  • 958786b: 8332522: SwitchBootstraps::mappedEnumLookup constructs unused array
  • f92c60e: 8337810: ProblemList BasicDirectoryModel/LoaderThreadCount.java on Windows
  • 0d8ec42: 8337642: Remove unused APIs of GCPolicyCounters
  • 2057594: 8337782: Use THROW_NULL instead of THROW_0 in pointer contexts in prims code
  • 73718fb: 8337788: RISC-V: Cleanup code in MacroAssembler::reserved_stack_check
  • ... and 20 more: https://git.openjdk.org/jdk/compare/34edc7358f733cdf433d0ff50921bcb5a94c5e35...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 6, 2024

@feilongjiang Pushed as commit 53db937.

💡 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-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants