-
Notifications
You must be signed in to change notification settings - Fork 824
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
feat(interface-types) New numbers and strings instructions #1329
feat(interface-types) New numbers and strings instructions #1329
Conversation
Basically the `x-to-y` instructions have been renamed `y.from_x`. This patch updates the instruction. The binary representation isn't specified yet, so it's just arbitrary values.
…ructions. The `string.lift_memory` instruction replaces `memory-to-string`, and `string.lower_memory` replaces `string-to-memory`.
This method allows to peek the last item on the stack (if any) by reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
) | ||
})?; | ||
|
||
let pointer = to_native::<i32>(&inputs[0], instruction)? as usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the fact this is an i32
cause a problem? It seems that we can't access the upper 2gb of memory by casting from i32
to usize
because -1i32 as usize
is 18446744073709551615
; -1i32 as u32 as usize
is 4294967295
which seems closer to what we'd want here.
If this is a mistake, perhaps we should add some tests using the upper 2gb of memory to make sure everything is working as expected as this issue will likely be in a lot of places!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. The pointer is of kind i32
in the spec. It is regular a Wasm core type i32
. Our API needs a usize
, hence the casting.
You're right we need to check it is positive. I'm opening an issue to focus on that.
bors r+ |
1329: feat(interface-types) New numbers and strings instructions r=Hywan a=Hywan This PR does 3 things: * Transforms the `x-to-y` number lowerings and liftings instructions to the new set of instructions `y.from_x`. It's just the opposite. It's more logical, but the diff is dense due to that. The `lowering_lifting` module is renamed `numbers`. * Renames `memory-to-string` to `string.lift_memory`, and `string-to-memory` to `string.lower_memory`. It's also more logical, but the diff is dense due to that too. The `memory_to_string` and `string_to_module` modules are merged into the `strings` module. * Introduce the new `string.size` instruction (in the `strings` module). I think commits are clean and atomic enough, so it might be better to review it like that. For binary encoding/decoding, the binary representation is absolutely entirely arbitrary (since the working notes define nothing, obviously). Cf https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/Instructions.md Co-authored-by: Ivan Enderlin <[email protected]> Co-authored-by: Ivan Enderlin <[email protected]>
Timed out |
This PR does 3 things:
x-to-y
number lowerings and liftings instructions to the new set of instructionsy.from_x
. It's just the opposite. It's more logical, but the diff is dense due to that. Thelowering_lifting
module is renamednumbers
.memory-to-string
tostring.lift_memory
, andstring-to-memory
tostring.lower_memory
. It's also more logical, but the diff is dense due to that too. Thememory_to_string
andstring_to_module
modules are merged into thestrings
module.string.size
instruction (in thestrings
module).I think commits are clean and atomic enough, so it might be better to review it like that.
For binary encoding/decoding, the binary representation is absolutely entirely arbitrary (since the working notes define nothing, obviously).
Cf https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/Instructions.md