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:
@ -9,6 +9,10 @@
|
||||
#include "aot_runtime.h"
|
||||
#include "aot_intrinsic.h"
|
||||
|
||||
#if WASM_ENABLE_STRINGREF != 0
|
||||
#include "string_object.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -49,10 +53,11 @@ typedef struct {
|
||||
#define REG_REF_TYPES_SYM()
|
||||
#endif
|
||||
|
||||
#if (WASM_ENABLE_PERF_PROFILING != 0) || (WASM_ENABLE_DUMP_CALL_STACK != 0)
|
||||
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
||||
#define REG_AOT_TRACE_SYM() \
|
||||
REG_SYM(aot_alloc_frame), \
|
||||
REG_SYM(aot_free_frame),
|
||||
REG_SYM(aot_free_frame), \
|
||||
REG_SYM(aot_frame_update_profile_info),
|
||||
#else
|
||||
#define REG_AOT_TRACE_SYM()
|
||||
#endif
|
||||
@ -129,6 +134,48 @@ typedef struct {
|
||||
#define REG_LLVM_PGO_SYM()
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_GC != 0
|
||||
#define REG_GC_SYM() \
|
||||
REG_SYM(aot_array_init_with_data), \
|
||||
REG_SYM(aot_create_func_obj), \
|
||||
REG_SYM(aot_obj_is_instance_of), \
|
||||
REG_SYM(aot_rtt_type_new), \
|
||||
REG_SYM(wasm_array_obj_copy), \
|
||||
REG_SYM(wasm_array_obj_new), \
|
||||
REG_SYM(wasm_externref_obj_to_internal_obj), \
|
||||
REG_SYM(wasm_internal_obj_to_externref_obj), \
|
||||
REG_SYM(wasm_obj_is_type_of), \
|
||||
REG_SYM(wasm_struct_obj_new),
|
||||
#else
|
||||
#define REG_GC_SYM()
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_STRINGREF != 0
|
||||
#define REG_STRINGREF_SYM() \
|
||||
REG_SYM(wasm_stringref_obj_new), \
|
||||
REG_SYM(wasm_stringview_wtf8_obj_new), \
|
||||
REG_SYM(wasm_stringview_wtf16_obj_new), \
|
||||
REG_SYM(wasm_stringview_iter_obj_new), \
|
||||
REG_SYM(wasm_string_destroy), \
|
||||
REG_SYM(wasm_string_new_const), \
|
||||
REG_SYM(wasm_string_new_with_encoding), \
|
||||
REG_SYM(wasm_string_measure), \
|
||||
REG_SYM(wasm_string_wtf16_get_length), \
|
||||
REG_SYM(wasm_string_encode), \
|
||||
REG_SYM(wasm_string_concat), \
|
||||
REG_SYM(wasm_string_eq), \
|
||||
REG_SYM(wasm_string_is_usv_sequence), \
|
||||
REG_SYM(wasm_string_create_view), \
|
||||
REG_SYM(wasm_string_advance), \
|
||||
REG_SYM(wasm_string_slice), \
|
||||
REG_SYM(wasm_string_get_wtf16_codeunit),\
|
||||
REG_SYM(wasm_string_next_codepoint), \
|
||||
REG_SYM(wasm_string_rewind), \
|
||||
REG_SYM(wasm_string_dump),
|
||||
#else
|
||||
#define REG_STRINGREF_SYM()
|
||||
#endif
|
||||
|
||||
#define REG_COMMON_SYMBOLS \
|
||||
REG_SYM(aot_set_exception_with_id), \
|
||||
REG_SYM(aot_invoke_native), \
|
||||
@ -160,6 +207,8 @@ typedef struct {
|
||||
REG_AOT_TRACE_SYM() \
|
||||
REG_INTRINSIC_SYM() \
|
||||
REG_LLVM_PGO_SYM() \
|
||||
REG_GC_SYM() \
|
||||
REG_STRINGREF_SYM() \
|
||||
|
||||
#define CHECK_RELOC_OFFSET(data_size) do { \
|
||||
if (!check_reloc_offset(target_section_size, \
|
||||
|
||||
Reference in New Issue
Block a user