winch: Simplify the handling of wasm_loads#10012
Merged
alexcrichton merged 1 commit intoJan 15, 2025
Merged
Conversation
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.
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
alexcrichton
approved these changes
Jan 15, 2025
Contributor
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
ExtendKind, to account for unsigned extends; prior to this commit it wasn't explicit which loads required unsigned extends.OperandSizefromExtendKind, removing from the caller the responsibility of encoding the operand size to use.