We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This issue exists to discuss solutions for matching opcodes and their arguments.
The initial solution was to match just the opcode byte and then read the opcode's arguments:
match wasm.read_u8().unwrap() { MY_OPCODE => { let some_opcode_argument = wasm.read_var_u32()?; ... } }
Then the approach to use slice patterns for matching was suggested:
match &wasm.full_contents[wasm.pc..] { [MY_OPCODE, ..] => { .. } }
Here we could also match some arguments directly:
[MY_OPCODE, some_opcode_argument, ..] => { .. }
However this only works for fixed-size arguments and WASM integers are encoded through a variable-length encoding format (specified here).
[MY_OPCODE_BYTE1, MY_OPCODE_BYTE2, ..] => { .. }
The text was updated successfully, but these errors were encountered:
Personally I'd prefer the 3. solution.
Also I'm curious about what your opinion is on this topic @wucke13
Sorry, something went wrong.
No branches or pull requests
This issue exists to discuss solutions for matching opcodes and their arguments.
Summary of the initial discussion (#23 (comment))
The initial solution was to match just the opcode byte and then read the opcode's arguments:
Then the approach to use slice patterns for matching was suggested:
Here we could also match some arguments directly:
However this only works for fixed-size arguments and WASM integers are encoded through a variable-length encoding format (specified here).
Solutions
The text was updated successfully, but these errors were encountered: