Skip to content

Conversation

@sunfishcode
Copy link
Member

First, this fixes the can_elide_bounds_check function to consider the guard size when determining whether all 32 bits of a 32-bit index space will be at least reserved. This allows configurations which use 4 GiB guard regions with smaller memory reservations to benefit from bounds check eliding.

Second, this fixes a subtract overflow in bounds_check_field_access when the offset is greater than the memory reservation size. In this case, optimization isn't important because the code can only ever trap, so the change here is just to avoid panicking in the compiler.

First, this fixes the `can_elide_bounds_check` function to consider the
guard size when determining whether all 32 bits of a 32-bit index space
will be at least reserved. This allows configurations which use
4 GiB guard regions with smaller memory reservations to benefit from
bounds check eliding.

Second, this fixes a subtract overflow in `bounds_check_field_access`
when the offset is greater than the memory reservation size. In this
case, optimization isn't important because the code can only ever trap,
so the change here is just to avoid panicking in the compiler.
@sunfishcode sunfishcode requested review from a team as code owners November 3, 2025 22:12
@sunfishcode sunfishcode requested review from alexcrichton and removed request for a team November 3, 2025 22:12
@sunfishcode
Copy link
Member Author

This patch exposed winch to more bounds-check-elision cases than it had been exposed to before, so I had to make some more substantial winch changes.

@github-actions github-actions bot added the winch Winch issues or pull requests label Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Subscribe to Label Action

cc @saulecabrera

This issue or pull request has been labeled: "winch"

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

  • saulecabrera: winch

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

Learn more.

@alexcrichton alexcrichton added this pull request to the merge queue Nov 4, 2025
Merged via the queue into bytecodealliance:main with commit c8dce6f Nov 4, 2025
172 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants