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

wasm2c: support the custom-page-sizes proposal #2508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keithw
Copy link
Member

@keithw keithw commented Nov 11, 2024

(Sequenced behind #2507)

This adds support for the custom-page-sizes proposal to wasm2c. It passes the custom-page-sizes tests (including the ones in WebAssembly/custom-page-sizes#31 that haven't made it to the testsuite repo and WABT yet).

@keithw keithw requested review from sbc100 and shravanrn November 11, 2024 09:20
@keithw keithw force-pushed the w2c-per-memory-strategy branch 2 times, most recently from 6c60b37 to 167eae8 Compare November 11, 2024 09:36
@keithw keithw force-pushed the w2c-custom-page-sizes branch from 22a441d to 102a439 Compare November 11, 2024 09:38
@keithw keithw force-pushed the w2c-per-memory-strategy branch from 167eae8 to 985d89d Compare November 11, 2024 09:48
@keithw keithw force-pushed the w2c-custom-page-sizes branch 2 times, most recently from abc2180 to 5386b49 Compare November 11, 2024 09:56
@keithw keithw force-pushed the w2c-per-memory-strategy branch from 985d89d to 5604e96 Compare November 11, 2024 09:57
@keithw keithw force-pushed the w2c-custom-page-sizes branch from 5386b49 to dd73c28 Compare November 11, 2024 09:58
@keithw keithw force-pushed the w2c-per-memory-strategy branch from 5604e96 to 4e60e9c Compare November 11, 2024 10:01
@keithw keithw force-pushed the w2c-custom-page-sizes branch from dd73c28 to a5c6e43 Compare November 11, 2024 10:01
@keithw keithw force-pushed the w2c-per-memory-strategy branch from 4e60e9c to 8abbc62 Compare November 12, 2024 18:41
keithw added a commit that referenced this pull request Dec 4, 2024
(Sequenced behind #2506)

This PR allows "software-bounds-checked" memories and
"guard-page-checked" memories to coexist in the same module.

It creates two versions of every memory operation: an unrestricted
version (that works with any memory) and a `_default32` version (for
memories with default page size and i32 indexing).

The unrestricted version calls `MEMCHECK_GENERAL`, which does a 64-bit
software `RANGE_CHECK` to check that the operation reads/writes within
the bounds of the memory.

The `_default32` version calls `MEMCHECK_DEFAULT32`, which is the same
as the old `MEMCHECK`: if the runtime declares
`WASM_RT_MEMCHECK_GUARD_PAGES`, it will do nothing. Otherwise it will do
a 32-bit software `RANGE_CHECK` (which seems to be one less instruction
than the 64-bit `RANGE_CHECK`).

This is a stepping stone to supporting custom-page-sizes (which will
need to be software bounds-checked) (#2508).
Base automatically changed from w2c-per-memory-strategy to w2c-harmonize-types December 4, 2024 20:37
keithw added a commit that referenced this pull request Dec 4, 2024
(Sequenced behind #2506)

This PR allows "software-bounds-checked" memories and
"guard-page-checked" memories to coexist in the same module.

It creates two versions of every memory operation: an unrestricted
version (that works with any memory) and a `_default32` version (for
memories with default page size and i32 indexing).

The unrestricted version calls `MEMCHECK_GENERAL`, which does a 64-bit
software `RANGE_CHECK` to check that the operation reads/writes within
the bounds of the memory.

The `_default32` version calls `MEMCHECK_DEFAULT32`, which is the same
as the old `MEMCHECK`: if the runtime declares
`WASM_RT_MEMCHECK_GUARD_PAGES`, it will do nothing. Otherwise it will do
a 32-bit software `RANGE_CHECK` (which seems to be one less instruction
than the 64-bit `RANGE_CHECK`).

This is a stepping stone to supporting custom-page-sizes (which will
need to be software bounds-checked) (#2508).
@keithw keithw force-pushed the w2c-harmonize-types branch from 6fd3383 to 89ba648 Compare December 4, 2024 20:37
keithw added a commit that referenced this pull request Dec 6, 2024
(Sequenced behind #2506)

This PR allows "software-bounds-checked" memories and
"guard-page-checked" memories to coexist in the same module.

It creates two versions of every memory operation: an unrestricted
version (that works with any memory) and a `_default32` version (for
memories with default page size and i32 indexing).

The unrestricted version calls `MEMCHECK_GENERAL`, which does a 64-bit
software `RANGE_CHECK` to check that the operation reads/writes within
the bounds of the memory.

The `_default32` version calls `MEMCHECK_DEFAULT32`, which is the same
as the old `MEMCHECK`: if the runtime declares
`WASM_RT_MEMCHECK_GUARD_PAGES`, it will do nothing. Otherwise it will do
a 32-bit software `RANGE_CHECK` (which seems to be one less instruction
than the 64-bit `RANGE_CHECK`).

This is a stepping stone to supporting custom-page-sizes (which will
need to be software bounds-checked) (#2508).
@keithw keithw force-pushed the w2c-harmonize-types branch from 89ba648 to 648efc8 Compare December 6, 2024 14:40
keithw added a commit that referenced this pull request Dec 18, 2024
…hecks per-memory (#2507)

The PR updates the bulk memory operations (memory.fill, memory.copy,
table.fill, etc.) to support 64-bit addresses and counts. Previously these functions
only took u32's, even with memory64 enabled. (#2506)

This PR also allows "software-bounds-checked" memories and "guard-page-checked"
memories to coexist in the same module. It creates two versions of every memory
operation: an unrestricted version (that works with any memory) and a _default32
version (for memories with default page size and i32 indexing). (#2507)

#2506 and #2507 have been squashed together to avoid a performance regression.

This is a stepping stone to supporting custom-page-sizes (which will need to be
software-bounds-checked) (#2508).
Base automatically changed from w2c-harmonize-types to main December 18, 2024 03:07
@keithw keithw force-pushed the w2c-custom-page-sizes branch from a5c6e43 to 6f5face Compare December 18, 2024 03:14
@keithw
Copy link
Member Author

keithw commented Dec 18, 2024

@sbc100 @shravanrn This is now ripe for review against the main branch.

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