-
Notifications
You must be signed in to change notification settings - Fork 4
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: module-level globals #78
Conversation
Codecov ReportAttention: Patch coverage is
|
b56698e
to
6f889ac
Compare
8523b85
to
2b61458
Compare
As a note, besides what we discussed I also moved |
2b61458
to
f4cf041
Compare
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.
I'm not sure whether it is the right approach to have duplicated validations and implementations for all const expressions (see execution::const_interpreter_loop::run_const
).
While I agree that having both another validator and an execution loop for const expressions is a bit inelegant - tons of repeated code! - the alternative would be to integrate these expressions into the regular loops. While possible, this would take a lot of work and I'd wager that the end result would be less readable than what we have now. Just to name a few reasons, the const expression loop needs to return the length of its code (it isn't mentioned in the binary, like how it is for code blocks); a merged execution loop would still need to differentiate between regular execution and const execution, because we want to error out if we try to execute a non-const instruction in a const expression; etc. |
f4cf041
to
ebbdae4
Compare
The constant-expression proposal is also supported Signed-off-by: George Cosma <[email protected]>
Signed-off-by: George Cosma <[email protected]>
8096cd6
to
b8035bc
Compare
In the last commit, I've done a bit more rework so that all validation of globals, including init expressions is done entirely within the |
e504c02
to
ceaf5a6
Compare
…moved global validation entirely to validation crate Signed-off-by: George Cosma <[email protected]>
ceaf5a6
to
c512607
Compare
Pull Request Overview
This pull request adds module-level support for globals.
Note: not all constant expressions are implemented. The missing ones are:
ref.null
ref.func
global.get
(need to properly implement imports first)Testing Strategy
This pull request was tested by running
cargo test
+ a lot of manually testing in wat2wasm. Details of my findings are in the commentsHelp Wanted
I feel like the code is everywhere. A little advice as to how to organize all the new additions would be welcome!
Formatting
cargo fmt
cargo check
cargo build
cargo doc
nix fmt
Github Issue
This pr depends on #77