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

@ -215,12 +215,25 @@ else
CFLAGS += -DWASM_ENABLE_BULK_MEMORY=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME), y)
CFLAGS += -DWASM_ENABLE_AOT_STACK_FRAME=1
else
CFLAGS += -DWASM_ENABLE_AOT_STACK_FRAME=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_PERF_PROFILING),y)
CFLAGS += -DWASM_ENABLE_PERF_PROFILING=1
CFLAGS += -DWASM_ENABLE_AOT_STACK_FRAME=1
else
CFLAGS += -DWASM_ENABLE_PERF_PROFILING=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_GC_PERF_PROFILING),y)
CFLAGS += -DWASM_ENABLE_GC_PERF_PROFILING=1
else
CFLAGS += -DWASM_ENABLE_GC_PERF_PROFILING=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_MEMORY_PROFILING),y)
CFLAGS += -DWASM_ENABLE_MEMORY_PROFILING=1
else
@ -235,6 +248,7 @@ endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_DUMP_CALL_STACK),y)
CFLAGS += -DWASM_ENABLE_DUMP_CALL_STACK=1
CFLAGS += -DWASM_ENABLE_AOT_STACK_FRAME=1
else
CFLAGS += -DWASM_ENABLE_DUMP_CALL_STACK=0
endif
@ -304,6 +318,20 @@ else
CFLAGS += -DWASM_ENABLE_LIB_WASI_THREADS=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_GC),y)
CFLAGS += -DWASM_ENABLE_GC=1
CSRCS += gc_common.c gc_type.c gc_object.c
VPATH += $(IWASM_ROOT)/common/gc
else
CFLAGS += -DWASM_ENABLE_GC=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_GC_MANUALLY),y)
CFLAGS += -DWASM_GC_MANUALLY=1
else
CFLAGS += -DWASM_GC_MANUALLY=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_LIB_PTHREAD),y)
CFLAGS += -DWASM_ENABLE_LIB_PTHREAD=1
CSRCS += lib_pthread_wrapper.c
@ -359,6 +387,12 @@ else
CFLAGS += -DWASM_ENABLE_REF_TYPES=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_TAIL_CALL),y)
CFLAGS += -DWASM_ENABLE_TAIL_CALL=1
else
CFLAGS += -DWASM_ENABLE_TAIL_CALL=0
endif
ifeq ($(CONFIG_INTERPRETERS_WAMR_ENABLE_EXCE_HANDLING),y)
CFLAGS += -DWASM_ENABLE_EXCE_HANDLING=1
CFLAGS += -DWASM_ENABLE_TAGS=1
@ -396,6 +430,7 @@ CSRCS += nuttx_platform.c \
ems_kfc.c \
ems_alloc.c \
ems_hmu.c \
ems_gc.c \
bh_assert.c \
bh_bitmap.c \
bh_common.c \