Open wenyongh opened 1 year ago
Use this issue to track the develop progress, and update the task list realtime.
Use this issue to track and update the AOT GC opcodes compilation development progress.
Basically finished most part of subtask 1, part 1, namely modifying existing opcodes, including:
pr #2376 merged
Subtask 1, part 2, to implement simple new opcodes, along with Subtask3 branching opcodes:
pr #2486 merged
Subtask 2, array-related and struct-related opcodes
GC (Gargbage Collection) AOT support
Motivation
In recent days we had refactored the WAMR GC interpreter implementation to support most features of the latest GC MVP spec proposal, and support the bytecodes generate by the binaryen toolchain as its bytecode definition is a little different from the definition of GC MVP, so as to run the workloads compiled by the ts2wasm compiler, which uses binaryen as its backend. To gain better performance and to reduce the footprint, we started to enable the GC AOT support.
Design Goals
Non Design Goals now
Changes of the AOT file format
There will be many changes in the AOT file format, after discussion, some decisions were made:
Some detail changes
Changes of the AOT compiler
--enable-gc
option for wamrccmake -DWAMR_BUILD_GC_BINARYEN=1
is used, the GC binaryen version is built.Changes of AOT module instance layout
AOT stack frame process
Current AOT doesn’t operate on the stack frame except in the feature of dumping call stack, memory profiling and performance profiling, since the operations of the function local variables and stack operators have been optimized to the operations of registers and native stack by the LLVM codegen. Since GC requires to add the GC objects into the rootset during garbage collection, we need to enable the stack frame operation for GC AOT:
Export GC runtime APIs
See PR #2143, the runtime APIs are exported in
core/iwasm/include/gc_export.h
GC multi-threding support
Need to enhance the thread suspend/resume mechanism to support the GC reclaim process for multi-thread: a thread can require to suspend the world if needed, or suspend other threads (wait until all other threads are suspended), and resume them after a job is finished. This mechanism is also helpful to the linear memory info synchronization when memory.grow opcode is exectued, see the discussion in #2078. Another scenario may be the source debugger for multi-threading: when a thread enters into break pointer, it may ask other threads to suspend, and resume them when it continues to run.
Standardize the interface between runtime and GC heap allocator
Better define the interface between runtime and GC heap allocator so that we can easily integrate a new GC heap allocator into runtime.
References