Add support for 64-bit Memory #169
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this PR adds support for 64-bit memories, by adjusting the APIs to match the C API introduced with bytecodealliance/wasmtime#3153 and bytecodealliance/wasmtime#3182.
It contains the following changes:
Config.WithMemory64()for enabling the Memory64 proposal.Memory,MemoryExportandMemoryImportthat work with pages (likeMinimum,Maximum,Grow()) to use alonginstead ofuint. (I choselonginstead ofulongbecause memory pages cannot exceed2**48, and becauseulongisn't CLS-compliant.)(This will be a breaking change.)
Is64Bitproperty that specifies whether the memory is a 64-bit memory.Memorywith more than 32767 pages #166 are able to access a memory beyond the 4 GiB area, and that the new APIs correctly retrieve the memory type definitions.Additionally, this fixes previously incorrect definitions of native functions
wasmtime_memory_sizeandwasmtime_memory_grow, where the parameter incorrectly useduintinstead ofulongafter the changes introduced in the Wasmtime C API.Also, I noticed that for native Config functions taking a C
boolparameter, the[MarshalAs]attribute was missing, which meant these parameter were marshaled by .NET as 4-byteBOOLinstead of an 1-byte value.What do you think?
Thanks!