Skip to content

Commit 16a4d71

Browse files
authoredFeb 6, 2024
Implement GC (Garbage Collection) feature for interpreter, AOT and LLVM-JIT (bytecodealliance#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.
1 parent 5931aaa commit 16a4d71

File tree

98 files changed

+38252
-7942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+38252
-7942
lines changed
 

‎.github/workflows/compilation_on_android_ubuntu.yml

+39-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ env:
6565
THREADS_TEST_OPTIONS: "-s spec -b -p -P"
6666
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
6767
WASI_TEST_OPTIONS: "-s wasi_certification -w"
68-
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -b -P"
68+
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -S -b -P"
69+
GC_TEST_OPTIONS: "-s spec -G -b -P"
6970

7071
jobs:
7172
build_llvm_libraries_on_ubuntu_2204:
@@ -484,6 +485,7 @@ jobs:
484485
$SIMD_TEST_OPTIONS,
485486
$THREADS_TEST_OPTIONS,
486487
$WASI_TEST_OPTIONS,
488+
$GC_TEST_OPTIONS,
487489
]
488490
wasi_sdk_release:
489491
[
@@ -517,10 +519,25 @@ jobs:
517519
test_option: $MULTI_MODULES_TEST_OPTIONS
518520
- running_mode: "multi-tier-jit"
519521
test_option: $SIMD_TEST_OPTIONS
522+
# fast-jit and multi-tier-jit don't support GC
523+
- running_mode: "fast-jit"
524+
test_option: $GC_TEST_OPTIONS
525+
- running_mode: "multi-tier-jit"
526+
test_option: $GC_TEST_OPTIONS
520527
steps:
521528
- name: checkout
522529
uses: actions/checkout@v4
523530

531+
- name: Set-up OCaml
532+
uses: ocaml/setup-ocaml@v2
533+
if: matrix.test_option == '$GC_TEST_OPTIONS'
534+
with:
535+
ocaml-compiler: 4.13
536+
537+
- name: Set-up Ocamlbuild
538+
if: matrix.test_option == '$GC_TEST_OPTIONS'
539+
run: opam install ocamlbuild dune
540+
524541
- name: download and install wasi-sdk
525542
if: matrix.test_option == '$WASI_TEST_OPTIONS'
526543
run: |
@@ -545,9 +562,9 @@ jobs:
545562

546563
- name: set env variable(if x86_32 test needed)
547564
if: >
548-
(matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
549-
|| matrix.test_option == '$WASI_TEST_OPTIONS')
550-
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
565+
((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
566+
|| matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
567+
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
551568
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
552569

553570
#only download llvm libraries in jit and aot mode
@@ -584,9 +601,18 @@ jobs:
584601

585602
- name: run tests
586603
timeout-minutes: 30
604+
if: matrix.test_option != '$GC_TEST_OPTIONS'
587605
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
588606
working-directory: ./tests/wamr-test-suites
589607

608+
- name: run gc tests
609+
timeout-minutes: 20
610+
if: matrix.test_option == '$GC_TEST_OPTIONS'
611+
run: |
612+
eval $(opam env)
613+
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
614+
working-directory: ./tests/wamr-test-suites
615+
590616
#only install x32 support libraries when to run x86_32 cases
591617
- name: install x32 support libraries
592618
if: env.TEST_ON_X86_32 == 'true'
@@ -600,10 +626,18 @@ jobs:
600626

601627
- name: run tests x86_32
602628
timeout-minutes: 30
603-
if: env.TEST_ON_X86_32 == 'true'
629+
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
604630
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
605631
working-directory: ./tests/wamr-test-suites
606632

633+
- name: run gc tests x86_32
634+
timeout-minutes: 20
635+
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
636+
run: |
637+
eval $(opam env)
638+
./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
639+
working-directory: ./tests/wamr-test-suites
640+
607641
test-wamr-ide:
608642
needs:
609643
[

‎.github/workflows/compilation_on_sgx.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ concurrency:
4848
cancel-in-progress: true
4949

5050
env:
51-
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"
51+
# ref types enabled in wamrc by default, so we need to enable it for iwasm in AOT mode
52+
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"
5253
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"
5354
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"
5455
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"

0 commit comments

Comments
 (0)
Please sign in to comment.