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

Add support for the custom-page-sizes proposal #2502

Merged
merged 5 commits into from
Nov 8, 2024
Merged

Conversation

keithw
Copy link
Member

@keithw keithw commented Nov 7, 2024

This PR adds support for the custom-page-sizes proposal to the lexer, the binary/text parsers and writers, the validator, interpreter, and objdump.

Will plan to add wasm2c in a future PR.

(@fitzgen)

@keithw keithw requested review from fitzgen and sbc100 November 7, 2024 03:01
Base automatically changed from fix-wat-write-memuse to main November 7, 2024 03:37
This adds support in the binary/text parsers and writers,
the validator and interpreter, and objdump (but not wasm2c).
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Nice!

include/wabt/interp/interp-inl.h Outdated Show resolved Hide resolved
src/shared-validator.cc Show resolved Hide resolved
src/shared-validator.cc Outdated Show resolved Hide resolved
Copy link

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Very cool! Love to see it! I'll add a link to this PR from the proposal's Overview.md.

@fitzgen
Copy link

fitzgen commented Nov 7, 2024

FWIW, if you want to hammer on this implementation a bit, wasm-smith has support for generating pseudorandom Wasm modules that use the custom-page-sizes proposal and you can use it via the CLI as well if you don't want to link to Rust code:

$ head -n 100 < /dev/urandom | wasm-tools smith -t --custom-page-sizes-enabled=true --max-memories=20
(module
  (table (;0;) 567 296841 externref)
  (memory (;0;) i64 345681 (pagesize 0x1))
  (global (;0;) f64 f64.const -0x1.cbe613cfc1799p+665 (;=-275023225219671150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;))
  (global (;1;) externref ref.null extern)
  (export "" (table 0))
  (export "\u{1d}k1" (table 0))
  (elem (;0;) declare funcref)
  (data (;0;) "")
)

You can throw that in a loop, pass each test case to WABT, and see if you can find any bugs :)

(There are also lots of other knobs you can configure to control Wasm module generation, for example you can disable random imports to make the modules self contained, turn off the GC proposal, etc...)

@keithw keithw merged commit 765b47d into main Nov 8, 2024
18 checks passed
@keithw keithw deleted the custom-page-sizes branch November 8, 2024 15:45
@keithw keithw restored the custom-page-sizes branch November 11, 2024 07:49
@keithw keithw deleted the custom-page-sizes branch November 11, 2024 07:49
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.

3 participants