Add support for memory growth#3569
Conversation
|
|
||
| WASM_RUNTIME_API_EXTERN bool | ||
| wasm_runtime_enlarge_memory(wasm_module_inst_t module_inst, | ||
| uint32_t inc_page_count); |
There was a problem hiding this comment.
i guess it's better to use uint64_t for memory64.
There was a problem hiding this comment.
In the current design of memory64, the max page count is UINT32_MAX since the max size of linear memory size is 274TB roughly and should be able to meet most of the requirements:
wasm-micro-runtime/core/iwasm/interpreter/wasm.h
Lines 97 to 108 in 65bf04e
And the type of page count in WASMMemoryInstance is kept uint32:
wasm-micro-runtime/core/iwasm/interpreter/wasm_runtime.h
Lines 116 to 118 in 65bf04e
So here using uint32 should be also OK.
There was a problem hiding this comment.
whatever limitations the current implementation has, it's better to make the user-facing api align with the spec and future-proof, IMO.
There was a problem hiding this comment.
OK, @bnason-nf, could you upload another PR to change uint32_t to uint64_t? Thanks.
There was a problem hiding this comment.
Submitted #3573.
As mentioned by @wenyongh, there are other existing 32 bit memory limitations. Aside from the many uint32 types used internally for memory sizes, including by the direct aot_enlarge_memory() and wasm_enlarge_memory() calls by this new function, there are also many places in the public API that use uint32_t for memory sizes. So as I'm sure everyone is aware, PR #3573 is just a tiny piece of a much larger effort that will need to take place to make WAMR truly 64 bit compatible.
No description provided.