Refine lock/unlock shared memory (#2682)

Split memory instance's field `uint32 ref_count` into `bool is_shared_memory`
and `uint16 ref_count`, and lock the memory only when `is_shared_memory`
flag is true, no need to acquire a lock for non-shared memory when shared
memory feature is enabled.
This commit is contained in:
Wenyong Huang
2023-10-31 11:46:03 +08:00
committed by GitHub
parent 3570a94a08
commit 52db362b89
7 changed files with 110 additions and 64 deletions

View File

@ -374,6 +374,7 @@ memory_instantiate(WASMModuleInstance *module_inst, WASMModuleInstance *parent,
#if WASM_ENABLE_SHARED_MEMORY != 0
if (is_shared_memory) {
memory->is_shared_memory = true;
memory->ref_count = 1;
}
#endif