Implement shared heap for AOT (#3815)
This commit is contained in:
@ -20,14 +20,14 @@
|
||||
/* clang-format on */
|
||||
|
||||
static uint32
|
||||
shared_malloc_wrapper(wasm_exec_env_t exec_env, uint32 size)
|
||||
shared_heap_malloc_wrapper(wasm_exec_env_t exec_env, uint32 size)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst(exec_env);
|
||||
return (uint32)module_shared_malloc((uint64)size, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
shared_free_wrapper(wasm_exec_env_t exec_env, void *ptr)
|
||||
shared_heap_free_wrapper(wasm_exec_env_t exec_env, void *ptr)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst(exec_env);
|
||||
|
||||
@ -45,8 +45,8 @@ shared_free_wrapper(wasm_exec_env_t exec_env, void *ptr)
|
||||
/* clang-format on */
|
||||
|
||||
static NativeSymbol native_symbols_shared_heap[] = {
|
||||
REG_NATIVE_FUNC(shared_malloc, "(i)i"),
|
||||
REG_NATIVE_FUNC(shared_free, "(*)"),
|
||||
REG_NATIVE_FUNC(shared_heap_malloc, "(i)i"),
|
||||
REG_NATIVE_FUNC(shared_heap_free, "(*)"),
|
||||
};
|
||||
|
||||
uint32
|
||||
|
||||
@ -1428,16 +1428,6 @@ wasm_cluster_attach_shared_heap(WASMModuleInstanceCommon *module_inst,
|
||||
{
|
||||
WASMExecEnv *exec_env = wasm_clusters_search_exec_env(module_inst);
|
||||
|
||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||
if (((WASMModuleInstance *)module_inst)->e->shared_heap) {
|
||||
LOG_WARNING("A shared heap is already attached");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (module_inst->module_type == Wasm_Module_AoT) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (exec_env == NULL) {
|
||||
/* Maybe threads have not been started yet. */
|
||||
return wasm_runtime_attach_shared_heap_internal(module_inst, heap);
|
||||
|
||||
Reference in New Issue
Block a user