Fix linear memory page count issues (#1380)

Fix issue reported in #1289 and #1371.
Enable to set the max page count to 65536.
This commit is contained in:
Wenyong Huang
2022-08-23 16:05:13 +08:00
committed by GitHub
parent e15db8d732
commit ccd627d2c6
6 changed files with 327 additions and 210 deletions

View File

@ -26,12 +26,25 @@ struct WASMMemoryInstance {
uint32 module_type;
/* Shared memory flag */
bool is_shared;
/* Number bytes per page */
uint32 num_bytes_per_page;
/* Current page count */
uint32 cur_page_count;
/* Maximum page count */
uint32 max_page_count;
/* Memory data size */
uint32 memory_data_size;
/**
* Memory data begin address, Note:
* the app-heap might be inserted in to the linear memory,
* when memory is re-allocated, the heap data and memory data
* must be copied to new memory also
*/
uint8 *memory_data;
/* Memory data end address */
uint8 *memory_data_end;
/* Heap data base address */
uint8 *heap_data;
@ -45,14 +58,6 @@ struct WASMMemoryInstance {
korp_mutex mem_lock;
#endif
/* Memory data end address */
uint8 *memory_data_end;
/* Memory data begin address, the layout is: memory data + heap data
Note: when memory is re-allocated, the heap data and memory data
must be copied to new memory also. */
uint8 *memory_data;
#if WASM_ENABLE_FAST_JIT != 0
#if UINTPTR_MAX == UINT64_MAX
uint64 mem_bound_check_1byte;