Skip to content

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
@keithw keithw force-pushed the custom-page-sizes branch from 7e4c060 to c28be4f Compare November 7, 2024 03:26
Base automatically changed from fix-wat-write-memuse to main November 7, 2024 03:37
@keithw keithw force-pushed the custom-page-sizes branch from c28be4f to 17904af Compare November 7, 2024 03:38
This adds support in the binary/text parsers and writers,
the validator and interpreter, and objdump (but not wasm2c).
@keithw keithw force-pushed the custom-page-sizes branch from 17904af to e2429a9 Compare November 7, 2024 12:09
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!

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
@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.

4 participants