Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm_export.h: Fix struct wasm_val_t #2435

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
wasm_export.h: Fix struct wasm_val_t
  • Loading branch information
wenyongh committed Aug 8, 2023
commit b18d05e9b4b78685d3d0348ecda2bccd8e02c9f6
2 changes: 2 additions & 0 deletions core/iwasm/include/wasm_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ enum wasm_valkind_enum {

#ifndef WASM_VAL_T_DEFINED
#define WASM_VAL_T_DEFINED
struct wasm_ref_t;

typedef struct wasm_val_t {
wasm_valkind_t kind;
Expand All @@ -197,6 +198,7 @@ typedef struct wasm_val_t {
double f64;
/* represent a foreign object, aka externref in .wat */
uintptr_t foreign;
struct wasm_ref_t *ref;
} of;
} wasm_val_t;
#endif
Expand Down
71 changes: 11 additions & 60 deletions core/iwasm/interpreter/wasm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3093,11 +3093,7 @@ llvm_jit_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
{
bool ret;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
return aot_call_indirect(exec_env, tbl_idx, elem_idx, argc, argv);
}
#endif
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);

ret = call_indirect(exec_env, tbl_idx, elem_idx, argc, argv, false, 0);
#ifdef OS_ENABLE_HW_BOUND_CHECK
Expand All @@ -3124,11 +3120,7 @@ llvm_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
char buf[96];
bool ret = false;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
return aot_invoke_native(exec_env, func_idx, argc, argv);
}
#endif
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);

module_inst = (WASMModuleInstance *)wasm_runtime_get_module_inst(exec_env);
module = module_inst->module;
Expand Down Expand Up @@ -3198,11 +3190,7 @@ llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
uint8 *maddr;
uint64 seg_len = 0;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == module_inst->module_type) {
return aot_memory_init(module_inst, seg_index, offset, len, dst);
}
#endif
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

memory_inst = wasm_get_default_memory(module_inst);
module = module_inst->module;
Expand All @@ -3228,11 +3216,7 @@ llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
bool
llvm_jit_data_drop(WASMModuleInstance *module_inst, uint32 seg_index)
{
#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == module_inst->module_type) {
return aot_data_drop(module_inst, seg_index);
}
#endif
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

module_inst->module->data_segments[seg_index]->data_length = 0;
/* Currently we can't free the dropped data segment
Expand All @@ -3247,11 +3231,7 @@ llvm_jit_drop_table_seg(WASMModuleInstance *module_inst, uint32 tbl_seg_idx)
{
WASMTableSeg *tbl_segs;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == module_inst->module_type) {
return aot_drop_table_seg(module_inst, tbl_seg_idx);
}
#endif
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

tbl_segs = module_inst->module->table_segments;
tbl_segs[tbl_seg_idx].is_dropped = true;
Expand All @@ -3265,12 +3245,7 @@ llvm_jit_table_init(WASMModuleInstance *module_inst, uint32 tbl_idx,
WASMTableInstance *tbl_inst;
WASMTableSeg *tbl_seg;

#if WASM_ENABLE_JIT != 0
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
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
tbl_seg = module_inst->module->table_segments + tbl_seg_idx;
Expand Down Expand Up @@ -3313,13 +3288,7 @@ llvm_jit_table_copy(WASMModuleInstance *module_inst, uint32 src_tbl_idx,
WASMTableInstance *src_tbl_inst;
WASMTableInstance *dst_tbl_inst;

#if WASM_ENABLE_JIT != 0
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
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

src_tbl_inst = wasm_get_table_inst(module_inst, src_tbl_idx);
dst_tbl_inst = wasm_get_table_inst(module_inst, dst_tbl_idx);
Expand Down Expand Up @@ -3350,12 +3319,7 @@ llvm_jit_table_fill(WASMModuleInstance *module_inst, uint32 tbl_idx,
{
WASMTableInstance *tbl_inst;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == module_inst->module_type) {
aot_table_fill(module_inst, tbl_idx, length, val, data_offset);
return;
}
#endif
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
bh_assert(tbl_inst);
Expand All @@ -3377,11 +3341,7 @@ llvm_jit_table_grow(WASMModuleInstance *module_inst, uint32 tbl_idx,
WASMTableInstance *tbl_inst;
uint32 i, orig_size, total_size;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == module_inst->module_type) {
return aot_table_grow(module_inst, tbl_idx, inc_size, init_val);
}
#endif
bh_assert(module_inst->module_type == Wasm_Module_Bytecode);

tbl_inst = wasm_get_table_inst(module_inst, tbl_idx);
if (!tbl_inst) {
Expand Down Expand Up @@ -3421,11 +3381,7 @@ llvm_jit_alloc_frame(WASMExecEnv *exec_env, uint32 func_index)
WASMInterpFrame *frame;
uint32 size;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
return aot_alloc_frame(exec_env, func_index);
}
#endif
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);

module_inst = (WASMModuleInstance *)exec_env->module_inst;
size = wasm_interp_interp_frame_size(0);
Expand Down Expand Up @@ -3454,12 +3410,7 @@ llvm_jit_free_frame(WASMExecEnv *exec_env)
WASMInterpFrame *frame;
WASMInterpFrame *prev_frame;

#if WASM_ENABLE_JIT != 0
if (Wasm_Module_AoT == exec_env->module_inst->module_type) {
aot_free_frame(exec_env);
return;
}
#endif
bh_assert(exec_env->module_inst->module_type == Wasm_Module_Bytecode);

frame = wasm_exec_env_get_cur_frame(exec_env);
prev_frame = frame->prev_frame;
Expand Down