diff --git a/.github/workflows/build_wamrc.yml b/.github/workflows/build_wamrc.yml index df257723f0..ebc585cf38 100644 --- a/.github/workflows/build_wamrc.yml +++ b/.github/workflows/build_wamrc.yml @@ -37,6 +37,14 @@ permissions: jobs: build: runs-on: ${{ inputs.runner }} + strategy: + matrix: + include: + - build_options: "" + suffix: "-gc" + - build_options: "-DWAMR_BUILD_GC=0" + suffix: "" + permissions: contents: write # for uploading release artifacts @@ -58,7 +66,7 @@ jobs: - name: generate wamrc binary release run: | - cmake -S . -B build + cmake -S . -B build ${{ matrix.build_options }} cmake --build build --config Release --parallel 4 working-directory: wamr-compiler @@ -89,17 +97,17 @@ jobs: - name: Compress the binary on Windows if: inputs.runner == 'windows-latest' && inputs.release run: | - tar -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe - Compress-Archive -Path wamrc.exe -DestinationPath wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip - mv wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../ + tar -czf wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe + Compress-Archive -Path wamrc.exe -DestinationPath wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip + mv wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../ working-directory: wamr-compiler/build/Release - name: compress the binary on non-Windows if: inputs.runner != 'windows-latest' && inputs.release run: | # Follow the symlink to the actual binary file - tar --dereference -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc - zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc + tar --dereference -czf wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc + zip wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc working-directory: wamr-compiler/build - name: upload release tar.gz @@ -109,8 +117,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ inputs.upload_url }} - asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz - asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz + asset_path: wamr-compiler/build/wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz + asset_name: wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz asset_content_type: application/x-gzip - name: upload release zip @@ -120,6 +128,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ inputs.upload_url }} - asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip - asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip + asset_path: wamr-compiler/build/wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip + asset_name: wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip asset_content_type: application/zip diff --git a/wamr-compiler/CMakeLists.txt b/wamr-compiler/CMakeLists.txt index 00940c62d2..f10977f6e9 100644 --- a/wamr-compiler/CMakeLists.txt +++ b/wamr-compiler/CMakeLists.txt @@ -55,7 +55,15 @@ add_definitions(-DWASM_ENABLE_MODULE_INST_CONTEXT=1) add_definitions(-DWASM_ENABLE_MEMORY64=1) add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=1) -add_definitions(-DWASM_ENABLE_GC=1) +# Sync with iwasm in config_common.cmake. Turn off GC by default. +# can be turned on by setting WAMR_BUILD_GC to 1 +if (NOT DEFINED WAMR_BUILD_GC) + set(WAMR_BUILD_GC 0) + add_definitions(-DWASM_ENABLE_GC=0) +else () + set(WAMR_BUILD_GC 1) + add_definitions(-DWASM_ENABLE_GC=${WAMR_BUILD_GC}) +endif () set (WAMR_BUILD_STRINGREF 1) set (WAMR_STRINGREF_IMPL_SOURCE "STUB") @@ -285,7 +293,11 @@ include (${SHARED_DIR}/utils/shared_utils.cmake) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) include (${IWASM_DIR}/libraries/thread-mgr/thread_mgr.cmake) include (${IWASM_DIR}/common/iwasm_common.cmake) -include (${IWASM_DIR}/common/gc/iwasm_gc.cmake) +if (WAMR_BUILD_GC EQUAL 1) + include (${IWASM_DIR}/common/gc/iwasm_gc.cmake) +else () + message (STATUS "WAMR GC is disabled") +endif () include (${IWASM_DIR}/interpreter/iwasm_interp.cmake) include (${IWASM_DIR}/aot/iwasm_aot.cmake) include (${IWASM_DIR}/compilation/iwasm_compl.cmake) diff --git a/wamr-compiler/main.c b/wamr-compiler/main.c index 2ca9a175db..bd75291ea7 100644 --- a/wamr-compiler/main.c +++ b/wamr-compiler/main.c @@ -179,7 +179,6 @@ print_help() printf(" --enable-memory-profiling Enable memory usage profiling\n"); printf(" --xip A shorthand of --enable-indirect-mode --disable-llvm-intrinsics\n"); printf(" --enable-indirect-mode Enable call function through symbol table but not direct call\n"); - printf(" --enable-gc Enable GC (Garbage Collection) feature\n"); printf(" --disable-llvm-intrinsics Disable the LLVM built-in intrinsics\n"); printf(" --enable-builtin-intrinsics=\n"); printf(" Enable the specified built-in intrinsics, it will override the default\n"); @@ -424,7 +423,11 @@ main(int argc, char *argv[]) option.enable_aux_stack_check = true; option.enable_bulk_memory = true; option.enable_ref_types = true; +#if WASM_ENABLE_GC != 0 + option.enable_gc = true; +#else option.enable_gc = false; +#endif option.enable_extended_const = false; aot_call_stack_features_init_default(&option.call_stack_features); @@ -573,10 +576,6 @@ main(int argc, char *argv[]) else if (!strcmp(argv[0], "--enable-indirect-mode")) { option.is_indirect_mode = true; } - else if (!strcmp(argv[0], "--enable-gc")) { - option.aux_stack_frame_type = AOT_STACK_FRAME_TYPE_STANDARD; - option.enable_gc = true; - } else if (!strcmp(argv[0], "--disable-llvm-intrinsics")) { option.disable_llvm_intrinsics = true; }