-
Notifications
You must be signed in to change notification settings - Fork 749
Refine fast jit backend translation of IR lookupswitch #1264
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
Refine fast jit backend translation of IR lookupswitch #1264
Conversation
| bh_list_insert(jmp_info_list, node); | ||
|
|
||
| imm.setValue(INT32_MAX); | ||
| a.je(imm); |
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.
in another PR, after je to INT32_MAX, there is an error checking. Do we need it here?
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.
It is because that I don't want to write offset to the invalid place when asmjit error occurs. Normally we check the asm error in jit_codegen_gen_native, after generating machine code for each INSN, in other place, we can skip the check to reduce the footprint.
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.
but if the error was raised,
| if (err_handler.err) { |
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.
Yes, it will be triggered, in the beginning of jit_codegen_gen_native, we set the error handler of code buffer:
wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp
Lines 6049 to 6051 in 7b72af3
| code.init(env); | |
| code.setErrorHandler(&err_handler); | |
| x86::Assembler a(&code); |
And the JitErrorHandler is defined here:
wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp
Lines 221 to 234 in 7b72af3
| class JitErrorHandler : public ErrorHandler | |
| { | |
| public: | |
| Error err; | |
| JitErrorHandler() | |
| : err(kErrorOk) | |
| {} | |
| void handleError(Error e, const char *msg, BaseEmitter *base) override | |
| { | |
| (void)msg; | |
| (void)base; | |
| this->err = e; |
Merge bytecodealliance:dev/fast_jit into wenyongh:opt_fast_jit_br_table_cg
Refine fast jit backend translation of IR lookupswitch (bytecodealliance#1264)
If the branches of lookupswitch is relatively big, lookup the dst
label address to jump from the address table but not compare
the value of branch one by one.