Skip to content

winch: Simplify the handling of wasm_loads#10012

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:winch-standardize-loads
Jan 15, 2025
Merged

winch: Simplify the handling of wasm_loads#10012
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:winch-standardize-loads

Conversation

@saulecabrera
Copy link
Copy Markdown
Member

This commit aims to simplify how wasm_loads are currently handled in the compiler by reducing the number of invariants that need to be encoded at callsites which make their emission error prone.

Concretely this change:

  • Augments ExtendKind, to account for unsigned extends; prior to this commit it wasn't explicit which loads required unsigned extends.
  • Derive OperandSize from ExtendKind, removing from the caller the responsibility of encoding the operand size to use.

This commit aims to simplify how `wasm_load`s are currently handled in
the compiler by reducing the number of invariants that need to be
encoded at callsites which make their emission error prone.

Concretely this change:

* Augments `ExtendKind`, to account for unsigned extends; prior to this
  commit it wasn't explicit which loads required unsigned extends.
* Derive `OperandSize` from `ExtendKind`, removing from the caller the
  responsibility of encoding the operand size to use.
@saulecabrera saulecabrera requested a review from a team as a code owner January 14, 2025 20:45
@saulecabrera saulecabrera requested review from fitzgen and removed request for a team January 14, 2025 20:45
@github-actions github-actions Bot added the winch Winch issues or pull requests label Jan 14, 2025
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @saulecabrera

Details 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 Jan 15, 2025
Merged via the queue into bytecodealliance:main with commit bb5e4bb Jan 15, 2025
@saulecabrera saulecabrera deleted the winch-standardize-loads branch January 15, 2025 12:05
@MarinPostma
Copy link
Copy Markdown
Contributor

MarinPostma commented Jan 15, 2025

In the context of atomic operations, which only accept zero-extends, it seems to me that encoding signed and zero extends in a single enum is maybe a bit too loose. Maybe we could split it in two enums instead:

enum ExtendKind {
    Signed(SignedExtendSize),
    Zero(ZeroExtendSize),
}

enum SignedExtendSize {
   I32extends8,
   //...
}

WIth that, we could avoid this check, for example: 53d2d25#diff-a9f4061f11240b9ea041bd84fbaf01290ff679313f87e5085eeebdecf300f5bdR1374-R1377

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.

3 participants