Fix memory sharing (#2415)

- Inherit shared memory from the parent instance, instead of
  trying to look it up by the underlying module. The old method
  works correctly only when every cluster uses different module.
- Use reference count in WASMMemoryInstance/AOTMemoryInstance
  to mark whether the memory is shared or not
- Retire WASMSharedMemNode
- For atomic opcode implementations in the interpreters, use
  a global lock for now
- Update the internal API users
  (wasi-threads, lib-pthread, wasm_runtime_spawn_thread)

Fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/1962
This commit is contained in:
YAMAMOTO Takashi
2023-08-04 11:18:13 +09:00
committed by GitHub
parent 29761c7216
commit 91592429f4
14 changed files with 298 additions and 401 deletions

View File

@ -581,7 +581,7 @@ pthread_create_wrapper(wasm_exec_env_t exec_env,
#endif
if (!(new_module_inst = wasm_runtime_instantiate_internal(
module, true, exec_env, stack_size, 0, NULL, 0)))
module, module_inst, exec_env, stack_size, 0, NULL, 0)))
return -1;
/* Set custom_data to new module instance */