mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-13 13:11:25 +00:00
wasm_export.h: Fix struct wasm_val_t (#2435)
Struct wasm_val_t should be same in wasm_export.h and wasm_c_api.h. And fix some invalid calls to aot function in LLVM JIT mode.
This commit is contained in:
parent
7e3a29d5e4
commit
8b5bb0009d
|
@ -186,6 +186,7 @@ enum wasm_valkind_enum {
|
||||||
|
|
||||||
#ifndef WASM_VAL_T_DEFINED
|
#ifndef WASM_VAL_T_DEFINED
|
||||||
#define WASM_VAL_T_DEFINED
|
#define WASM_VAL_T_DEFINED
|
||||||
|
struct wasm_ref_t;
|
||||||
|
|
||||||
typedef struct wasm_val_t {
|
typedef struct wasm_val_t {
|
||||||
wasm_valkind_t kind;
|
wasm_valkind_t kind;
|
||||||
|
@ -197,6 +198,7 @@ typedef struct wasm_val_t {
|
||||||
double f64;
|
double f64;
|
||||||
/* represent a foreign object, aka externref in .wat */
|
/* represent a foreign object, aka externref in .wat */
|
||||||
uintptr_t foreign;
|
uintptr_t foreign;
|
||||||
|
struct wasm_ref_t *ref;
|
||||||
} of;
|
} of;
|
||||||
} wasm_val_t;
|
} wasm_val_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3093,11 +3093,7 @@ llvm_jit_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
|
|
||||||
return aot_call_indirect(exec_env, tbl_idx, elem_idx, argc, argv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = call_indirect(exec_env, tbl_idx, elem_idx, argc, argv, false, 0);
|
ret = call_indirect(exec_env, tbl_idx, elem_idx, argc, argv, false, 0);
|
||||||
#ifdef OS_ENABLE_HW_BOUND_CHECK
|
#ifdef OS_ENABLE_HW_BOUND_CHECK
|
||||||
|
@ -3124,11 +3120,7 @@ llvm_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
|
||||||
char buf[96];
|
char buf[96];
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
|
|
||||||
return aot_invoke_native(exec_env, func_idx, argc, argv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
module_inst = (WASMModuleInstance *)wasm_runtime_get_module_inst(exec_env);
|
module_inst = (WASMModuleInstance *)wasm_runtime_get_module_inst(exec_env);
|
||||||
module = module_inst->module;
|
module = module_inst->module;
|
||||||
|
@ -3198,11 +3190,7 @@ llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
|
||||||
uint8 *maddr;
|
uint8 *maddr;
|
||||||
uint64 seg_len = 0;
|
uint64 seg_len = 0;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
return aot_memory_init(module_inst, seg_index, offset, len, dst);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
memory_inst = wasm_get_default_memory(module_inst);
|
memory_inst = wasm_get_default_memory(module_inst);
|
||||||
module = module_inst->module;
|
module = module_inst->module;
|
||||||
|
@ -3228,11 +3216,7 @@ llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
|
||||||
bool
|
bool
|
||||||
llvm_jit_data_drop(WASMModuleInstance *module_inst, uint32 seg_index)
|
llvm_jit_data_drop(WASMModuleInstance *module_inst, uint32 seg_index)
|
||||||
{
|
{
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
return aot_data_drop(module_inst, seg_index);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
module_inst->module->data_segments[seg_index]->data_length = 0;
|
module_inst->module->data_segments[seg_index]->data_length = 0;
|
||||||
/* Currently we can't free the dropped data segment
|
/* Currently we can't free the dropped data segment
|
||||||
|
@ -3247,11 +3231,7 @@ llvm_jit_drop_table_seg(WASMModuleInstance *module_inst, uint32 tbl_seg_idx)
|
||||||
{
|
{
|
||||||
WASMTableSeg *tbl_segs;
|
WASMTableSeg *tbl_segs;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
return aot_drop_table_seg(module_inst, tbl_seg_idx);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tbl_segs = module_inst->module->table_segments;
|
tbl_segs = module_inst->module->table_segments;
|
||||||
tbl_segs[tbl_seg_idx].is_dropped = true;
|
tbl_segs[tbl_seg_idx].is_dropped = true;
|
||||||
|
@ -3265,12 +3245,7 @@ llvm_jit_table_init(WASMModuleInstance *module_inst, uint32 tbl_idx,
|
||||||
WASMTableInstance *tbl_inst;
|
WASMTableInstance *tbl_inst;
|
||||||
WASMTableSeg *tbl_seg;
|
WASMTableSeg *tbl_seg;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
return aot_table_init(module_inst, tbl_idx, tbl_seg_idx, length,
|
|
||||||
src_offset, dst_offset);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
||||||
tbl_seg = module_inst->module->table_segments + tbl_seg_idx;
|
tbl_seg = module_inst->module->table_segments + tbl_seg_idx;
|
||||||
|
@ -3313,13 +3288,7 @@ llvm_jit_table_copy(WASMModuleInstance *module_inst, uint32 src_tbl_idx,
|
||||||
WASMTableInstance *src_tbl_inst;
|
WASMTableInstance *src_tbl_inst;
|
||||||
WASMTableInstance *dst_tbl_inst;
|
WASMTableInstance *dst_tbl_inst;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
aot_table_copy(module_inst, src_tbl_idx, dst_tbl_idx, length,
|
|
||||||
src_offset, dst_offset);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
src_tbl_inst = wasm_get_table_inst(module_inst, src_tbl_idx);
|
src_tbl_inst = wasm_get_table_inst(module_inst, src_tbl_idx);
|
||||||
dst_tbl_inst = wasm_get_table_inst(module_inst, dst_tbl_idx);
|
dst_tbl_inst = wasm_get_table_inst(module_inst, dst_tbl_idx);
|
||||||
|
@ -3350,12 +3319,7 @@ llvm_jit_table_fill(WASMModuleInstance *module_inst, uint32 tbl_idx,
|
||||||
{
|
{
|
||||||
WASMTableInstance *tbl_inst;
|
WASMTableInstance *tbl_inst;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
aot_table_fill(module_inst, tbl_idx, length, val, data_offset);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
||||||
bh_assert(tbl_inst);
|
bh_assert(tbl_inst);
|
||||||
|
@ -3377,11 +3341,7 @@ llvm_jit_table_grow(WASMModuleInstance *module_inst, uint32 tbl_idx,
|
||||||
WASMTableInstance *tbl_inst;
|
WASMTableInstance *tbl_inst;
|
||||||
uint32 i, orig_size, total_size;
|
uint32 i, orig_size, total_size;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == module_inst->module_type) {
|
|
||||||
return aot_table_grow(module_inst, tbl_idx, inc_size, init_val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
|
||||||
if (!tbl_inst) {
|
if (!tbl_inst) {
|
||||||
|
@ -3421,11 +3381,7 @@ llvm_jit_alloc_frame(WASMExecEnv *exec_env, uint32 func_index)
|
||||||
WASMInterpFrame *frame;
|
WASMInterpFrame *frame;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
|
|
||||||
return aot_alloc_frame(exec_env, func_index);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
module_inst = (WASMModuleInstance *)exec_env->module_inst;
|
module_inst = (WASMModuleInstance *)exec_env->module_inst;
|
||||||
size = wasm_interp_interp_frame_size(0);
|
size = wasm_interp_interp_frame_size(0);
|
||||||
|
@ -3454,12 +3410,7 @@ llvm_jit_free_frame(WASMExecEnv *exec_env)
|
||||||
WASMInterpFrame *frame;
|
WASMInterpFrame *frame;
|
||||||
WASMInterpFrame *prev_frame;
|
WASMInterpFrame *prev_frame;
|
||||||
|
|
||||||
#if WASM_ENABLE_JIT != 0
|
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);
|
||||||
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
|
|
||||||
aot_free_frame(exec_env);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
frame = wasm_exec_env_get_cur_frame(exec_env);
|
frame = wasm_exec_env_get_cur_frame(exec_env);
|
||||||
prev_frame = frame->prev_frame;
|
prev_frame = frame->prev_frame;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user