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

Cranelift: Leave the return address in place for most tail calls on x64 #6650

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Jun 27, 2023

When the size of the tail callee's and tail caller's stack arguments is the same, we don't need to copy the return address and then write it to the stack again, since its original location will also be its final location. That is, we were previously reading a value and then writing it back to the exact same location.

Builds on top of #6635

@fitzgen fitzgen requested a review from cfallin June 27, 2023 17:16
@fitzgen fitzgen requested a review from a team as a code owner June 27, 2023 17:16
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:x64 Issues related to x64 codegen isle Related to the ISLE domain-specific language labels Jun 27, 2023
@github-actions
Copy link

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "cranelift:area:x64", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

LGTM on last commit!

When the size of the tail callee's and tail caller's stack arguments is the
same, we don't need to copy the return address and then write it to the stack
again, since its original location will also be its final location. That is, we
were previously reading a value and then writing it back to the exact same
location.
@fitzgen fitzgen force-pushed the leave-return-address-in-place-for-most-tail-calls branch from 1a77ae7 to 58b2f6b Compare June 27, 2023 18:10
@fitzgen fitzgen enabled auto-merge June 27, 2023 18:10
@fitzgen fitzgen added this pull request to the merge queue Jun 27, 2023
Merged via the queue into bytecodealliance:main with commit c2cb37b Jun 27, 2023
@fitzgen fitzgen deleted the leave-return-address-in-place-for-most-tail-calls branch June 27, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants