mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
Fix fast jit several issues (#1163)
This commit is contained in:
parent
d40eb1d3ff
commit
4135622008
|
@ -696,9 +696,16 @@ mov_r_to_m(x86::Assembler &a, uint32 bytes_dst, uint32 kind_dst,
|
||||||
* @return new stream
|
* @return new stream
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
mov_imm_to_m(x86::Assembler &a, x86::Mem &m_dst, Imm imm_src)
|
mov_imm_to_m(x86::Assembler &a, x86::Mem &m_dst, Imm imm_src, uint32 bytes_dst)
|
||||||
{
|
{
|
||||||
a.mov(m_dst, imm_src);
|
if (bytes_dst == 8) {
|
||||||
|
/* As there is no instruction `MOV m64, imm64`, we use
|
||||||
|
two instructions to implement it */
|
||||||
|
a.mov(regs_i64[REG_I64_FREE_IDX], imm_src);
|
||||||
|
a.mov(m_dst, regs_i64[REG_I64_FREE_IDX]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
a.mov(m_dst, imm_src);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,7 +938,7 @@ st_imm_to_base_imm_offset_imm(x86::Assembler &a, uint32 bytes_dst,
|
||||||
x86::Mem m((uintptr_t)(base + offset), bytes_dst);
|
x86::Mem m((uintptr_t)(base + offset), bytes_dst);
|
||||||
Imm imm;
|
Imm imm;
|
||||||
imm_set_value(imm, data_src, bytes_dst);
|
imm_set_value(imm, data_src, bytes_dst);
|
||||||
return mov_imm_to_m(a, m, imm);
|
return mov_imm_to_m(a, m, imm, bytes_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -954,7 +961,7 @@ st_imm_to_base_imm_offset_r(x86::Assembler &a, uint32 bytes_dst, void *data_src,
|
||||||
x86::Mem m(regs_i64[reg_no_offset], base, bytes_dst);
|
x86::Mem m(regs_i64[reg_no_offset], base, bytes_dst);
|
||||||
Imm imm;
|
Imm imm;
|
||||||
imm_set_value(imm, data_src, bytes_dst);
|
imm_set_value(imm, data_src, bytes_dst);
|
||||||
return mov_imm_to_m(a, m, imm);
|
return mov_imm_to_m(a, m, imm, bytes_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -977,7 +984,7 @@ st_imm_to_base_r_offset_imm(x86::Assembler &a, uint32 bytes_dst, void *data_src,
|
||||||
x86::Mem m(regs_i64[reg_no_base], offset, bytes_dst);
|
x86::Mem m(regs_i64[reg_no_base], offset, bytes_dst);
|
||||||
Imm imm;
|
Imm imm;
|
||||||
imm_set_value(imm, data_src, bytes_dst);
|
imm_set_value(imm, data_src, bytes_dst);
|
||||||
return mov_imm_to_m(a, m, imm);
|
return mov_imm_to_m(a, m, imm, bytes_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1001,7 +1008,7 @@ st_imm_to_base_r_offset_r(x86::Assembler &a, uint32 bytes_dst, void *data_src,
|
||||||
x86::Mem m(regs_i64[reg_no_base], regs_i64[reg_no_offset], 0, 0, bytes_dst);
|
x86::Mem m(regs_i64[reg_no_base], regs_i64[reg_no_offset], 0, 0, bytes_dst);
|
||||||
Imm imm;
|
Imm imm;
|
||||||
imm_set_value(imm, data_src, bytes_dst);
|
imm_set_value(imm, data_src, bytes_dst);
|
||||||
return mov_imm_to_m(a, m, imm);
|
return mov_imm_to_m(a, m, imm, bytes_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -454,7 +454,7 @@ handle_op_end(JitCompContext *cc, uint8 **p_frame_ip, bool is_block_polymorphic)
|
||||||
jit_basic_block_label(block->basic_block_end);
|
jit_basic_block_label(block->basic_block_end);
|
||||||
}
|
}
|
||||||
else if (insn->opcode == JIT_OP_BNE) {
|
else if (insn->opcode == JIT_OP_BNE) {
|
||||||
*(jit_insn_opnd(insn, 1)) =
|
*(jit_insn_opnd(insn, 2)) =
|
||||||
jit_basic_block_label(block->basic_block_end);
|
jit_basic_block_label(block->basic_block_end);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -837,8 +837,14 @@ jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
|
||||||
WASMModuleInstance *module_inst =
|
WASMModuleInstance *module_inst =
|
||||||
(WASMModuleInstance *)exec_env->module_inst;
|
(WASMModuleInstance *)exec_env->module_inst;
|
||||||
WASMFunctionInstance *cur_func = module_inst->functions + func_idx;
|
WASMFunctionInstance *cur_func = module_inst->functions + func_idx;
|
||||||
|
uint32 *sp_org;
|
||||||
|
|
||||||
|
sp_org = prev_frame->sp;
|
||||||
wasm_interp_call_func_native(module_inst, exec_env, cur_func, prev_frame);
|
wasm_interp_call_func_native(module_inst, exec_env, cur_func, prev_frame);
|
||||||
|
/* Restore the stack pointer of previous frame as the caller in
|
||||||
|
jitted code will just read the return value and won't decrease
|
||||||
|
the stack pointer */
|
||||||
|
prev_frame->sp = sp_org;
|
||||||
|
|
||||||
return wasm_get_exception(module_inst) ? false : true;
|
return wasm_get_exception(module_inst) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user