Skip to content

Commit bdd43c7

Browse files
committed
Move GetModuleInstanceExtraCommon to wasm_runtime_common.h.
1 parent c6ed8fb commit bdd43c7

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

core/iwasm/common/wasm_runtime_common.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8136,3 +8136,18 @@ wasm_runtime_check_and_update_last_used_shared_heap(
81368136
return false;
81378137
}
81388138
#endif
8139+
8140+
WASMModuleInstanceExtraCommon *
8141+
GetModuleInstanceExtraCommon(WASMModuleInstance *module_inst)
8142+
{
8143+
#if WASM_ENABLE_AOT != 0
8144+
if (module_inst->module_type == Wasm_Module_AoT) {
8145+
return &((AOTModuleInstanceExtra *)module_inst->e)->common;
8146+
}
8147+
else {
8148+
return &module_inst->e->common;
8149+
}
8150+
#else
8151+
return &module_inst->e->common;
8152+
#endif
8153+
}

core/iwasm/common/wasm_runtime_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,9 @@ wasm_runtime_check_and_update_last_used_shared_heap(
14271427
uint8 **shared_heap_base_addr_adj_p, bool is_memory64);
14281428
#endif
14291429

1430+
struct WASMModuleInstanceExtraCommon *
1431+
GetModuleInstanceExtraCommon(struct WASMModuleInstance *module_inst);
1432+
14301433
#ifdef __cplusplus
14311434
}
14321435
#endif

core/iwasm/libraries/thread-mgr/thread_manager.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,31 +1530,16 @@ wasm_cluster_is_thread_terminated(WASMExecEnv *exec_env)
15301530
return is_thread_terminated;
15311531
}
15321532

1533-
static WASMModuleInstanceExtraCommon *
1534-
GetModuleinstanceCommon(WASMModuleInstance *module_inst)
1535-
{
1536-
#if WASM_ENABLE_AOT != 0
1537-
if (module_inst->module_type == Wasm_Module_AoT) {
1538-
return &((AOTModuleInstanceExtra *)module_inst->e)->common;
1539-
}
1540-
else {
1541-
return &module_inst->e->common;
1542-
}
1543-
#else
1544-
return &module_inst->e->common;
1545-
#endif
1546-
}
1547-
15481533
void
15491534
exception_lock(WASMModuleInstance *module_inst)
15501535
{
1551-
os_mutex_lock(&GetModuleinstanceCommon(module_inst)->exception_lock);
1536+
os_mutex_lock(&GetModuleInstanceExtraCommon(module_inst)->exception_lock);
15521537
}
15531538

15541539
void
15551540
exception_unlock(WASMModuleInstance *module_inst)
15561541
{
1557-
os_mutex_unlock(&GetModuleinstanceCommon(module_inst)->exception_lock);
1542+
os_mutex_unlock(&GetModuleInstanceExtraCommon(module_inst)->exception_lock);
15581543
}
15591544

15601545
void

0 commit comments

Comments
 (0)