mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-10-22 08:51:21 +00:00
Fix fast-jit codegen lower_select issue (#1082)
Directly patch the offset in condition jmp instructions as the offset generated by asmjit is always 0.
This commit is contained in:
parent
d4fe9fcbdc
commit
aeeaf4b02e
|
@ -3545,12 +3545,9 @@ static bool
|
||||||
cmp_r_and_jmp_relative(x86::Assembler &a, int32 reg_no, COND_OP op,
|
cmp_r_and_jmp_relative(x86::Assembler &a, int32 reg_no, COND_OP op,
|
||||||
int32 offset)
|
int32 offset)
|
||||||
{
|
{
|
||||||
Imm target;
|
Imm target(INT32_MAX);
|
||||||
|
char *stream = (char *)a.code()->sectionById(0)->buffer().data()
|
||||||
if (offset >= -127 && offset <= 127)
|
+ a.code()->sectionById(0)->buffer().size();
|
||||||
target.setValue((int8)offset);
|
|
||||||
else
|
|
||||||
target.setValue(offset);
|
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case EQ:
|
case EQ:
|
||||||
|
@ -3588,6 +3585,8 @@ cmp_r_and_jmp_relative(x86::Assembler &a, int32 reg_no, COND_OP op,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The offset written by asmjit is always 0, we patch it again */
|
||||||
|
*(int32 *)(stream + 2) = offset;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user