-
Notifications
You must be signed in to change notification settings - Fork 749
Refine Fast JIT call indirect and call native #1620
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge main into dev/fast_jit
Import Fast JIT framework and translate some opcodes in the frontend.
Add more return value checks and set lass error Implement exception throw and add operand stack overflow check Remove lower_fe pass Use cc->cmp_reg for cmp/branch IRs Fix jit dump issues Fix some compile warnings Add part of codegen framework Remove some unused JIT IRs
After `jit_value_stack_destory()`, the `JitValue` pointed by `value_list_head` and `value_list_end` are freed and still keep the value. So, when `jit_value_stack_push()` is called, for example, `load_block_params()` after `jit_value_stack_destroy()` in `handle_op_else()`, `value_stack` will not be treated like an empty one, and new `JitValue` will be appended to `value_list_end`, which is a dangling pointer(pointer to the freed `JitValue`).
Since `basic_block_else` is NULL, it meets a crash if there is a
IF block without a else branch. Like:
``` wat
(func (export "params-id") (param i32) (result i32)
(i32.const 1)
(if (param i32) (result i32) (local.get 0)
(then)
)
)
```
Consider the ELSE block will be created lazily, focus on
`basic_block_entry" here.
Implement part of codegen and fix some frontend issues Add asmjit to emit native code and add zydis to disassemble native code Can successfully run some simple cases
Or else, all secondary IRs and machine code will be appended into the content of first function
And refine IR translation of BR_IF
Translate WASM_OP_CALL into JIT IR in the frontend, and translate JIT_OP_CALLBC and JIT_OP_CALLNATIVE in the backend. For calling wasm native API, simply call wasm_interp_call_func_native to reduce the complexity. And fix some issues, including wasm loader, frontend, register allocator, and code gen.
And define the fixed virtual registers, create them at the beginning.
Directly patch the offset in condition jmp instructions as the offset generated by asmjit is always 0.
Merge main into dev/fast_jit
WASM_OP_SET_GLOBAL_AUX_STACK is unsupported currently
Since locals and operands are stored in stack on a 64-bit platform
`DEF_UNI_INT_CONST_OPS` handle the case of both consts
Refine fast jit frontend translation of opcode br_if and br_table: for br_if, no need to clear jit frame after handling new basic block, so as to re-use registers of current basic block, for br_table, no need to create a new basic block to jump if there is no parameters/results to copy to new block, just jumping to current existing basic block.
Merge below INSNs translated by wasm opcodes cmp + if or cmp + br_if: CMP, SELECTcc, CMP, Bcc into CMP, Bcc So as to reduce the instructions
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.
Use register edx/rdx/xmm0 to pass i32/i64/f32/f64 return value in function return/call, but not store and load the register into stack frame, so as to improve performance.
Fix fast jit sanitizer complaint in fe/jit_emit_number.c: i32/i64 multiply integer overflow was detected
Merge main into dev/fast_jit
Merge two JIT IRs: ADD maddr, memory_data, offset1 LOAD/STORE value, maddr, 0 into one JIT IR: LOAD/STORE value, memory_data, offset1
Copy fast jit function pointers array from wasm module into wasm module instance, and load fast jit func pointer from module instance instead of wasm module, so as to reduce one load operation when callbc.
Fix compilation issues Update build scripts Update documents
Fix interp hw bound check issues (#1322)
Merge main into dev/fast_jit
Merge main into dev/fast_jit
Translate call_indirect opcode by calling wasm functions with JIT IRs instead of calling jit_call_indirect runtime API, so as to improve the performance.
Translate call native function process with JIT IRs to validate each pointer argument and convert it into native address, and then call the native function directly instead of calling jit_invoke_native runtime API, so as to improve the performance.
Merge main into dev/fast_jit
vickiegpt
pushed a commit
to vickiegpt/wamr-aot-gc-checkpoint-restore
that referenced
this pull request
May 27, 2024
…ce#1620) Translate call_indirect opcode by calling wasm functions with Fast JIT IRs instead of calling jit_call_indirect runtime API, so as to improve the performance. Translate call native function process with Fast JIT IRs to validate each pointer argument and convert it into native address, and then call the native function directly instead of calling jit_invoke_native runtime API, so as to improve the performance.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.