diff options
author | Sam Clegg <sbc@chromium.org> | 2023-01-12 22:38:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 22:38:39 -0800 |
commit | 400fa0f5210a68a610db878a39237be1c6591099 (patch) | |
tree | 8bd3a24b69a908edc4d943af47bbc328e3d998c7 /wasm2c/wasm-rt.h | |
parent | ce775b0b55a29665956b021074d9eec9d2fa870a (diff) | |
download | wabt-400fa0f5210a68a610db878a39237be1c6591099.tar.gz wabt-400fa0f5210a68a610db878a39237be1c6591099.tar.bz2 wabt-400fa0f5210a68a610db878a39237be1c6591099.zip |
wasm2c: Initial implementation of memory64 (#2086)
Note, there are still some issues here that needs to be resolved,
mostly about memory sandboxing (bounds checking).
Since this is still experimental I've also added a `--experimental` flag
to wasm2c that is required in addition to passing `--enable-memory64`.
Diffstat (limited to 'wasm2c/wasm-rt.h')
-rw-r--r-- | wasm2c/wasm-rt.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/wasm2c/wasm-rt.h b/wasm2c/wasm-rt.h index 07c8fd5f..d3ab3f36 100644 --- a/wasm2c/wasm-rt.h +++ b/wasm2c/wasm-rt.h @@ -76,8 +76,12 @@ extern "C" { /* Signal handler is supported. Use it by default. */ #ifndef WASM_RT_MEMCHECK_SIGNAL_HANDLER +#ifdef SUPPORT_MEMORY64 +#define WASM_RT_MEMCHECK_SIGNAL_HANDLER 0 +#else #define WASM_RT_MEMCHECK_SIGNAL_HANDLER 1 #endif +#endif #else #define WASM_RT_SIGNAL_RECOVERY_SUPPORTED 0 @@ -202,9 +206,11 @@ typedef struct { uint8_t* data; /** The current and maximum page count for this Memory object. If there is no * maximum, `max_pages` is 0xffffffffu (i.e. UINT32_MAX). */ - uint32_t pages, max_pages; + uint64_t pages, max_pages; /** The current size of the linear memory, in bytes. */ - uint32_t size; + uint64_t size; + /** Is this memory indexed by u64 (as opposed to default u32) */ + bool is64; } wasm_rt_memory_t; /** A Table of type funcref. */ @@ -352,8 +358,9 @@ void* wasm_rt_exception(void); * ``` */ void wasm_rt_allocate_memory(wasm_rt_memory_t*, - uint32_t initial_pages, - uint32_t max_pages); + uint64_t initial_pages, + uint64_t max_pages, + bool is64); /** * Grow a Memory object by `pages`, and return the previous page count. If @@ -370,7 +377,7 @@ void wasm_rt_allocate_memory(wasm_rt_memory_t*, * } * ``` */ -uint32_t wasm_rt_grow_memory(wasm_rt_memory_t*, uint32_t pages); +uint64_t wasm_rt_grow_memory(wasm_rt_memory_t*, uint64_t pages); /** * Free a Memory object. |