mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-09-05 09:21:42 +00:00
Enhance build configuration to support optional gc
There will be two sets of binaries for iwasm and wamrc. One set without a suffix indicates there is no GC support. Another set with the suffixes "-gc" and "-gc-eh" includes GC support. Users cannot disable GC through command line options; they need to choose the appropriate set to use.
This commit is contained in:
parent
6c3f6fd017
commit
797a442ed1
28
.github/workflows/build_wamrc.yml
vendored
28
.github/workflows/build_wamrc.yml
vendored
|
@ -37,6 +37,14 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ inputs.runner }}
|
runs-on: ${{ inputs.runner }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- build_options: ""
|
||||||
|
suffix: ""
|
||||||
|
- build_options: "-DWAMR_BUILD_GC=1"
|
||||||
|
suffix: "-gc"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for uploading release artifacts
|
contents: write # for uploading release artifacts
|
||||||
|
|
||||||
|
@ -58,7 +66,7 @@ jobs:
|
||||||
|
|
||||||
- name: generate wamrc binary release
|
- name: generate wamrc binary release
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build
|
cmake -S . -B build ${{ matrix.build_options }}
|
||||||
cmake --build build --config Release --parallel 4
|
cmake --build build --config Release --parallel 4
|
||||||
working-directory: wamr-compiler
|
working-directory: wamr-compiler
|
||||||
|
|
||||||
|
@ -89,17 +97,17 @@ jobs:
|
||||||
- name: Compress the binary on Windows
|
- name: Compress the binary on Windows
|
||||||
if: inputs.runner == 'windows-latest' && inputs.release
|
if: inputs.runner == 'windows-latest' && inputs.release
|
||||||
run: |
|
run: |
|
||||||
tar -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe
|
tar -czf wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe
|
||||||
Compress-Archive -Path wamrc.exe -DestinationPath wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
Compress-Archive -Path wamrc.exe -DestinationPath wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||||
mv wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
|
mv wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
|
||||||
working-directory: wamr-compiler/build/Release
|
working-directory: wamr-compiler/build/Release
|
||||||
|
|
||||||
- name: compress the binary on non-Windows
|
- name: compress the binary on non-Windows
|
||||||
if: inputs.runner != 'windows-latest' && inputs.release
|
if: inputs.runner != 'windows-latest' && inputs.release
|
||||||
run: |
|
run: |
|
||||||
# Follow the symlink to the actual binary file
|
# Follow the symlink to the actual binary file
|
||||||
tar --dereference -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
|
tar --dereference -czf wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
|
||||||
zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
|
zip wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
|
||||||
working-directory: wamr-compiler/build
|
working-directory: wamr-compiler/build
|
||||||
|
|
||||||
- name: upload release tar.gz
|
- name: upload release tar.gz
|
||||||
|
@ -109,8 +117,8 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ inputs.upload_url }}
|
upload_url: ${{ inputs.upload_url }}
|
||||||
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
asset_path: wamr-compiler/build/wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||||||
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
asset_name: wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||||||
asset_content_type: application/x-gzip
|
asset_content_type: application/x-gzip
|
||||||
|
|
||||||
- name: upload release zip
|
- name: upload release zip
|
||||||
|
@ -120,6 +128,6 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ inputs.upload_url }}
|
upload_url: ${{ inputs.upload_url }}
|
||||||
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
asset_path: wamr-compiler/build/wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||||
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
asset_name: wamrc${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
|
@ -417,7 +417,6 @@ jobs:
|
||||||
[
|
[
|
||||||
build_iwasm,
|
build_iwasm,
|
||||||
build_llvm_libraries_on_ubuntu_2204,
|
build_llvm_libraries_on_ubuntu_2204,
|
||||||
build_wamrc,
|
|
||||||
]
|
]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -464,14 +463,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
os: ${{ matrix.os }}
|
os: ${{ matrix.os }}
|
||||||
|
|
||||||
- name: Build wamrc
|
|
||||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
|
||||||
run: |
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake ..
|
|
||||||
cmake --build . --config Release --parallel 4
|
|
||||||
working-directory: wamr-compiler
|
|
||||||
|
|
||||||
- name: Build Sample [wasm-c-api]
|
- name: Build Sample [wasm-c-api]
|
||||||
run: |
|
run: |
|
||||||
VERBOSE=1
|
VERBOSE=1
|
||||||
|
|
|
@ -3953,15 +3953,7 @@ unsupport_simd:
|
||||||
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
|
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
|
||||||
unsupport_ref_types:
|
unsupport_ref_types:
|
||||||
aot_set_last_error("reference type instruction was found, "
|
aot_set_last_error("reference type instruction was found, "
|
||||||
"try removing --disable-ref-types option "
|
"try removing --disable-ref-types option ");
|
||||||
"or adding --enable-gc option");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WASM_ENABLE_GC != 0
|
|
||||||
unsupport_gc:
|
|
||||||
aot_set_last_error("GC instruction was found, "
|
|
||||||
"try adding --enable-gc option");
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3969,7 +3961,7 @@ unsupport_gc:
|
||||||
unsupport_gc_and_ref_types:
|
unsupport_gc_and_ref_types:
|
||||||
aot_set_last_error(
|
aot_set_last_error(
|
||||||
"reference type or gc instruction was found, try removing "
|
"reference type or gc instruction was found, try removing "
|
||||||
"--disable-ref-types option or adding --enable-gc option");
|
"--disable-ref-types option");
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -46,15 +46,14 @@ set(WAMR_BUILD_INTERP 1)
|
||||||
if (NOT DEFINED WAMR_BUILD_AOT)
|
if (NOT DEFINED WAMR_BUILD_AOT)
|
||||||
set(WAMR_BUILD_AOT 0)
|
set(WAMR_BUILD_AOT 0)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT DEFINED WAMR_BUILD_JIT)
|
if (NOT DEFINED WAMR_BUILD_JIT)
|
||||||
set(WAMR_BUILD_JIT 0)
|
set(WAMR_BUILD_JIT 0)
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT DEFINED WAMR_BUILD_DUMP_CALL_STACK)
|
if (NOT DEFINED WAMR_BUILD_DUMP_CALL_STACK)
|
||||||
set(WAMR_BUILD_DUMP_CALL_STACK 0)
|
set(WAMR_BUILD_DUMP_CALL_STACK 0)
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT DEFINED WAMR_BUILD_GC)
|
set(WAMR_BUILD_GC 0)
|
||||||
set(WAMR_BUILD_GC 0)
|
|
||||||
endif ()
|
|
||||||
set(WAMR_BUILD_SIMD 1)
|
set(WAMR_BUILD_SIMD 1)
|
||||||
set(WAMR_BUILD_REF_TYPES 1)
|
set(WAMR_BUILD_REF_TYPES 1)
|
||||||
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
||||||
|
@ -160,45 +159,30 @@ ExternalProject_Add(WASM_MODULE
|
||||||
|
|
||||||
################ WASM MODULES TO AOT
|
################ WASM MODULES TO AOT
|
||||||
if (WAMR_BUILD_AOT EQUAL 1)
|
if (WAMR_BUILD_AOT EQUAL 1)
|
||||||
set(WAMR_COMPILER_DIR ${CMAKE_CURRENT_LIST_DIR}/../../wamr-compiler/build)
|
set(WAMR_COMPILER_DIR ${CMAKE_CURRENT_LIST_DIR}/../../wamr-compiler)
|
||||||
message(CHECK_START "Detecting WAMR_COMPILER at ${WAMR_COMPILER_DIR}")
|
|
||||||
find_file(WAMR_COMPILER
|
ExternalProject_Add(wamrc_local
|
||||||
wamrc
|
SOURCE_DIR ${WAMR_ROOT_DIR}/wamr-compiler
|
||||||
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../wamr-compiler/build"
|
BUILD_ALWAYS TRUE
|
||||||
NO_DEFAULT_PATH
|
UPDATE_COMMAND ""
|
||||||
NO_CMAKE_FIND_ROOT_PATH
|
PATCH_COMMAND ""
|
||||||
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${WAMR_ROOT_DIR}/wamr-compiler -B build --install-prefix ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
BUILD_COMMAND ${CMAKE_COMMAND} --build build
|
||||||
|
INSTALL_COMMAND ${CMAKE_COMMAND} --install build
|
||||||
)
|
)
|
||||||
if(WAMR_COMPILER)
|
|
||||||
message(CHECK_PASS "found")
|
|
||||||
else()
|
|
||||||
message(CHECK_FAIL "not found")
|
|
||||||
endif()
|
|
||||||
if((NOT EXISTS ${WAMR_COMPILER}) )
|
|
||||||
message(FATAL_ERROR "Please build wamrc under the path=${WAMR_ROOT_DIR}/wamr-compiler/ ")
|
|
||||||
else()
|
|
||||||
message(STATUS "WAMR_COMPILER is ${WAMR_COMPILER}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1)
|
if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1)
|
||||||
list(APPEND WAMR_AOT_COMPILE_OPTIONS "--enable-dump-call-stack")
|
list(APPEND WAMR_AOT_COMPILE_OPTIONS "--enable-dump-call-stack")
|
||||||
endif ()
|
endif ()
|
||||||
if (WAMR_BUILD_GC EQUAL 1)
|
|
||||||
list(APPEND WAMR_AOT_COMPILE_OPTIONS "--enable-gc")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
wasm_to_aot
|
wasm_to_aot
|
||||||
ALL
|
ALL
|
||||||
DEPENDS
|
DEPENDS WASM_MODULE wamrc_local
|
||||||
WASM_MODULE ${WAMR_COMPILER}
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/wamrc ${WAMR_AOT_COMPILE_OPTIONS} -o mA.aot ./mA.wasm
|
||||||
COMMAND
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/wamrc ${WAMR_AOT_COMPILE_OPTIONS} -o mB.aot ./mB.wasm
|
||||||
${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mA.aot ./mA.wasm
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/wamrc ${WAMR_AOT_COMPILE_OPTIONS} -o mC.aot ./mC.wasm
|
||||||
COMMAND
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mB.aot ./mB.wasm
|
|
||||||
COMMAND
|
|
||||||
${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mC.aot ./mC.wasm
|
|
||||||
WORKING_DIRECTORY
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,23 @@
|
||||||
# WAMR MULTI-MODUEL SAMPLE
|
# WAMR MULTI-MODUEL SAMPLE
|
||||||
**WAMR supports *multi-module* in both *interpreter* mode and *aot* mode.**
|
|
||||||
|
**WAMR supports _multi-module_ in both _interpreter_ mode and _aot_ mode.**
|
||||||
|
|
||||||
Multi-modules will determine the running mode based on the type of the main module.
|
Multi-modules will determine the running mode based on the type of the main module.
|
||||||
|
|
||||||
|
## Interpreter mode
|
||||||
|
|
||||||
``` shell
|
```bash
|
||||||
$ mkdir build
|
$ cmake -S . -B build
|
||||||
|
$ cmake --build
|
||||||
$ cd build
|
$ cd build
|
||||||
$ cmake ..
|
|
||||||
$ make
|
|
||||||
$ # It will build multi_module runtime and
|
|
||||||
$ # wasm file under the ./build .
|
|
||||||
$ # If you have built wamrc,
|
|
||||||
$ # aot file will also generate.
|
|
||||||
$ ./multi_module mC.wasm
|
$ ./multi_module mC.wasm
|
||||||
$ ...
|
```
|
||||||
$ ./multi_module mC.aot
|
|
||||||
$ ...
|
|
||||||
|
|
||||||
|
## Aot mode
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cmake -S . -B build -DWAMR_BUILD_AOT=1
|
||||||
|
$ cmake --build
|
||||||
|
$ cd build
|
||||||
|
$ ./multi_module mC.aot
|
||||||
|
```
|
||||||
|
|
|
@ -62,6 +62,9 @@ if(NOT DEFINED WAMR_BUILD_AOT)
|
||||||
set(WAMR_BUILD_AOT 0)
|
set(WAMR_BUILD_AOT 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CMakePrintHelpers)
|
||||||
|
cmake_print_variables(WAMR_BUILD_INTERP WAMR_BUILD_AOT)
|
||||||
|
|
||||||
if(NOT DEFINED WAMR_BUILD_JIT)
|
if(NOT DEFINED WAMR_BUILD_JIT)
|
||||||
set(WAMR_BUILD_JIT 0)
|
set(WAMR_BUILD_JIT 0)
|
||||||
endif()
|
endif()
|
||||||
|
@ -71,11 +74,7 @@ set(WAMR_BUILD_LIBC_WASI 0)
|
||||||
set(WAMR_BUILD_MULTI_MODULE 1)
|
set(WAMR_BUILD_MULTI_MODULE 1)
|
||||||
set(WAMR_BUILD_DUMP_CALL_STACK 1)
|
set(WAMR_BUILD_DUMP_CALL_STACK 1)
|
||||||
set(WAMR_BUILD_REF_TYPES 1)
|
set(WAMR_BUILD_REF_TYPES 1)
|
||||||
|
set(WAMR_BUILD_GC 0)
|
||||||
# If not defined WAMR_BUILD_GC, set it to 0
|
|
||||||
if(NOT DEFINED WAMRC_BUILD_WITH_GC)
|
|
||||||
set(WAMRC_BUILD_WITH_GC 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED WAMR_BUILD_FAST_INTERP)
|
if(NOT DEFINED WAMR_BUILD_FAST_INTERP)
|
||||||
set(WAMR_BUILD_FAST_INTERP 1)
|
set(WAMR_BUILD_FAST_INTERP 1)
|
||||||
|
@ -130,17 +129,16 @@ if (${WAT2WASM_VERSION} VERSION_LESS 1.0.26)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(${WAMR_BUILD_AOT} EQUAL 1 AND ${WAMR_BUILD_INTERP} EQUAL 0)
|
if(${WAMR_BUILD_AOT} EQUAL 1 AND ${WAMR_BUILD_INTERP} EQUAL 0)
|
||||||
## locate wamrc
|
include(ExternalProject)
|
||||||
find_program(WAMRC
|
ExternalProject_Add(wamrc_local
|
||||||
wamrc
|
SOURCE_DIR ${WAMR_ROOT_DIR}/wamr-compiler
|
||||||
PATHS ${WAMR_ROOT_DIR}/wamr-compiler/build/
|
BUILD_ALWAYS TRUE
|
||||||
|
UPDATE_COMMAND ""
|
||||||
|
PATCH_COMMAND ""
|
||||||
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${WAMR_ROOT_DIR}/wamr-compiler -B build --install-prefix ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
BUILD_COMMAND ${CMAKE_COMMAND} --build build
|
||||||
|
INSTALL_COMMAND ${CMAKE_COMMAND} --install build
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT WAMRC)
|
|
||||||
message(SEND_ERROR "can not find wamrc. refer to \
|
|
||||||
https://github.com/bytecodealliance/wasm-micro-runtime#build-wamrc-aot-compiler"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
||||||
|
|
||||||
|
@ -182,16 +180,11 @@ foreach(EX ${EXAMPLES})
|
||||||
add_dependencies(${EX} ${EX}_WASM)
|
add_dependencies(${EX} ${EX}_WASM)
|
||||||
|
|
||||||
# generate .aot file
|
# generate .aot file
|
||||||
if(${WAMR_BUILD_AOT} EQUAL 1)
|
if(${WAMR_BUILD_AOT} EQUAL 1 AND ${WAMR_BUILD_INTERP} EQUAL 0)
|
||||||
if(${WAMRC_BUILD_WITH_GC} EQUAL 1)
|
|
||||||
set(WAMRC_GC_FLAGS "--enable-gc")
|
|
||||||
else()
|
|
||||||
set(WAMRC_GC_FLAGS "")
|
|
||||||
endif()
|
|
||||||
add_custom_target(${EX}_AOT
|
add_custom_target(${EX}_AOT
|
||||||
COMMAND ${WAMRC} ${WAMRC_GC_FLAGS} -o ${PROJECT_BINARY_DIR}/${EX}.aot
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/wamrc -o ${PROJECT_BINARY_DIR}/${EX}.aot
|
||||||
${PROJECT_BINARY_DIR}/${EX}.wasm
|
${PROJECT_BINARY_DIR}/${EX}.wasm
|
||||||
DEPENDS ${EX}_WASM
|
DEPENDS ${EX}_WASM wamrc_local
|
||||||
BYPRODUCTS ${PROJECT_BINARY_DIR}/${EX}.aot
|
BYPRODUCTS ${PROJECT_BINARY_DIR}/${EX}.aot
|
||||||
VERBATIM
|
VERBATIM
|
||||||
COMMENT "generate a aot file ${PROJECT_BINARY_DIR}/${EX}.aot"
|
COMMENT "generate a aot file ${PROJECT_BINARY_DIR}/${EX}.aot"
|
||||||
|
|
|
@ -1162,7 +1162,6 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r, output='de
|
||||||
cmd.append("--enable-multi-thread")
|
cmd.append("--enable-multi-thread")
|
||||||
|
|
||||||
if opts.gc:
|
if opts.gc:
|
||||||
cmd.append("--enable-gc")
|
|
||||||
cmd.append("--enable-tail-call")
|
cmd.append("--enable-tail-call")
|
||||||
|
|
||||||
if output == 'object':
|
if output == 'object':
|
||||||
|
|
|
@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
project(wasm-apps-aot-stack-frame)
|
project(wasm-apps-aot-stack-frame)
|
||||||
|
|
||||||
set (WAMRC_OPTION --enable-dump-call-stack --bounds-checks=1 --enable-gc)
|
set (WAMRC_OPTION --enable-dump-call-stack --bounds-checks=1)
|
||||||
|
|
||||||
if (WAMR_BUILD_TARGET STREQUAL "X86_32")
|
if (WAMR_BUILD_TARGET STREQUAL "X86_32")
|
||||||
set (WAMRC_OPTION ${WAMRC_OPTION} --target=i386)
|
set (WAMRC_OPTION ${WAMRC_OPTION} --target=i386)
|
||||||
|
|
|
@ -1157,7 +1157,6 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r, output = '
|
||||||
cmd.append("--enable-multi-thread")
|
cmd.append("--enable-multi-thread")
|
||||||
|
|
||||||
if opts.gc:
|
if opts.gc:
|
||||||
cmd.append("--enable-gc")
|
|
||||||
cmd.append("--enable-tail-call")
|
cmd.append("--enable-tail-call")
|
||||||
|
|
||||||
if opts.extended_const:
|
if opts.extended_const:
|
||||||
|
|
|
@ -835,7 +835,7 @@ function build_iwasm_with_cfg()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_wamrc()
|
function build_wamrc_with_cfg()
|
||||||
{
|
{
|
||||||
if [[ "${TARGET_LIST[*]}" =~ "${TARGET}" ]]; then
|
if [[ "${TARGET_LIST[*]}" =~ "${TARGET}" ]]; then
|
||||||
echo "suppose wamrc is already built"
|
echo "suppose wamrc is already built"
|
||||||
|
@ -852,10 +852,7 @@ function build_wamrc()
|
||||||
&& ./${BUILD_LLVM_SH} \
|
&& ./${BUILD_LLVM_SH} \
|
||||||
&& if [ -d build ]; then rm -r build/*; else mkdir build; fi \
|
&& if [ -d build ]; then rm -r build/*; else mkdir build; fi \
|
||||||
&& cd build \
|
&& cd build \
|
||||||
&& cmake .. \
|
&& cmake $* .. \
|
||||||
-DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE} \
|
|
||||||
-DWAMR_BUILD_SHRUNK_MEMORY=0 \
|
|
||||||
-DWAMR_BUILD_EXTENDED_CONST_EXPR=${ENABLE_EXTENDED_CONST_EXPR} \
|
|
||||||
&& make -j 4
|
&& make -j 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,6 +1070,18 @@ function trigger()
|
||||||
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=$WAMR_BUILD_SANITIZER"
|
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=$WAMR_BUILD_SANITIZER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local WAMRC_BUILD_FLAGS=""
|
||||||
|
WAMRC_BUILD_FLAGS+=" -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}"
|
||||||
|
WAMRC_BUILD_FLAGS+=" -DWAMR_BUILD_SHRUNK_MEMORY=0"
|
||||||
|
|
||||||
|
if [[ ${ENABLE_GC} == 1 ]]; then
|
||||||
|
WAMRC_BUILD_FLAGS+=" -DWAMR_BUILD_GC=1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${ENABLE_EXTENDED_CONST_EXPR} == 1 ]]; then
|
||||||
|
WAMRC_BUILD_FLAGS+=" -DWAMR_BUILD_EXTENDED_CONST_EXPR=1"
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure we're using the builtin WASI libc implementation
|
# Make sure we're using the builtin WASI libc implementation
|
||||||
# if we're running the wasi certification tests.
|
# if we're running the wasi certification tests.
|
||||||
if [[ $TEST_CASE_ARR ]]; then
|
if [[ $TEST_CASE_ARR ]]; then
|
||||||
|
@ -1148,7 +1157,7 @@ function trigger()
|
||||||
build_iwasm_with_cfg $BUILD_FLAGS
|
build_iwasm_with_cfg $BUILD_FLAGS
|
||||||
fi
|
fi
|
||||||
if [ -z "${WAMRC_CMD}" ]; then
|
if [ -z "${WAMRC_CMD}" ]; then
|
||||||
build_wamrc
|
build_wamrc_with_cfg $WAMRC_BUILD_FLAGS
|
||||||
WAMRC_CMD=${WAMRC_CMD_DEFAULT}
|
WAMRC_CMD=${WAMRC_CMD_DEFAULT}
|
||||||
fi
|
fi
|
||||||
for suite in "${TEST_CASE_ARR[@]}"; do
|
for suite in "${TEST_CASE_ARR[@]}"; do
|
||||||
|
|
|
@ -55,7 +55,17 @@ add_definitions(-DWASM_ENABLE_MODULE_INST_CONTEXT=1)
|
||||||
add_definitions(-DWASM_ENABLE_MEMORY64=1)
|
add_definitions(-DWASM_ENABLE_MEMORY64=1)
|
||||||
add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=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)
|
||||||
|
message ("-- GC disabled")
|
||||||
|
set(WAMR_BUILD_GC 0)
|
||||||
|
add_definitions(-DWASM_ENABLE_GC=0)
|
||||||
|
else ()
|
||||||
|
message ("-- GC enabled")
|
||||||
|
set(WAMR_BUILD_GC 1)
|
||||||
|
add_definitions(-DWASM_ENABLE_GC=1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
set (WAMR_BUILD_STRINGREF 1)
|
set (WAMR_BUILD_STRINGREF 1)
|
||||||
set (WAMR_STRINGREF_IMPL_SOURCE "STUB")
|
set (WAMR_STRINGREF_IMPL_SOURCE "STUB")
|
||||||
|
@ -285,7 +295,11 @@ include (${SHARED_DIR}/utils/shared_utils.cmake)
|
||||||
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
||||||
include (${IWASM_DIR}/libraries/thread-mgr/thread_mgr.cmake)
|
include (${IWASM_DIR}/libraries/thread-mgr/thread_mgr.cmake)
|
||||||
include (${IWASM_DIR}/common/iwasm_common.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}/interpreter/iwasm_interp.cmake)
|
||||||
include (${IWASM_DIR}/aot/iwasm_aot.cmake)
|
include (${IWASM_DIR}/aot/iwasm_aot.cmake)
|
||||||
include (${IWASM_DIR}/compilation/iwasm_compl.cmake)
|
include (${IWASM_DIR}/compilation/iwasm_compl.cmake)
|
||||||
|
|
|
@ -179,7 +179,6 @@ print_help()
|
||||||
printf(" --enable-memory-profiling Enable memory usage profiling\n");
|
printf(" --enable-memory-profiling Enable memory usage profiling\n");
|
||||||
printf(" --xip A shorthand of --enable-indirect-mode --disable-llvm-intrinsics\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-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(" --disable-llvm-intrinsics Disable the LLVM built-in intrinsics\n");
|
||||||
printf(" --enable-builtin-intrinsics=<flags>\n");
|
printf(" --enable-builtin-intrinsics=<flags>\n");
|
||||||
printf(" Enable the specified built-in intrinsics, it will override the default\n");
|
printf(" Enable the specified built-in intrinsics, it will override the default\n");
|
||||||
|
@ -424,7 +423,13 @@ main(int argc, char *argv[])
|
||||||
option.enable_aux_stack_check = true;
|
option.enable_aux_stack_check = true;
|
||||||
option.enable_bulk_memory = true;
|
option.enable_bulk_memory = true;
|
||||||
option.enable_ref_types = true;
|
option.enable_ref_types = true;
|
||||||
|
#if WASM_ENABLE_GC != 0
|
||||||
|
/* gc depends on AOT_STACK_FRAME */
|
||||||
|
option.enable_gc = true;
|
||||||
|
option.aux_stack_frame_type = AOT_STACK_FRAME_TYPE_STANDARD;
|
||||||
|
#else
|
||||||
option.enable_gc = false;
|
option.enable_gc = false;
|
||||||
|
#endif
|
||||||
option.enable_extended_const = false;
|
option.enable_extended_const = false;
|
||||||
aot_call_stack_features_init_default(&option.call_stack_features);
|
aot_call_stack_features_init_default(&option.call_stack_features);
|
||||||
|
|
||||||
|
@ -573,10 +578,6 @@ main(int argc, char *argv[])
|
||||||
else if (!strcmp(argv[0], "--enable-indirect-mode")) {
|
else if (!strcmp(argv[0], "--enable-indirect-mode")) {
|
||||||
option.is_indirect_mode = true;
|
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")) {
|
else if (!strcmp(argv[0], "--disable-llvm-intrinsics")) {
|
||||||
option.disable_llvm_intrinsics = true;
|
option.disable_llvm_intrinsics = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user