mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 08:55:28 +00:00
Fix duplicated destroy shared memory's lock issue (#514)
And add native symbol node to list head when registering native symbol, so as to lookup developer's registered node firstly when linking. Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
parent
5947ea492d
commit
1630cb2524
|
@ -21,7 +21,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static NativeSymbolsList g_native_symbols_list = NULL;
|
static NativeSymbolsList g_native_symbols_list = NULL;
|
||||||
static NativeSymbolsList g_native_symbols_list_end = NULL;
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
get_libc_builtin_export_apis(NativeSymbol **p_libc_builtin_apis);
|
get_libc_builtin_export_apis(NativeSymbol **p_libc_builtin_apis);
|
||||||
|
@ -287,15 +286,10 @@ register_natives(const char *module_name,
|
||||||
node->native_symbols = native_symbols;
|
node->native_symbols = native_symbols;
|
||||||
node->n_native_symbols = n_native_symbols;
|
node->n_native_symbols = n_native_symbols;
|
||||||
node->call_conv_raw = call_conv_raw;
|
node->call_conv_raw = call_conv_raw;
|
||||||
node->next = NULL;
|
|
||||||
|
|
||||||
if (g_native_symbols_list_end) {
|
/* Add to list head */
|
||||||
g_native_symbols_list_end->next = node;
|
node->next = g_native_symbols_list;
|
||||||
g_native_symbols_list_end = node;
|
g_native_symbols_list = node;
|
||||||
}
|
|
||||||
else {
|
|
||||||
g_native_symbols_list = g_native_symbols_list_end = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_SORT_DEBUG != 0
|
#if ENABLE_SORT_DEBUG != 0
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
|
@ -417,5 +411,5 @@ wasm_native_destroy()
|
||||||
node = node_next;
|
node = node_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_native_symbols_list = g_native_symbols_list_end = NULL;
|
g_native_symbols_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@ memories_deinstantiate(WASMModuleInstance *module_inst,
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
#if WASM_ENABLE_SHARED_MEMORY != 0
|
#if WASM_ENABLE_SHARED_MEMORY != 0
|
||||||
os_mutex_destroy(&memories[0]->mem_lock);
|
|
||||||
if (memories[i]->is_shared) {
|
if (memories[i]->is_shared) {
|
||||||
int32 ref_count =
|
int32 ref_count =
|
||||||
shared_memory_dec_reference(
|
shared_memory_dec_reference(
|
||||||
|
@ -104,6 +103,7 @@ memories_deinstantiate(WASMModuleInstance *module_inst,
|
||||||
if (ref_count > 0)
|
if (ref_count > 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
os_mutex_destroy(&memories[i]->mem_lock);
|
||||||
#endif
|
#endif
|
||||||
if (memories[i]->heap_handle) {
|
if (memories[i]->heap_handle) {
|
||||||
mem_allocator_destroy(memories[i]->heap_handle);
|
mem_allocator_destroy(memories[i]->heap_handle);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user