Skip to content

Support u64 limits for wasm 3.0 - #2836

Merged
zherczeg merged 1 commit into
WebAssembly:mainfrom
zherczeg:mem64_limits
Aug 26, 2026
Merged

zherczeg merged 1 commit into
WebAssembly:mainfrom
zherczeg:mem64_limits

Conversation

@zherczeg

Copy link
Copy Markdown
Collaborator

https://github.com/WebAssembly/memory64/blob/main/proposals/memory64/Overview.md#structure

The limits structure uses u64 values, regardless the table/memory is i32.

This is also true for WebAssembly 3.0:
https://webassembly.github.io/spec/core/binary/types.html#binary-limits

Hence (memory 0x1_0000_0000) and (table 0x1_0000_0000 funcref)) are not-malformed, only invalid now. This patch tries to support this behavior.

@zherczeg
zherczeg force-pushed the mem64_limits branch 4 times, most recently from 9db64aa to 83991a1 Compare August 25, 2026 10:47
Comment thread src/binary-reader.cc
if (has_max) {
CHECK_RESULT(ReadU32OrU64Leb128(&max, is_64, "table max elem count"));
CHECK_RESULT(ReadU32OrU64Leb128(&max, options_.features.memory64_enabled(),
"table max elem count"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we just always read this as u64 now?

I guess the natural followup is should have features like memory64 be always-enabled these days? (i.e. now that its stage5?)

@zherczeg

Copy link
Copy Markdown
Collaborator Author

Sorry, I just saw that there was an update with enable flags. I updated the tests, and now everything green.

@zherczeg
zherczeg merged commit 4e145b3 into WebAssembly:main Aug 26, 2026
17 checks passed
@zherczeg
zherczeg deleted the mem64_limits branch August 26, 2026 05:57
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