Implement GC (Garbage Collection) feature for interpreter, AOT and LLVM-JIT (#3125)

Implement the GC (Garbage Collection) feature for interpreter mode,
AOT mode and LLVM-JIT mode, and support most features of the latest
spec proposal, and also enable the stringref feature.

Use `cmake -DWAMR_BUILD_GC=1/0` to enable/disable the feature,
and `wamrc --enable-gc` to generate the AOT file with GC supported.

And update the AOT file version from 2 to 3 since there are many AOT
ABI breaks, including the changes of AOT file format, the changes of
AOT module/memory instance layouts, the AOT runtime APIs for the
AOT code to invoke and so on.
This commit is contained in:
Wenyong Huang
2024-02-06 20:47:11 +08:00
committed by GitHub
parent 5931aaacbe
commit 16a4d71b34
98 changed files with 33469 additions and 3159 deletions

View File

@ -8461,7 +8461,7 @@ jit_codegen_compile_call_to_llvm_jit(const WASMType *func_type)
/* r10 = outs_area->lp */
{
x86::Mem m(regs_i64[hreg_info->exec_env_hreg_index],
(uint32)offsetof(WASMExecEnv, wasm_stack.s.top));
(uint32)offsetof(WASMExecEnv, wasm_stack.top));
a.mov(reg_lp, m);
a.add(reg_lp, (uint32)offsetof(WASMInterpFrame, lp));
}
@ -8701,15 +8701,15 @@ fast_jit_alloc_frame(WASMExecEnv *exec_env, uint32 param_cell_num,
* frame to store the function results from jit function to call,
* the second is the frame for the jit function
*/
if ((uint8 *)exec_env->wasm_stack.s.top + size_frame1 + size_frame2
> exec_env->wasm_stack.s.top_boundary) {
if ((uint8 *)exec_env->wasm_stack.top + size_frame1 + size_frame2
> exec_env->wasm_stack.top_boundary) {
wasm_set_exception(module_inst, "wasm operand stack overflow");
return NULL;
}
/* Allocate the frame */
frame = (WASMInterpFrame *)exec_env->wasm_stack.s.top;
exec_env->wasm_stack.s.top += size_frame1;
frame = (WASMInterpFrame *)exec_env->wasm_stack.top;
exec_env->wasm_stack.top += size_frame1;
frame->function = NULL;
frame->ip = NULL;
@ -9073,9 +9073,9 @@ jit_codegen_compile_call_to_fast_jit(const WASMModule *module, uint32 func_idx)
/* rdx = exec_env->cur_frame->prev_frame */
a.mov(x86::rdx,
x86::ptr(x86::rsi, (uint32)offsetof(WASMInterpFrame, prev_frame)));
/* exec_env->wasm_stack.s.top = cur_frame */
/* exec_env->wasm_stack.top = cur_frame */
{
x86::Mem m(x86::rdi, offsetof(WASMExecEnv, wasm_stack.s.top));
x86::Mem m(x86::rdi, offsetof(WASMExecEnv, wasm_stack.top));
a.mov(m, x86::rsi);
}
/* exec_env->cur_frame = prev_frame */