Add support for 64-bit Memory#169
Merged
peterhuene merged 5 commits intobytecodealliance:mainfrom Oct 31, 2022
Merged
Conversation
…e Wasmtime C API with bytecodealliance/wasmtime#3182. Additionally, add tests to verify the new APIs added with bytecodealliance#166 are able to access a memory beyond the 4 GiB area.
Config.WithMemory64() to allow to enable the Memory64
Config.WithMemory64() to allow to enable the Memory64Config.WithMemory64() for enabling the Memory64 proposal
…codealliance/wasmtime#3153, in order to support 64-bit memory. This also fixes the definition of native functions wasmtime_memory_size and wasmtime_memory_grow, which previously incorrectly used a UInt32 instead of UInt64, and config functions taking a bool parameter, which were previously missing the MarshalAsAttribute (to marshal a Boolean as 1 byte instead of 4 bytes).
Config.WithMemory64() for enabling the Memory64 proposal
peterhuene
approved these changes
Oct 31, 2022
Member
peterhuene
left a comment
There was a problem hiding this comment.
These changes look great! Thanks for taking the opportunity to implement this feature along with the fixes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!