Skip to content
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

Generate valid Wasm code #22

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Generate valid Wasm code #22

merged 1 commit into from
Feb 23, 2024

Conversation

vouillon
Copy link
Collaborator

Ensure that locals are always explicitely initialized before being used.

- Ensure that locals are always explicitely initialized before being used
- Do not declare a memory if not used
Copy link
Collaborator

@OlivierNicole OlivierNicole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a question and a nitpicking comment, this looks good to me (although I’m not up to speed on the whole compilation pipeline yet, so I can’t pretend to be an authority).

compiler/lib/wasm/wa_code_generation.ml Show resolved Hide resolved
Comment on lines +104 to +107
| I32 | I64 | F32 | F64 | Ref { nullable = true; _ } ->
mark_initialized ctx (i + param_count)
| Ref { nullable = false; _ } -> ())
locals;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Nit, feel free to ignore) Personally I like to explicit the ignored fields in order to have the typechecker catch all the potential locations to update when modifying a type, but I admit that it can be verbose.

@OlivierNicole OlivierNicole merged commit 5230813 into main Feb 23, 2024
4 checks passed
@vouillon vouillon deleted the valid-code branch March 8, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants