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:
@ -65,7 +65,8 @@ env:
|
||||
THREADS_TEST_OPTIONS: "-s spec -b -p -P"
|
||||
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
|
||||
WASI_TEST_OPTIONS: "-s wasi_certification -w"
|
||||
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -b -P"
|
||||
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -S -b -P"
|
||||
GC_TEST_OPTIONS: "-s spec -G -b -P"
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries_on_ubuntu_2204:
|
||||
@ -484,6 +485,7 @@ jobs:
|
||||
$SIMD_TEST_OPTIONS,
|
||||
$THREADS_TEST_OPTIONS,
|
||||
$WASI_TEST_OPTIONS,
|
||||
$GC_TEST_OPTIONS,
|
||||
]
|
||||
wasi_sdk_release:
|
||||
[
|
||||
@ -517,10 +519,25 @@ jobs:
|
||||
test_option: $MULTI_MODULES_TEST_OPTIONS
|
||||
- running_mode: "multi-tier-jit"
|
||||
test_option: $SIMD_TEST_OPTIONS
|
||||
# fast-jit and multi-tier-jit don't support GC
|
||||
- running_mode: "fast-jit"
|
||||
test_option: $GC_TEST_OPTIONS
|
||||
- running_mode: "multi-tier-jit"
|
||||
test_option: $GC_TEST_OPTIONS
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set-up OCaml
|
||||
uses: ocaml/setup-ocaml@v2
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
with:
|
||||
ocaml-compiler: 4.13
|
||||
|
||||
- name: Set-up Ocamlbuild
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: opam install ocamlbuild dune
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: |
|
||||
@ -545,9 +562,9 @@ jobs:
|
||||
|
||||
- name: set env variable(if x86_32 test needed)
|
||||
if: >
|
||||
(matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
|
||||
|| matrix.test_option == '$WASI_TEST_OPTIONS')
|
||||
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
|
||||
((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
|
||||
|| matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
|
||||
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
|
||||
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
|
||||
|
||||
#only download llvm libraries in jit and aot mode
|
||||
@ -584,9 +601,18 @@ jobs:
|
||||
|
||||
- name: run tests
|
||||
timeout-minutes: 30
|
||||
if: matrix.test_option != '$GC_TEST_OPTIONS'
|
||||
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
- name: run gc tests
|
||||
timeout-minutes: 20
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: |
|
||||
eval $(opam env)
|
||||
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
#only install x32 support libraries when to run x86_32 cases
|
||||
- name: install x32 support libraries
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
@ -600,10 +626,18 @@ jobs:
|
||||
|
||||
- name: run tests x86_32
|
||||
timeout-minutes: 30
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
|
||||
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
- name: run gc tests x86_32
|
||||
timeout-minutes: 20
|
||||
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: |
|
||||
eval $(opam env)
|
||||
./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
test-wamr-ide:
|
||||
needs:
|
||||
[
|
||||
|
||||
3
.github/workflows/compilation_on_sgx.yml
vendored
3
.github/workflows/compilation_on_sgx.yml
vendored
@ -48,7 +48,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
# ref types enabled in wamrc by default, so we need to enable it for iwasm in AOT mode
|
||||
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0 -DWAMR_BUILD_REF_TYPES=1"
|
||||
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
|
||||
67
.github/workflows/spec_test_on_nuttx.yml
vendored
67
.github/workflows/spec_test_on_nuttx.yml
vendored
@ -10,7 +10,13 @@ on:
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/spec_test_on_nuttx.yml"
|
||||
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
- "wamr-sdk/**"
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
@ -20,7 +26,7 @@ env:
|
||||
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
|
||||
WASI_SDK_PATH: "/opt/wasi-sdk"
|
||||
WAMR_COMMON_OPTION:
|
||||
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=32768\\nCONFIG_INTERPRETERS_WAMR_LOG=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\\nCONFIG_EOL_IS_LF=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\nCONFIG_LIBC_FLOATINGPOINT=y\\n"
|
||||
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=327680\\nCONFIG_INTERPRETERS_WAMR_LOG=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\\nCONFIG_EOL_IS_LF=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\nCONFIG_LIBC_FLOATINGPOINT=y\\n"
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries:
|
||||
@ -28,13 +34,13 @@ jobs:
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "ARM RISCV AArch64"
|
||||
container_image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:d9261eacf6c6ebe656c571757751c803e8f04c3ae9b820320a5ea5dd57b7205a
|
||||
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
|
||||
|
||||
spec_test_on_qemu:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build_llvm_libraries]
|
||||
container:
|
||||
image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:d9261eacf6c6ebe656c571757751c803e8f04c3ae9b820320a5ea5dd57b7205a
|
||||
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
|
||||
strategy:
|
||||
matrix:
|
||||
target_config: [
|
||||
@ -75,20 +81,25 @@ jobs:
|
||||
mode: "-t aot",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
|
||||
},
|
||||
{
|
||||
mode: "-t aot -X",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
|
||||
},
|
||||
{
|
||||
mode: "-t classic-interp",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
|
||||
},
|
||||
{
|
||||
mode: "-t fast-interp",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
|
||||
},
|
||||
# {
|
||||
# mode: "-t aot -X",
|
||||
# option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
|
||||
# },
|
||||
# {
|
||||
# mode: "-t classic-interp",
|
||||
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
|
||||
# },
|
||||
# {
|
||||
# mode: "-t fast-interp",
|
||||
# option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
|
||||
# },
|
||||
]
|
||||
|
||||
wamr_feature_option:
|
||||
# Empty option for default
|
||||
- { option: "", mode: "" }
|
||||
- { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
|
||||
|
||||
exclude:
|
||||
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
|
||||
- target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
|
||||
@ -136,6 +147,23 @@ jobs:
|
||||
if: contains(matrix.wamr_test_option.mode, 'aot')
|
||||
run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
|
||||
|
||||
# Inject the config option to NuttX
|
||||
# TODO: Merge this into NuttX once GC is generally available
|
||||
- name: Modify Kconfig
|
||||
run: |
|
||||
echo "\n" >> apps/interpreters/wamr/Kconfig
|
||||
echo "config INTERPRETERS_WAMR_GC" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tbool \"Enable GC\"" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\n" >> apps/interpreters/wamr/Kconfig
|
||||
echo "config INTERPRETERS_WAMR_AOT_STACK_FRAME" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tbool \"Enable AOT stack frame\"" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\n" >> apps/interpreters/wamr/Kconfig
|
||||
echo "config INTERPRETERS_WAMR_TAIL_CALL" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
|
||||
echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
|
||||
|
||||
- name: Enable WAMR for NuttX
|
||||
run: |
|
||||
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
|
||||
@ -144,6 +172,11 @@ jobs:
|
||||
run: |
|
||||
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
|
||||
|
||||
- name: Enable WAMR Feature for NuttX
|
||||
if: matrix.wamr_feature_option.option != ''
|
||||
run: |
|
||||
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
|
||||
|
||||
- name: Disable FPU for NuttX
|
||||
if: matrix.target_config.fpu_type == 'none'
|
||||
run: |
|
||||
@ -172,4 +205,4 @@ jobs:
|
||||
- name: Test
|
||||
run: |
|
||||
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
|
||||
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }}
|
||||
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
|
||||
|
||||
Reference in New Issue
Block a user