-
Notifications
You must be signed in to change notification settings - Fork 749
fast-jit call_indirect optimization #1481
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
Conversation
| offset1_i32 = jit_cc_new_reg_I32(cc); | ||
| offset1 = jit_cc_new_reg_I64(cc); | ||
| GEN_INSN(SHL, offset1_i32, func_idx, NEW_CONST(I32, 2)); | ||
| GEN_INSN(I32TOI64, offset1, offset1_i32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also handle the 32-bit case like above:
if (UINTPTR_MAX == UINT64_MAX) {
offset1_i32 = jit_cc_new_reg_I32(cc);
offset1 = jit_cc_new_reg_I64(cc);
GEN_INSN(SHL, offset1_i32, func_idx, NEW_CONST(I32, 2));
GEN_INSN(I32TOI64, offset1, offset1_i32);
}
else {
offset1 = jit_cc_new_reg_I32(cc);
GEN_INSN(SHL, offset1, func_idx, NEW_CONST(I32, 2));
}| GEN_INSN(BLTU, cc->cmp_reg, jit_basic_block_label(block_import), | ||
| jit_basic_block_label(block_nonimport)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should format the coding style, the CI coding guideline check reported failure.
Please install clang-format-12 to format the source file, refer to: https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/3089321530/jobs/4997498173#step:3:35
| // if (!jit_emit_callnative(cc, jit_call_indirect, native_ret, arg_regs, 6)) { | ||
| // return false; | ||
| // } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused code
| // import_func_ptrs_reg = get_import_func_ptrs_reg(jit_frame); | ||
| // func_import = jit_cc_new_reg_I32(cc); | ||
| // JitReg func_import_offset = jit_cc_new_reg_I32(cc); | ||
| // JitReg func_import_offset_i64 = jit_cc_new_reg_I64(cc); | ||
| // // TODO: I32/2 or I64/3, switch | ||
| // GEN_INSN(SHL, func_import_offset, func_idx, NEW_CONST(I32, 3)); | ||
| // GEN_INSN(I32TOI64, func_import_offset_i64, func_import_offset); | ||
| // GEN_INSN(LDPTR, func_import, import_func_ptrs_reg, func_import_offset_i64); | ||
| // if (!jit_emit_callnative(cc, jit_invoke_native, native_ret, arg_regs, | ||
| // 6)) { | ||
| // goto fail; | ||
| // } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused code
| GEN_INSN(LDPTR, jitted_code, fast_jit_func_ptrs_reg, jitted_code_offset); | ||
| } | ||
|
|
||
| JitReg res = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the variable definition at the beginning of function.
| GEN_INSN(CALLBC, res, 0, jitted_code); | ||
| /* Store res into current frame, so that post_return in | ||
| block func_return can get the value */ | ||
| uint32 n = cc->jit_frame->sp - cc->jit_frame->lp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
fix bug in block import |
|
LGTM |
No description provided.