mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
some refactor
This commit is contained in:
parent
0b0ef2d117
commit
91f1234dd0
|
@ -267,9 +267,10 @@ wasm_runtime_chain_shared_heaps(WASMSharedHeap *head, WASMSharedHeap *body)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (cur = shared_heap_list; cur; cur = cur->next) {
|
for (cur = shared_heap_list; cur; cur = cur->next) {
|
||||||
if (cur->chain_next == body) {
|
if (cur->chain_next == body || cur->chain_next == head) {
|
||||||
LOG_WARNING("To create shared heap chain, the `body` shared heap "
|
LOG_WARNING(
|
||||||
"can't already be in a chain");
|
"To create shared heap chain, both the 'head' and 'body' "
|
||||||
|
"shared heap can't already be the 'body' in another a chain");
|
||||||
os_mutex_unlock(&shared_heap_list_lock);
|
os_mutex_unlock(&shared_heap_list_lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -600,12 +601,10 @@ wasm_runtime_shared_heap_malloc(WASMModuleInstanceCommon *module_inst,
|
||||||
*p_native_addr = native_addr;
|
*p_native_addr = native_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memory->is_memory64)
|
return memory->is_memory64
|
||||||
return shared_heap->start_off_mem64
|
? shared_heap->start_off_mem64
|
||||||
+ ((uint8 *)native_addr - shared_heap->base_addr);
|
: shared_heap->start_off_mem32
|
||||||
else
|
+ ((uint8 *)native_addr - shared_heap->base_addr);
|
||||||
return shared_heap->start_off_mem32
|
|
||||||
+ ((uint8 *)native_addr - shared_heap->base_addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user