Commit Graph

11 Commits

Author SHA1 Message Date
Wenyong Huang
d4fe9fcbdc
Add pointer reg and LDPTR/STPTR to refine the code (#1079)
And define the fixed virtual registers, create them at the beginning.
2022-04-12 09:01:08 +08:00
Wenyong Huang
3b7bc63274
Implement op_call for fast-jit (#1075)
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.
2022-04-10 18:41:23 +08:00
Wenyong Huang
883ce5d875
Implement codegen lookupswitch (#1066) 2022-04-04 08:24:12 +08:00
liang.he
4d966d45ee
Fix issues of compiling control related opcodes (#1063) 2022-04-03 20:25:13 +08:00
liang.he
8113536278
Implement IR translation of BR_TABLE (#1064)
And refine IR translation of BR_IF
2022-04-02 14:02:06 +08:00
liang.he
7de695fb3a
Reset JitCompContext before compiling each function (#1062)
Or else, all secondary IRs and machine code will be appended into
the content of first function
2022-03-25 15:49:03 +08:00
Wenyong Huang
f7b6cd75c7
Implement part of codegen, add asmjit and zydis (#1050)
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
2022-03-22 12:22:04 +08:00
liang.he
0f2885cd66
Fix issues of handling op block/if/loop/else (#1049)
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.
2022-03-21 14:00:58 +08:00
liang.he
9fd3d53bc9
Reset members of jit block/value stack after destroy (#1048)
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`).
2022-03-15 20:10:48 +08:00
Wenyong Huang
eb518c0423
Refine code, fix some issues and add codegen framework (#1045)
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
2022-03-14 15:32:32 +08:00
Wenyong Huang
24aae4f0d6
Import Fast JIT framework (#1016)
Import Fast JIT framework and translate some opcodes in the frontend.
2022-03-09 12:34:56 +08:00