diff --git a/.dockerignore b/.dockerignore index 20b1ad526..f322b3c1e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,16 +1,12 @@ # for now, it is used to speed up wasi-nn tests only. # you shall adapt below rules to incoming requirements -build -*/build -*/*/build -*/*/*/build -*/*/*/*/build -*/*/*/*/*/build -*/*/*/*/*/*/build +**/build +**/tmp.* .* +**/*.gguf -core/deps -!core/deps/tensorflow-src -samples -tests +/core/deps/ +!/core/deps/tensorflow-src +/samples +/tests diff --git a/.github/actions/install-linux-sgx/action.yml b/.github/actions/install-linux-sgx/action.yml new file mode 100644 index 000000000..17757573d --- /dev/null +++ b/.github/actions/install-linux-sgx/action.yml @@ -0,0 +1,47 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Always follow https://download.01.org/intel-sgx/latest/linux-latest/docs/ + +name: "Install Intel SGX SDK" +description: "Installs the Intel SGX SDK and necessary libraries for Ubuntu." +author: "Intel Corporation" +inputs: + os: + description: "Operating system to install on (ubuntu-22.04)" + required: true + +runs: + using: "composite" + steps: + - name: Check Runner OS + if: ${{ inputs.os != 'ubuntu-22.04' }} + shell: bash + run: | + echo "::error title=⛔ error hint::Only support ubuntu-22.04 for now" + exit 1 + + - name: Create installation directory + shell: bash + run: sudo mkdir -p /opt/intel + + - name: Download and install SGX SDK on ubuntu-22.04 + if: ${{ inputs.os == 'ubuntu-22.04' }} + shell: bash + run: | + sudo wget -O sgx_linux_x64_sdk.bin https://download.01.org/intel-sgx/sgx-linux/2.25/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.25.100.3.bin + sudo chmod +x sgx_linux_x64_sdk.bin + echo 'yes' | sudo ./sgx_linux_x64_sdk.bin + working-directory: /opt/intel + + - name: Add SGX repository and install libraries + shell: bash + run: | + echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list + wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - + sudo apt update + sudo apt install -y libsgx-launch libsgx-urts + + - name: Source SGX SDK environment + shell: bash + run: source /opt/intel/sgxsdk/environment diff --git a/.github/actions/install-wasi-sdk-wabt/action.yml b/.github/actions/install-wasi-sdk-wabt/action.yml new file mode 100644 index 000000000..c872e4252 --- /dev/null +++ b/.github/actions/install-wasi-sdk-wabt/action.yml @@ -0,0 +1,80 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Get URLs from: +# - https://github.com/WebAssembly/wasi-sdk/releases +# - https://github.com/WebAssembly/wabt/releases + +# Install WASI-SDK and WABT at /opt +# /opt is the assumed location widely used in the project +name: Install WASI-SDK and WABT + +description: A composite action to download and install wasi-sdk and wabt on Ubuntu, macOS. + +inputs: + os: + description: "Operating system to install on (ubuntu, macos)" + required: true + +runs: + using: "composite" + steps: + - name: Check Runner OS + if: ${{ !startsWith(inputs.os, 'ubuntu') && !startsWith(inputs.os, 'windows') && !startsWith(inputs.os, 'macos') }} + shell: bash + run: | + echo "::error title=⛔ error hint::Support Ubuntu, Windows, and macOS Only" + exit 1 + + - name: Set up wasi-sdk and wabt on Ubuntu + if: ${{ startsWith(inputs.os, 'ubuntu') }} + shell: bash + run: | + sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz + sudo tar -xf wasi-sdk.tar.gz + sudo ln -sf wasi-sdk-25.0-x86_64-linux/ wasi-sdk + sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-ubuntu-20.04.tar.gz + sudo tar -xf wabt.tar.gz + sudo ln -sf wabt-1.0.37 wabt + /opt/wasi-sdk/bin/clang --version + /opt/wabt/bin/wasm-interp --version + echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ubuntu" + working-directory: /opt + + - name: Set up wasi-sdk and wabt on macOS-13 (intel) + if: ${{ inputs.os == 'macos-13' }} + shell: bash + run: | + sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-macos.tar.gz + sudo tar -xf wasi-sdk.tar.gz + sudo ln -sf wasi-sdk-25.0-x86_64-macos wasi-sdk + sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.36/wabt-1.0.36-macos-12.tar.gz + sudo tar -xf wabt.tar.gz + sudo ln -sf wabt-1.0.36 wabt + /opt/wasi-sdk/bin/clang --version + /opt/wabt/bin/wasm-interp --version + echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on macos-13" + working-directory: /opt + + - name: Set up wasi-sdk and wabt on macOS-14 (arm64) + if: ${{ inputs.os == 'macos-14' }} + shell: bash + run: | + sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-macos.tar.gz + sudo tar -xf wasi-sdk.tar.gz + sudo ln -sf wasi-sdk-25.0-arm64-macos wasi-sdk + sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-macos-14.tar.gz + sudo tar -xf wabt.tar.gz + sudo ln -sf wabt-1.0.37 wabt + /opt/wasi-sdk/bin/clang --version + /opt/wabt/bin/wasm-interp --version + echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on macos-14" + working-directory: /opt + + #TODO: Add support for Windows + - name: Set up wasi-sdk and wabt on Windows + if: ${{ startsWith(inputs.os, 'windows') }} + shell: powershell + run: | + echo "::notice::Support for Windows is not implemented yet" + exit 1 diff --git a/.github/workflows/build_iwasm_release.yml b/.github/workflows/build_iwasm_release.yml index 74c2340af..a975d5807 100644 --- a/.github/workflows/build_iwasm_release.yml +++ b/.github/workflows/build_iwasm_release.yml @@ -137,7 +137,8 @@ jobs: - name: compress the binary on non-Windows if: inputs.runner != 'windows-latest' run: | - tar czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm + # Follow the symlink to the actual binary file + tar --dereference -czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm zip iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm working-directory: ${{ inputs.cwd }}/build diff --git a/.github/workflows/build_llvm_libraries.yml b/.github/workflows/build_llvm_libraries.yml index bdfd4fcb2..97e665c0b 100644 --- a/.github/workflows/build_llvm_libraries.yml +++ b/.github/workflows/build_llvm_libraries.yml @@ -65,6 +65,7 @@ jobs: shell: bash run: | echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --llvm-ver)" >> $GITHUB_OUTPUT + working-directory: build-scripts # Bump the prefix number to evict all previous caches and # enforce a clean build, in the unlikely case that some @@ -88,14 +89,6 @@ jobs: ./core/deps/llvm/build/share key: ${{ steps.create_lib_cache_key.outputs.key}} - - uses: actions/cache@v4 - with: - path: ~/.ccache - key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }} - restore-keys: | - 0-ccache-${{ inputs.os }} - if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-20.04' - - uses: actions/cache@v4 with: path: ~/.cache/ccache diff --git a/.github/workflows/build_wamr_lldb.yml b/.github/workflows/build_wamr_lldb.yml index b5cf53a4c..297328cc5 100644 --- a/.github/workflows/build_wamr_lldb.yml +++ b/.github/workflows/build_wamr_lldb.yml @@ -172,6 +172,12 @@ jobs: python3 ci/validate_lldb.py --port 1239 --lldb core/deps/wamr-lldb/bin/lldb --wamr wamr-debug/iwasm --verbose working-directory: . + # Define CMAKE_OSX_SYSROOT to avoid the error: + # no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excServer.c' + # no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excUser.c' + # + # This workaround should be removed when the issue is fixed in llvm-project: + # - https://github.com/llvm/llvm-project/pull/138020/ - name: build lldb macos if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos') run: | @@ -179,6 +185,7 @@ jobs: mkdir -p wamr-lldb cmake -S ./llvm -B build \ -G Ninja \ + -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) \ -DCMAKE_INSTALL_PREFIX=../wamr-lldb \ -DCMAKE_BUILD_TYPE:STRING="Release" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ diff --git a/.github/workflows/build_wamrc.yml b/.github/workflows/build_wamrc.yml index 6b687c749..55d63f13b 100644 --- a/.github/workflows/build_wamrc.yml +++ b/.github/workflows/build_wamrc.yml @@ -73,7 +73,8 @@ jobs: - name: compress the binary on non-Windows if: inputs.runner != 'windows-latest' && inputs.release run: | - tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc + # 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 working-directory: wamr-compiler/build diff --git a/.github/workflows/check_version_h.yml b/.github/workflows/check_version_h.yml new file mode 100644 index 000000000..ab23ecf9e --- /dev/null +++ b/.github/workflows/check_version_h.yml @@ -0,0 +1,29 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +name: confirm version.h stay in sync + +on: + workflow_call: + +permissions: + contents: read + +jobs: + confirm_version: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: cmake execute to generate version.h + run: cmake -B build_version -S . + + - name: confirm version.h + run: | + if [ -z "$(git status --porcelain | grep version.h)" ]; then + echo "version.h is in sync" + else + echo "version.h is not in sync" + exit 1 + fi diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a98d5f1a9..37d331189 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,7 +53,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3.28.8 + uses: github/codeql-action/init@v3.28.19 with: languages: ${{ matrix.language }} @@ -70,7 +70,7 @@ jobs: - run: | ./.github/scripts/codeql_buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3.28.8 + uses: github/codeql-action/analyze@v3.28.19 with: category: "/language:${{matrix.language}}" upload: false @@ -99,14 +99,14 @@ jobs: output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif - name: Upload CodeQL results to code scanning - uses: github/codeql-action/upload-sarif@v3.28.8 + uses: github/codeql-action/upload-sarif@v3.28.19 with: sarif_file: ${{ steps.step1.outputs.sarif-output }} category: "/language:${{matrix.language}}" - name: Upload CodeQL results as an artifact if: success() || failure() - uses: actions/upload-artifact@v4.6.0 + uses: actions/upload-artifact@v4.6.2 with: name: codeql-results path: ${{ steps.step1.outputs.sarif-output }} diff --git a/.github/workflows/coding_guidelines.yml b/.github/workflows/coding_guidelines.yml index 569237778..b1f59ce3b 100644 --- a/.github/workflows/coding_guidelines.yml +++ b/.github/workflows/coding_guidelines.yml @@ -19,7 +19,7 @@ permissions: jobs: compliance_job: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: checkout uses: actions/checkout@v4 diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index b08498cc0..44c8d5168 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -74,6 +74,12 @@ permissions: contents: read jobs: + check_version_h: + permissions: + contents: read + actions: write + uses: ./.github/workflows/check_version_h.yml + build_llvm_libraries_on_ubuntu_2204: permissions: contents: read @@ -152,6 +158,7 @@ jobs: "-DWAMR_BUILD_PERF_PROFILING=1", "-DWAMR_BUILD_REF_TYPES=1", "-DWAMR_BUILD_SIMD=1", + "-DWAMR_BUILD_LIB_SIMDE=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_MEMORY64=1", @@ -172,11 +179,9 @@ jobs: make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - # SIMD only on JIT/AOT mode + # SIMD only on JIT/AOT/fast interpreter mode - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_SIMD=1" - - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" # DEBUG_INTERP only on CLASSIC INTERP mode - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" @@ -310,17 +315,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] + build_target: [ + "X86_64", + "X86_32", + ] include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} + steps: - name: checkout uses: actions/checkout@v4 @@ -341,19 +343,10 @@ jobs: if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - name: download and install wasi-sdk - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo ln -sf wasi-sdk-20.0 wasi-sdk - - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo mv wabt-1.0.31 wabt + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: Build wamrc run: | @@ -362,10 +355,16 @@ jobs: cmake --build . --config Release --parallel 4 working-directory: wamr-compiler + - name: Install dependencies for X86_32 + if: matrix.build_target == 'X86_32' + run: | + sudo apt-get update + sudo apt-get install -y g++-multilib + - name: Build and run unit tests run: | mkdir build && cd build - cmake .. + cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }} cmake --build . --config Release --parallel 4 ctest working-directory: tests/unit @@ -392,14 +391,6 @@ jobs: $MULTI_TIER_JIT_BUILD_OPTIONS, ] os: [ubuntu-22.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} @@ -425,12 +416,10 @@ jobs: if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo mv wabt-1.0.31 wabt + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: Build wamrc if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) @@ -448,6 +437,11 @@ jobs: ctest --test-dir build --output-on-failure working-directory: samples/wasm-c-api + - name: Build Sample [printversion] + run: | + ./test.sh + working-directory: samples/printversion + build_samples_others: needs: [ @@ -459,34 +453,14 @@ jobs: strategy: matrix: os: [ubuntu-22.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} + steps: - name: checkout uses: actions/checkout@v4 - - name: download and install wasi-sdk - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo ln -sf wasi-sdk-20.0 wasi-sdk - - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo ln -sf wabt-1.0.31 wabt - name: Get LLVM libraries id: retrieve_llvm_libs uses: actions/cache@v4 @@ -498,12 +472,19 @@ jobs: ./core/deps/llvm/build/libexec ./core/deps/llvm/build/share key: ${{ matrix.llvm_cache_key }} + + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} + - name: Build wamrc run: | mkdir build && cd build cmake .. cmake --build . --config Release --parallel 4 working-directory: wamr-compiler + - name: Build Sample [basic] run: | cd samples/basic @@ -629,10 +610,6 @@ jobs: $MEMORY64_TEST_OPTIONS, $MULTI_MEMORY_TEST_OPTIONS, ] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} @@ -643,11 +620,9 @@ jobs: test_option: $WAMR_COMPILER_TEST_OPTIONS exclude: # incompatible modes and features - # classic-interp and fast-interp don't support simd + # classic-interp doesn't support simd - running_mode: "classic-interp" test_option: $SIMD_TEST_OPTIONS - - running_mode: "fast-interp" - test_option: $SIMD_TEST_OPTIONS # llvm jit doesn't support multi module - running_mode: "jit" test_option: $MULTI_MODULES_TEST_OPTIONS @@ -675,7 +650,7 @@ jobs: test_option: $MEMORY64_TEST_OPTIONS - running_mode: "multi-tier-jit" test_option: $MEMORY64_TEST_OPTIONS - # aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory + # aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory - running_mode: "aot" test_option: $MULTI_MEMORY_TEST_OPTIONS - running_mode: "fast-interp" @@ -703,20 +678,9 @@ jobs: - name: download and install wasi-sdk if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo mv wasi-sdk-20.0 wasi-sdk - - # It is a temporary solution until new wasi-sdk that includes bug fixes is released - - name: build wasi-libc from source - if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: | - git clone https://github.com/WebAssembly/wasi-libc - cd wasi-libc - make -j AR=/opt/wasi-sdk/bin/llvm-ar NM=/opt/wasi-sdk/bin/llvm-nm CC=/opt/wasi-sdk/bin/clang THREAD_MODEL=posix - echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: set env variable(if llvm are used) if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit' @@ -754,7 +718,7 @@ jobs: - name: Build WASI thread tests if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: bash build.sh --sysroot "$SYSROOT_PATH" + run: bash build.sh working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/ - name: build socket api tests diff --git a/.github/workflows/compilation_on_macos.yml b/.github/workflows/compilation_on_macos.yml index 66938905c..44c7973f1 100644 --- a/.github/workflows/compilation_on_macos.yml +++ b/.github/workflows/compilation_on_macos.yml @@ -46,11 +46,14 @@ 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" - 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" - LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" - LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" + # For BUILD + AOT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" + CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -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_FAST_JIT=0 -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=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" + LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" + LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" + MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" permissions: contents: read @@ -214,60 +217,82 @@ jobs: working-directory: product-mini/platforms/${{ matrix.platform }} build_samples_wasm_c_api: - needs: [build_iwasm] + needs: + [ + build_iwasm, + build_llvm_libraries_on_intel_macos, + build_wamrc, + ] runs-on: ${{ matrix.os }} strategy: matrix: make_options: [ - # Running modes supported + $AOT_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS, - # Running modes unsupported - #$LLVM_LAZY_JIT_BUILD_OPTIONS, - #$LLVM_EAGER_JIT_BUILD_OPTIONS, - #$AOT_BUILD_OPTIONS, + $FAST_JIT_BUILD_OPTIONS, + $LLVM_LAZY_JIT_BUILD_OPTIONS, + $LLVM_EAGER_JIT_BUILD_OPTIONS, + $MULTI_TIER_JIT_BUILD_OPTIONS, ] os: [macos-13] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz", - ] + include: + - os: macos-13 + llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }} + steps: - name: checkout uses: actions/checkout@v4 - - name: download and install wabt + - name: Get LLVM libraries + id: retrieve_llvm_libs + if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) + uses: actions/cache@v4 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ${{ matrix.llvm_cache_key }} + + - name: Quit if cache miss + if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} + + - name: Build wamrc + if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo mv wabt-1.0.31 wabt + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + working-directory: wamr-compiler - name: Build Sample [wasm-c-api] run: | + VERBOSE=1 cmake -S . -B build ${{ matrix.make_options }} - cmake --build build --config Release --parallel 4 + cmake --build build --config Debug --parallel 4 ctest --test-dir build --output-on-failure working-directory: samples/wasm-c-api + - name: Build Sample [printversion] + run: | + ./test.sh + working-directory: samples/printversion + build_samples_others: needs: [build_iwasm, build_wamrc, build_llvm_libraries_on_intel_macos, build_llvm_libraries_on_arm_macos] runs-on: ${{ matrix.os }} strategy: matrix: os: [macos-13, macos-14] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz", - ] include: - os: macos-13 llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }} @@ -277,19 +302,10 @@ jobs: - name: checkout uses: actions/checkout@v4 - - name: download and install wasi-sdk - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo ln -sf wasi-sdk-20.0 wasi-sdk - - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo ln -sf wabt-1.0.31 wabt + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: Build Sample [basic] run: | @@ -356,12 +372,13 @@ jobs: cmake --build . --config Release --parallel 4 working-directory: wamr-compiler + # cmake --build . --config Debug --parallel 4 - name: Build Sample [wasi-threads] run: | cd samples/wasi-threads mkdir build && cd build cmake .. - cmake --build . --config Debug --parallel 4 + cmake --build . --config Debug --verbose ./iwasm wasm-apps/no_pthread.wasm ../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index ef0799b42..5922f5e3a 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -88,14 +88,14 @@ jobs: uses: actions/checkout@v4 with: repository: apache/nuttx - ref: releases/12.6 + ref: releases/12.9 path: nuttx - name: Checkout NuttX Apps uses: actions/checkout@v4 with: repository: apache/nuttx-apps - ref: releases/12.6 + ref: releases/12.9 path: apps - name: Checkout WAMR diff --git a/.github/workflows/compilation_on_sgx.yml b/.github/workflows/compilation_on_sgx.yml index 70597c366..e6cc29108 100644 --- a/.github/workflows/compilation_on_sgx.yml +++ b/.github/workflows/compilation_on_sgx.yml @@ -49,10 +49,14 @@ env: # 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_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 -DWAMR_BUILD_SIMD=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" LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" + # For Spec Test + DEFAULT_TEST_OPTIONS: "-s spec -x -p -b" + SIMD_TEST_OPTIONS: "-s spec -x -p -b -S" + XIP_TEST_OPTIONS: "-s spec -x -p -b -X" permissions: contents: read @@ -64,7 +68,7 @@ jobs: actions: write uses: ./.github/workflows/build_llvm_libraries.yml with: - os: "ubuntu-20.04" + os: ubuntu-22.04 arch: "X86" build_iwasm: @@ -97,12 +101,12 @@ jobs: "-DWAMR_BUILD_PERF_PROFILING=1", "-DWAMR_BUILD_REF_TYPES=1", # doesn't support - # "-DWAMR_BUILD_SIMD=1", + "-DWAMR_BUILD_SIMD=0", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_SGX_IPFS=1", ] - os: [ubuntu-20.04] + os: [ubuntu-22.04] platform: [linux-sgx] exclude: # incompatible mode and feature @@ -110,22 +114,14 @@ jobs: - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" steps: - - name: install SGX SDK and necessary libraries - run: | - mkdir -p /opt/intel - cd /opt/intel - wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin - chmod +x sgx_linux_x64_sdk_2.15.100.3.bin - echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin - echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list - wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - - sudo apt update - sudo apt install -y libsgx-launch libsgx-urts - source /opt/intel/sgxsdk/environment - - name: checkout uses: actions/checkout@v4 + - name: install SGX SDK and necessary libraries + uses: ./.github/actions/install-linux-sgx + with: + os: ${{ matrix.os }} + - name: Build iwasm run: | mkdir build && cd build @@ -150,69 +146,29 @@ jobs: #$LLVM_LAZY_JIT_BUILD_OPTIONS, #$LLVM_EAGER_JIT_BUILD_OPTIONS, ] - os: [ubuntu-20.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] + os: [ubuntu-22.04] iwasm_make_options_feature: [ # Features to be tested: IPFS "-DWAMR_BUILD_SGX_IPFS=1", ] platform: [linux-sgx] include: - - os: ubuntu-20.04 + - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }} steps: - name: checkout uses: actions/checkout@v4 - - name: download and install wasi-sdk - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo mv wasi-sdk-19.0 wasi-sdk - - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo mv wabt-1.0.31 wabt - - - name: build wasi-libc (needed for wasi-threads) - run: | - mkdir wasi-libc - cd wasi-libc - git init - # "Fix a_store operation in atomic.h" commit on main branch - git fetch https://github.com/WebAssembly/wasi-libc \ - 1dfe5c302d1c5ab621f7abf04620fae92700fd22 - git checkout FETCH_HEAD - make \ - AR=/opt/wasi-sdk/bin/llvm-ar \ - NM=/opt/wasi-sdk/bin/llvm-nm \ - CC=/opt/wasi-sdk/bin/clang \ - THREAD_MODEL=posix - working-directory: core/deps + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: install SGX SDK and necessary libraries - run: | - mkdir -p /opt/intel - cd /opt/intel - wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin - chmod +x sgx_linux_x64_sdk_2.15.100.3.bin - echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin - echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list - wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - - sudo apt update - sudo apt install -y libsgx-launch libsgx-urts + uses: ./.github/actions/install-linux-sgx + with: + os: ${{ matrix.os }} - name: Build iwasm for testing samples run: | @@ -240,59 +196,61 @@ jobs: - name: Build wamrc only for testing samples in aot mode if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS' run: | - mkdir build && cd build - cmake .. - cmake --build . --config Release --parallel 4 - cp wamrc `pwd`/../../product-mini/platforms/${{ matrix.platform }}/enclave-sample + cmake -S . -B build + cmake --build build --config Release --parallel 4 + cp build/wamrc ../product-mini/platforms/${{ matrix.platform }}/enclave-sample working-directory: wamr-compiler - name: Build Sample [file] run: | - cd samples/file - mkdir build && cd build - cmake .. - cmake --build . --config Debug --parallel 4 - cp wasm-app/file.wasm `pwd`/../../../product-mini/platforms/${{ matrix.platform }}/enclave-sample + cmake -S . -B build + cmake --build build --config Debug --parallel 4 + cp build/wasm-app/file.wasm ../../product-mini/platforms/${{ matrix.platform }}/enclave-sample + working-directory: samples/file - name: Test Sample [file] in non-aot mode if: matrix.iwasm_make_options_run_mode != '$AOT_BUILD_OPTIONS' run: | source /opt/intel/sgxsdk/environment - ./iwasm --dir=. file.wasm + ./iwasm --dir=. ./file.wasm working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample - name: Test Sample [file] in aot mode if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS' run: | source /opt/intel/sgxsdk/environment - ./wamrc -sgx -o file.aot file.wasm - ./iwasm --dir=. file.aot + ./wamrc -sgx -o ./file.aot ./file.wasm + ./iwasm --dir=. ./file.aot working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample spec_test_default: needs: [build_iwasm, build_llvm_libraries] - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} strategy: matrix: - running_mode: ["classic-interp", "fast-interp", "aot", "fast-jit"] - # FIXME: use binary release(adding -b) instead of building from source after upgrading to 22.04 - test_option: ["-x -p -s spec -P", "-x -p -s spec -S -P", "-x -p -s spec -X -P"] - llvm_cache_key: ["${{ needs.build_llvm_libraries.outputs.cache_key }}"] + #(workaround) disable "fast-interp" because of SIMDE + running_mode: ["classic-interp", "aot", "fast-jit"] + test_option: + [$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS, $XIP_TEST_OPTIONS] + os: [ubuntu-22.04] exclude: # classic-interp, fast-interp and fast-jit don't support simd - running_mode: "classic-interp" - test_option: "-x -p -s spec -S -P" + test_option: $SIMD_TEST_OPTIONS - running_mode: "fast-interp" - test_option: "-x -p -s spec -S -P" + test_option: $SIMD_TEST_OPTIONS - running_mode: "fast-jit" - test_option: "-x -p -s spec -S -P" + test_option: $SIMD_TEST_OPTIONS # classic-interp, fast-interp and fast jit don't support XIP - running_mode: "classic-interp" - test_option: "-x -p -s spec -X -P" + test_option: $XIP_TEST_OPTIONS - running_mode: "fast-interp" - test_option: "-x -p -s spec -X -P" + test_option: $XIP_TEST_OPTIONS - running_mode: "fast-jit" - test_option: "-x -p -s spec -X -P" + test_option: $XIP_TEST_OPTIONS + include: + - os: ubuntu-22.04 + llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }} steps: - name: checkout @@ -316,22 +274,44 @@ jobs: run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - name: install SGX SDK and necessary libraries - run: | - mkdir -p /opt/intel - cd /opt/intel - wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin - chmod +x sgx_linux_x64_sdk_2.15.100.3.bin - echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin - echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list - wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - - sudo apt update - sudo apt install -y libsgx-launch libsgx-urts + uses: ./.github/actions/install-linux-sgx + with: + os: ${{ matrix.os }} - - name: install for wabt compilation - run: sudo apt update && sudo apt install -y ninja-build + #workaround about a https://github.com/actions/runner-images/issues/6680#issuecomment-2640923706 + - name: Increase swapfile + run: | + sudo swapoff -a + sudo fallocate -l 15G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + sudo swapon --show - name: run spec tests run: | + set +e source /opt/intel/sgxsdk/environment - ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} + attempts=0 + max_attempts=3 + + while [ $attempts -lt $max_attempts ]; do + ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} + exitcode="$?" + + if [ $exitcode -eq 0 ]; then + echo "Spec test passed" + exit 0 + elif [ $exitcode -ne 143 ]; then + echo "Spec test failed with error code $exitcode" + exit 1 + fi + + echo "$exitcode is a known GitHub-hosted runner issue" + echo "::notice::Re-running the spec test due to error code 143" + attempts=$((attempts + 1)) + done + + echo "::notice::Report an error with code 143 in SGX CI after $max_attempts attempts" + exit 143 working-directory: ./tests/wamr-test-suites diff --git a/.github/workflows/compilation_on_windows.yml b/.github/workflows/compilation_on_windows.yml index 369980ba9..21f961cb9 100644 --- a/.github/workflows/compilation_on_windows.yml +++ b/.github/workflows/compilation_on_windows.yml @@ -57,23 +57,33 @@ permissions: contents: read jobs: - build: + build_llvm_libraries_on_windows: + permissions: + contents: read + actions: write + uses: ./.github/workflows/build_llvm_libraries.yml + with: + os: "windows-latest" + arch: "AArch64 ARM Mips RISCV X86" + + build_iwasm: runs-on: windows-latest strategy: matrix: - build_options: [ - "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0", - "-DWAMR_BUILD_AOT=0", - "-DWAMR_BUILD_TAIL_CALL=1", - "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1", - "-DWAMR_DISABLE_HW_BOUND_CHECK=1", - "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", - "-DWAMR_BUILD_DEBUG_INTERP=1", - "-DWAMR_BUILD_LIB_PTHREAD=1", - "-DWAMR_BUILD_LIB_WASI_THREADS=1", - "-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1" - ] + build_options: + [ + "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0", + "-DWAMR_BUILD_AOT=0", + "-DWAMR_BUILD_TAIL_CALL=1", + "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1", + "-DWAMR_DISABLE_HW_BOUND_CHECK=1", + "-DWAMR_BUILD_REF_TYPES=1", + "-DWAMR_BUILD_SIMD=1", + "-DWAMR_BUILD_DEBUG_INTERP=1", + "-DWAMR_BUILD_LIB_PTHREAD=1", + "-DWAMR_BUILD_LIB_WASI_THREADS=1", + "-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1", + ] steps: - uses: actions/checkout@v4 @@ -89,17 +99,49 @@ jobs: cmake .. ${{ matrix.build_options }} cmake --build . --config Release --parallel 4 + build_wamrc: + needs: [build_llvm_libraries_on_windows] + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: windows-latest + llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }} + steps: + - name: checkout + uses: actions/checkout@v4 + + # since jobs.id can't contain the dot character + # it is hard to use `format` to assemble the cache key + - name: Get LLVM libraries + id: retrieve_llvm_libs + uses: actions/cache@v4 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ${{ matrix.llvm_cache_key }} + + - name: Quit if cache miss + if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: Build wamrc + run: | + cmake -S . -B build + cmake --build build --config Release --parallel 4 + working-directory: wamr-compiler + test: runs-on: windows-latest - needs: [build] + needs: [build_iwasm, build_wamrc] strategy: fail-fast: false matrix: - running_mode: - [ - "classic-interp", - "fast-interp", - ] + running_mode: ["classic-interp", "fast-interp"] test_option: [ $DEFAULT_TEST_OPTIONS, diff --git a/.github/workflows/nightly_run.yml b/.github/workflows/nightly_run.yml index dacdbc42d..d9841a2b3 100644 --- a/.github/workflows/nightly_run.yml +++ b/.github/workflows/nightly_run.yml @@ -48,15 +48,7 @@ permissions: contents: read jobs: - build_llvm_libraries_on_ubuntu_2004: - permissions: - contents: read - actions: write - uses: ./.github/workflows/build_llvm_libraries.yml - with: - os: "ubuntu-20.04" - arch: "X86" - build_llvm_libraries_on_ubuntu_2204: + build_llvm_libraries_on_ubuntu: permissions: contents: read actions: write @@ -66,16 +58,13 @@ jobs: arch: "X86" build_wamrc: - needs: - [ - build_llvm_libraries_on_ubuntu_2004, - ] + needs: build_llvm_libraries_on_ubuntu runs-on: ${{ matrix.os }} strategy: matrix: include: - - os: ubuntu-20.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} + - os: ubuntu-22.04 + llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} steps: - name: checkout uses: actions/checkout@v4 @@ -106,10 +95,7 @@ jobs: working-directory: wamr-compiler build_iwasm: - needs: - [ - build_llvm_libraries_on_ubuntu_2004, - ] + needs: build_llvm_libraries_on_ubuntu runs-on: ${{ matrix.os }} strategy: matrix: @@ -144,7 +130,7 @@ jobs: "-DWAMR_BUILD_MULTI_MEMORY=1", "-DWAMR_BUILD_SHARED=1", ] - os: [ubuntu-20.04] + os: [ubuntu-22.04] platform: [android, linux] exclude: # incompatible feature and platform @@ -241,8 +227,8 @@ jobs: - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS platform: android include: - - os: ubuntu-20.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} + - os: ubuntu-22.04 + llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} steps: - name: checkout @@ -375,12 +361,7 @@ jobs: working-directory: wamr/product-mini/platforms/linux build_samples_wasm_c_api: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2004, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc] runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -396,18 +377,10 @@ jobs: $LLVM_EAGER_JIT_BUILD_OPTIONS, $MULTI_TIER_JIT_BUILD_OPTIONS, ] - os: [ubuntu-20.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] + os: [ubuntu-22.04] include: - - os: ubuntu-20.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} + - os: ubuntu-22.04 + llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} exclude: - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS sanitizer: asan @@ -432,12 +405,11 @@ jobs: if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo mv wabt-1.0.31 wabt + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} + - name: Build wamrc if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) run: | @@ -457,44 +429,23 @@ jobs: working-directory: samples/wasm-c-api build_samples_others: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2004, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc] runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] - wabt_release: - [ - "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz", - ] + os: [ubuntu-22.04] include: - - os: ubuntu-20.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} + - os: ubuntu-22.04 + llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} steps: - name: checkout uses: actions/checkout@v4 - - name: download and install wasi-sdk - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo ln -sf wasi-sdk-20.0 wasi-sdk - - name: download and install wabt - run: | - cd /opt - sudo wget ${{ matrix.wabt_release }} - sudo tar -xzf wabt-1.0.31-*.tar.gz - sudo ln -sf wabt-1.0.31 wabt - + - name: install-wasi-sdk-wabt + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} + - name: Get LLVM libraries id: retrieve_llvm_libs uses: actions/cache@v4 @@ -591,17 +542,21 @@ jobs: ./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm working-directory: ./samples/native-lib - - name: checkout wamr-app-framework - run: git clone https://github.com/bytecodealliance/wamr-app-framework.git - - name: download wamr-app-framework dependencies - run: LVGL=0 LV_DRIVERS=0 ./download.sh - working-directory: ./wamr-app-framework/deps - - name: Build Sample [simple] - run: | - ./build.sh -p host-interp - python3 ./sample_test_run.py $(pwd)/out - exit $? - working-directory: ./wamr-app-framework/samples/simple + # FIXME: un-comment me after fix cmake minimum issue + # https://github.com/bytecodealliance/wamr-app-framework/pull/11 + # - name: checkout wamr-app-framework + # run: git clone https://github.com/bytecodealliance/wamr-app-framework.git + + # - name: download wamr-app-framework dependencies + # run: LVGL=0 LV_DRIVERS=0 ./download.sh + # working-directory: ./wamr-app-framework/deps + + # - name: Build Sample [simple] + # run: | + # ./build.sh -p host-interp + # python3 ./sample_test_run.py $(pwd)/out + # exit $? + # working-directory: ./wamr-app-framework/samples/simple - name: Build Sample [shared-heap] run: | @@ -613,18 +568,12 @@ jobs: ./shared_heap_test --aot test: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2004, - build_llvm_libraries_on_ubuntu_2204, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc] runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04] + os: [ubuntu-22.04] sanitizer: ["", "ubsan", "asan", "tsan"] running_mode: [ @@ -643,22 +592,12 @@ jobs: $THREADS_TEST_OPTIONS, $WASI_TEST_OPTIONS, ] - wasi_sdk_release: - [ - "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz", - ] include: - - os: ubuntu-20.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} - ubuntu_version: "20.04" - os: ubuntu-22.04 - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} + llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} ubuntu_version: "22.04" exclude: - # incompatible modes and features - - os: ubuntu-20.04 - sanitizer: tsan # asan works only for aot now - running_mode: "classic-interp" sanitizer: asan @@ -700,22 +639,11 @@ jobs: - name: checkout uses: actions/checkout@v4 - - name: download and install wasi-sdk + - name: install-wasi-sdk-wabt if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: | - cd /opt - sudo wget ${{ matrix.wasi_sdk_release }} - sudo tar -xzf wasi-sdk-*.tar.gz - sudo mv wasi-sdk-20.0 wasi-sdk - - # It is a temporary solution until new wasi-sdk that includes bug fixes is released - - name: build wasi-libc from source - if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: | - git clone https://github.com/WebAssembly/wasi-libc - cd wasi-libc - make -j AR=/opt/wasi-sdk/bin/llvm-ar NM=/opt/wasi-sdk/bin/llvm-nm CC=/opt/wasi-sdk/bin/clang THREAD_MODEL=posix - echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV + uses: ./.github/actions/install-wasi-sdk-wabt + with: + os: ${{ matrix.os }} - name: set env variable(if llvm are used) if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit' @@ -761,12 +689,12 @@ jobs: - name: Build WASI thread tests if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: bash build.sh --sysroot "$SYSROOT_PATH" + run: bash build.sh working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/ - name: Build WASI thread stress tests if: matrix.test_option == '$WASI_TEST_OPTIONS' - run: bash build.sh --sysroot "$SYSROOT_PATH" + run: bash build.sh working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/ - name: build socket api tests diff --git a/.github/workflows/release_process.yml b/.github/workflows/release_process.yml index 031d57884..91f081fd2 100644 --- a/.github/workflows/release_process.yml +++ b/.github/workflows/release_process.yml @@ -58,16 +58,6 @@ jobs: # # LLVM_LIBRARIES - build_llvm_libraries_on_ubuntu_2004: - permissions: - contents: read - actions: write - needs: [create_tag, create_release] - uses: ./.github/workflows/build_llvm_libraries.yml - with: - os: "ubuntu-20.04" - arch: "AArch64 ARM Mips RISCV X86" - build_llvm_libraries_on_ubuntu_2204: permissions: contents: read @@ -100,18 +90,6 @@ jobs: # # WAMRC - release_wamrc_on_ubuntu_2004: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2004] - uses: ./.github/workflows/build_wamrc.yml - with: - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} - release: true - runner: ubuntu-20.04 - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver}} - release_wamrc_on_ubuntu_2204: permissions: contents: write # upload release artifact @@ -135,7 +113,7 @@ jobs: runner: macos-13 upload_url: ${{ needs.create_release.outputs.upload_url }} ver_num: ${{ needs.create_tag.outputs.new_ver }} - + release_wamrc_on_windows: permissions: contents: write # upload release artifact @@ -150,18 +128,6 @@ jobs: # # IWASM - release_iwasm_on_ubuntu_2004: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2004] - uses: ./.github/workflows/build_iwasm_release.yml - with: - cwd: product-mini/platforms/linux - llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }} - runner: ubuntu-20.04 - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver}} - release_iwasm_on_ubuntu_2204: permissions: contents: write # upload release artifact @@ -200,19 +166,6 @@ jobs: # # WAMR_SDK - release_wamr_sdk_on_ubuntu_2004: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release] - uses: ./.github/workflows/build_wamr_sdk.yml - with: - config_file: wamr_config_ubuntu_release.cmake - runner: ubuntu-20.04 - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver}} - wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz - wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git - release_wamr_sdk_on_ubuntu_2204: permissions: contents: write # upload release artifact @@ -239,41 +192,33 @@ jobs: wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git + # Let's disable it for now and reopen it when the actual requirement arises. + # Please ensure all dependencies have been updated before reopening. # - # vscode extension cross-platform - release_wamr_ide_vscode_ext: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release] - uses: ./.github/workflows/build_wamr_vscode_ext.yml - secrets: inherit - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver }} + # # vscode extension cross-platform + # release_wamr_ide_vscode_ext: + # permissions: + # contents: write # upload release artifact + # needs: [create_tag, create_release] + # uses: ./.github/workflows/build_wamr_vscode_ext.yml + # secrets: inherit + # with: + # upload_url: ${{ needs.create_release.outputs.upload_url }} + # ver_num: ${{ needs.create_tag.outputs.new_ver }} - # - # vscode extension docker images package - release_wamr_ide_docker_images_package: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release] - uses: ./.github/workflows/build_docker_images.yml - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver }} + # # + # # vscode extension docker images package + # release_wamr_ide_docker_images_package: + # permissions: + # contents: write # upload release artifact + # needs: [create_tag, create_release] + # uses: ./.github/workflows/build_docker_images.yml + # with: + # upload_url: ${{ needs.create_release.outputs.upload_url }} + # ver_num: ${{ needs.create_tag.outputs.new_ver }} # # WAMR_LLDB - release_wamr_lldb_on_ubuntu_2004: - permissions: - contents: write # upload release artifact - needs: [create_tag, create_release] - uses: ./.github/workflows/build_wamr_lldb.yml - with: - runner: ubuntu-20.04 - upload_url: ${{ needs.create_release.outputs.upload_url }} - ver_num: ${{ needs.create_tag.outputs.new_ver}} - release_wamr_lldb_on_ubuntu_2204: permissions: contents: write # upload release artifact diff --git a/.github/workflows/spec_test_on_nuttx.yml b/.github/workflows/spec_test_on_nuttx.yml index 8138a8612..6c36c45ca 100644 --- a/.github/workflows/spec_test_on_nuttx.yml +++ b/.github/workflows/spec_test_on_nuttx.yml @@ -146,14 +146,14 @@ jobs: uses: actions/checkout@v4 with: repository: apache/nuttx - ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || 'releases/12.6' }} + ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || 'releases/12.9' }} path: nuttx - name: Checkout NuttX Apps uses: actions/checkout@v4 with: repository: apache/nuttx-apps - ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || 'releases/12.6' }} + ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || 'releases/12.9' }} path: apps - name: Checkout WAMR @@ -183,28 +183,6 @@ 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 - # - # Note: the version of nuttx-apps we use for xtensa does have - # an equivalent. (the default of INTERPRETERS_WAMR_TAIL_CALL is - # different though.) - - name: Modify Kconfig - if: matrix.target_config.target != 'xtensa' - 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: Build wamrc if: contains(matrix.wamr_test_option.mode, 'aot') working-directory: apps/interpreters/wamr/wamr/wamr-compiler @@ -351,7 +329,7 @@ jobs: - name: upload the log if: always() - uses: actions/upload-artifact@v4.6.0 + uses: actions/upload-artifact@v4.6.2 with: name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }} path: log diff --git a/.github/workflows/supply_chain.yml b/.github/workflows/supply_chain.yml index 4c743d2ec..fe105b246 100644 --- a/.github/workflows/supply_chain.yml +++ b/.github/workflows/supply_chain.yml @@ -39,7 +39,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 with: results_file: results.sarif results_format: sarif @@ -52,7 +52,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v3.1.0 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v3.1.0 with: name: SARIF file path: results.sarif @@ -60,6 +60,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@0701025a8b1600e416be4f3bb5a830b1aa6af01e # v2.2.4 + uses: github/codeql-action/upload-sarif@b1e4dc3db58c9601794e22a9f6d28d45461b9dbf with: sarif_file: results.sarif diff --git a/CMakeLists.txt b/CMakeLists.txt index a637c3643..88a1642b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,9 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.14) + +option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) if(ESP_PLATFORM) include (${COMPONENT_DIR}/build-scripts/esp-idf/wamr/CMakeLists.txt) @@ -18,13 +20,6 @@ if (NOT DEFINED WAMR_BUILD_PLATFORM) string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) endif () -if (NOT DEFINED WAMR_BUILD_STATIC) - set (WAMR_BUILD_STATIC 1) -endif () -if (NOT DEFINED WAMR_BUILD_SHARED) - set (WAMR_BUILD_SHARED 1) -endif () - # Reset default linker flags set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") @@ -104,6 +99,11 @@ if (NOT DEFINED WAMR_BUILD_LIB_WASI_THREADS) set (WAMR_BUILD_LIB_WASI_THREADS 0) endif () +if (NOT DEFINED WAMR_ENABLE_COPY_CALLSTACK) + # Disable copy callstack by default + set (WAMR_ENABLE_COPY_CALLSTACK 0) +endif() + if (NOT DEFINED WAMR_BUILD_MINI_LOADER) # Disable wasm mini loader by default set (WAMR_BUILD_MINI_LOADER 0) @@ -152,56 +152,40 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) set (THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -if (MSVC) - add_definitions(-DCOMPILING_WASM_RUNTIME_API=1) +add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm) +target_include_directories(vmlib INTERFACE + $ + $ +) + +target_link_libraries (vmlib PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT}) +if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(vmlib INTERFACE boringssl_crypto) endif () -# STATIC LIBRARY -if (WAMR_BUILD_STATIC) - add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) - set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) - target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) - target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT}) - if (WAMR_BUILD_WASM_CACHE EQUAL 1) - target_link_libraries(iwasm_static INTERFACE boringssl_crypto) - endif () - - if (MINGW) - target_link_libraries (iwasm_static PRIVATE ws2_32) - endif () - - if (WIN32) - target_link_libraries(iwasm_static PRIVATE ntdll) - endif() - - install (TARGETS iwasm_static ARCHIVE DESTINATION lib) +if (MINGW) + target_link_libraries(vmlib INTERFACE -lWs2_32 -lwsock32) + target_link_libraries(vmlib PRIVATE ws2_32) endif () -# SHARED LIBRARY -if (WAMR_BUILD_SHARED) - add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) - target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) - target_link_libraries (iwasm_shared PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT}) - if (WAMR_BUILD_WASM_CACHE EQUAL 1) - target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) - endif () +if (WIN32) + target_link_libraries(vmlib PRIVATE ntdll) +endif() - if (MINGW) - target_link_libraries(iwasm_shared INTERFACE -lWs2_32 -lwsock32) - target_link_libraries(iwasm_shared PRIVATE ws2_32) - endif () +set (WAMR_PUBLIC_HEADERS + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h + ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h +) +set_target_properties (vmlib PROPERTIES PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}") - if (WIN32) - target_link_libraries(iwasm_shared PRIVATE ntdll) - endif() +set_version_info (vmlib) - install (TARGETS iwasm_shared LIBRARY DESTINATION lib) -endif () +install (TARGETS vmlib + EXPORT iwasmTargets + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include +) -# HEADERS -install (FILES - ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h - ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h - ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h - DESTINATION include) +install_iwasm_package () diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e04101d2..a8ab96427 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Code changes We Use Github Flow, So All Code Changes Happen Through Pull Requests. Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: - If you've added code that should be tested, add tests. Ensure the test suite passes. -- Avoid use macros for different platforms. Use seperate folder of source files to host diffeent platform logic. +- Avoid use macros for different platforms. Use separate folder of source files to host different platform logic. - Put macro definitions inside share_lib/include/config.h if you have to use macro. - Make sure your code lints and compliant to our coding style. - Extend the application library is highly welcome. diff --git a/README.md b/README.md index 05368b929..39ce5fd03 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ WebAssembly Micro Runtime (WAMR) is a lightweight standalone WebAssembly (Wasm) ### Key features - Full compliant to the W3C Wasm MVP -- Small runtime binary size (core vmlib on cortex-m4f with tail-call/bulk memroy/shared memroy support, text size from bloaty) +- Small runtime binary size (core vmlib on cortex-m4f with tail-call/bulk memory/shared memory support, text size from bloaty) * ~58.9K for fast interpreter * ~56.3K for classic interpreter * ~29.4K for aot runtime diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e0bb032cf..8b3cfec28 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,45 +1,271 @@ -## WAMR-2.2.0 +## WAMR-2.3.1 -### Breaking changes +### Breaking Changes -### New features -- Add support for multi-memory proposal in classic interpreter (#3742) -- wasi-nn: Add a new target for llama.cpp as a wasi-nn backend (#3709) -- Add memory instance support apis (#3786) -- Implement a first version of shared heap feature (#3789) -- Support dynamic aot debug (#3788) -- Implement shared heap for AOT (#3815) -- Support table64 extension in classic-interp and AOT running modes (#3811) - +- Revert the location to install public headers (#4295). This restores compatibility (of installed headers) with WAMR-2.2.0 and earlier. + +### New Features + +- feat: Add instruction metering for interpreter (#4122) + +### Bug Fixes + +- updating WASI stdio handle initialization and build options for UVWASI (#4260) +- Fix SIMD load lane to avoid incompatible pointer types (#4278) +- Fixed unit tests on X86_32 (#4279) +- Improve Embedding WAMR guideline (#4284) +- Fix Compiler Error C2491 (#4286) +- Enhance type checking for function types in loader and improve error handling (#4294) +- Dockerfile.vx-delegate build error fix (#4273) +- Enable runtime API exposure for MSVC builds (#4287) + +### Enhancements + +- feat(yml): Add ESP32-P4 and ESP32-C5 support (#4270) +- add a sample to use cmake package (#4291) + +### Others + +- build(deps): Bump github/codeql-action from 3.28.17 to 3.28.18 (#4285) + +--- + +## WAMR-2.3.0 + +### Breaking changes + +### New features + +- simd for fast-interp (#4131) +- copy call-stack (#4033) ### Bug fixes -- Enable merged os_mmap for aot data sections (#3681) -- Fix arm64 issues on mac (#3688) + +- fix(ios): Remove `float-abi` flag (#3889) +- Fix out of bounds issues after memory.grow on non-aot non-threads builds (#3872) +- Fix out of bounds issue in is_native_addr_in_shared_heap function (#3886) +- Fix mmap flags for AOT loader on non-Linux SGX platforms (#3890) +- fix(uwp): Gate NTSTATUS definition behind WINAPI_PARTITION_DESKTOP for UWP builds (#3897) +- Fix linked global initialization in multimodule (#3905) +- Correct the table index calculation in aot_instantiation (#3903) +- Fix a leak in wasm_loader_emit_br_info (#3900) +- Check possible integer overflow in aot memory boundary check (#3920) +- Fix CI wamr-ide error (#3913) +- Fix WASI Path Mapping Processing (#3923) +- Use plain assignment rather than bh_memcpy_s (#3924) +- Fix loader small bug (#3928) +- don't return an uninitialized trap if argv_to_results fails (#3935) +- support WASM_FUNCREF return type in argv_to_results (#3936) +- Fix incorrect assignment in win_file.c (#3939) +- Fix aot table instantiate (#3946) +- set alignment 4 when loading multi return value (#3955) +- Only access Zephyr thread stats info when it's available (#3962) +- top-level cmakefile: fix macOS build (#3968) +- Handle a new scenario where an item is both exported and imported. (#3984) +- platform/nuttx: Flush icache/dcache properly (#4147) +- fix(runtest.py): A workaround to bypass errors that occur when deleting temporary files (#4093) +- Fix build issues when compiling WAMRC as a cross-compiler (#4112) +- include bh_platform.h (#4135) +- Fix iwasm build error when WAMR_BUILD_WASI_NN enabled (#4138) +- avoid Windows perform newline translation (#4128) +- fix: correct typos and improve comments across multiple files by codespell (#4116) +- fix: fix load aarch64 aot failed (#4114) +- wasm_loader allocates more spaces for elements (#4099) +- fix: add dispose of the debug information builder when destroying compilation context (#4105) +- prevent mmap size overflow on 32 bit platform for memory.grow (#4071) +- fix: when load aot init expr,no type_idx set. (#4094) +- fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (#4095) +- fix(build_llvm_libraries.yml): Correct script path for build_llvm.py (#4089) +- fix(unit-test): libc_builtin_test issues (#4073) +- [gc] Subtyping fix (#4075) +- fix(build_llvm.py): clean up whitespace and formatting in build script (#4087) +- Unit test:type matching issue and code redundancy (#4079) +- fix(aot): ensure value_cmp does not exceed br_count in branch table compilation (#4065) +- In wasm32, fix potential conversion overflow when enlarging 65536 pages (#4064) +- Use wasm32-wasip1 instead of wasm32-wasi target for rust code (#4057) +- Update Rust target from 'wasm32-wasi' to 'wasm32-wasip1' in CI (#4050) +- Fix wasm loader check data segment count (#4039) +- Fix table index calculations in wasm_loader and wasm_mini_loader (#4004) +- Ensure **heap_base and **data_end global indices are validated against import count (#3996) +- fix format specifier warning on 32bit builds (#4177) +- Remove indirect-load for constants on Xtensa Target to improve performance (#4162) +- cmake: Enhance target selection for ARM architectures with FPU (#4185) +- Add import memory/table flag assert check for miniloader (#4179) +- Fix few integer overflowing (#4161) +- prevent frame_offset underflow in wasm_loader (#4165) +- fix: Remove unused variables in SIMD_v128_const case (#4197) +- fix false native stack overflow detections with HW_BOUND_CHECK (#4196) +- Keep fix the CMake compatibility issue (#4180) +- Fix the error of AOT mode on the "i386-windows-msvc" platform (#4183) +- debug-engine: fix a few type mismatches (#4189) +- Replace CMAKE_CURRENT_FUNCTION_LIST_DIR (#4200) +- fix potential memory leak (#4205) +- Add missing V128 handling in WASM_OP_BR (#4203) +- fix print_help when libc wasi is enabled (#4218) +- LLVM: don't verify instcombine fixpoint (#4219) +- LLVMCreateTargetMachineWithOpts: disable large data (#4220) +- set default value of `WAMR_BUILD_REF_TYPES` to 1 in standalone cases (#4227) +- platform/nuttx: Fix dcache operation in os_dcache_flush (#4225) +- fix return types of our 64-bit clz/ctz/popcount intrinsics (#4238) +- riscv: avoid llvm.cttz.i32/i64 for xip (#4248) +- Add overflow check for preserved local offset in preserve_referenced_local (#4211) +- aot_resolve_object_relocation_group: adapt to LLVM 16 (#4250) +- initialize WASI stdio handles to invalid for better error handling (#4092) +- Modifying build flags to ensure libiwasm.so is built (#4255) +- Stop pretending to support extended-const proposal (#4258) +- Improve readlinkat_dup() to handle symlink size correctly (#4229) +- fix: improve error handling of snprintf() in send_thread_stop_status() (#4234) +- Don't call os_thread_get_stack_boundary unless we actually use it (#4264) +- avoid access null pointer (#4262) +- disable compiler to prevent get_current_target() crash (#4251) +- product-mini/platforms/windows: set C++17 explicitly (#4269) +- fix buf checking in load_table_section (#4276) +- Set CMAKE_OSX_SYSROOT when building lldb (#4274) +- Add select 128 (#4236) + +### Enhancements + +- Refine looking up aot function with index (#3882) +- Wasm loader enhancement: check code size in code entry (#3892) +- Refactor AOT loader to support compatible versions (#3891) +- GlobalValueSet was moved to IRPartitionLayer recently, but we have a local definition anyway (#3899) +- Support external toolchain on Windows for aot compiler (#3911) +- Drop declarative elements on module instantiation (#3922) +- add testcases for shared heap and fix POP_MEM_OFFSET of memory64 (#3916) +- Enable ref types by default (#3894) +- Update README.md to clarify Windows toolchain support and ESP-IDF reference (#3917) +- add thread cpu time for zephyr (#3937) +- Improvements for platform thread APIs on Windows and Zephyr (#3941) +- Refactor SConscript and add file checks in iwasm.c (#3945) +- Consume the placeholders that were put when emitting table info (#3940) +- wasm_export.h: Use "default" visibility for gcc and clang (#3957) +- [fuzzing] Enable instantiation (#3958) +- use a random secret key (#3971) +- CMakeLists.txt: Do not require C++ (#3956) +- add reference type support by default for darwin to support WASI-SDK-25 (#3978) +- top-level cmake: link llvm libraries to our shared library (#3973) +- Set thread information earlier in exec_env creation (#3967) +- Break aot_create_comp_data into small functions (#3987) +- Optimize memory initialization handling in AOT loader (#3983) +- nuttx: remove the up_x API for kernel build (#4154) +- Expose WAMR_BUILD_GC_HEAP_SIZE_DEFAULT as a CMake option (#4124) +- Use log instead of using assertion in aot loader (#4119) +- feat: use C linkage in aot_comp_option.h for C++ embeding (#4106) +- Cmake improvements (#4076) +- feat: add support for EXTERNREF value type and enable AOT validator in fuzz tests (#4083) +- build_llvm.py: Allow to build xtensa target on non-xtensa host (#4086) +- Add a conditional check for the macro **STDC_VERSION** (#4080) +- [fuzzing] execute every exported function (#3959) +- Update memory allocation functions to use allocator user data (#4043) +- Add versioning support and update CMake configuration (#3933) +- Show wasm proposals status during compilation and execution (#3989) +- add a validator for aot module (#3995) +- Synchronize the GC spec tests to the commit from December 9. 2024. (#4022) +- Refine getting const offsets in wasm loader of fast-interp (#4012) +- fixes for compiling on windows (#4026) +- .github: Add shared lib builds (#3975) +- Error message improvement (#4000) +- Refine read leb int wasm loader of fast interpreter (#4017) +- Enable shrunk memory by default and add related configurations (#4008) +- Add documentation regarding security issues and the status of Wasm proposals (#3972) +- Improve stack consistency by ensuring sufficient space for dummy offsets (#4011) +- Check whether related table has funcref elem in opcode call_indirect (#3999) +- [fuzzing] Use software bound-check during fuzzing (#4003) +- Add an example of how to embed WAMR in Zephyr user mode (#3998) +- Update cmake min to 3.14 (#4175) +- aot: add new u64 intrinsics (#4168) +- Refactor Dockerfile and update .dockerignore for wasi-nn tests; adjust map-dir parameters in smoke test script (#4158) +- improve variable naming and code clarity in SIMD operations (#4157) +- Raise CI runner to ubuntu 22.04 (#4191) +- Remove the dlen to optimize it. (#4193) +- Add missing casts and improve error handling in performance map functions (#4202) +- Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187) +- wamrc: add --disable-llvm-jump-tables option (#4224) +- feat(fuzz): add a new fuzzing target about aot compiler (#4121) +- bypass vptr santizier (#4231) +- use a selected llvm libs list to replace the full list (#4232) +- teach aot emitter/loader about .srodata and .srodata.cst\* sections (#4240) +- run_clang_format_diff: mention homebrew for clang-format installation (#4237) +- Use --target to pass a triple in wamrc (#4199) +- samples/wasm-c-api: skip aot compilation unless necessary (#4239) +- samples/wasm-c-api: remove unused valgrind detection (#4249) +- More detail to python setup, and fixed small typo (#4247) +- JIT: don't join worker threads twice (#4252) +- aot_resolve_object_relocation_group: adapt to LLVM 19 (#4254) +- build-scripts/build_llvm.py: bump to llvm 18 (#4259) +- CI: make macos' build_samples_wasm_c_api similar to ubuntu (#4253) +- Refactor fast-interpreter SIMD compilation flags (#4261) +- Bypass wamr_ide-related components from the release process. (#4268) +- Check for WASM_ENABLE_SIMDE in a couple more places (#4266) +- Add error handling for sgx ci (#4222) + +### Security Issues + +- Add validation for old_path in wasi_path_symlink (# CVE-2025-43853) + +### Others + +- Exclude fuzz test python and npm packages in scoreboard scan (#3871) +- Bump AOT_CURRENT_VERSION for WAMR 2.x (gc, memory64) (#3880) +- Add Tianlong into code owners (#3970) +- build(deps): Bump actions/upload-artifact from 4.4.3 to 4.5.0 (#3981) +- docs: Update build instructions suggestions for using Valgrind (#4164) +- test: temporarily skip 'skip-stack-guard-page' test case (#4163) +- build(deps): Bump actions/upload-artifact from 4.6.1 to 4.6.2 (#4159) +- Update NuttX and NuttX Apps references to releases/12.9 in workflow files (#4148) +- build(deps): Bump esbuild, @vitejs/plugin-react and vite (#4149) +- build(deps): Bump ossf/scorecard-action from 2.4.0 to 2.4.1 (#4109) +- build(deps): bump github/codeql-action from 3.26.13 to 3.28.1 (#3888) (#3902) +- build(deps): Bump github/codeql-action from 3.28.10 to 3.28.11 (#4132) +- build(deps): Bump github/codeql-action from 3.28.9 to 3.28.10 (#4108) +- build(deps): Bump actions/upload-artifact from 4.6.0 to 4.6.1 (#4107) + +--- + +## WAMR-2.2.0 + +### Breaking changes + +### New features + +- Add support for multi-memory proposal in classic interpreter (#3742) +- wasi-nn: Add a new target for llama.cpp as a wasi-nn backend (#3709) +- Add memory instance support apis (#3786) +- Implement a first version of shared heap feature (#3789) +- Support dynamic aot debug (#3788) +- Implement shared heap for AOT (#3815) +- Support table64 extension in classic-interp and AOT running modes (#3811) + +### Bug fixes + +- Enable merged os_mmap for aot data sections (#3681) +- Fix arm64 issues on mac (#3688) - aot loader: Call os_mmap with MMAP_MAP_32BIT only when target is x86-64 or riscv64 (#3755) -- Fix building iwasm_shared and iwasm_static libs on win32 (#3762) +- Fix building iwasm_shared and iwasm_static libs on win32 (#3762) - Fix compile error when multi-module and tags are enabled (#3781) - Fix aot multi export memory support (#3791) - Fix Windows compile error when uvwasi is enabled (#3810) - Fix missing symbols when using aot mode on riscv platforms (#3812) - Fix mac build of libc_emcc_wrapper.c (#3836) - aot_comp_option.h: Add missing stdint.h header (#3834) -- Fix compilation error found in tflite test (#3820) -- Fix exec_env_tls assertion in module instantiation (#3844) +- Fix compilation error found in tflite test (#3820) +- Fix exec_env_tls assertion in module instantiation (#3844) - Fix issues of destroy_shared_heaps (#3847) ### Enhancements + - aot loader: Refine os_mmap related code (#3711) - Enable merged os_mmap for aot data sections and aot text (#3743) - Improve posix mmap retry logic (#3714) - Remove unnecessary code duplication in aot runtime (#3767) -- Add wamrc parameter to configure stack frame features (#3763) +- Add wamrc parameter to configure stack frame features (#3763) - refactoring: Re-use commit IP functionality between exception handling and other cases (#3768) -- AOT call stack optimizations (#3773) +- AOT call stack optimizations (#3773) - Appease GCC strict prototypes warning (#3775) - Appease GCC -Wformat (#3783) - Fix compiler warnings (#3784) - Implement option for skipping function index in the callstack (#3785) -- Fix a compile warning in aot_emit_function.c (#3793) +- Fix a compile warning in aot_emit_function.c (#3793) - Restore cmake hidden compile symbol visibility (#3796) - Refactor shared heap feature for interpreter mode (#3794) - Add no_resolve to LoadArgs and wasm_runtime_resolve_symbols (#3790) @@ -49,179 +275,189 @@ - Add scoreboard CI for supply-chain security (#3819) - Emit load_addr and load_size if WAMR_ENABLE_COMPILER is set (#3835) - libc-emcc: Use alternate method to check getrandom support (#3848) -- Enable libc-wasi for windows msvc build (#3852) -- Remove unused folder samples/gui and samples/littlevgl (#3853) +- Enable libc-wasi for windows msvc build (#3852) +- Remove unused folder samples/gui and samples/littlevgl (#3853) - Fix some compile warnings and typos (#3854) - Allow to set native stack boundary to exec_env (#3862) - Refine wasm/aot function instance lookup (#3865) - Fix quadratic runtime for duplicate export name detection (#3861) - ### Others -- Add a comment on AOT_SECTION_TYPE_SIGNATURE (#3746) + +- Add a comment on AOT_SECTION_TYPE_SIGNATURE (#3746) - CI: Freeze version of bloaty for NuttX compilation (#3756) - aot compiler: Allow to control stack boundary check when boundary check is enabled (#3754) - Update ref to the multi-memory tests (#3764) - compilation_on_nuttx.yml: Update checkout action to suppress warnings (#3765) - CI: Disable parallel test in spectest for NuttX (#3780) -- spec_test_on_nuttx.yml: Disable riscv32_ilp32f for now (#3777) +- spec_test_on_nuttx.yml: Disable riscv32_ilp32f for now (#3777) - Ignore temporary file from aider (#3787) - Add CODEOWNERS (#3822) - build(deps): bump github/codeql-action from 2.2.4 to 3.26.9 (#3826) - build(deps): bump actions/upload-artifact from 3.1.0 to 4.4.0 (#3827) - build(deps): bump ossf/scorecard-action from 2.3.1 to 2.4.0 (#3828) -- build(deps): bump github/codeql-action from 3.26.9 to 3.26.11 (#3843) +- build(deps): bump github/codeql-action from 3.26.9 to 3.26.11 (#3843) - build(deps): bump actions/upload-artifact from 4.4.0 to 4.4.3 (#3855) - build(deps): bump github/codeql-action from 3.26.11 to 3.26.12 (#3856) - Add Windows wamrc and iwasm build in release CI (#3857) - Fix syntax error in codeql_buildscript.sh (#3864) - release CI: Add another iwasm binary that supports Garbage Collection and Exception Handling (#3866) - Fix lookup function issue reported in nightly run (#3868) - + --- ## WAMR-2.1.2 ### Breaking Changes - - wasi-nn: Apply new architecture (#3692) + +- wasi-nn: Apply new architecture (#3692) ### New Features - - [wasi-nn] Add a new wasi-nn backend openvino (#3603) - - Add APIs into wasm_c_api.h to summary wasm function execution duration (#3639) - - Add support for RISCV32 ILP32F (#3708) + +- [wasi-nn] Add a new wasi-nn backend openvino (#3603) +- Add APIs into wasm_c_api.h to summary wasm function execution duration (#3639) +- Add support for RISCV32 ILP32F (#3708) ### Bug Fixes - - libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702) - - Fix potential memory leak in insert_native_symbol (#3712) - - aot compiler: Fix NaN handling for opcode f32/f64.const in XIP mode (#3721) - - Fix table idx resolving in op call_indirect/return_call_indirect (#3726) + +- libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702) +- Fix potential memory leak in insert_native_symbol (#3712) +- aot compiler: Fix NaN handling for opcode f32/f64.const in XIP mode (#3721) +- Fix table idx resolving in op call_indirect/return_call_indirect (#3726) ### Enhancements - - Remove a few hardcoded spec test knowledge from the core library (#3648) - - Change log of import function to be consistent (#3656) - - libc-builtin: Fix a printf format (#3652) - - Set compile symbol visibility to hidden in cmake (#3655) - - wamrc: Add --mllvm= option (#3658) - - wamr-compiler: Avoid size-level tweak if target is specified (#3659) - - aot runtime: Add missing arm/thumb relocations (#3660) - - aot compiler: Enlarge AOTNativeSymbol->symbol (#3662) - - aot compiler: Bail out on too long native symbol names (#3663) - - Support more features for rt-thread (#3661) - - Zephyr User Mode Support (#3650) - - Set posix thread name for debug build (#3657) - - Add emscripten_sleep() wrapper to libc-emcc (#3669) - - Fix a compilation warning (#3682) - - wamrc: Add some help text for --size-level (#3689) - - Restore linux iwasm default visibility (#3691) - - posix_thread.c: Restore old signal alternate stack before thread exit (#3693) - - libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overlook their access modes (#3694) - - [refactoring] Extract read leb to a separate file, share the code between loader and mini loader (#3701) - - debug-interp: Only add lock when signal_flag is SIG_SINGSTEP (#3704) - - Fix compilation warnings (#3707) - - Add missing headers in bh_atomic.h and aot_llvm_extra.cpp (#3715) - - Update std atomic check and simd compatibility check for arc compiler (#3716) - - aot compiler: Track non-0x00 tableindex as ref types use (#3695) - - compilation: Use the dedicated stack-sizes section only for AOT (#3732) - - riscv: Add missing relocation intrinsics for __fixdfsi/__ltdf2 (#3733) + +- Remove a few hardcoded spec test knowledge from the core library (#3648) +- Change log of import function to be consistent (#3656) +- libc-builtin: Fix a printf format (#3652) +- Set compile symbol visibility to hidden in cmake (#3655) +- wamrc: Add --mllvm= option (#3658) +- wamr-compiler: Avoid size-level tweak if target is specified (#3659) +- aot runtime: Add missing arm/thumb relocations (#3660) +- aot compiler: Enlarge AOTNativeSymbol->symbol (#3662) +- aot compiler: Bail out on too long native symbol names (#3663) +- Support more features for rt-thread (#3661) +- Zephyr User Mode Support (#3650) +- Set posix thread name for debug build (#3657) +- Add emscripten_sleep() wrapper to libc-emcc (#3669) +- Fix a compilation warning (#3682) +- wamrc: Add some help text for --size-level (#3689) +- Restore linux iwasm default visibility (#3691) +- posix_thread.c: Restore old signal alternate stack before thread exit (#3693) +- libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overlook their access modes (#3694) +- [refactoring] Extract read leb to a separate file, share the code between loader and mini loader (#3701) +- debug-interp: Only add lock when signal_flag is SIG_SINGSTEP (#3704) +- Fix compilation warnings (#3707) +- Add missing headers in bh_atomic.h and aot_llvm_extra.cpp (#3715) +- Update std atomic check and simd compatibility check for arc compiler (#3716) +- aot compiler: Track non-0x00 tableindex as ref types use (#3695) +- compilation: Use the dedicated stack-sizes section only for AOT (#3732) +- riscv: Add missing relocation intrinsics for **fixdfsi/**ltdf2 (#3733) ### Others - - Fix night run CI (#3640) - - spec-test-script/runtest.py: Don't assume the tmp dir path (#3632) - - wamr-test-suites: Remove dead code (wasi_test) (#3634) - - wamr-test-suites/test_wamr.sh: Add an option to specify wamrc binary (#3635) - - CI: Build llvm for xtensa (#3637) - - spec-test-script/runtest.py: Avoid specifying -v=0 unnecessarily (#3642) - - spec-test-script: Add xtensa case (#3643) - - spec-test-script/runtest.py: Move "--size-level=1" to common place for RISCV64 (#3644) - - spec-test-script/runtest.py: Use a shorter timeout when expected to fail (#3647) - - spec-test-script: Make case_last_words larger (#3651) - - spec-test-script/runtest.py: Reduce stack size for aot w/o gc (#3653) - - spec-test-script: Skip a few tests for xtensa qemu (#3664) - - spec-test-script: Use -mtext-section-literals for xtensa xip (#3666) - - spec_test_on_nuttx.yml: Add xtensa (#3665) - - spec_test_on_nuttx.yml: Enable xip (#3671) - - spec_test_on_nuttx.yml: Record more logs (#3670) - - spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (#3672) - - spec_test_on_nuttx.yml: Retire CONFIG_EOL_IS_LF (#3676) - - spec-test-script/runtest.py: Use wamrc --xip option for xip (#3683) - - CI: Bump NuttX version to 12.6 (#3684) - - wamr-test-suites: Clean up generated tmp files after spec test (#3700) - - test_wamr.sh: Fix build wabt tool (#3703) - - NuttX: Retire CONFIG_ARCH_RV32IM and CONFIG_ARCH_RV64GC (#3717) - - runtest.py: Normallize option handling for XIP mode (#3722) - - CI: Enable XIP spectest for RISCV32 ILP32F (#3727) - - CI: Unify configuration stage for NuttX (#3725) + +- Fix night run CI (#3640) +- spec-test-script/runtest.py: Don't assume the tmp dir path (#3632) +- wamr-test-suites: Remove dead code (wasi_test) (#3634) +- wamr-test-suites/test_wamr.sh: Add an option to specify wamrc binary (#3635) +- CI: Build llvm for xtensa (#3637) +- spec-test-script/runtest.py: Avoid specifying -v=0 unnecessarily (#3642) +- spec-test-script: Add xtensa case (#3643) +- spec-test-script/runtest.py: Move "--size-level=1" to common place for RISCV64 (#3644) +- spec-test-script/runtest.py: Use a shorter timeout when expected to fail (#3647) +- spec-test-script: Make case_last_words larger (#3651) +- spec-test-script/runtest.py: Reduce stack size for aot w/o gc (#3653) +- spec-test-script: Skip a few tests for xtensa qemu (#3664) +- spec-test-script: Use -mtext-section-literals for xtensa xip (#3666) +- spec_test_on_nuttx.yml: Add xtensa (#3665) +- spec_test_on_nuttx.yml: Enable xip (#3671) +- spec_test_on_nuttx.yml: Record more logs (#3670) +- spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (#3672) +- spec_test_on_nuttx.yml: Retire CONFIG_EOL_IS_LF (#3676) +- spec-test-script/runtest.py: Use wamrc --xip option for xip (#3683) +- CI: Bump NuttX version to 12.6 (#3684) +- wamr-test-suites: Clean up generated tmp files after spec test (#3700) +- test_wamr.sh: Fix build wabt tool (#3703) +- NuttX: Retire CONFIG_ARCH_RV32IM and CONFIG_ARCH_RV64GC (#3717) +- runtest.py: Normallize option handling for XIP mode (#3722) +- CI: Enable XIP spectest for RISCV32 ILP32F (#3727) +- CI: Unify configuration stage for NuttX (#3725) --- ## WAMR-2.1.1 ### Breaking Changes - - Sync up with latest wasi-nn spec (#3530) + +- Sync up with latest wasi-nn spec (#3530) ### New Features - - Add APIs to get package version (#3601) - - Export API wasm_runtime_enlarge_memory (#3569) - - Add table type API support (#3515) - - Add wasm_runtime_get_module_package_type() and wasm_runtime_get_file_package_type() (#3600) + +- Add APIs to get package version (#3601) +- Export API wasm_runtime_enlarge_memory (#3569) +- Add table type API support (#3515) +- Add wasm_runtime_get_module_package_type() and wasm_runtime_get_file_package_type() (#3600) ### Bug Fixes - - wasm_application.c: Avoid null pointer dereference (#3620) - - EH: Use the consistent type for EH handlers (#3619) - - wasm loader: Fix several issues in GC and exception handling (#3586) - - wasm loader: Fix push_frame_offset when pushing v128 type (#3588) - - Add integer overflow check for some indices in wasm/aot loader (#3579) - - aot-analyzer: Fix a few printf formats (#3590) - - aot-analyzer: Fix macos build (#3589) - - Fix compilation errors in aot-analyzer tool (#3584) - - interp debugger: Fix setting invalid value to step_count (#3583) - - aot loader: Check import global value type before using (#3571) - - Fix missing stack frame alloc/free in AOT multi-module invoke (#3562) - - aot loader: Verify global value type (#3560) - - aot loader: Add more checks in load_native_symbol_section() (#3559) - - core/shared/platform: Zero memory returned by os_mmap in some platforms (#3551) - - dwarf_extractor.cpp: Fix buffer overruns (#3541) - - aot loader: Prevent loading multiple native symbol sections (#3538) - - Validate func type in aot loader (#3535) - - wamrc: Fix truncated DW_AT_producer (#3537) - - wasm loader: Fix pop invalid offset count when stack top is ANY (#3516) - - Fix two fuzz issues (#3529) - - Fix several issues reported by oss-fuzz (#3526) + +- wasm_application.c: Avoid null pointer dereference (#3620) +- EH: Use the consistent type for EH handlers (#3619) +- wasm loader: Fix several issues in GC and exception handling (#3586) +- wasm loader: Fix push_frame_offset when pushing v128 type (#3588) +- Add integer overflow check for some indices in wasm/aot loader (#3579) +- aot-analyzer: Fix a few printf formats (#3590) +- aot-analyzer: Fix macos build (#3589) +- Fix compilation errors in aot-analyzer tool (#3584) +- interp debugger: Fix setting invalid value to step_count (#3583) +- aot loader: Check import global value type before using (#3571) +- Fix missing stack frame alloc/free in AOT multi-module invoke (#3562) +- aot loader: Verify global value type (#3560) +- aot loader: Add more checks in load_native_symbol_section() (#3559) +- core/shared/platform: Zero memory returned by os_mmap in some platforms (#3551) +- dwarf_extractor.cpp: Fix buffer overruns (#3541) +- aot loader: Prevent loading multiple native symbol sections (#3538) +- Validate func type in aot loader (#3535) +- wamrc: Fix truncated DW_AT_producer (#3537) +- wasm loader: Fix pop invalid offset count when stack top is ANY (#3516) +- Fix two fuzz issues (#3529) +- Fix several issues reported by oss-fuzz (#3526) ### Enhancements - - Fix compile warnings/error reported in Windows (#3616) - - wasm loader: Reject v128 for interpreters (#3611) - - Fix typos in wamrc and wasm_export.h (#3609) - - Bump ocaml/setup-ocaml from 2 to 3 (#3604) - - CMakeLists.txt: Fix Android pthread linkage (#3591) - - Add more arm AOT reloc entries (#3587) - - wasi-nn: Use numpy v1 in wasi-nn test requirements.txt (#3582) - - Optimize for multi-module support in AOT mode (#3563) - - aot compiler: Propagate const-ness by ourselves (#3567) - - aot_resolve_target_info: Avoid in-place modification of e_type (#3564) - - Allow missing imports in wasm loader and report error in wasm instantiation instead (#3539) - - aot compiler: Use larger alignment for load/store when possible (#3552) - - Consistent const keyword position in wasm_export.h (#3558) - - wasm_memory.c: Fix typo: hasn't been initialize -> `hasn't been initialized` (#3547) - - dwarf_extractor.cpp: Try to preserve link name (#3542) - - dwarf_extractor.cpp: Enable limited support for C++ (#3540) - - Sync up with latest wasi-nn spec (#3530) - - Expose more functions related to emitting AOT files (#3520) - - Make wasi-nn backends as separated shared libraries (#3509) - - build_llvm.py: Speed up llvm build with multi procs on windows (#3512) - - Fix compilation warnings of wasi-nn (#3497) - - Add missing functions to make RIOT work with the 2.x.x version (#3508) + +- Fix compile warnings/error reported in Windows (#3616) +- wasm loader: Reject v128 for interpreters (#3611) +- Fix typos in wamrc and wasm_export.h (#3609) +- Bump ocaml/setup-ocaml from 2 to 3 (#3604) +- CMakeLists.txt: Fix Android pthread linkage (#3591) +- Add more arm AOT reloc entries (#3587) +- wasi-nn: Use numpy v1 in wasi-nn test requirements.txt (#3582) +- Optimize for multi-module support in AOT mode (#3563) +- aot compiler: Propagate const-ness by ourselves (#3567) +- aot_resolve_target_info: Avoid in-place modification of e_type (#3564) +- Allow missing imports in wasm loader and report error in wasm instantiation instead (#3539) +- aot compiler: Use larger alignment for load/store when possible (#3552) +- Consistent const keyword position in wasm_export.h (#3558) +- wasm_memory.c: Fix typo: hasn't been initialize -> `hasn't been initialized` (#3547) +- dwarf_extractor.cpp: Try to preserve link name (#3542) +- dwarf_extractor.cpp: Enable limited support for C++ (#3540) +- Sync up with latest wasi-nn spec (#3530) +- Expose more functions related to emitting AOT files (#3520) +- Make wasi-nn backends as separated shared libraries (#3509) +- build_llvm.py: Speed up llvm build with multi procs on windows (#3512) +- Fix compilation warnings of wasi-nn (#3497) +- Add missing functions to make RIOT work with the 2.x.x version (#3508) ### Others - - Update devcontainer.md (#3628) - - Fix compile errors on workload bwa and benchmark jetstream (#3617) - - wasm-mutator-fuzz: Set compilers earlier (#3585) - - wasm-mutator-fuzz: Make compilers overridable (#3578) - - wasi-nn: Add wasmedge-wasinn-example as smoke test (#3554) - - Add standalone cases (#3536) - - wasm-mutator-fuzz: Fix build errors and warnings for macOS (#3519) - - wasm-mutator-fuzz: Use another variable to check if in oss-fuzz environment (#3518) - - Add wasi-nn example as smoke test case (#3501) + +- Update devcontainer.md (#3628) +- Fix compile errors on workload bwa and benchmark jetstream (#3617) +- wasm-mutator-fuzz: Set compilers earlier (#3585) +- wasm-mutator-fuzz: Make compilers overridable (#3578) +- wasi-nn: Add wasmedge-wasinn-example as smoke test (#3554) +- Add standalone cases (#3536) +- wasm-mutator-fuzz: Fix build errors and warnings for macOS (#3519) +- wasm-mutator-fuzz: Use another variable to check if in oss-fuzz environment (#3518) +- Add wasi-nn example as smoke test case (#3501) --- @@ -230,102 +466,107 @@ ### Breaking Changes ### New Features - - Add wasm_export.h APIs to expose memory type (#3496) - - Add api to get export global instance (#3452) - - Add wasm-mutator-fuzz test (#3420) - - Implement Memory64 support for AOT (#3362) - - Add wasm module global type information APIs (#3406) - - Add aot binary analysis tool aot-analyzer (#3379) - - Expose API to get import/export function's param/result valkind (#3363) - - Add WASI support for esp-idf platform (#3348) + +- Add wasm_export.h APIs to expose memory type (#3496) +- Add api to get export global instance (#3452) +- Add wasm-mutator-fuzz test (#3420) +- Implement Memory64 support for AOT (#3362) +- Add wasm module global type information APIs (#3406) +- Add aot binary analysis tool aot-analyzer (#3379) +- Expose API to get import/export function's param/result valkind (#3363) +- Add WASI support for esp-idf platform (#3348) ### Bug Fixes - - Fix posix build when libc wasi is disabled and debug interp is enabled (#3503) - - Fix wasm_mini_loader.c build when jit or multi-module is enabled (#3502) - - Fix wasm loader check data segment count (#3492) - - Fix loader parse block type and calculate dynamic offset for loop args (#3482) - - Fix memory64 handling find_block_addr and execute_main (#3480) - - Fix two issues to make fuzzing test quit earlier (#3471) - - Fix test-wamr-ide CI failure (#3485) - - NuttX: Fix a dbus-related crash on esp32s3 (#3470) - - Clone data segments when specified with load args (#3463) - - Fix codeql compilation error (#3461) - - Fix several typos and fix bh_log calculate mills (#3441) - - ssp_config.h: Fix ifdef for android random api (#3444) - - libc-wasi: Fix a locking botch (#3437) - - Fix fast interp RECOVER_BR_INFO and local set/tee (#3434) - - aot compiler: Fix a type mismatch in compile_op_float_min_max (#3423) - - Correct Exception Handling tag type when GC is enabled (#3413) - - wasm loader: Fix handling if block without op else (#3404) - - ref-types: Correct default value for function local variables (#3397) - - aot compiler: Fix the length type passed to aot_memmove/aot_memset (#3378) - - Fix loader and mini-loader select potiential error (#3374) - - Fix aot debugger compilation error on windows (#3370) - - A few native stack detection fixes for macOS/arm64 (#3368) - - Fix ESP32-S3 compiling error (#3359) - - Fix a few native stack address calculations (#3351) + +- Fix posix build when libc wasi is disabled and debug interp is enabled (#3503) +- Fix wasm_mini_loader.c build when jit or multi-module is enabled (#3502) +- Fix wasm loader check data segment count (#3492) +- Fix loader parse block type and calculate dynamic offset for loop args (#3482) +- Fix memory64 handling find_block_addr and execute_main (#3480) +- Fix two issues to make fuzzing test quit earlier (#3471) +- Fix test-wamr-ide CI failure (#3485) +- NuttX: Fix a dbus-related crash on esp32s3 (#3470) +- Clone data segments when specified with load args (#3463) +- Fix codeql compilation error (#3461) +- Fix several typos and fix bh_log calculate mills (#3441) +- ssp_config.h: Fix ifdef for android random api (#3444) +- libc-wasi: Fix a locking botch (#3437) +- Fix fast interp RECOVER_BR_INFO and local set/tee (#3434) +- aot compiler: Fix a type mismatch in compile_op_float_min_max (#3423) +- Correct Exception Handling tag type when GC is enabled (#3413) +- wasm loader: Fix handling if block without op else (#3404) +- ref-types: Correct default value for function local variables (#3397) +- aot compiler: Fix the length type passed to aot_memmove/aot_memset (#3378) +- Fix loader and mini-loader select potiential error (#3374) +- Fix aot debugger compilation error on windows (#3370) +- A few native stack detection fixes for macOS/arm64 (#3368) +- Fix ESP32-S3 compiling error (#3359) +- Fix a few native stack address calculations (#3351) ### Enhancements - - Modify logging for windows exception handler and remove unused function (#3489) - - posix iwasm: Make the timeout logic a bit more robust (#3478) - - libc-builtin: Enhance buffered print for printf_wrapper (#3460) - - Enhance GC const initializer expression to support nested struct/array new (#3447) - - wasi: Tweak the configuration for nuttx and explain why (#3451) - - NuttX: Replace esp32s3 bits with the OS-provided APIs (#3439) - - Allow not copying the wasm binary in wasm-c-api and not referring to the binary in wasm/aot loader (#3389) - - aot: Make precheck functions use short-call for xtensa (#3418) - - Add wasm_runtime_detect_native_stack_overflow_size (#3355) - - Enhance wasm loader checks for opcode br_table (#3352) + +- Modify logging for windows exception handler and remove unused function (#3489) +- posix iwasm: Make the timeout logic a bit more robust (#3478) +- libc-builtin: Enhance buffered print for printf_wrapper (#3460) +- Enhance GC const initializer expression to support nested struct/array new (#3447) +- wasi: Tweak the configuration for nuttx and explain why (#3451) +- NuttX: Replace esp32s3 bits with the OS-provided APIs (#3439) +- Allow not copying the wasm binary in wasm-c-api and not referring to the binary in wasm/aot loader (#3389) +- aot: Make precheck functions use short-call for xtensa (#3418) +- Add wasm_runtime_detect_native_stack_overflow_size (#3355) +- Enhance wasm loader checks for opcode br_table (#3352) ### Others - - Bump requests from 2.32.2 to 2.32.3 in /build-scripts (#3494) - - Enable building static library on Android platform (#3488) - - wasm-mutator-fuzz: Generate more kinds of corpus (#3487) - - Correct nuttx repo names (#3484) - - Bump requests from 2.31.0 to 2.32.2 in /build-scripts (#3474) - - wasm-mutator-fuzz: Adapt to oss-fuzz compilation (#3464) - - Add regression tests of BA issue cases (#3462) - - Add malformed test cases (#3459) - - NuttX: Rename a few recently-added nuttx options (#3449) - - wamr-test-suites: Enable AOT multi-module spec tests (#3450) - - Remove install_wasi_sdk from workload preparation script (#3445) - - Add cmake static/shared library build settings (#3443) - - Update spec test to latest commit (#3293) - - Fix typo of WAMR_CONFIGUABLE_BOUNDS_CHECKS (#3424) - - ci/coding_guidelines_check.py: Allow some well-known file names to contain '-' (#3428) - - product-mini/platforms/posix/main.c: Adapt to WASM_MEM_DUAL_BUS_MIRROR (#3427) - - Add comments to global type function declarations (#3431) - - nuttx/esp32s3: Apply ibus/dbus adjustment to internal ram 1 as well (#3421) - - Change WASM_ANYREF to WASM_EXTERNREF (#3426) - - Remove unused macros which were moved to wamr-app-framework (#3425) - - Add WASM_V128 in wasm_valkind_enum (#3412) - - Fix basic example, parameter missmatch between host and wasm (#3415) - - Fix workspaces path in build_wamr.sh (#3414) - - core/iwasm/compilation: Remove stale function prototypes (#3408) - - Add test cases for the requirements of "gc-aot" feature (#3399) - - append_aot_to_wasm.py: Add --ver-str option to emit more info in custom section name (#3398) - - Fix clang compile warnings (#3396) - - Fix some more spelling issues (#3393) - - Fix some spelling issues (#3385) - - samples/native-stack-overflow: Examine native functions with signature (#3382) - - Add some more comments on WASM_STACK_GUARD_SIZE (#3380) - - Fix typo for 'native' in wasm_export.h (#3376) - - CI: Use macos-13 instead of macos-latest (#3366) - - Test more samples in nightly-run CI (#3358) - - Random improvements to samples/native-stack-overflow (#3353) - - Reduce WASM_STACK_GUARD_SIZE a bit for posix-like platforms (#3350) - - doc: Add ADOPTERS.md (#3324) - - Update binary size info in README.md (#3030) - - core/config.h: Bump the default WASM_STACK_GUARD_SIZE (#3344) - - Add unit test suites (#3490) - - Fix internal global getter types (#3495) - - Fix CI build and run unit tests (#3499) + +- Bump requests from 2.32.2 to 2.32.3 in /build-scripts (#3494) +- Enable building static library on Android platform (#3488) +- wasm-mutator-fuzz: Generate more kinds of corpus (#3487) +- Correct nuttx repo names (#3484) +- Bump requests from 2.31.0 to 2.32.2 in /build-scripts (#3474) +- wasm-mutator-fuzz: Adapt to oss-fuzz compilation (#3464) +- Add regression tests of BA issue cases (#3462) +- Add malformed test cases (#3459) +- NuttX: Rename a few recently-added nuttx options (#3449) +- wamr-test-suites: Enable AOT multi-module spec tests (#3450) +- Remove install_wasi_sdk from workload preparation script (#3445) +- Add cmake static/shared library build settings (#3443) +- Update spec test to latest commit (#3293) +- Fix typo of WAMR_CONFIGUABLE_BOUNDS_CHECKS (#3424) +- ci/coding_guidelines_check.py: Allow some well-known file names to contain '-' (#3428) +- product-mini/platforms/posix/main.c: Adapt to WASM_MEM_DUAL_BUS_MIRROR (#3427) +- Add comments to global type function declarations (#3431) +- nuttx/esp32s3: Apply ibus/dbus adjustment to internal ram 1 as well (#3421) +- Change WASM_ANYREF to WASM_EXTERNREF (#3426) +- Remove unused macros which were moved to wamr-app-framework (#3425) +- Add WASM_V128 in wasm_valkind_enum (#3412) +- Fix basic example, parameter missmatch between host and wasm (#3415) +- Fix workspaces path in build_wamr.sh (#3414) +- core/iwasm/compilation: Remove stale function prototypes (#3408) +- Add test cases for the requirements of "gc-aot" feature (#3399) +- append_aot_to_wasm.py: Add --ver-str option to emit more info in custom section name (#3398) +- Fix clang compile warnings (#3396) +- Fix some more spelling issues (#3393) +- Fix some spelling issues (#3385) +- samples/native-stack-overflow: Examine native functions with signature (#3382) +- Add some more comments on WASM_STACK_GUARD_SIZE (#3380) +- Fix typo for 'native' in wasm_export.h (#3376) +- CI: Use macos-13 instead of macos-latest (#3366) +- Test more samples in nightly-run CI (#3358) +- Random improvements to samples/native-stack-overflow (#3353) +- Reduce WASM_STACK_GUARD_SIZE a bit for posix-like platforms (#3350) +- doc: Add ADOPTERS.md (#3324) +- Update binary size info in README.md (#3030) +- core/config.h: Bump the default WASM_STACK_GUARD_SIZE (#3344) +- Add unit test suites (#3490) +- Fix internal global getter types (#3495) +- Fix CI build and run unit tests (#3499) --- ## WAMR-2.0.0 ### Breaking Changes + - The AOT ABI was changed after GC and memory64 features were introduced: - Implement GC feature for interpreter, AOT and LLVM-JIT (#3125) - Implement memory64 for classic interpreter (#3266) @@ -335,11 +576,13 @@ - Separate app-manager and app-framework from WAMR (#3129) ### New Features + - Implement GC feature for interpreter, AOT and LLVM-JIT (#3125) - Implement memory64 for classic interpreter (#3266) - Add wasi_ephemeral_nn module support (#3241) ### Bug Fixes + - EH: Fix broken stack usage calculation (#3121) - Fix loader check_wasi_abi_compatibility (#3126) - Fix possible integer overflow in loader target block check (#3133) @@ -366,6 +609,7 @@ - Fix windows relocation string parsing issue (#3333) ### Enhancements + - Zero the memory mapped from os_mmap in NuttX (#3132) - Use logger for runtime error/debug prints (#3097) - aot_compile_op_call: Stop setting calling convention explicitly (#3140) @@ -409,6 +653,7 @@ - Add functions to expose module import/export info (#3330) ### Others + - Add ARM MacOS to the CI (#3120) - Download jetstream src from github instead of browserbench.org (#3196) - Update document to add wamr-rust-sdk introduction (#3204) @@ -427,12 +672,14 @@ ### Breaking Changes ### New Features + - Implement Exception Handling for classic interpreter (#3096) - Use `cmake -DWAMR_BUILD_EXCE_HANDLING=1/0` option to enable/disable the feature, and by default it is disabled - It is still in highly experimental stage ### Bug Fixes + - Fix build errors when initializing wasm_val_t values with macros (#3007) - fix(wasm-c-api): Do not clone stack frames if there's no trap (#3008) - classic-interp: Handle SIMD opcode when JIT is enabled (#3046) @@ -451,6 +698,7 @@ - Fix read and validation of misc/simd/atomic sub opcodes (#3115) ### Enhancements + - Clear compilation warning and dead code (#3002) - aot debug: Try to use a bit more appropriate file names (#3000) - Increase default app thread stack size (#3010) @@ -459,7 +707,7 @@ - Allow using mmap for shared memory if hw bound check is disabled (#3029) - Don't redefine D_INO if already defined (#3036) - Enhancements on wasm function execution time statistic (#2985) -- wamr-compiler: Fix non-x86{_64} host builds (#3037) +- wamr-compiler: Fix non-x86{\_64} host builds (#3037) - Disable quick aot entry for interp and fast-jit (#3039) - nuttx: Add option to enable quick aot entry (#3040) - Set CONFIG_HAS_CAP_ENTER to support posix file api for freertos (#3041) @@ -481,6 +729,7 @@ - Fix windows build error and compilation warnings (#3095) ### Others + - Fix nightly-run CI failure (#3014) - Build samples in debug mode (#3019) - Remove deprecated tests in language-bindings python (#3018) @@ -501,6 +750,7 @@ ## WAMR-1.3.1 ### Breaking Changes + - In multi-threading, when an exception was thrown in wasm_func_call(), the trap returned contains the stack frames of the thread where the exception occurs, but not the stack frames of the main thread. @@ -509,9 +759,11 @@ `wamrc --emit-custom-sections=name` to emit it and make it clear. ### New Features + - Enable AOT linux perf support (#2930) ### Bug Fixes + - Corrects Zephyr include files for current versions of Zephyr (#2881) - Fix possible dead lock in wasm_cluster_spawn_exec_env (#2882) - Handle ambiguous fstflags on fd_filestat_set_times (#2892) @@ -530,7 +782,8 @@ - Fix linux-sgx build error when libc-wasi is disabled (#2997) ### Enhancements -- fix command-reactor: Look for _initialize only if _start not found (#2891) + +- fix command-reactor: Look for \_initialize only if \_start not found (#2891) - Refactor reloc symbols for riscv (#2894) - Avoid memory import failure when wasi-threads is enabled (#2893) - interpreter: Simplify memory.grow a bit (#2899) @@ -542,7 +795,7 @@ - Enable wasm_runtime_terminate for single-threading (#2924) - nuttx: Add CONFIG_INTERPRETERS_WAMR_DEBUG_AOT (#2929) - Allow to control built-in libraries for wamrc from command line options (#2928) -- Fix a bug that appends '_precheck' to aot_func (#2936) +- Fix a bug that appends '\_precheck' to aot_func (#2936) - freertos: Add os_cond_broadcast for pthread wrapper (#2937) - Append .aot to .wasm as a custom section named "aot" (#2933) - fix(sgx-ra): Fix building when enclave is built without librats ahead (#2968) @@ -557,6 +810,7 @@ - Refine AOT/JIT code call wasm-c-api import process (#2982) ### Others + - compilation_on_nuttx.yml: Use docker image to simplify env setup (#2878) - samples/spawn-thread: Disable libc and pthread (#2883) - Add arm64 to nuttx compilation test (#2886) @@ -571,6 +825,7 @@ ## WAMR-1.3.0 ### Breaking Changes + - Abstract POSIX filesystem functions (#2585) - Change API wasm_runtime_set_wasi_args_ex's arguments `int stdinfd/stdoutfd/stderrfd` to `int64_t stdinfd/stdoutfd/stderrfd` @@ -585,6 +840,7 @@ - libc-wasi: Conditionally support SYNC flags (#2581) ### New Features + - Support muti-module for AOT mode (#2482) - Implement libc-wasi for Windows platform (#2740) - Implement module instance context APIs (#2436) @@ -593,8 +849,9 @@ - Add Cosmopolitan Libc Platform (#2598) ### Bug Fixes + - sgx-ra: Disable the building of samples (#2507) -- Handle a return from wasi _start function correctly (#2529) +- Handle a return from wasi \_start function correctly (#2529) - fd_object_release: Preserve errno (#2535) - Fix build error with ancient GCC (4.8) (#2553) - Fix compiling error for RT-Thread (#2569) @@ -645,6 +902,7 @@ - Fix sample basic intToStr was called with wrong length (#2876) ### Enhancements + - Implement strict validation of thread IDs according to the specification (#2521) - Stop abusing shared memory lock to protect exception (#2509) - Implement os_usleep for posix (#2517) @@ -660,7 +918,7 @@ - Add user to enlarge memory error callback (#2546) - runtest.py: Show accurate case amount in summary (#2549) - Allow using custom signal handler from non-main thread (#2551) -- Return __WASI_EINVAL from fd_prestat_dir_name (#2580) +- Return \_\_WASI_EINVAL from fd_prestat_dir_name (#2580) - Support AOT compiler with LLVM 17 (#2567) - Add support for closing/renumbering preopen fds (#2578) - Enable AOT usage on M1 mac (#2618) @@ -703,6 +961,7 @@ - Fix compilation warnings on Windows (#2868) ### Others + - Add mutex stress test (#2472) - Add unit tests for the tid allocator (#2519) - Add support for running tests on apple M1 macs (#2554) @@ -740,15 +999,18 @@ ## WAMR-1.2.3 ### Breaking Changes + - Increase default native stack size (#2332) ### New Features + - Implement the segue optimization for LLVM AOT/JIT (#2230) - Implement AOT static PGO (#2243) - Enable static PGO for Linux SGX (#2270) - Add Rust Formatters to Debugger (Vector, Map etc.) (#2219) ### Bug Fixes + - The Python language-binding needs python>=3.9 (#2228) - aot_compile_op_call: Remove a wrong optimization (#2233) - Fix typo in samples/ref-types (#2236) @@ -791,6 +1053,7 @@ - Fix typo in aot_emit_aot_file.c (#2478) ### Enhancements + - A few changes related to WAMRC_LLC_COMPILER (#2218) - Enhance linux-sgx CI (#2102) - Add asan and ubsan to WAMR CI (#2161) @@ -799,7 +1062,7 @@ - Add cmake variable to disable writing gs register (#2284) - Make hmu_tree_node 4 byte aligned to reduce compiler warning (#2268) - Appease unused warning on min_uint64 (#2277) -- Fix format warning by PRIu32 in [wasm|aot] dump call stack (#2251) +- Fix format warning by PRIu32 in [wasm|aot] dump call stack (#2251) - Fix a compile warning due to missing include (#2293) - Fix dockerfile linter warnings (#2291) - Enable windows x86-32 AOT relocations (#2285) @@ -812,7 +1075,7 @@ - aot: Implement a few more relocation types for riscv (#2318) - wasi-nn: Add support of wasi-nn as shared lib (#2310) - Add a few more assertions on structures to which aot abi is sensitive (#2326) -- Fix sanitizer errors in posix socket (#2331) +- Fix sanitizer errors in posix socket (#2331) - Add "--xip" option for wamrc (#2336) - Add "--enable-llvm-passes=" option to wamrc (#2335) - Make memory access boundary check behavior configurable (#2289) @@ -856,6 +1119,7 @@ - Clone the input binary during wasm_module_validate (#2483) ### Others + - Nuttx CI: Ignore the expired certificate for riscv gcc toolchain (#2222) - core/iwasm/compilation: constify a bit (#2223) - Bump requests from 2.28.2 to 2.31.0 in /build-scripts (#2229) @@ -878,9 +1142,11 @@ ### Breaking Changes ### New Features + - Implement Fast JIT multi-threading feature (#2134) ### Bug Fixes + - Update request.ts wasm_response_send signature (#2122) - Fix ems allocator unaligned memory access on riscv64 (#2140) - libc_wasi_wrapper.c: Fix min func issue for size_t < 8 bytes on some platforms (#2152) @@ -889,6 +1155,7 @@ - Fix wamr-ide debugger ignoring launch config (#2155) ### Enhancements + - Add test for validating linear memory size updates (#2078) - Update Zephyr docs to remove unsupported west subcommand (#2128) - Update messages/comments to refer the new place of the version definition (#2133) @@ -907,6 +1174,7 @@ - Fix compile warnings on windows platform (#2208) ### Others + - CI: Add ubsan checks to samples/wasm-c-api (#2147) - CI: More precise trigger paths for github actions (#2157) @@ -919,6 +1187,7 @@ ### New Features ### Bug Fixes + - libc-wasi/posix.c: Fix POLL{RD,WR}NORM in uClibc (#2069) - Fix bh_assert for 64-bit platforms (#2071) - wamr-ide: Modify Dockerfile to update base image version and fix build issue (#2068) @@ -932,6 +1201,7 @@ - Fix interpreter read linear memory size for multi-threading (#2088) ### Enhancements + - Limit the minimal size of bh_hashmap (#2073) - Bump tensorflow to 2.11.1 in /core/iwasm/libraries/wasi-nn/test (#2061) - Bump tensorflow to 2.11.1 in install_tensorflow.sh (#2076) @@ -939,6 +1209,7 @@ - Update documents (#2100) ### Others + - spectest/nuttx: Increase stack size of iwasm task (#2082) - ci: Refactor windows build definition (#2087) - ci: Enable WASI threads in CI (#2086) @@ -950,8 +1221,8 @@ ### Breaking Changes - ### New Features + - Implement two-level Multi-tier JIT engine: tier-up from Fast JIT to LLVM JIT to get quick cold startup and better performance - Enable running mode control for runtime, wasm module instance and iwasm - Implement wasi-threads feature @@ -964,6 +1235,7 @@ - Add libsodium benchmark ### Bug Fixes + - Fix wasm-c-api import func link issue in wasm_instance_new - Fix watchpoint segfault when using debug interp without server - libc-wasi: Fix spurious poll timeout @@ -992,6 +1264,7 @@ - fix debugger: Set termination flags also when in debug mode ### Enhancements + - Add WAMR-IDE vscode extension to the Visual Studio Marketplace - Refine Windows thread waiting list operations - Improve wasm-c-api instantiation-time linking @@ -1032,6 +1305,7 @@ - Refine aot compiler check suspend_flags and fix issue of multi-tier jit ### Others + - Enable XIP in CI daily test - Integrate wasi test suite to wamr-test-suites and CI - Add CI for wasi-threads tests @@ -1046,6 +1320,7 @@ ## WAMR-1.1.2 ### Breaking Changes + - Remove the LLVM MCJIT mode, replace it with LLVM ORC JIT eager mode - Add option to pass user data to the allocator functions of RuntimeInitArgs - Change how iwasm returns: @@ -1055,6 +1330,7 @@ - Enable bulk memory by default ### New Features + - Add control for the native stack check with hardware trap - Add memory watchpoint support to debugger - Add wasm_module_obtain() to clone wasm_module_t @@ -1062,6 +1338,7 @@ - esp-idf: Add socket support for esp-idf platform ### Bug Fixes + - Fix XIP issue caused by rem_s on RISC-V - Fix XIP issues of fp to int cast and int rem/div - Fix missing float cmp for XIP @@ -1081,6 +1358,7 @@ - Fix XIP issue of handling 64-bit const in 32-bit target ### Enhancements + - Refactor the layout of interpreter and AOT module instance - Refactor LLVM JIT: remove mcjit and legacy pass manager, upgrade to ORCv2 JIT - Refine Fast JIT call indirect and call native process @@ -1097,7 +1375,7 @@ - Refine the stack frame size check in interpreter - Enlarge the default wasm operand stack size to 64KB - Use cmake POSITION_INDEPENDENT_CODE instead of hardcoding -pie -fPIE -- Implement R_ARM_THM_MOVT_[ABS|REPL] for thumb +- Implement R*ARM_THM_MOVT*[ABS|REPL] for thumb - Suppress the warnings when building with GCC11 - samples/native-lib: Add a bit more complicated example - Add mutex initializer for wasm-c-api engine operations @@ -1125,6 +1403,7 @@ - Enable wasm cache loading in wasm-c-api ### Others + - Add CIs to release new version and publish binary files - Add more compilation groups of fast jit into CI - Enable spec test on nuttx and daily run it @@ -1273,5 +1552,3 @@ ### Others --- - - diff --git a/build-scripts/build_llvm.py b/build-scripts/build_llvm.py index ec6bb3954..3d241355b 100755 --- a/build-scripts/build_llvm.py +++ b/build-scripts/build_llvm.py @@ -112,17 +112,11 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl ] # if not on ARC platform, but want to add expeirmental backend ARC as target - if platform != "ARC" and "ARC" in backends: + if platform != "ARC" and "ARC" in backends: LLVM_TARGETS_TO_BUILD.extend( LLVM_EXTRA_COMPILE_OPTIONS["arc"] ) - if platform != "Xtensa" and "Xtensa" in backends: - print( - "Currently it's not supported to build Xtensa backend on non-Xtensa platform" - ) - return None - LLVM_PROJECTS_TO_BUILD = [ '-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else "" ] @@ -217,11 +211,11 @@ def repackage_llvm_windows(llvm_dir): if not packs_path: raise Exception("Didn't find any LLVM-* package") return - + llvm_package_path = f"_CPack_Packages/win64/NSIS/{packs_path[0].name}" windows_package_dir = build_dir.joinpath(llvm_package_path).resolve() - # mv package dir outside of build + # mv package dir outside of build shutil.move(str(windows_package_dir), str(llvm_dir)) # rm -r build shutil.rmtree(str(build_dir)) @@ -231,7 +225,7 @@ def repackage_llvm_windows(llvm_dir): moved_package_dir = llvm_dir.joinpath(packs_path[0].name) for sub_dir in moved_package_dir.iterdir(): shutil.move(str(sub_dir), str(build_dir)) - moved_package_dir.rmdir() + moved_package_dir.rmdir() def main(): parser = argparse.ArgumentParser(description="build necessary LLVM libraries") @@ -300,17 +294,17 @@ def main(): "arc": { "repo": "https://github.com/llvm/llvm-project.git", "repo_ssh": "git@github.com:llvm/llvm-project.git", - "branch": "release/15.x", + "branch": "release/18.x", }, "xtensa": { "repo": "https://github.com/espressif/llvm-project.git", "repo_ssh": "git@github.com:espressif/llvm-project.git", - "branch": "xtensa_release_17.0.1", + "branch": "xtensa_release_18.1.2", }, "default": { "repo": "https://github.com/llvm/llvm-project.git", "repo_ssh": "git@github.com:llvm/llvm-project.git", - "branch": "release/15.x", + "branch": "release/18.x", }, } diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake index 6a30bfb7b..1a77d4cac 100644 --- a/build-scripts/config_common.cmake +++ b/build-scripts/config_common.cmake @@ -131,6 +131,12 @@ else () unset (LLVM_AVAILABLE_LIBS) endif () +# Version +include (${WAMR_ROOT_DIR}/build-scripts/version.cmake) + +# Package +include (${WAMR_ROOT_DIR}/build-scripts/package.cmake) + # Sanitizers if (NOT DEFINED WAMR_BUILD_SANITIZER) @@ -151,6 +157,9 @@ elseif (WAMR_BUILD_SANITIZER STREQUAL "asan") elseif (WAMR_BUILD_SANITIZER STREQUAL "tsan") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" ) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread") +elseif (WAMR_BUILD_SANITIZER STREQUAL "posan") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=pointer-overflow -fno-sanitize-recover=all" ) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=pointer-overflow") elseif (NOT (WAMR_BUILD_SANITIZER STREQUAL "") ) message(SEND_ERROR "Unsupported sanitizer: ${WAMR_BUILD_SANITIZER}") endif() @@ -167,16 +176,63 @@ if (NOT DEFINED WAMR_BUILD_SHRUNK_MEMORY) set (WAMR_BUILD_SHRUNK_MEMORY 1) endif () +######################################## +# Default values +######################################## +if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) + set (WAMR_BUILD_BULK_MEMORY 1) +endif () + +if (NOT DEFINED WAMR_BUILD_EXCE_HANDLING) + set (WAMR_BUILD_EXCE_HANDLING 0) +endif () + +if (NOT DEFINED WAMR_BUILD_GC) + set (WAMR_BUILD_GC 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MEMORY64) + set (WAMR_BUILD_MEMORY64 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MULTI_MEMORY) + set (WAMR_BUILD_MULTI_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_SHARED_MEMORY) + set(WAMR_BUILD_SHARED_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_STRINGREF) + set(WAMR_BUILD_STRINGREF 0) +endif () + +if (NOT DEFINED WAMR_BUILD_TAIL_CALL) + set (WAMR_BUILD_TAIL_CALL 0) +endif () + +######################################## +# Compilation options to marco ######################################## message ("-- Build Configurations:") message (" Build as target ${WAMR_BUILD_TARGET}") +message (" Build for platform ${WAMR_BUILD_PLATFORM}") message (" CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE}) +message (" BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS}) +################## running mode ################## if (WAMR_BUILD_INTERP EQUAL 1) message (" WAMR Interpreter enabled") else () message (" WAMR Interpreter disabled") endif () +if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) + add_definitions (-DWASM_ENABLE_FAST_INTERP=1) + message (" Fast interpreter enabled") +else () + add_definitions (-DWASM_ENABLE_FAST_INTERP=0) + message (" Fast interpreter disabled") +endif () if (WAMR_BUILD_AOT EQUAL 1) message (" WAMR AOT enabled") else () @@ -207,32 +263,7 @@ if (WAMR_BUILD_FAST_JIT EQUAL 1 AND WAMR_BUILD_JIT EQUAL 1 AND WAMR_BUILD_LAZY_JIT EQUAL 1) message (" Multi-tier JIT enabled") endif () -if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) - message (" Libc builtin enabled") -else () - message (" Libc builtin disabled") -endif () -if (WAMR_BUILD_LIBC_UVWASI EQUAL 1) - message (" Libc WASI enabled with uvwasi implementation") -elseif (WAMR_BUILD_LIBC_WASI EQUAL 1) - message (" Libc WASI enabled") -else () - message (" Libc WASI disabled") -endif () -if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) - add_definitions (-DWASM_ENABLE_FAST_INTERP=1) - message (" Fast interpreter enabled") -else () - add_definitions (-DWASM_ENABLE_FAST_INTERP=0) - message (" Fast interpreter disabled") -endif () -if (WAMR_BUILD_MULTI_MODULE EQUAL 1) - add_definitions (-DWASM_ENABLE_MULTI_MODULE=1) - message (" Multiple modules enabled") -else () - add_definitions (-DWASM_ENABLE_MULTI_MODULE=0) - message (" Multiple modules disabled") -endif () +################## test modes ################## if (WAMR_BUILD_SPEC_TEST EQUAL 1) add_definitions (-DWASM_ENABLE_SPEC_TEST=1) message (" spec test compatible mode is on") @@ -241,41 +272,23 @@ if (WAMR_BUILD_WASI_TEST EQUAL 1) add_definitions (-DWASM_ENABLE_WASI_TEST=1) message (" wasi test compatible mode is on") endif () -if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) - # Enable bulk memory by default - set (WAMR_BUILD_BULK_MEMORY 1) -endif () -if (WAMR_BUILD_BULK_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_BULK_MEMORY=1) - message (" Bulk memory feature enabled") +################## native ################## +if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) + message (" Libc builtin enabled") else () - add_definitions (-DWASM_ENABLE_BULK_MEMORY=0) - message (" Bulk memory feature disabled") + message (" Libc builtin disabled") endif () -if (WAMR_BUILD_SHARED_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1) - message (" Shared memory enabled") +if (WAMR_BUILD_LIBC_UVWASI EQUAL 1) + message (" Libc WASI enabled with uvwasi implementation\n" + " WANRING:: uvwasi does not currently provide the comprehensive\n" + " file system security properties provided by some WASI runtimes.\n" + " Full support for secure file system sandboxing may or may not\n" + " be implemented in future. In the mean time, DO NOT RELY ON IT\n" + " TO RUN UNTRUSTED CODE.") +elseif (WAMR_BUILD_LIBC_WASI EQUAL 1) + message (" Libc WASI enabled") else () - add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0) -endif () -if (WAMR_BUILD_SHARED_HEAP EQUAL 1) - add_definitions (-DWASM_ENABLE_SHARED_HEAP=1) - message (" Shared heap enabled") -endif() - -if (WAMR_BUILD_MEMORY64 EQUAL 1) - # if native is 32-bit or cross-compiled to 32-bit - if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*") - message (FATAL_ERROR "-- Memory64 is only available on the 64-bit platform/target") - endif() - add_definitions (-DWASM_ENABLE_MEMORY64=1) - set (WAMR_DISABLE_HW_BOUND_CHECK 1) - message (" Memory64 memory enabled") -endif () -if (WAMR_BUILD_MULTI_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1) - message (" Multi memory enabled") - set (WAMR_BUILD_DEBUG_INTERP 0) + message (" Libc WASI disabled") endif () if (WAMR_BUILD_THREAD_MGR EQUAL 1) message (" Thread manager enabled") @@ -295,6 +308,53 @@ endif () if (WAMR_BUILD_LIB_RATS EQUAL 1) message (" Lib rats enabled") endif() +if ((WAMR_BUILD_LIB_SIMDE EQUAL 1)) + message (" Lib simde enabled") +endif() +################## WAMR features ################## +if (WAMR_BUILD_MULTI_MODULE EQUAL 1) + add_definitions (-DWASM_ENABLE_MULTI_MODULE=1) + message (" Multiple modules enabled") +else () + add_definitions (-DWASM_ENABLE_MULTI_MODULE=0) + message (" Multiple modules disabled") +endif () +if (WAMR_BUILD_BULK_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_BULK_MEMORY=1) +else () + add_definitions (-DWASM_ENABLE_BULK_MEMORY=0) +endif () +if (WAMR_BUILD_SHARED_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1) + message (" Shared memory enabled") +else () + add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0) +endif () +if (WAMR_BUILD_SHARED_HEAP EQUAL 1) + add_definitions (-DWASM_ENABLE_SHARED_HEAP=1) + message (" Shared heap enabled") +endif() + +if (WAMR_ENABLE_COPY_CALLSTACK EQUAL 1) + add_definitions (-DWAMR_ENABLE_COPY_CALLSTACK=1) + message(" Copy callstack enabled") +else () + add_definitions (-DWAMR_ENABLE_COPY_CALLSTACK=0) + message(" Copy callstack disabled") +endif() + +if (WAMR_BUILD_MEMORY64 EQUAL 1) + # if native is 32-bit or cross-compiled to 32-bit + if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*") + message (FATAL_ERROR "-- Memory64 is only available on the 64-bit platform/target") + endif() + add_definitions (-DWASM_ENABLE_MEMORY64=1) + set (WAMR_DISABLE_HW_BOUND_CHECK 1) +endif () +if (WAMR_BUILD_MULTI_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1) + set (WAMR_BUILD_DEBUG_INTERP 0) +endif () if (WAMR_BUILD_MINI_LOADER EQUAL 1) add_definitions (-DWASM_ENABLE_MINI_LOADER=1) message (" WASM mini loader enabled") @@ -322,12 +382,14 @@ else () message (" Wakeup of blocking operations enabled") endif () if (WAMR_BUILD_SIMD EQUAL 1) - if (NOT WAMR_BUILD_TARGET MATCHES "RISCV64.*") - add_definitions (-DWASM_ENABLE_SIMD=1) - message (" SIMD enabled") - else () + if (WAMR_BUILD_TARGET MATCHES "RISCV64.*") + set(SIMD_ENABLED 0) message (" SIMD disabled due to not supported on target RISCV64") + else() + set(SIMD_ENABLED 1) + message (" SIMD enabled") endif () + add_definitions(-DWASM_ENABLE_SIMD=${SIMD_ENABLED}) endif () if (WAMR_BUILD_AOT_STACK_FRAME EQUAL 1) add_definitions (-DWASM_ENABLE_AOT_STACK_FRAME=1) @@ -354,16 +416,11 @@ if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1) endif () if (WAMR_BUILD_TAIL_CALL EQUAL 1) add_definitions (-DWASM_ENABLE_TAIL_CALL=1) - message (" Tail call enabled") endif () if (WAMR_BUILD_REF_TYPES EQUAL 1) add_definitions (-DWASM_ENABLE_REF_TYPES=1) - message (" Reference types enabled") -else () - message (" Reference types disabled") endif () if (WAMR_BUILD_GC EQUAL 1) - message (" GC enabled") if (WAMR_TEST_GC EQUAL 1) message(" GC testing enabled") endif() @@ -375,7 +432,6 @@ else () message (" GC performance profiling disabled") endif () if (WAMR_BUILD_STRINGREF EQUAL 1) - message (" Stringref enabled") if (NOT DEFINED WAMR_STRINGREF_IMPL_SOURCE) message (" Using WAMR builtin implementation for stringref") else () @@ -610,4 +666,45 @@ if (WAMR_BUILD_SHRUNK_MEMORY EQUAL 1) else () add_definitions (-DWASM_ENABLE_SHRUNK_MEMORY=0) message (" Shrunk memory disabled") +endif() +if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1) + message (" AOT validator enabled") + add_definitions (-DWASM_ENABLE_AOT_VALIDATOR=1) endif () +if (WAMR_BUILD_INSTRUCTION_METERING EQUAL 1) + message (" Instruction metering enabled") + add_definitions (-DWASM_ENABLE_INSTRUCTION_METERING=1) +endif () + +######################################## +# Show Phase4 Wasm proposals status. +######################################## + +message ( +"-- About Wasm Proposals:\n" +" Always-on:\n" +" \"Multi-value\"\n" +" \"Non-trapping float-to-int conversions\"\n" +" \"Sign-extension operators\"\n" +" \"WebAssembly C and C++ API\"\n" +" Configurable. 0 is OFF. 1 is ON:\n" +" \"Bulk Memory Operation\" via WAMR_BUILD_BULK_MEMORY: ${WAMR_BUILD_BULK_MEMORY}\n" +" \"Fixed-width SIMD\" via WAMR_BUILD_SIMD: ${WAMR_BUILD_SIMD}\n" +" \"Garbage collection\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n" +" \"Legacy Exception handling\" via WAMR_BUILD_EXCE_HANDLING: ${WAMR_BUILD_EXCE_HANDLING}\n" +" \"Memory64\" via WAMR_BUILD_MEMORY64: ${WAMR_BUILD_MEMORY64}\n" +" \"Multiple memories\" via WAMR_BUILD_MULTI_MEMORY: ${WAMR_BUILD_MULTI_MEMORY}\n" +" \"Reference Types\" via WAMR_BUILD_REF_TYPES: ${WAMR_BUILD_REF_TYPES}\n" +" \"Reference-Typed Strings\" via WAMR_BUILD_STRINGREF: ${WAMR_BUILD_STRINGREF}\n" +" \"Tail call\" via WAMR_BUILD_TAIL_CALL: ${WAMR_BUILD_TAIL_CALL}\n" +" \"Threads\" via WAMR_BUILD_SHARED_MEMORY: ${WAMR_BUILD_SHARED_MEMORY}\n" +" \"Typed Function References\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n" +" Unsupported (>= Phase4):\n" +" \"Branch Hinting\"\n" +" \"Custom Annotation Syntax in the Text Format\"\n" +" \"Exception handling\"\n" +" \"Extended Constant Expressions\"\n" +" \"Import/Export of Mutable Globals\"\n" +" \"JS String Builtins\"\n" +" \"Relaxed SIMD\"\n" +) diff --git a/build-scripts/esp-idf/README.md b/build-scripts/esp-idf/README.md index 6bec45d1e..25fe491ea 100644 --- a/build-scripts/esp-idf/README.md +++ b/build-scripts/esp-idf/README.md @@ -11,7 +11,7 @@ You can build an ESP-IDF project with wasm-micro-runtime as a component: - In the newly created project folder edit the `CMakeList.txt`: ``` - cmake_minimum_required(VERSION 3.5) + cmake_minimum_required(VERSION 3.14) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/build-scripts/esp-idf/wamr/CMakeLists.txt b/build-scripts/esp-idf/wamr/CMakeLists.txt index af0d8efc9..b47cd16ab 100644 --- a/build-scripts/esp-idf/wamr/CMakeLists.txt +++ b/build-scripts/esp-idf/wamr/CMakeLists.txt @@ -5,11 +5,15 @@ if (NOT CMAKE_BUILD_EARLY_EXPANSION) if (CONFIG_IDF_TARGET_ARCH_RISCV) - set (WAMR_BUILD_TARGET "RISCV32") + if (CONFIG_IDF_TARGET_ESP32P4) + set (WAMR_BUILD_TARGET "RISCV32_ILP32F") + else () + set (WAMR_BUILD_TARGET "RISCV32_ILP32") + endif () elseif (CONFIG_IDF_TARGET_ARCH_XTENSA) - set (WAMR_BUILD_TARGET "XTENSA") + set (WAMR_BUILD_TARGET "XTENSA") else () - message (FATAL_ERROR "Arch ${CONFIG_IDF_TARGET_ARCH} is not supported") + message (FATAL_ERROR "Arch ${CONFIG_IDF_TARGET_ARCH} is not supported") endif () set (WAMR_BUILD_PLATFORM "esp-idf") @@ -41,31 +45,31 @@ if (NOT CMAKE_BUILD_EARLY_EXPANSION) endif () if (CONFIG_WAMR_ENABLE_MULTI_MODULE) - set (WAMR_BUILD_MULTI_MODULE 1) + set (WAMR_BUILD_MULTI_MODULE 1) endif () if (CONFIG_WAMR_ENABLE_SHARED_MEMORY) - set (WAMR_BUILD_SHARED_MEMORY 1) + set (WAMR_BUILD_SHARED_MEMORY 1) endif () if (CONFIG_WAMR_ENABLE_MEMORY_PROFILING) - set (WAMR_BUILD_MEMORY_PROFILING 1) + set (WAMR_BUILD_MEMORY_PROFILING 1) endif () if (CONFIG_WAMR_ENABLE_PERF_PROFILING) - set (WAMR_BUILD_PERF_PROFILING 1) + set (WAMR_BUILD_PERF_PROFILING 1) endif () if (CONFIG_WAMR_ENABLE_REF_TYPES) - set (WAMR_BUILD_REF_TYPES 1) + set (WAMR_BUILD_REF_TYPES 1) endif () if (CONFIG_WAMR_ENABLE_LIBC_WASI) - set (WAMR_BUILD_LIBC_WASI 1) + set (WAMR_BUILD_LIBC_WASI 1) endif () if (CONFIG_WAMR_ENABLE_LIB_PTHREAD) - set (WAMR_BUILD_LIB_PTHREAD 1) + set (WAMR_BUILD_LIB_PTHREAD 1) endif () set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) @@ -89,7 +93,11 @@ idf_component_register(SRCS ${srcs} target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") if (CONFIG_IDF_TARGET_ARCH_RISCV) - target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_RISCV32_ILP32=1) + if (CONFIG_IDF_TARGET_ESP32P4) + target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_RISCV32_ILP32F=1) + else () + target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_RISCV32_ILP32=1) + endif () elseif (CONFIG_IDF_TARGET_ARCH_XTENSA) target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_XTENSA=1) endif () diff --git a/build-scripts/iwasmConfig.cmake.in b/build-scripts/iwasmConfig.cmake.in new file mode 100644 index 000000000..05ec5a8cd --- /dev/null +++ b/build-scripts/iwasmConfig.cmake.in @@ -0,0 +1,6 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/iwasmTargets.cmake") diff --git a/build-scripts/package.cmake b/build-scripts/package.cmake new file mode 100644 index 000000000..67cb8fc23 --- /dev/null +++ b/build-scripts/package.cmake @@ -0,0 +1,30 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +set(_WAMR_BUILD_SCRIPTS_DIR "${CMAKE_CURRENT_LIST_DIR}") + +function(install_iwasm_package) + install (EXPORT iwasmTargets + FILE iwasmTargets.cmake + NAMESPACE iwasm:: + DESTINATION lib/cmake/iwasm + ) + + include (CMakePackageConfigHelpers) + configure_package_config_file (${_WAMR_BUILD_SCRIPTS_DIR}/iwasmConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake" + INSTALL_DESTINATION lib/cmake/iwasm + ) + + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake" + VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH} + COMPATIBILITY SameMajorVersion + ) + + install (FILES + "${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake" + DESTINATION lib/cmake/iwasm + ) +endfunction() diff --git a/build-scripts/runtime_lib.cmake b/build-scripts/runtime_lib.cmake index c57cfc57a..e538b5d91 100644 --- a/build-scripts/runtime_lib.cmake +++ b/build-scripts/runtime_lib.cmake @@ -14,7 +14,7 @@ if (NOT DEFINED DEPS_DIR) set (DEPS_DIR ${WAMR_ROOT_DIR}/core/deps) endif () if (NOT DEFINED SHARED_PLATFORM_CONFIG) - # CMake file for platform configuration. The PLATFORM_SHARED_SOURCE varable + # CMake file for platform configuration. The PLATFORM_SHARED_SOURCE variable # should point to a list of platform-specfic source files to compile. set (SHARED_PLATFORM_CONFIG ${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake) endif () @@ -168,6 +168,18 @@ endif () # include the build config template file include (${CMAKE_CURRENT_LIST_DIR}/config_common.cmake) +if (WAMR_BUILD_SIMD EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1) + if (WAMR_BUILD_PLATFORM STREQUAL "windows") + message(STATUS "SIMDe doesnt support platform " ${WAMR_BUILD_PLATFORM}) + set(WAMR_BUILD_SIMDE 0) + else() + include (${IWASM_DIR}/libraries/simde/simde.cmake) + set (WAMR_BUILD_SIMDE 1) + endif() +else() + set(WAMR_BUILD_SIMDE 0) +endif () + include_directories (${IWASM_DIR}/include) file (GLOB header @@ -181,6 +193,13 @@ else() enable_language (ASM) endif() +# it will expose the runtime APIs. +# you'll use the following command to check the exported APIs +# dumpbin.exe /EXPORTS xxx +if (MSVC) + add_compile_definitions(COMPILING_WASM_RUNTIME_API=1) +endif () + include (${SHARED_PLATFORM_CONFIG}) include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake) include (${IWASM_DIR}/common/iwasm_common.cmake) diff --git a/build-scripts/version.cmake b/build-scripts/version.cmake new file mode 100644 index 000000000..c98b10f6f --- /dev/null +++ b/build-scripts/version.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +if(NOT WAMR_ROOT_DIR) + # if from wamr-compiler + set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/..) +endif() + +set(WAMR_VERSION_MAJOR 2) +set(WAMR_VERSION_MINOR 3) +set(WAMR_VERSION_PATCH 1) + +message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}") + +# Configure the version header file +configure_file( + ${WAMR_ROOT_DIR}/core/version.h.in + ${WAMR_ROOT_DIR}/core/version.h +) + +# Set the library version and SOVERSION +function(set_version_info target) + set_target_properties(${target} + PROPERTIES + VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH} + SOVERSION ${WAMR_VERSION_MAJOR} +) +endfunction() diff --git a/ci/coding_guidelines_check.py b/ci/coding_guidelines_check.py index a0b4535f9..43c366259 100644 --- a/ci/coding_guidelines_check.py +++ b/ci/coding_guidelines_check.py @@ -13,8 +13,8 @@ import subprocess import sys import unittest -CLANG_FORMAT_CMD = "clang-format-12" -GIT_CLANG_FORMAT_CMD = "git-clang-format-12" +CLANG_FORMAT_CMD = "clang-format-14" +GIT_CLANG_FORMAT_CMD = "git-clang-format-14" # glob style patterns EXCLUDE_PATHS = [ @@ -32,7 +32,7 @@ EXCLUDE_PATHS = [ "**/tests/wamr-test-suites/workspace/*", ] -C_SUFFIXES = [".c", ".cpp", ".h"] +C_SUFFIXES = [".c", ".cc", ".cpp", ".h"] INVALID_DIR_NAME_SEGMENT = r"([a-zA-Z0-9]+\_[a-zA-Z0-9]+)" INVALID_FILE_NAME_SEGMENT = r"([a-zA-Z0-9]+\-[a-zA-Z0-9]+)" @@ -93,20 +93,29 @@ def run_clang_format(file_path: Path, root: Path) -> bool: def run_clang_format_diff(root: Path, commits: str) -> bool: """ - Use `clang-format-12` or `git-clang-format-12` to check code format of + Use `clang-format-14` or `git-clang-format-14` to check code format of the PR, with a commit range specified. It is required to format the code before committing the PR, or it might fail to pass the CI check: - 1. Install clang-format-12.0.0 - Normally we can install it by `sudo apt-get install clang-format-12`, - or download the `clang+llvm-12.0.0-xxx-tar.xz` package from - https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0 - and install it + 1. Install clang-format-14.0.0 + + You can download the package from + https://github.com/llvm/llvm-project/releases + and install it. + + For Debian/Ubuntu, we can probably use + `sudo apt-get install clang-format-14`. + + Homebrew has it as a part of llvm@14. + ```shell + brew install llvm@14 + /usr/local/opt/llvm@14/bin/clang-format + ``` 2. Format the C/C++ source file ``` shell cd path/to/wamr/root - clang-format-12 --style file -i path/to/file + clang-format-14 --style file -i path/to/file ``` The code wrapped by `/* clang-format off */` and `/* clang-format on */` @@ -145,7 +154,7 @@ def run_clang_format_diff(root: Path, commits: str) -> bool: found = False for summary in [x for x in diff_content if x.startswith("diff --git")]: # b/path/to/file -> path/to/file - with_invalid_format = re.split("\s+", summary)[-1][2:] + with_invalid_format = re.split(r"\s+", summary)[-1][2:] if not is_excluded(with_invalid_format): print(f"--- {with_invalid_format} failed on code style checking.") found = True diff --git a/core/config.h b/core/config.h index 27d26f093..a4e1499e3 100644 --- a/core/config.h +++ b/core/config.h @@ -193,6 +193,10 @@ #error "Heap aux stack allocation must be enabled for WASI threads" #endif +#ifndef WAMR_ENABLE_COPY_CALLSTACK +#define WAMR_ENABLE_COPY_CALLSTACK 0 +#endif + #ifndef WASM_ENABLE_BASE_LIB #define WASM_ENABLE_BASE_LIB 0 #endif @@ -318,6 +322,12 @@ #define WASM_ENABLE_SIMD 0 #endif +/* Disable SIMDe (used in the fast interpreter for SIMD opcodes) +unless used elsewhere */ +#ifndef WASM_ENABLE_SIMDE +#define WASM_ENABLE_SIMDE 0 +#endif + /* GC performance profiling */ #ifndef WASM_ENABLE_GC_PERF_PROFILING #define WASM_ENABLE_GC_PERF_PROFILING 0 @@ -702,4 +712,12 @@ #define WASM_ENABLE_SHRUNK_MEMORY 1 #endif +#ifndef WASM_ENABLE_AOT_VALIDATOR +#define WASM_ENABLE_AOT_VALIDATOR 0 +#endif + +#ifndef WASM_ENABLE_INSTRUCTION_METERING +#define WASM_ENABLE_INSTRUCTION_METERING 0 +#endif + #endif /* end of _CONFIG_H_ */ diff --git a/core/iwasm/aot/aot_intrinsic.c b/core/iwasm/aot/aot_intrinsic.c index 245c7a651..a0e59e1d2 100644 --- a/core/iwasm/aot/aot_intrinsic.c +++ b/core/iwasm/aot/aot_intrinsic.c @@ -194,7 +194,7 @@ aot_intrinsic_clz_i32(uint32 type) return num; } -uint32 +uint64 aot_intrinsic_clz_i64(uint64 type) { uint32 num = 0; @@ -220,7 +220,7 @@ aot_intrinsic_ctz_i32(uint32 type) return num; } -uint32 +uint64 aot_intrinsic_ctz_i64(uint64 type) { uint32 num = 0; @@ -244,7 +244,7 @@ aot_intrinsic_popcnt_i32(uint32 u) return ret; } -uint32 +uint64 aot_intrinsic_popcnt_i64(uint64 u) { uint32 ret = 0; @@ -485,6 +485,30 @@ aot_intrinsic_i64_bit_and(uint64 l, uint64 r) return l & r; } +uint64 +aot_intrinsic_i64_mul(uint64 l, uint64 r) +{ + return l * r; +} + +uint64 +aot_intrinsic_i64_shl(uint64 l, uint64 r) +{ + return l << r; +} + +uint64 +aot_intrinsic_i64_shr_s(uint64 l, uint64 r) +{ + return (int64)l >> r; +} + +uint64 +aot_intrinsic_i64_shr_u(uint64 l, uint64 r) +{ + return l >> r; +} + #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0 typedef struct { @@ -561,6 +585,10 @@ static const aot_intrinsic g_intrinsic_mapping[] = { { "i64.rem_u", "aot_intrinsic_i64_rem_u", AOT_INTRINSIC_FLAG_I64_REM_U}, { "i64.or", "aot_intrinsic_i64_bit_or", AOT_INTRINSIC_FLAG_I64_BIT_OR}, { "i64.and", "aot_intrinsic_i64_bit_and", AOT_INTRINSIC_FLAG_I64_BIT_AND}, + { "i64.mul", "aot_intrinsic_i64_mul", AOT_INTRINSIC_FLAG_I64_MUL}, + { "i64.shl", "aot_intrinsic_i64_shl", AOT_INTRINSIC_FLAG_I64_SHL}, + { "i64.shr_s", "aot_intrinsic_i64_shr_s", AOT_INTRINSIC_FLAG_I64_SHR_S}, + { "i64.shr_u", "aot_intrinsic_i64_shr_u", AOT_INTRINSIC_FLAG_I64_SHR_U}, }; /* clang-format on */ @@ -601,6 +629,10 @@ add_i64_common_intrinsics(AOTCompContext *comp_ctx) add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_REM_U); add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_BIT_OR); add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_BIT_AND); + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_MUL); + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_SHL); + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_SHR_S); + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_SHR_U); } static void @@ -866,6 +898,17 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx) if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) { add_i64_common_intrinsics(comp_ctx); } + /* + * LLVM 16 and later expands cttz intrinsic to a table lookup, + * which involves some relocations. (unless ZBB is available, + * in which case the native instructions are preferred over + * the table-based lowering.) + * https://reviews.llvm.org/D128911 + */ +#if LLVM_VERSION_MAJOR >= 16 + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CTZ); + add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_CTZ); +#endif } else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) { /* @@ -878,9 +921,6 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx) add_i64_common_intrinsics(comp_ctx); add_common_float_integer_conversion(comp_ctx); add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F32_CONST); - add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CONST); - add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CONST); - add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_CONST); } else { /* diff --git a/core/iwasm/aot/aot_intrinsic.h b/core/iwasm/aot/aot_intrinsic.h index 6a456efda..e54c82516 100644 --- a/core/iwasm/aot/aot_intrinsic.h +++ b/core/iwasm/aot/aot_intrinsic.h @@ -98,6 +98,10 @@ extern "C" { #define AOT_INTRINSIC_FLAG_I64_REM_U AOT_INTRINSIC_FLAG(1, 31) #define AOT_INTRINSIC_FLAG_I64_BIT_OR AOT_INTRINSIC_FLAG(1, 32) #define AOT_INTRINSIC_FLAG_I64_BIT_AND AOT_INTRINSIC_FLAG(1, 33) +#define AOT_INTRINSIC_FLAG_I64_MUL AOT_INTRINSIC_FLAG(1, 34) +#define AOT_INTRINSIC_FLAG_I64_SHL AOT_INTRINSIC_FLAG(1, 35) +#define AOT_INTRINSIC_FLAG_I64_SHR_S AOT_INTRINSIC_FLAG(1, 36) +#define AOT_INTRINSIC_FLAG_I64_SHR_U AOT_INTRINSIC_FLAG(1, 37) /* clang-format on */ @@ -182,19 +186,19 @@ aot_intrinsic_fmax_f64(float64 a, float64 b); uint32 aot_intrinsic_clz_i32(uint32 type); -uint32 +uint64 aot_intrinsic_clz_i64(uint64 type); uint32 aot_intrinsic_ctz_i32(uint32 type); -uint32 +uint64 aot_intrinsic_ctz_i64(uint64 type); uint32 aot_intrinsic_popcnt_i32(uint32 u); -uint32 +uint64 aot_intrinsic_popcnt_i64(uint64 u); float32 @@ -287,6 +291,18 @@ aot_intrinsic_i64_bit_or(uint64 l, uint64 r); uint64 aot_intrinsic_i64_bit_and(uint64 l, uint64 r); +uint64 +aot_intrinsic_i64_mul(uint64 l, uint64 r); + +uint64 +aot_intrinsic_i64_shl(uint64 l, uint64 r); + +uint64 +aot_intrinsic_i64_shr_s(uint64 l, uint64 r); + +uint64 +aot_intrinsic_i64_shr_u(uint64 l, uint64 r); + #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0 const char * aot_intrinsic_get_symbol(const char *llvm_intrinsic); diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index bde3ee034..b875ab93c 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -10,6 +10,9 @@ #include "../common/wasm_native.h" #include "../common/wasm_loader_common.h" #include "../compilation/aot.h" +#if WASM_ENABLE_AOT_VALIDATOR != 0 +#include "aot_validator.h" +#endif #if WASM_ENABLE_DEBUG_AOT != 0 #include "debug/elf_parser.h" @@ -314,9 +317,12 @@ loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size) map_flags = MMAP_MAP_32BIT; if ((mem = os_mmap(NULL, size, map_prot, map_flags, os_get_invalid_handle()))) { - /* The mmapped memory must be in the first 2 Gigabytes of the + /* Test whether the mmapped memory in the first 2 Gigabytes of the process address space */ - bh_assert((uintptr_t)mem < INT32_MAX); + if ((uintptr_t)mem >= INT32_MAX) + LOG_WARNING( + "Warning: loader mmap memory address is not in the first 2 " + "Gigabytes of the process address space."); return mem; } #endif @@ -584,7 +590,8 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end, } /* for backwards compatibility with previous wamrc aot files */ - if (!strcmp(target_info.arch, "arm64")) + if (!strcmp(target_info.arch, "arm64") + || !strcmp(target_info.arch, "aarch64")) bh_strcpy_s(target_info.arch, sizeof(target_info.arch), "aarch64v8"); /* Check machine info */ @@ -1106,9 +1113,6 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, const uint8 *buf = *p_buf; read_uint32(buf, buf_end, module->import_memory_count); - /* We don't support import_memory_count > 0 currently */ - if (module->import_memory_count > 0) - return false; read_uint32(buf, buf_end, module->memory_count); total_size = sizeof(AOTMemory) * (uint64)module->memory_count; @@ -1251,6 +1255,7 @@ load_init_expr(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, } free_if_fail = true; init_values->count = field_count; + init_values->type_idx = type_idx; expr->u.data = init_values; if (type_idx >= module->type_count) { @@ -1710,7 +1715,7 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, read_uint16(buf, buf_end, type_flag); read_uint8(buf, buf_end, is_equivalence_type); - /* If there is an equivalence type, re-use it */ + /* If there is an equivalence type, reuse it */ if (is_equivalence_type) { uint8 u8; /* padding */ @@ -3184,10 +3189,12 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group, symbol_addr = module->code; } else if (!strcmp(symbol, ".data") || !strcmp(symbol, ".sdata") - || !strcmp(symbol, ".rdata") - || !strcmp(symbol, ".rodata") + || !strcmp(symbol, ".rdata") || !strcmp(symbol, ".rodata") + || !strcmp(symbol, ".srodata") /* ".rodata.cst4/8/16/.." */ || !strncmp(symbol, ".rodata.cst", strlen(".rodata.cst")) + /* ".srodata.cst4/8/16/.." */ + || !strncmp(symbol, ".srodata.cst", strlen(".srodata.cst")) /* ".rodata.strn.m" */ || !strncmp(symbol, ".rodata.str", strlen(".rodata.str")) || !strcmp(symbol, AOT_STACK_SIZES_SECTION_NAME) @@ -4120,6 +4127,18 @@ create_module(char *name, char *error_buf, uint32 error_buf_size) } #endif +#if WASM_ENABLE_LIBC_WASI != 0 +#if WASM_ENABLE_UVWASI == 0 + module->wasi_args.stdio[0] = os_invalid_raw_handle(); + module->wasi_args.stdio[1] = os_invalid_raw_handle(); + module->wasi_args.stdio[2] = os_invalid_raw_handle(); +#else + module->wasi_args.stdio[0] = os_get_invalid_handle(); + module->wasi_args.stdio[1] = os_get_invalid_handle(); + module->wasi_args.stdio[2] = os_get_invalid_handle(); +#endif /* WASM_ENABLE_UVWASI == 0 */ +#endif /* WASM_ENABLE_LIBC_WASI != 0 */ + return module; #if WASM_ENABLE_GC != 0 fail2: @@ -4403,6 +4422,13 @@ aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args, os_thread_jit_write_protect_np(true); /* Make memory executable */ os_icache_flush(module->code, module->code_size); +#if WASM_ENABLE_AOT_VALIDATOR != 0 + if (!aot_module_validate(module, error_buf, error_buf_size)) { + aot_unload(module); + return NULL; + } +#endif /* WASM_ENABLE_AOT_VALIDATOR != 0 */ + LOG_VERBOSE("Load module success.\n"); return module; } diff --git a/core/iwasm/aot/aot_perf_map.c b/core/iwasm/aot/aot_perf_map.c index 22700dcdd..b072c9851 100644 --- a/core/iwasm/aot/aot_perf_map.c +++ b/core/iwasm/aot/aot_perf_map.c @@ -7,7 +7,6 @@ #include "bh_log.h" #include "bh_platform.h" -#if WASM_ENABLE_LINUX_PERF != 0 struct func_info { uint32 idx; void *ptr; @@ -32,8 +31,15 @@ get_func_size(const AOTModule *module, struct func_info *sorted_func_ptrs, static int compare_func_ptrs(const void *f1, const void *f2) { - return (intptr_t)((struct func_info *)f1)->ptr - - (intptr_t)((struct func_info *)f2)->ptr; + uintptr_t ptr1 = (uintptr_t)((struct func_info *)f1)->ptr; + uintptr_t ptr2 = (uintptr_t)((struct func_info *)f2)->ptr; + + if (ptr1 < ptr2) + return -1; + else if (ptr1 > ptr2) + return 1; + else + return 0; } static struct func_info * @@ -46,8 +52,8 @@ sort_func_ptrs(const AOTModule *module, char *error_buf, uint32 error_buf_size) content_len = (uint64)sizeof(struct func_info) * module->func_count; sorted_func_ptrs = wasm_runtime_malloc(content_len); if (!sorted_func_ptrs) { - snprintf(error_buf, error_buf_size, - "allocate memory failed when creating perf map"); + (void)snprintf(error_buf, error_buf_size, + "allocate memory failed when creating perf map"); return NULL; } @@ -78,7 +84,8 @@ aot_create_perf_map(const AOTModule *module, char *error_buf, if (!sorted_func_ptrs) goto quit; - snprintf(perf_map_path, sizeof(perf_map_path) - 1, "/tmp/perf-%d.map", pid); + (void)snprintf(perf_map_path, sizeof(perf_map_path) - 1, "/tmp/perf-%d.map", + pid); perf_map = fopen(perf_map_path, "a"); if (!perf_map) { LOG_WARNING("warning: can't create /tmp/perf-%d.map, because %s", pid, @@ -89,19 +96,23 @@ aot_create_perf_map(const AOTModule *module, char *error_buf, const char *module_name = aot_get_module_name((AOTModule *)module); for (i = 0; i < module->func_count; i++) { memset(perf_map_info, 0, 128); - if (strlen(module_name) > 0) - snprintf(perf_map_info, 128, "%lx %x [%s]#aot_func#%u\n", - (uintptr_t)sorted_func_ptrs[i].ptr, - get_func_size(module, sorted_func_ptrs, i), module_name, - sorted_func_ptrs[i].idx); - else - snprintf(perf_map_info, 128, "%lx %x aot_func#%u\n", - (uintptr_t)sorted_func_ptrs[i].ptr, - get_func_size(module, sorted_func_ptrs, i), - sorted_func_ptrs[i].idx); + if (strlen(module_name) > 0) { + (void)snprintf(perf_map_info, 128, + "%" PRIxPTR " %x [%s]#aot_func#%u\n", + (uintptr_t)sorted_func_ptrs[i].ptr, + get_func_size(module, sorted_func_ptrs, i), + module_name, sorted_func_ptrs[i].idx); + } + else { + (void)snprintf(perf_map_info, 128, + "%" PRIxPTR " %x aot_func#%u\n", + (uintptr_t)sorted_func_ptrs[i].ptr, + get_func_size(module, sorted_func_ptrs, i), + sorted_func_ptrs[i].idx); + } /* fwrite() is thread safe */ - fwrite(perf_map_info, 1, strlen(perf_map_info), perf_map); + (void)fwrite(perf_map_info, 1, strlen(perf_map_info), perf_map); } LOG_VERBOSE("write map information from %s into /tmp/perf-%d.map", @@ -113,8 +124,7 @@ quit: wasm_runtime_free(sorted_func_ptrs); if (perf_map) - fclose(perf_map); + (void)fclose(perf_map); return ret; } -#endif /* WASM_ENABLE_LINUX_PERF != 0 */ \ No newline at end of file diff --git a/core/iwasm/aot/aot_reloc.h b/core/iwasm/aot/aot_reloc.h index f7ada4d8d..ca9ba17f1 100644 --- a/core/iwasm/aot/aot_reloc.h +++ b/core/iwasm/aot/aot_reloc.h @@ -122,6 +122,10 @@ typedef struct { REG_SYM(aot_intrinsic_i64_rem_u), \ REG_SYM(aot_intrinsic_i64_bit_or), \ REG_SYM(aot_intrinsic_i64_bit_and), \ + REG_SYM(aot_intrinsic_i64_mul), \ + REG_SYM(aot_intrinsic_i64_shl), \ + REG_SYM(aot_intrinsic_i64_shr_s), \ + REG_SYM(aot_intrinsic_i64_shr_u), \ REG_SYM(aot_intrinsic_i32_div_s), \ REG_SYM(aot_intrinsic_i32_div_u), \ REG_SYM(aot_intrinsic_i32_rem_s), \ diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index d3cd27ee9..341f64cd5 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -2317,13 +2317,6 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr, #endif bool ret; - /* Check native stack overflow firstly to ensure we have enough - native stack to run the following codes before actually calling - the aot function in invokeNative function. */ - if (!wasm_runtime_detect_native_stack_overflow(exec_env)) { - return false; - } - if (!exec_env_tls) { if (!os_thread_signal_inited()) { aot_set_exception(module_inst, "thread signal env not inited"); @@ -2342,6 +2335,13 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr, } } + /* Check native stack overflow firstly to ensure we have enough + native stack to run the following codes before actually calling + the aot function in invokeNative function. */ + if (!wasm_runtime_detect_native_stack_overflow(exec_env)) { + return false; + } + wasm_exec_env_push_jmpbuf(exec_env, &jmpbuf_node); if (os_setjmp(jmpbuf_node.jmpbuf) == 0) { @@ -2632,7 +2632,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function, ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL, attachment, argv, argc, argv); - if (aot_copy_exception(module_inst, NULL)) { + if (!ret) { #ifdef AOT_STACK_FRAME_DEBUG if (aot_stack_frame_callback) { aot_stack_frame_callback(exec_env); @@ -2653,7 +2653,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function, aot_free_frame(exec_env); #endif - return ret && !aot_copy_exception(module_inst, NULL) ? true : false; + return ret; } } @@ -3287,8 +3287,25 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx, cell_num += wasm_value_type_cell_num(ext_ret_types[i]); } +#if WASM_ENABLE_AOT_STACK_FRAME != 0 + void *prev_frame = get_top_frame(exec_env); + if (!is_frame_per_function(exec_env) + && !aot_alloc_frame(exec_env, func_idx)) { + if (argv1 != argv1_buf) + wasm_runtime_free(argv1); + return false; + } +#endif ret = invoke_native_internal(exec_env, func_ptr, func_type, signature, attachment, argv1, argc, argv); +#if WASM_ENABLE_AOT_STACK_FRAME != 0 + /* Free all frames allocated, note that some frames + may be allocated in AOT code and haven't been + freed if exception occurred */ + while (get_top_frame(exec_env) != prev_frame) + aot_free_frame(exec_env); +#endif + if (!ret) { if (argv1 != argv1_buf) wasm_runtime_free(argv1); @@ -3329,8 +3346,25 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx, return true; } else { +#if WASM_ENABLE_AOT_STACK_FRAME != 0 + void *prev_frame = get_top_frame(exec_env); + /* Only allocate frame for frame-per-call mode; in the + frame-per-function mode the frame is allocated at the + beginning of the function. */ + if (!is_frame_per_function(exec_env) + && !aot_alloc_frame(exec_env, func_idx)) { + return false; + } +#endif ret = invoke_native_internal(exec_env, func_ptr, func_type, signature, attachment, argv, argc, argv); +#if WASM_ENABLE_AOT_STACK_FRAME != 0 + /* Free all frames allocated, note that some frames + may be allocated in AOT code and haven't been + freed if exception occurred */ + while (get_top_frame(exec_env) != prev_frame) + aot_free_frame(exec_env); +#endif if (!ret) goto fail; @@ -4105,6 +4139,136 @@ aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame) } #endif /* end of WASM_ENABLE_AOT_STACK_FRAME != 0 */ +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +uint32 +aot_copy_callstack_tiny_frame(WASMExecEnv *exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, + char *error_buf, uint32 error_buf_size) +{ + /* + * Note for devs: please refrain from such modifications inside of + * aot_copy_callstack_tiny_frame + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_copy_callstack in + * wasm_export.h + */ + uint8 *top_boundary = exec_env->wasm_stack.top_boundary; + uint8 *top = exec_env->wasm_stack.top; + uint8 *bottom = exec_env->wasm_stack.bottom; + uint32 count = 0; + + bool is_top_index_in_range = + top_boundary >= top && top >= (bottom + sizeof(AOTTinyFrame)); + if (!is_top_index_in_range) { + char *err_msg = + "Top of the stack pointer is outside of the stack boundaries"; + strncpy(error_buf, err_msg, error_buf_size); + return 0; + } + bool is_top_aligned_with_bottom = + (unsigned long)(top - bottom) % sizeof(AOTTinyFrame) == 0; + if (!is_top_aligned_with_bottom) { + char *err_msg = "Top of the stack is not aligned with the bottom"; + strncpy(error_buf, err_msg, error_buf_size); + return 0; + } + + AOTTinyFrame *frame = (AOTTinyFrame *)(top - sizeof(AOTTinyFrame)); + WASMCApiFrame record_frame; + while (frame && (uint8_t *)frame >= bottom && count < (skip_n + length)) { + if (count < skip_n) { + ++count; + frame -= 1; + continue; + } + record_frame.instance = exec_env->module_inst; + record_frame.module_offset = 0; + record_frame.func_index = frame->func_index; + record_frame.func_offset = frame->ip_offset; + buffer[count - skip_n] = record_frame; + frame -= 1; + ++count; + } + return count >= skip_n ? count - skip_n : 0; +} + +uint32 +aot_copy_callstack_standard_frame(WASMExecEnv *exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, + char *error_buf, uint32_t error_buf_size) +{ + /* + * Note for devs: please refrain from such modifications inside of + * aot_iterate_callstack_standard_frame + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_iterate_callstack in + * wasm_export.h + */ + + uint32 count = 0; +#if WASM_ENABLE_GC == 0 + WASMModuleInstance *module_inst = + (WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env); + AOTFrame *cur_frame = (AOTFrame *)wasm_exec_env_get_cur_frame(exec_env); + uint8 *top_boundary = exec_env->wasm_stack.top_boundary; + uint8 *bottom = exec_env->wasm_stack.bottom; + uint32 frame_size = (uint32)offsetof(AOTFrame, lp); + + WASMCApiFrame record_frame; + while (cur_frame && (uint8_t *)cur_frame >= bottom + && (uint8_t *)cur_frame + frame_size <= top_boundary + && count < (skip_n + length)) { + if (count < skip_n) { + ++count; + cur_frame = cur_frame->prev_frame; + continue; + } + record_frame.instance = module_inst; + record_frame.module_offset = 0; + record_frame.func_index = (uint32)cur_frame->func_index; + record_frame.func_offset = (uint32)cur_frame->ip_offset; + buffer[count - skip_n] = record_frame; + cur_frame = cur_frame->prev_frame; + ++count; + } +#else +/* + * TODO: add support for standard frames when GC is enabled + * now it poses a risk due to variable size of the frame + */ +#endif + return count >= skip_n ? count - skip_n : 0; +} + +uint32 +aot_copy_callstack(WASMExecEnv *exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, char *error_buf, + uint32_t error_buf_size) +{ + /* + * Note for devs: please refrain from such modifications inside of + * aot_iterate_callstack + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_iterate_callstack in + * wasm_export.h + */ + if (!is_tiny_frame(exec_env)) { + return aot_copy_callstack_standard_frame( + exec_env, buffer, length, skip_n, error_buf, error_buf_size); + } + else { + return aot_copy_callstack_tiny_frame(exec_env, buffer, length, skip_n, + error_buf, error_buf_size); + } +} +#endif // WAMR_ENABLE_COPY_CALLSTACK + #if WASM_ENABLE_DUMP_CALL_STACK != 0 bool aot_create_call_stack(struct WASMExecEnv *exec_env) diff --git a/core/iwasm/aot/aot_runtime.h b/core/iwasm/aot/aot_runtime.h index f841bfb6a..2d12723e7 100644 --- a/core/iwasm/aot/aot_runtime.h +++ b/core/iwasm/aot/aot_runtime.h @@ -776,6 +776,13 @@ aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame); bool aot_create_call_stack(struct WASMExecEnv *exec_env); +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +uint32 +aot_copy_callstack(WASMExecEnv *exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, char *error_buf, + uint32_t error_buf_size); +#endif // WAMR_ENABLE_COPY_CALLSTACK + /** * @brief Dump wasm call stack or get the size * diff --git a/core/iwasm/aot/aot_validator.c b/core/iwasm/aot/aot_validator.c new file mode 100644 index 000000000..58757f767 --- /dev/null +++ b/core/iwasm/aot/aot_validator.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2025 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include "aot_validator.h" + +static void +set_error_buf(char *error_buf, uint32 error_buf_size, const char *string) +{ + if (error_buf != NULL) { + snprintf(error_buf, error_buf_size, + "AOT module load failed: from validator. %s", string); + } +} + +static bool +aot_memory_info_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size) +{ + if (module->import_memory_count > 0) { + set_error_buf(error_buf, error_buf_size, + "import memory is not supported"); + return false; + } + + if (module->memory_count < 1) { + set_error_buf(error_buf, error_buf_size, + "there should be >=1 memory in one aot module"); + return false; + } + + return true; +} + +bool +aot_module_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size) +{ + if (!aot_memory_info_validate(module, error_buf, error_buf_size)) { + return false; + } + + return true; +} diff --git a/core/iwasm/aot/aot_validator.h b/core/iwasm/aot/aot_validator.h new file mode 100644 index 000000000..dd8f0ecb5 --- /dev/null +++ b/core/iwasm/aot/aot_validator.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2025 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#ifndef _AOT_VALIDATOR_H_ +#define _AOT_VALIDATOR_H_ + +#include "aot_runtime.h" + +bool +aot_module_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size); + +#endif /* _AOT_VALIDATOR_H_ */ diff --git a/core/iwasm/aot/arch/aot_reloc_aarch64.c b/core/iwasm/aot/arch/aot_reloc_aarch64.c index 26815334f..e42d2cd8e 100644 --- a/core/iwasm/aot/arch/aot_reloc_aarch64.c +++ b/core/iwasm/aot/arch/aot_reloc_aarch64.c @@ -63,7 +63,7 @@ get_current_target(char *target_buf, uint32 target_buf_size) /* Set to "aarch64v8" by default if sub version isn't specified */ if (strcmp(s, "AARCH64") == 0) { s = "aarch64v8"; - s_size = 9; /* strlen("aarch64v8"); */ + s_size = 10; /* sizeof("aarch64v8"); */ } if (target_buf_size < s_size) { s_size = target_buf_size; diff --git a/core/iwasm/aot/arch/aot_reloc_dummy.c b/core/iwasm/aot/arch/aot_reloc_dummy.c new file mode 100644 index 000000000..bc05d7b78 --- /dev/null +++ b/core/iwasm/aot/arch/aot_reloc_dummy.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include "aot_reloc.h" + +SymbolMap * +get_target_symbol_map(uint32 *sym_num) +{ + abort(); +} + +uint32 +get_plt_table_size(void) +{ + abort(); +} + +void +init_plt_table(uint8 *plt) +{ + abort(); +} + +void +get_current_target(char *target_buf, uint32 target_buf_size) +{ + abort(); +} + +bool +apply_relocation(AOTModule *module, uint8 *target_section_addr, + uint32 target_section_size, uint64 reloc_offset, + int64 reloc_addend, uint32 reloc_type, void *symbol_addr, + int32 symbol_index, char *error_buf, uint32 error_buf_size) +{ + abort(); +} diff --git a/core/iwasm/aot/arch/aot_reloc_x86_32.c b/core/iwasm/aot/arch/aot_reloc_x86_32.c index 0a423c398..f7f2421f4 100644 --- a/core/iwasm/aot/arch/aot_reloc_x86_32.c +++ b/core/iwasm/aot/arch/aot_reloc_x86_32.c @@ -30,36 +30,39 @@ void __umoddi3(); #pragma function(floor) #pragma function(ceil) -static int64 -__divdi3(int64 a, int64 b) +static int64 __stdcall __divdi3(int64 a, int64 b) { return a / b; } -static uint64 -__udivdi3(uint64 a, uint64 b) +static uint64 __stdcall __udivdi3(uint64 a, uint64 b) { return a / b; } -static int64 -__moddi3(int64 a, int64 b) +static int64 __stdcall __moddi3(int64 a, int64 b) { return a % b; } -static uint64 -__umoddi3(uint64 a, uint64 b) +static uint64 __stdcall __umoddi3(uint64 a, uint64 b) { return a % b; } -#endif -static uint64 -__aulldiv(uint64 a, uint64 b) +static uint64 __stdcall __aulldiv(uint64 a, uint64 b) { return a / b; } +static int64 __stdcall __alldiv(int64 a, int64 b) +{ + return a / b; +} +static int64 __stdcall __allrem(int64 a, int64 b) +{ + return a % b; +} +#endif /* !defined(_WIN32) && !defined(_WIN32_) */ /* clang-format off */ static SymbolMap target_sym_map[] = { @@ -69,7 +72,11 @@ static SymbolMap target_sym_map[] = { REG_SYM(__udivdi3), REG_SYM(__moddi3), REG_SYM(__umoddi3), - REG_SYM(__aulldiv) +#if defined(_WIN32) || defined(_WIN32_) + REG_SYM(__aulldiv), + REG_SYM(__alldiv), + REG_SYM(__allrem) +#endif /* defined(_WIN32) || defined(_WIN32_) */ }; /* clang-format on */ diff --git a/core/iwasm/aot/arch/aot_reloc_xtensa.c b/core/iwasm/aot/arch/aot_reloc_xtensa.c index fca1b80da..a866883d7 100644 --- a/core/iwasm/aot/arch/aot_reloc_xtensa.c +++ b/core/iwasm/aot/arch/aot_reloc_xtensa.c @@ -154,7 +154,7 @@ check_reloc_offset(uint32 target_section_size, uint64 reloc_offset, * CPU like esp32 can read and write data through the instruction bus, but only * in a word aligned manner; non-word-aligned access will cause a CPU exception. * This function uses a world aligned manner to write 16bit value to instruction - * addreess. + * address. */ static void put_imm16_to_addr(int16 imm16, int16 *addr) diff --git a/core/iwasm/aot/iwasm_aot.cmake b/core/iwasm/aot/iwasm_aot.cmake index efff88dd0..e6d56c43f 100644 --- a/core/iwasm/aot/iwasm_aot.cmake +++ b/core/iwasm/aot/iwasm_aot.cmake @@ -1,15 +1,37 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + set (IWASM_AOT_DIR ${CMAKE_CURRENT_LIST_DIR}) add_definitions (-DWASM_ENABLE_AOT=1) include_directories (${IWASM_AOT_DIR}) -file (GLOB c_source_all ${IWASM_AOT_DIR}/*.c) +list (APPEND c_source_all + ${IWASM_AOT_DIR}/aot_intrinsic.c + ${IWASM_AOT_DIR}/aot_loader.c + ${IWASM_AOT_DIR}/aot_runtime.c +) -if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") +if (WAMR_BUILD_LINUX_PERF EQUAL 1) + list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_perf_map.c) +endif () + +if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1) + list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_validator.c) +endif () + +if (WAMR_BUILD_WAMR_COMPILER EQUAL 1) + # AOT reloc functions are not used during AOT compilation + set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_dummy.c) +elseif (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_64.c) elseif (WAMR_BUILD_TARGET STREQUAL "X86_32") set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_32.c) diff --git a/core/iwasm/common/arch/invokeNative_aarch64.s b/core/iwasm/common/arch/invokeNative_aarch64.s index ea5cbcb36..f48a429c5 100644 --- a/core/iwasm/common/arch/invokeNative_aarch64.s +++ b/core/iwasm/common/arch/invokeNative_aarch64.s @@ -45,7 +45,7 @@ _invokeNative: /* Now x20 points to stack args */ - /* Directly call the fucntion if no args in stack */ + /* Directly call the function if no args in stack */ cmp x21, #0 beq call_func @@ -69,7 +69,7 @@ loop_stack_args: /* copy stack arguments to stack */ call_func: mov x20, x30 /* save x30(lr) */ blr x19 - mov sp, x22 /* restore sp which is saved before calling fuction*/ + mov sp, x22 /* restore sp which is saved before calling function*/ return: mov x30, x20 /* restore x30(lr) */ diff --git a/core/iwasm/common/arch/invokeNative_aarch64_simd.s b/core/iwasm/common/arch/invokeNative_aarch64_simd.s index a6ccc1508..f940c3403 100644 --- a/core/iwasm/common/arch/invokeNative_aarch64_simd.s +++ b/core/iwasm/common/arch/invokeNative_aarch64_simd.s @@ -43,7 +43,7 @@ _invokeNative: /* Now x20 points to stack args */ - /* Directly call the fucntion if no args in stack */ + /* Directly call the function if no args in stack */ cmp x21, #0 beq call_func @@ -67,7 +67,7 @@ loop_stack_args: /* copy stack arguments to stack */ call_func: mov x20, x30 /* save x30(lr) */ blr x19 - mov sp, x22 /* restore sp which is saved before calling fuction*/ + mov sp, x22 /* restore sp which is saved before calling function*/ return: mov x30, x20 /* restore x30(lr) */ diff --git a/core/iwasm/common/arch/invokeNative_arm_vfp.s b/core/iwasm/common/arch/invokeNative_arm_vfp.s index 78a4bab82..19bc5d67c 100644 --- a/core/iwasm/common/arch/invokeNative_arm_vfp.s +++ b/core/iwasm/common/arch/invokeNative_arm_vfp.s @@ -53,7 +53,7 @@ _invokeNative: vldr s13, [r4, #52] vldr s14, [r4, #56] vldr s15, [r4, #60] - /* Directly call the fucntion if no args in stack */ + /* Directly call the function if no args in stack */ cmp r5, #0 beq call_func diff --git a/core/iwasm/common/arch/invokeNative_riscv.S b/core/iwasm/common/arch/invokeNative_riscv.S index 0908f73cc..87039f44c 100644 --- a/core/iwasm/common/arch/invokeNative_riscv.S +++ b/core/iwasm/common/arch/invokeNative_riscv.S @@ -4,7 +4,7 @@ */ /* - * The float abi macros used bellow are from risc-v c api: + * The float abi macros used below are from risc-v c api: * https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md * */ @@ -130,7 +130,7 @@ _invokeNative: loop_stack_args: beq t2, x0, call_func RV_OP_LOADREG t5, 0(t1) /* load stack argument, t5 = argv[i] */ - RV_OP_STOREREG t5, 0(t4) /* store t5 to reseved stack, sp[j] = t5 */ + RV_OP_STOREREG t5, 0(t4) /* store t5 to reserved stack, sp[j] = t5 */ addi t1, t1, RV_REG_SIZE /* move to next stack argument */ addi t4, t4, RV_REG_SIZE /* move to next stack pointer */ addi t2, t2, -1 /* decrease t2 every loop, nstacks = nstacks -1 */ @@ -142,7 +142,7 @@ call_func: /* restore registers pushed in stack or saved in another register */ return: mv sp, fp /* restore sp saved in fp before function call */ - RV_OP_LOADREG fp, 0 * RV_REG_SIZE(sp) /* load previous frame poniter to fp register */ + RV_OP_LOADREG fp, 0 * RV_REG_SIZE(sp) /* load previous frame pointer to fp register */ RV_OP_LOADREG ra, 1 * RV_REG_SIZE(sp) /* load previous return address to ra register */ addi sp, sp, 2 * RV_REG_SIZE /* pop frame, restore sp */ jr ra diff --git a/core/iwasm/common/arch/invokeNative_thumb_vfp.s b/core/iwasm/common/arch/invokeNative_thumb_vfp.s index 218cd91e0..3f12b91d3 100644 --- a/core/iwasm/common/arch/invokeNative_thumb_vfp.s +++ b/core/iwasm/common/arch/invokeNative_thumb_vfp.s @@ -55,7 +55,7 @@ _invokeNative: vldr s13, [r4, #52] vldr s14, [r4, #56] vldr s15, [r4, #60] - /* Directly call the fucntion if no args in stack */ + /* Directly call the function if no args in stack */ cmp r5, #0 beq call_func diff --git a/core/iwasm/common/gc/gc_type.c b/core/iwasm/common/gc/gc_type.c index c9e6d206e..bafa3c86c 100644 --- a/core/iwasm/common/gc/gc_type.c +++ b/core/iwasm/common/gc/gc_type.c @@ -1145,6 +1145,14 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1, return true; else { int32 heap_type = ref_type1->ref_ht_common.heap_type; + // We dont care whether type2 is nullable or not. So + // we normalize it into its related one-byte type. + if (type2 == REF_TYPE_HT_NULLABLE + || type2 == REF_TYPE_HT_NON_NULLABLE) { + bh_assert(ref_type2); + type2 = (uint8)(ref_type2->ref_ht_common.heap_type + + REF_TYPE_FUNCREF - HEAP_TYPE_FUNC); + } if (heap_type == HEAP_TYPE_ANY) { /* (ref any) <: anyref */ return type2 == REF_TYPE_ANYREF ? true : false; @@ -1188,19 +1196,15 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1, } #endif else if (heap_type == HEAP_TYPE_NONE) { - /* (ref none) */ - /* TODO */ - bh_assert(0); + return wasm_is_reftype_supers_of_none(type2, NULL, types, + type_count); } else if (heap_type == HEAP_TYPE_NOEXTERN) { - /* (ref noextern) */ - /* TODO */ - bh_assert(0); + return wasm_is_reftype_supers_of_noextern(type2); } else if (heap_type == HEAP_TYPE_NOFUNC) { - /* (ref nofunc) */ - /* TODO */ - bh_assert(0); + return wasm_is_reftype_supers_of_nofunc(type2, NULL, types, + type_count); } else { bh_assert(0); diff --git a/core/iwasm/common/wasm_application.c b/core/iwasm/common/wasm_application.c index b5928d95c..85f3770f6 100644 --- a/core/iwasm/common/wasm_application.c +++ b/core/iwasm/common/wasm_application.c @@ -118,7 +118,7 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[]) #if WASM_ENABLE_LIBC_WASI != 0 /* In wasi mode, we should call the function named "_start" - which initializes the wasi envrionment and then calls + which initializes the wasi environment and then calls the actual main function. Directly calling main function may cause exception thrown. */ if ((func = wasm_runtime_lookup_wasi_start_function(module_inst))) { diff --git a/core/iwasm/common/wasm_c_api.c b/core/iwasm/common/wasm_c_api.c index d5c45a441..269ec5776 100644 --- a/core/iwasm/common/wasm_c_api.c +++ b/core/iwasm/common/wasm_c_api.c @@ -2257,7 +2257,7 @@ wasm_module_new_ex(wasm_store_t *store, wasm_byte_vec_t *binary, LoadArgs *args) if (!store || !binary || binary->size == 0 || binary->size > UINT32_MAX) goto quit; - /* whether the combination of compilation flags are compatable with the + /* whether the combination of compilation flags are compatible with the * package type */ { PackageType pkg_type; diff --git a/core/iwasm/common/wasm_exec_env.c b/core/iwasm/common/wasm_exec_env.c index 48465fc94..47752950f 100644 --- a/core/iwasm/common/wasm_exec_env.c +++ b/core/iwasm/common/wasm_exec_env.c @@ -85,6 +85,10 @@ wasm_exec_env_create_internal(struct WASMModuleInstanceCommon *module_inst, wasm_runtime_dump_exec_env_mem_consumption(exec_env); #endif +#if WASM_ENABLE_INSTRUCTION_METERING != 0 + exec_env->instructions_to_execute = -1; +#endif + return exec_env; #ifdef OS_ENABLE_HW_BOUND_CHECK @@ -202,7 +206,7 @@ wasm_exec_env_destroy(WASMExecEnv *exec_env) wasm_cluster_wait_for_all_except_self(cluster, exec_env); #if WASM_ENABLE_DEBUG_INTERP != 0 /* Must fire exit event after other threads exits, otherwise - the stopped thread will be overriden by other threads */ + the stopped thread will be overridden by other threads */ wasm_cluster_thread_exited(exec_env); #endif /* We have waited for other threads, this is the only alive thread, so @@ -276,8 +280,6 @@ wasm_exec_env_restore_module_inst( void wasm_exec_env_set_thread_info(WASMExecEnv *exec_env) { - uint8 *stack_boundary = os_thread_get_stack_boundary(); - #if WASM_ENABLE_THREAD_MGR != 0 os_mutex_lock(&exec_env->wait_lock); #endif @@ -286,9 +288,11 @@ wasm_exec_env_set_thread_info(WASMExecEnv *exec_env) /* WASM_STACK_GUARD_SIZE isn't added for flexibility to developer, he must ensure that enough guard bytes are kept. */ exec_env->native_stack_boundary = exec_env->user_native_stack_boundary; - else + else { + uint8 *stack_boundary = os_thread_get_stack_boundary(); exec_env->native_stack_boundary = stack_boundary ? stack_boundary + WASM_STACK_GUARD_SIZE : NULL; + } exec_env->native_stack_top_min = (void *)UINTPTR_MAX; #if WASM_ENABLE_THREAD_MGR != 0 os_mutex_unlock(&exec_env->wait_lock); diff --git a/core/iwasm/common/wasm_exec_env.h b/core/iwasm/common/wasm_exec_env.h index ce0c1fa7f..5d80312fb 100644 --- a/core/iwasm/common/wasm_exec_env.h +++ b/core/iwasm/common/wasm_exec_env.h @@ -87,6 +87,11 @@ typedef struct WASMExecEnv { uint8 *bottom; } wasm_stack; +#if WASM_ENABLE_INSTRUCTION_METERING != 0 + /* instructions to execute */ + int instructions_to_execute; +#endif + #if WASM_ENABLE_FAST_JIT != 0 /** * Cache for diff --git a/core/iwasm/common/wasm_loader_common.c b/core/iwasm/common/wasm_loader_common.c index 97ea5efd1..dc8009205 100644 --- a/core/iwasm/common/wasm_loader_common.c +++ b/core/iwasm/common/wasm_loader_common.c @@ -151,11 +151,13 @@ is_valid_value_type(uint8 type) bool is_valid_value_type_for_interpreter(uint8 value_type) { -#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) +#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \ + && (WASM_ENABLE_SIMDE == 0) /* - * Note: regardless of WASM_ENABLE_SIMD, our interpreters don't have - * SIMD implemented. It's safer to reject v128, especially for the - * fast interpreter. + * Note: regardless of WASM_ENABLE_SIMD, our classic interpreters don't + * have SIMD implemented. + * + * WASM_ENABLE_SIMDE is used to control SIMD feaure in fast interpreter */ if (value_type == VALUE_TYPE_V128) return false; diff --git a/core/iwasm/common/wasm_memory.c b/core/iwasm/common/wasm_memory.c index b9a42ceff..a67c4209e 100644 --- a/core/iwasm/common/wasm_memory.c +++ b/core/iwasm/common/wasm_memory.c @@ -1475,6 +1475,14 @@ wasm_mremap_linear_memory(void *mapped_mem, uint64 old_size, uint64 new_size, bh_assert(new_size > 0); bh_assert(new_size > old_size); +#if UINTPTR_MAX == UINT32_MAX + if (new_size == 4 * (uint64)BH_GB) { + LOG_WARNING("On 32 bit platform, linear memory can't reach maximum " + "size of 4GB\n"); + return NULL; + } +#endif + if (mapped_mem) { new_mem = os_mremap(mapped_mem, old_size, new_size); } @@ -1589,7 +1597,7 @@ wasm_enlarge_memory_internal(WASMModuleInstanceCommon *module, if (!(memory_data_new = realloc_func(Alloc_For_LinearMemory, full_size_mmaped, #if WASM_MEM_ALLOC_WITH_USER_DATA != 0 - NULL, + allocator_user_data, #endif memory_data_old, total_size_new))) { ret = false; @@ -1611,7 +1619,7 @@ wasm_enlarge_memory_internal(WASMModuleInstanceCommon *module, if (full_size_mmaped) { #ifdef BH_PLATFORM_WINDOWS if (!os_mem_commit(memory->memory_data_end, - (mem_offset_t)(total_size_new - total_size_old), + total_size_new - total_size_old, MMAP_PROT_READ | MMAP_PROT_WRITE)) { ret = false; goto return_func; @@ -1619,12 +1627,12 @@ wasm_enlarge_memory_internal(WASMModuleInstanceCommon *module, #endif if (os_mprotect(memory->memory_data_end, - (mem_offset_t)(total_size_new - total_size_old), + total_size_new - total_size_old, MMAP_PROT_READ | MMAP_PROT_WRITE) != 0) { #ifdef BH_PLATFORM_WINDOWS os_mem_decommit(memory->memory_data_end, - (mem_offset_t)(total_size_new - total_size_old)); + total_size_new - total_size_old); #endif ret = false; goto return_func; @@ -1902,7 +1910,7 @@ wasm_deallocate_linear_memory(WASMMemoryInstance *memory_inst) (void)map_size; free_func(Alloc_For_LinearMemory, #if WASM_MEM_ALLOC_WITH_USER_DATA != 0 - NULL, + allocator_user_data, #endif memory_inst->memory_data); #else @@ -1955,7 +1963,7 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory, (void)wasm_mmap_linear_memory; if (!(*data = malloc_func(Alloc_For_LinearMemory, #if WASM_MEM_ALLOC_WITH_USER_DATA != 0 - NULL, + allocator_user_data, #endif *memory_data_size))) { return BHT_ERROR; diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index cc6badd9e..dcee0aeaf 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -757,7 +757,10 @@ wasm_runtime_full_init_internal(RuntimeInitArgs *init_args) #endif #if WASM_ENABLE_GC != 0 - gc_heap_size_default = init_args->gc_heap_size; + uint32 gc_heap_size = init_args->gc_heap_size; + if (gc_heap_size > 0) { + gc_heap_size_default = gc_heap_size; + } #endif #if WASM_ENABLE_JIT != 0 @@ -1501,7 +1504,7 @@ wasm_runtime_load_ex(uint8 *buf, uint32 size, const LoadArgs *args, error_buf_size); } -WASM_RUNTIME_API_EXTERN bool +bool wasm_runtime_resolve_symbols(WASMModuleCommon *module) { #if WASM_ENABLE_INTERP != 0 @@ -1740,6 +1743,45 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env) wasm_exec_env_destroy(exec_env); } +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +uint32 +wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, char *error_buf, + uint32_t error_buf_size) +{ + /* + * Note for devs: please refrain from such modifications inside of + * wasm_copy_callstack to preserve async-signal-safety + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_copy_callstack in + * wasm_export.h + */ +#if WASM_ENABLE_DUMP_CALL_STACK + WASMModuleInstance *module_inst = + (WASMModuleInstance *)get_module_inst(exec_env); + +#if WASM_ENABLE_INTERP != 0 + if (module_inst->module_type == Wasm_Module_Bytecode) { + return wasm_interp_copy_callstack(exec_env, buffer, length, skip_n, + error_buf, error_buf_size); + } +#endif + +#if WASM_ENABLE_AOT != 0 + if (module_inst->module_type == Wasm_Module_AoT) { + return aot_copy_callstack(exec_env, buffer, length, skip_n, error_buf, + error_buf_size); + } +#endif +#endif + char *err_msg = "No copy_callstack API was actually executed"; + strncpy(error_buf, err_msg, error_buf_size); + return 0; +} +#endif // WAMR_ENABLE_COPY_CALLSTACK + bool wasm_runtime_init_thread_env(void) { @@ -2243,6 +2285,15 @@ wasm_runtime_access_exce_check_guard_page() } #endif +#if WASM_ENABLE_INSTRUCTION_METERING != 0 +void +wasm_runtime_set_instruction_count_limit(WASMExecEnv *exec_env, + int instructions_to_execute) +{ + exec_env->instructions_to_execute = instructions_to_execute; +} +#endif + WASMFuncType * wasm_runtime_get_function_type(const WASMFunctionInstanceCommon *function, uint32 module_type) @@ -3835,11 +3886,15 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst, init_options.allocator = &uvwasi_allocator; init_options.argc = argc; init_options.argv = (const char **)argv; - init_options.in = (stdinfd != -1) ? (uvwasi_fd_t)stdinfd : init_options.in; - init_options.out = - (stdoutfd != -1) ? (uvwasi_fd_t)stdoutfd : init_options.out; - init_options.err = - (stderrfd != -1) ? (uvwasi_fd_t)stderrfd : init_options.err; + init_options.in = (stdinfd != os_get_invalid_handle()) + ? (uvwasi_fd_t)stdinfd + : init_options.in; + init_options.out = (stdoutfd != os_get_invalid_handle()) + ? (uvwasi_fd_t)stdoutfd + : init_options.out; + init_options.err = (stderrfd != os_get_invalid_handle()) + ? (uvwasi_fd_t)stderrfd + : init_options.err; if (dir_count > 0) { init_options.preopenc = dir_count; @@ -4458,8 +4513,9 @@ wasm_func_type_get_param_valkind(WASMFuncType *const func_type, return WASM_V128; case VALUE_TYPE_FUNCREF: return WASM_FUNCREF; - case VALUE_TYPE_EXTERNREF: + return WASM_EXTERNREF; + case VALUE_TYPE_VOID: default: { @@ -7793,7 +7849,7 @@ wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env, return true; } -WASM_RUNTIME_API_EXTERN bool +bool wasm_runtime_is_underlying_binary_freeable(WASMModuleCommon *const module) { #if WASM_ENABLE_INTERP != 0 diff --git a/core/iwasm/common/wasm_runtime_common.h b/core/iwasm/common/wasm_runtime_common.h index 4c7dfed4f..64a6cd793 100644 --- a/core/iwasm/common/wasm_runtime_common.h +++ b/core/iwasm/common/wasm_runtime_common.h @@ -37,6 +37,10 @@ extern "C" { do { \ *(int64 *)(addr) = (int64)(value); \ } while (0) +#define PUT_V128_TO_ADDR(addr, value) \ + do { \ + *(V128 *)(addr) = (value); \ + } while (0) #define PUT_F64_TO_ADDR(addr, value) \ do { \ *(float64 *)(addr) = (float64)(value); \ @@ -49,6 +53,7 @@ extern "C" { #define GET_I64_FROM_ADDR(addr) (*(int64 *)(addr)) #define GET_F64_FROM_ADDR(addr) (*(float64 *)(addr)) #define GET_REF_FROM_ADDR(addr) (*(void **)(addr)) +#define GET_V128_FROM_ADDR(addr) (*(V128 *)(addr)) /* For STORE opcodes */ #define STORE_I64 PUT_I64_TO_ADDR @@ -68,6 +73,12 @@ STORE_U8(void *addr, uint8_t value) *(uint8 *)addr = value; } +static inline void +STORE_V128(void *addr, V128 value) +{ + *(V128 *)addr = value; +} + /* For LOAD opcodes */ #define LOAD_I64(addr) (*(int64 *)(addr)) #define LOAD_F64(addr) (*(float64 *)(addr)) @@ -75,6 +86,7 @@ STORE_U8(void *addr, uint8_t value) #define LOAD_U32(addr) (*(uint32 *)(addr)) #define LOAD_I16(addr) (*(int16 *)(addr)) #define LOAD_U16(addr) (*(uint16 *)(addr)) +#define LOAD_V128(addr) (*(V128 *)(addr)) #define STORE_PTR(addr, ptr) \ do { \ @@ -83,6 +95,15 @@ STORE_U8(void *addr, uint8_t value) #else /* WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 */ +#define PUT_V128_TO_ADDR(addr, value) \ + do { \ + uint32 *addr_u32 = (uint32 *)(addr); \ + addr_u32[0] = (value).i32x4[0]; \ + addr_u32[1] = (value).i32x4[1]; \ + addr_u32[2] = (value).i32x4[2]; \ + addr_u32[3] = (value).i32x4[3]; \ + } while (0) + #define PUT_I64_TO_ADDR(addr, value) \ do { \ uint32 *addr_u32 = (uint32 *)(addr); \ @@ -124,6 +145,17 @@ STORE_U8(void *addr, uint8_t value) } while (0) #endif +static inline V128 +GET_V128_FROM_ADDR(uint32 *addr) +{ + V128 ret; + ret.i32x4[0] = addr[0]; + ret.i32x4[1] = addr[1]; + ret.i32x4[2] = addr[2]; + ret.i32x4[3] = addr[3]; + return ret; +} + static inline int64 GET_I64_FROM_ADDR(uint32 *addr) { @@ -239,7 +271,94 @@ STORE_U16(void *addr, uint16_t value) ((uint8_t *)(addr))[0] = u.u8[0]; ((uint8_t *)(addr))[1] = u.u8[1]; } + +static inline void +STORE_V128(void *addr, V128 value) +{ + uintptr_t addr_ = (uintptr_t)(addr); + union { + V128 val; + uint64 u64[2]; + uint32 u32[4]; + uint16 u16[8]; + uint8 u8[16]; + } u; + + if ((addr_ & (uintptr_t)15) == 0) { + *(V128 *)addr = value; + } + else if ((addr_ & (uintptr_t)7) == 0) { + u.val = value; + ((uint64 *)(addr))[0] = u.u64[0]; + ((uint64 *)(addr))[1] = u.u64[1]; + } + else if ((addr_ & (uintptr_t)3) == 0) { + u.val = value; + ((uint32 *)addr)[0] = u.u32[0]; + ((uint32 *)addr)[1] = u.u32[1]; + ((uint32 *)addr)[2] = u.u32[2]; + ((uint32 *)addr)[3] = u.u32[3]; + } + else if ((addr_ & (uintptr_t)1) == 0) { + u.val = value; + ((uint16 *)addr)[0] = u.u16[0]; + ((uint16 *)addr)[1] = u.u16[1]; + ((uint16 *)addr)[2] = u.u16[2]; + ((uint16 *)addr)[3] = u.u16[3]; + ((uint16 *)addr)[4] = u.u16[4]; + ((uint16 *)addr)[5] = u.u16[5]; + ((uint16 *)addr)[6] = u.u16[6]; + ((uint16 *)addr)[7] = u.u16[7]; + } + else { + u.val = value; + for (int i = 0; i < 16; i++) + ((uint8 *)addr)[i] = u.u8[i]; + } +} + /* For LOAD opcodes */ +static inline V128 +LOAD_V128(void *addr) +{ + uintptr_t addr1 = (uintptr_t)addr; + union { + V128 val; + uint64 u64[2]; + uint32 u32[4]; + uint16 u16[8]; + uint8 u8[16]; + } u; + if ((addr1 & (uintptr_t)15) == 0) + return *(V128 *)addr; + + if ((addr1 & (uintptr_t)7) == 0) { + u.u64[0] = ((uint64 *)addr)[0]; + u.u64[1] = ((uint64 *)addr)[1]; + } + else if ((addr1 & (uintptr_t)3) == 0) { + u.u32[0] = ((uint32 *)addr)[0]; + u.u32[1] = ((uint32 *)addr)[1]; + u.u32[2] = ((uint32 *)addr)[2]; + u.u32[3] = ((uint32 *)addr)[3]; + } + else if ((addr1 & (uintptr_t)1) == 0) { + u.u16[0] = ((uint16 *)addr)[0]; + u.u16[1] = ((uint16 *)addr)[1]; + u.u16[2] = ((uint16 *)addr)[2]; + u.u16[3] = ((uint16 *)addr)[3]; + u.u16[4] = ((uint16 *)addr)[4]; + u.u16[5] = ((uint16 *)addr)[5]; + u.u16[6] = ((uint16 *)addr)[6]; + u.u16[7] = ((uint16 *)addr)[7]; + } + else { + for (int i = 0; i < 16; i++) + u.u8[i] = ((uint8 *)addr)[i]; + } + return u.val; +} + static inline int64 LOAD_I64(void *addr) { @@ -464,19 +583,6 @@ typedef struct WASMRegisteredModule { typedef package_type_t PackageType; typedef wasm_section_t WASMSection, AOTSection; -typedef struct wasm_frame_t { - /* wasm_instance_t */ - void *instance; - uint32 module_offset; - uint32 func_index; - uint32 func_offset; - const char *func_name_wp; - - uint32 *sp; - uint8 *frame_ref; - uint32 *lp; -} WASMCApiFrame; - #if WASM_ENABLE_JIT != 0 typedef struct LLVMJITOptions { uint32 opt_level; @@ -652,6 +758,13 @@ wasm_runtime_create_exec_env(WASMModuleInstanceCommon *module_inst, WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env); +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +WASM_RUNTIME_API_EXTERN uint32_t +wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_t *buffer, + const uint32 length, const uint32 skip_n, char *error_buf, + uint32 error_buf_size); +#endif // WAMR_ENABLE_COPY_CALLSTACK + /* See wasm_export.h for description */ WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon * wasm_runtime_get_module_inst(WASMExecEnv *exec_env); @@ -678,9 +791,17 @@ WASM_RUNTIME_API_EXTERN void wasm_runtime_set_native_stack_boundary(WASMExecEnv *exec_env, uint8 *native_stack_boundary); -#if WASM_CONFIGURABLE_BOUNDS_CHECKS != 0 +#if WASM_ENABLE_INSTRUCTION_METERING != 0 /* See wasm_export.h for description */ WASM_RUNTIME_API_EXTERN void +wasm_runtime_set_instruction_count_limit(WASMExecEnv *exec_env, + int instructions_to_execute); +#endif + +#if WASM_CONFIGURABLE_BOUNDS_CHECKS != 0 +/* See wasm_export.h for description */ +WASM_RUNTIME_API_EXTERN +void wasm_runtime_set_bounds_checks(WASMModuleInstanceCommon *module_inst, bool enable); diff --git a/core/iwasm/compilation/aot_compiler.c b/core/iwasm/compilation/aot_compiler.c index 82f70ca3d..5d9664ee8 100644 --- a/core/iwasm/compilation/aot_compiler.c +++ b/core/iwasm/compilation/aot_compiler.c @@ -1316,6 +1316,13 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index) return false; break; +#if WASM_ENABLE_SIMD != 0 + case WASM_OP_SELECT_128: + if (!aot_compile_op_select(comp_ctx, func_ctx, true)) + return false; + break; +#endif + #if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0 case WASM_OP_SELECT_T: { diff --git a/core/iwasm/compilation/aot_compiler.h b/core/iwasm/compilation/aot_compiler.h index 06d8e42bd..889e2304b 100644 --- a/core/iwasm/compilation/aot_compiler.h +++ b/core/iwasm/compilation/aot_compiler.h @@ -790,7 +790,7 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type) } \ else { \ char *func_name = #name; \ - /* AOT mode, delcare the function */ \ + /* AOT mode, declare the function */ \ if (!(func = LLVMGetNamedFunction(func_ctx->module, func_name)) \ && !(func = LLVMAddFunction(func_ctx->module, func_name, \ func_type))) { \ diff --git a/core/iwasm/compilation/aot_emit_aot_file.c b/core/iwasm/compilation/aot_emit_aot_file.c index 9b2436a2b..097727d13 100644 --- a/core/iwasm/compilation/aot_emit_aot_file.c +++ b/core/iwasm/compilation/aot_emit_aot_file.c @@ -920,9 +920,11 @@ get_relocations_size(AOTObjectData *obj_data, /* ignore the relocations to aot_func_internal#n in text section for windows platform since they will be applied in aot_emit_text_section */ + + const char *name = relocation->symbol_name; if ((!strcmp(relocation_group->section_name, ".text") || !strcmp(relocation_group->section_name, ".ltext")) - && !strncmp(relocation->symbol_name, AOT_FUNC_INTERNAL_PREFIX, + && !strncmp(name, AOT_FUNC_INTERNAL_PREFIX, strlen(AOT_FUNC_INTERNAL_PREFIX)) && ((!strncmp(obj_data->comp_ctx->target_arch, "x86_64", 6) /* Windows AOT_COFF64_BIN_TYPE */ @@ -1790,7 +1792,9 @@ aot_emit_mem_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset, &init_datas[i]->offset)) return false; EMIT_U32(init_datas[i]->byte_count); - EMIT_BUF(init_datas[i]->bytes, init_datas[i]->byte_count); + if (init_datas[i]->byte_count) { + EMIT_BUF(init_datas[i]->bytes, init_datas[i]->byte_count); + } } if (offset - *p_offset != get_mem_info_size(comp_ctx, comp_data)) { @@ -2487,8 +2491,8 @@ aot_emit_text_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset, relocation_count = relocation_group->relocation_count; for (j = 0; j < relocation_count; j++) { /* relocation to aot_func_internal#n */ - if (str_starts_with(relocation->symbol_name, - AOT_FUNC_INTERNAL_PREFIX) + const char *name = relocation->symbol_name; + if (str_starts_with(name, AOT_FUNC_INTERNAL_PREFIX) && ((obj_data->target_info.bin_type == 6 /* AOT_COFF64_BIN_TYPE */ && relocation->relocation_type @@ -2498,8 +2502,7 @@ aot_emit_text_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset, && relocation->relocation_type == 20 /* IMAGE_REL_I386_REL32 */))) { uint32 func_idx = - atoi(relocation->symbol_name - + strlen(AOT_FUNC_INTERNAL_PREFIX)); + atoi(name + strlen(AOT_FUNC_INTERNAL_PREFIX)); uint64 text_offset, reloc_offset, reloc_addend; bh_assert(func_idx < obj_data->func_count); @@ -3050,6 +3053,27 @@ typedef struct elf64_rela { #define SET_TARGET_INFO_FIELD(f, v, type, little) \ SET_TARGET_INFO_VALUE(f, elf_header->v, type, little) +/* in windows 32, the symbol name may start with '_' */ +static char * +LLVMGetSymbolNameAndUnDecorate(LLVMSymbolIteratorRef si, + AOTTargetInfo target_info) +{ + char *original_name = (char *)LLVMGetSymbolName(si); + if (!original_name) { + return NULL; + } + + if (target_info.bin_type != AOT_COFF32_BIN_TYPE) { + return original_name; + } + + if (*original_name == '_') { + return ++original_name; + } + + return original_name; +} + static bool aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data) { @@ -3246,8 +3270,17 @@ is_data_section(AOTObjectData *obj_data, LLVMSectionIteratorRef sec_itr, return (!strcmp(section_name, ".data") || !strcmp(section_name, ".sdata") || !strcmp(section_name, ".rodata") +#if LLVM_VERSION_MAJOR >= 19 + /* https://github.com/llvm/llvm-project/pull/82214 */ + || !strcmp(section_name, ".srodata") +#endif /* ".rodata.cst4/8/16/.." */ || !strncmp(section_name, ".rodata.cst", strlen(".rodata.cst")) +#if LLVM_VERSION_MAJOR >= 19 + /* https://github.com/llvm/llvm-project/pull/82214 + * ".srodata.cst4/8/16/.." */ + || !strncmp(section_name, ".srodata.cst", strlen(".srodata.cst")) +#endif /* ".rodata.strn.m" */ || !strncmp(section_name, ".rodata.str", strlen(".rodata.str")) || (!strcmp(section_name, ".rdata") @@ -3524,12 +3557,9 @@ aot_resolve_stack_sizes(AOTCompContext *comp_ctx, AOTObjectData *obj_data) } while (!LLVMObjectFileIsSymbolIteratorAtEnd(obj_data->binary, sym_itr)) { - if ((name = LLVMGetSymbolName(sym_itr)) - && (!strcmp(name, aot_stack_sizes_alias_name) - /* symbol of COFF32 starts with "_" */ - || (obj_data->target_info.bin_type == AOT_COFF32_BIN_TYPE - && !strncmp(name, "_", 1) - && !strcmp(name + 1, aot_stack_sizes_alias_name)))) { + if ((name = + LLVMGetSymbolNameAndUnDecorate(sym_itr, obj_data->target_info)) + && (!strcmp(name, aot_stack_sizes_alias_name))) { #if 0 /* cf. https://github.com/llvm/llvm-project/issues/67765 */ uint64 sz = LLVMGetSymbolSize(sym_itr); if (sz != sizeof(uint32) * obj_data->func_count @@ -3693,8 +3723,8 @@ aot_resolve_functions(AOTCompContext *comp_ctx, AOTObjectData *obj_data) } while (!LLVMObjectFileIsSymbolIteratorAtEnd(obj_data->binary, sym_itr)) { - if ((name = (char *)LLVMGetSymbolName(sym_itr)) - && str_starts_with(name, prefix)) { + name = LLVMGetSymbolNameAndUnDecorate(sym_itr, obj_data->target_info); + if (name && str_starts_with(name, prefix)) { /* symbol aot_func#n */ func_index = (uint32)atoi(name + strlen(prefix)); if (func_index < obj_data->func_count) { @@ -3732,8 +3762,7 @@ aot_resolve_functions(AOTCompContext *comp_ctx, AOTObjectData *obj_data) } } } - else if ((name = (char *)LLVMGetSymbolName(sym_itr)) - && str_starts_with(name, AOT_FUNC_INTERNAL_PREFIX)) { + else if (name && str_starts_with(name, AOT_FUNC_INTERNAL_PREFIX)) { /* symbol aot_func_internal#n */ func_index = (uint32)atoi(name + strlen(AOT_FUNC_INTERNAL_PREFIX)); if (func_index < obj_data->func_count) { @@ -3844,7 +3873,7 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data, } } - /* pares each relocation */ + /* parse each relocation */ if (!(rel_itr = LLVMGetRelocations(rel_sec))) { aot_set_last_error("llvm get relocations failed."); return false; @@ -3881,7 +3910,8 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data, /* set relocation fields */ relocation->relocation_type = (uint32)type; - relocation->symbol_name = (char *)LLVMGetSymbolName(rel_sym); + relocation->symbol_name = + LLVMGetSymbolNameAndUnDecorate(rel_sym, obj_data->target_info); relocation->relocation_offset = offset; if (!strcmp(group->section_name, ".rela.text.unlikely.") || !strcmp(group->section_name, ".rel.text.unlikely.")) { @@ -3908,12 +3938,7 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data, * Note: aot_stack_sizes_section_name section only contains * stack_sizes table. */ - if (!strcmp(relocation->symbol_name, aot_stack_sizes_name) - /* in windows 32, the symbol name may start with '_' */ - || (strlen(relocation->symbol_name) > 0 - && relocation->symbol_name[0] == '_' - && !strcmp(relocation->symbol_name + 1, - aot_stack_sizes_name))) { + if (!strcmp(relocation->symbol_name, aot_stack_sizes_name)) { /* discard const */ relocation->symbol_name = (char *)aot_stack_sizes_section_name; } @@ -3982,8 +4007,21 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data, && (str_starts_with(relocation->symbol_name, ".LCPI") || str_starts_with(relocation->symbol_name, ".LJTI") || str_starts_with(relocation->symbol_name, ".LBB") - || str_starts_with(relocation->symbol_name, - ".Lswitch.table."))) { + || str_starts_with(relocation->symbol_name, ".Lswitch.table.") +#if LLVM_VERSION_MAJOR >= 16 + /* cf. https://reviews.llvm.org/D123264 */ + || str_starts_with(relocation->symbol_name, ".Lpcrel_hi") +#endif +#if LLVM_VERSION_MAJOR >= 19 + /* cf. + * https://github.com/llvm/llvm-project/pull/95031 + * https://github.com/llvm/llvm-project/pull/89693 + * + * note: the trailing space in ".L0 " is intentional. */ + || !strcmp(relocation->symbol_name, "") + || !strcmp(relocation->symbol_name, ".L0 ") +#endif + )) { /* change relocation->relocation_addend and relocation->symbol_name */ LLVMSectionIteratorRef contain_section; diff --git a/core/iwasm/compilation/aot_emit_control.c b/core/iwasm/compilation/aot_emit_control.c index 1c50fe75f..80e379513 100644 --- a/core/iwasm/compilation/aot_emit_control.c +++ b/core/iwasm/compilation/aot_emit_control.c @@ -1218,6 +1218,28 @@ aot_compile_op_br_table(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, return aot_handle_next_reachable_block(comp_ctx, func_ctx, p_frame_ip); } + /* + * if (value_cmp > br_count) + * value_cmp = br_count; + */ + LLVMValueRef br_count_value = I32_CONST(br_count); + CHECK_LLVM_CONST(br_count_value); + + LLVMValueRef clap_value_cmp_cond = + LLVMBuildICmp(comp_ctx->builder, LLVMIntUGT, value_cmp, br_count_value, + "cmp_w_br_count"); + if (!clap_value_cmp_cond) { + aot_set_last_error("llvm build icmp failed."); + return false; + } + + value_cmp = LLVMBuildSelect(comp_ctx->builder, clap_value_cmp_cond, + br_count_value, value_cmp, "clap_value_cmp"); + if (!value_cmp) { + aot_set_last_error("llvm build select failed."); + return false; + } + if (!LLVMIsEfficientConstInt(value_cmp)) { if (comp_ctx->aot_frame) { if (comp_ctx->enable_gc diff --git a/core/iwasm/compilation/aot_emit_conversion.c b/core/iwasm/compilation/aot_emit_conversion.c index c3dfa6bf1..fa5c2ab95 100644 --- a/core/iwasm/compilation/aot_emit_conversion.c +++ b/core/iwasm/compilation/aot_emit_conversion.c @@ -347,17 +347,8 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, POP_F32(value); - if (!comp_ctx->is_indirect_mode) { - if (sign) { - min_value = F32_CONST(-2147483904.0f); - max_value = F32_CONST(2147483648.0f); - } - else { - min_value = F32_CONST(-1.0f); - max_value = F32_CONST(4294967296.0f); - } - } - else { + if (comp_ctx->is_indirect_mode + && aot_intrinsic_check_capability(comp_ctx, "f32.const")) { WASMValue wasm_value; if (sign) { wasm_value.f32 = -2147483904.0f; @@ -376,6 +367,16 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32); } } + else { + if (sign) { + min_value = F32_CONST(-2147483904.0f); + max_value = F32_CONST(2147483648.0f); + } + else { + min_value = F32_CONST(-1.0f); + max_value = F32_CONST(4294967296.0f); + } + } CHECK_LLVM_CONST(min_value); CHECK_LLVM_CONST(max_value); @@ -400,17 +401,8 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, POP_F64(value); - if (!comp_ctx->is_indirect_mode) { - if (sign) { - min_value = F64_CONST(-2147483649.0); - max_value = F64_CONST(2147483648.0); - } - else { - min_value = F64_CONST(-1.0); - max_value = F64_CONST(4294967296.0); - } - } - else { + if (comp_ctx->is_indirect_mode + && aot_intrinsic_check_capability(comp_ctx, "f64.const")) { WASMValue wasm_value; if (sign) { wasm_value.f64 = -2147483649.0; @@ -429,6 +421,16 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64); } } + else { + if (sign) { + min_value = F64_CONST(-2147483649.0); + max_value = F64_CONST(2147483648.0); + } + else { + min_value = F64_CONST(-1.0); + max_value = F64_CONST(4294967296.0); + } + } CHECK_LLVM_CONST(min_value); CHECK_LLVM_CONST(max_value); @@ -554,17 +556,8 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, POP_F32(value); - if (!comp_ctx->is_indirect_mode) { - if (sign) { - min_value = F32_CONST(-9223373136366403584.0f); - max_value = F32_CONST(9223372036854775808.0f); - } - else { - min_value = F32_CONST(-1.0f); - max_value = F32_CONST(18446744073709551616.0f); - } - } - else { + if (comp_ctx->is_indirect_mode + && aot_intrinsic_check_capability(comp_ctx, "f32.const")) { WASMValue wasm_value; if (sign) { wasm_value.f32 = -9223373136366403584.0f; @@ -583,6 +576,16 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32); } } + else { + if (sign) { + min_value = F32_CONST(-9223373136366403584.0f); + max_value = F32_CONST(9223372036854775808.0f); + } + else { + min_value = F32_CONST(-1.0f); + max_value = F32_CONST(18446744073709551616.0f); + } + } CHECK_LLVM_CONST(min_value); CHECK_LLVM_CONST(max_value); @@ -607,17 +610,8 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, POP_F64(value); - if (!comp_ctx->is_indirect_mode) { - if (sign) { - min_value = F64_CONST(-9223372036854777856.0); - max_value = F64_CONST(9223372036854775808.0); - } - else { - min_value = F64_CONST(-1.0); - max_value = F64_CONST(18446744073709551616.0); - } - } - else { + if (comp_ctx->is_indirect_mode + && aot_intrinsic_check_capability(comp_ctx, "f64.const")) { WASMValue wasm_value; if (sign) { wasm_value.f64 = -9223372036854777856.0; @@ -636,6 +630,16 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64); } } + else { + if (sign) { + min_value = F64_CONST(-9223372036854777856.0); + max_value = F64_CONST(9223372036854775808.0); + } + else { + min_value = F64_CONST(-1.0); + max_value = F64_CONST(18446744073709551616.0); + } + } CHECK_LLVM_CONST(min_value); CHECK_LLVM_CONST(max_value); diff --git a/core/iwasm/compilation/aot_emit_memory.c b/core/iwasm/compilation/aot_emit_memory.c index 9adf96ac5..e685fccd9 100644 --- a/core/iwasm/compilation/aot_emit_memory.c +++ b/core/iwasm/compilation/aot_emit_memory.c @@ -345,7 +345,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, memory allocator, the hmu node includes hmu header and hmu memory, only the latter is returned to the caller as the allocated memory, the hmu header isn't returned so the - first byte of the shared heap won't be accesed, (2) using + first byte of the shared heap won't be accessed, (2) using IntUGT gets better performance than IntUGE in some cases */ BUILD_ICMP(LLVMIntUGT, offset1, func_ctx->shared_heap_start_off, is_in_shared_heap, "is_in_shared_heap"); @@ -1101,7 +1101,7 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx) } else { char *func_name = "aot_enlarge_memory"; - /* AOT mode, delcare the function */ + /* AOT mode, declare the function */ if (!(func = LLVMGetNamedFunction(func_ctx->module, func_name)) && !(func = LLVMAddFunction(func_ctx->module, func_name, func_type))) { @@ -1184,7 +1184,7 @@ check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, * Note: not throw the integer-overflow-exception here since it must * have been thrown when converting float to integer before */ - /* return addres directly if constant offset and inside memory space */ + /* return address directly if constant offset and inside memory space */ if (LLVMIsEfficientConstInt(offset) && LLVMIsEfficientConstInt(bytes)) { uint64 mem_offset = (uint64)LLVMConstIntGetZExtValue(offset); uint64 mem_len = (uint64)LLVMConstIntGetZExtValue(bytes); diff --git a/core/iwasm/compilation/aot_emit_numberic.c b/core/iwasm/compilation/aot_emit_numberic.c index 1f37060d9..492c3048c 100644 --- a/core/iwasm/compilation/aot_emit_numberic.c +++ b/core/iwasm/compilation/aot_emit_numberic.c @@ -653,15 +653,22 @@ compile_int_sub(AOTCompContext *comp_ctx, LLVMValueRef left, LLVMValueRef right, } static LLVMValueRef -compile_int_mul(AOTCompContext *comp_ctx, LLVMValueRef left, LLVMValueRef right, - bool is_i32) +compile_int_mul(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, + LLVMValueRef left, LLVMValueRef right, bool is_i32) { /* If one of the operands is 0, just return constant 0 */ if (IS_CONST_ZERO(left) || IS_CONST_ZERO(right)) return is_i32 ? I32_ZERO : I64_ZERO; /* Build mul */ - return LLVMBuildMul(comp_ctx->builder, left, right, "mul"); + LLVMTypeRef param_types[2]; + param_types[1] = param_types[0] = is_i32 ? I32_TYPE : I64_TYPE; + + LLVMValueRef res; + LLVM_BUILD_OP_OR_INTRINSIC(Mul, left, right, res, + is_i32 ? "i32.mul" : "i64.mul", "mul", false); + + return res; } static bool @@ -679,8 +686,9 @@ compile_op_int_arithmetic(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, "compile int sub fail."); return true; case INT_MUL: - DEF_INT_BINARY_OP(compile_int_mul(comp_ctx, left, right, is_i32), - "compile int mul fail."); + DEF_INT_BINARY_OP( + compile_int_mul(comp_ctx, func_ctx, left, right, is_i32), + "compile int mul fail."); return true; case INT_DIV_S: case INT_DIV_U: @@ -726,43 +734,57 @@ fail: } static LLVMValueRef -compile_int_shl(AOTCompContext *comp_ctx, LLVMValueRef left, LLVMValueRef right, - bool is_i32) +compile_int_shl(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, + LLVMValueRef left, LLVMValueRef right, bool is_i32) { LLVMValueRef res; SHIFT_COUNT_MASK; /* Build shl */ - LLVM_BUILD_OP(Shl, left, right, res, "shl", NULL); + LLVMTypeRef param_types[2]; + param_types[1] = param_types[0] = is_i32 ? I32_TYPE : I64_TYPE; + + LLVM_BUILD_OP_OR_INTRINSIC(Shl, left, right, res, + is_i32 ? "i32.shl" : "i64.shl", "shl", false); return res; } static LLVMValueRef -compile_int_shr_s(AOTCompContext *comp_ctx, LLVMValueRef left, - LLVMValueRef right, bool is_i32) +compile_int_shr_s(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, + LLVMValueRef left, LLVMValueRef right, bool is_i32) { LLVMValueRef res; SHIFT_COUNT_MASK; /* Build shl */ - LLVM_BUILD_OP(AShr, left, right, res, "shr_s", NULL); + LLVMTypeRef param_types[2]; + param_types[1] = param_types[0] = is_i32 ? I32_TYPE : I64_TYPE; + + LLVM_BUILD_OP_OR_INTRINSIC(AShr, left, right, res, + is_i32 ? "i32.shr_s" : "i64.shr_s", "shr_s", + false); return res; } static LLVMValueRef -compile_int_shr_u(AOTCompContext *comp_ctx, LLVMValueRef left, - LLVMValueRef right, bool is_i32) +compile_int_shr_u(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, + LLVMValueRef left, LLVMValueRef right, bool is_i32) { LLVMValueRef res; SHIFT_COUNT_MASK; /* Build shl */ - LLVM_BUILD_OP(LShr, left, right, res, "shr_u", NULL); + LLVMTypeRef param_types[2]; + param_types[1] = param_types[0] = is_i32 ? I32_TYPE : I64_TYPE; + + LLVM_BUILD_OP_OR_INTRINSIC(LShr, left, right, res, + is_i32 ? "i32.shr_u" : "i64.shr_u", "shr_u", + false); return res; } @@ -814,16 +836,18 @@ compile_op_int_shift(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, { switch (shift_op) { case INT_SHL: - DEF_INT_BINARY_OP(compile_int_shl(comp_ctx, left, right, is_i32), - NULL); + DEF_INT_BINARY_OP( + compile_int_shl(comp_ctx, func_ctx, left, right, is_i32), NULL); return true; case INT_SHR_S: - DEF_INT_BINARY_OP(compile_int_shr_s(comp_ctx, left, right, is_i32), - NULL); + DEF_INT_BINARY_OP( + compile_int_shr_s(comp_ctx, func_ctx, left, right, is_i32), + NULL); return true; case INT_SHR_U: - DEF_INT_BINARY_OP(compile_int_shr_u(comp_ctx, left, right, is_i32), - NULL); + DEF_INT_BINARY_OP( + compile_int_shr_u(comp_ctx, func_ctx, left, right, is_i32), + NULL); return true; case INT_ROTL: DEF_INT_BINARY_OP( diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index 14ee4dd2b..c1708e3f9 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -711,8 +711,7 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module, prefix))) goto fail; - if (comp_ctx->is_indirect_mode) { - /* avoid LUT relocations ("switch-table") */ + if (comp_ctx->disable_llvm_jump_tables) { LLVMAttributeRef attr_no_jump_tables = LLVMCreateStringAttribute( comp_ctx->context, "no-jump-tables", (uint32)strlen("no-jump-tables"), "true", (uint32)strlen("true")); @@ -1720,7 +1719,7 @@ aot_create_stack_sizes(const AOTCompData *comp_data, AOTCompContext *comp_ctx) * This value is a placeholder, which will be replaced * after the corresponding functions are compiled. * - * Don't use zeros becasue LLVM can optimize them to + * Don't use zeros because LLVM can optimize them to * zeroinitializer. */ values[i] = I32_NEG_ONE; @@ -2354,7 +2353,7 @@ create_target_machine_detect_host(AOTCompContext *comp_ctx) } if (!LLVMTargetHasJIT(target)) { - aot_set_last_error("unspported JIT on this platform."); + aot_set_last_error("unsupported JIT on this platform."); goto fail; } @@ -2521,7 +2520,8 @@ aot_compiler_init(void) LLVMInitializeCore(LLVMGetGlobalPassRegistry()); #endif -#if WASM_ENABLE_WAMR_COMPILER != 0 +/* fuzzing only use host targets for simple */ +#if WASM_ENABLE_WAMR_COMPILER != 0 && WASM_ENABLE_FUZZ_TEST == 0 /* Init environment of all targets for AOT compiler */ LLVMInitializeAllTargetInfos(); LLVMInitializeAllTargets(); @@ -2664,12 +2664,18 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) if (option->enable_aux_stack_check) comp_ctx->enable_aux_stack_check = true; - if (option->is_indirect_mode) + if (option->is_indirect_mode) { comp_ctx->is_indirect_mode = true; + /* avoid LUT relocations ("switch-table") */ + comp_ctx->disable_llvm_jump_tables = true; + } if (option->disable_llvm_intrinsics) comp_ctx->disable_llvm_intrinsics = true; + if (option->disable_llvm_jump_tables) + comp_ctx->disable_llvm_jump_tables = true; + if (option->disable_llvm_lto) comp_ctx->disable_llvm_lto = true; @@ -2736,10 +2742,23 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) } else { /* Create LLVM target machine */ - arch = option->target_arch; - abi = option->target_abi; - cpu = option->target_cpu; - features = option->cpu_features; + if (!option->target_arch || !strstr(option->target_arch, "-")) { + /* Retrieve the target triple based on user input */ + triple = NULL; + arch = option->target_arch; + abi = option->target_abi; + cpu = option->target_cpu; + features = option->cpu_features; + } + else { + /* Form a target triple */ + triple = option->target_arch; + arch = NULL; + abi = NULL; + cpu = NULL; + features = NULL; + } + opt_level = option->opt_level; size_level = option->size_level; @@ -2980,6 +2999,7 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) aot_set_last_error(buf); goto fail; } + LOG_VERBOSE("triple: %s => normailized: %s", triple, triple_norm); if (!cpu) cpu = ""; } @@ -3334,6 +3354,11 @@ aot_destroy_comp_context(AOTCompContext *comp_ctx) if (comp_ctx->builder) LLVMDisposeBuilder(comp_ctx->builder); +#if WASM_ENABLE_DEBUG_AOT != 0 + if (comp_ctx->debug_builder) + LLVMDisposeDIBuilder(comp_ctx->debug_builder); +#endif + if (comp_ctx->orc_thread_safe_context) LLVMOrcDisposeThreadSafeContext(comp_ctx->orc_thread_safe_context); @@ -3407,7 +3432,7 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol) sym = bh_list_first_elem(&comp_ctx->native_symbols); - /* Lookup an existing symobl record */ + /* Lookup an existing symbol record */ while (sym) { if (strcmp(sym->symbol, symbol) == 0) { diff --git a/core/iwasm/compilation/aot_llvm.h b/core/iwasm/compilation/aot_llvm.h index 9c608d301..6b1233c39 100644 --- a/core/iwasm/compilation/aot_llvm.h +++ b/core/iwasm/compilation/aot_llvm.h @@ -448,6 +448,9 @@ typedef struct AOTCompContext { /* Disable LLVM built-in intrinsics */ bool disable_llvm_intrinsics; + /* Disable LLVM jump tables */ + bool disable_llvm_jump_tables; + /* Disable LLVM link time optimization */ bool disable_llvm_lto; diff --git a/core/iwasm/compilation/aot_llvm_extra.cpp b/core/iwasm/compilation/aot_llvm_extra.cpp index e6770eb45..35b25c830 100644 --- a/core/iwasm/compilation/aot_llvm_extra.cpp +++ b/core/iwasm/compilation/aot_llvm_extra.cpp @@ -318,10 +318,15 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module) ModulePassManager MPM; if (comp_ctx->is_jit_mode) { +#if LLVM_VERSION_MAJOR >= 18 +#define INSTCOMBINE "instcombine" +#else +#define INSTCOMBINE "instcombine" +#endif const char *Passes = "loop-vectorize,slp-vectorizer," "load-store-vectorizer,vector-combine," - "mem2reg,instcombine,simplifycfg,jump-threading,indvars"; + "mem2reg," INSTCOMBINE ",simplifycfg,jump-threading,indvars"; ExitOnErr(PB.parsePassPipeline(MPM, Passes)); } else { diff --git a/core/iwasm/compilation/aot_llvm_extra2.cpp b/core/iwasm/compilation/aot_llvm_extra2.cpp index ccbccd1e0..5e1fdf6ce 100644 --- a/core/iwasm/compilation/aot_llvm_extra2.cpp +++ b/core/iwasm/compilation/aot_llvm_extra2.cpp @@ -159,6 +159,17 @@ LLVMCreateTargetMachineWithOpts(LLVMTargetRef ctarget, const char *triple, auto cm = convert(code_model, &jit); auto targetmachine = target->createTargetMachine(triple, cpu, features, opts, rm, cm, ol, jit); +#if LLVM_VERSION_MAJOR >= 18 + // always place data in normal data section. + // + // note that: + // - our aot file emitter/loader doesn't support x86-64 large data + // sections. (eg .lrodata) + // - for our purposes, "data" is usually something the compiler + // generated. (eg. jump tables) we probably never benefit from + // large data sections. + targetmachine->setLargeDataThreshold(UINT64_MAX); +#endif return reinterpret_cast(targetmachine); } diff --git a/core/iwasm/compilation/debug/dwarf_extractor.cpp b/core/iwasm/compilation/debug/dwarf_extractor.cpp index 334f4bb6c..f08f76616 100644 --- a/core/iwasm/compilation/debug/dwarf_extractor.cpp +++ b/core/iwasm/compilation/debug/dwarf_extractor.cpp @@ -311,14 +311,18 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx, case eLanguageTypeC: case eLanguageTypeC99: case eLanguageTypeC11: +#if LLVM_VERSION_MAJOR >= 17 case eLanguageTypeC17: +#endif break; case eLanguageTypeC_plus_plus: case eLanguageTypeC_plus_plus_03: case eLanguageTypeC_plus_plus_11: case eLanguageTypeC_plus_plus_14: +#if LLVM_VERSION_MAJOR >= 17 case eLanguageTypeC_plus_plus_17: case eLanguageTypeC_plus_plus_20: +#endif cplusplus = true; break; default: diff --git a/core/iwasm/compilation/iwasm_compl.cmake b/core/iwasm/compilation/iwasm_compl.cmake index 77925d62d..9db1d5bfe 100644 --- a/core/iwasm/compilation/iwasm_compl.cmake +++ b/core/iwasm/compilation/iwasm_compl.cmake @@ -17,7 +17,7 @@ endif() set (IWASM_COMPL_SOURCE ${source_all}) -# Disalbe rtti to works with LLVM +# Disable rtti to works with LLVM if (MSVC) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") diff --git a/core/iwasm/compilation/simd/simd_int_arith.c b/core/iwasm/compilation/simd/simd_int_arith.c index 6a1902d1f..ada4b5d35 100644 --- a/core/iwasm/compilation/simd/simd_int_arith.c +++ b/core/iwasm/compilation/simd/simd_int_arith.c @@ -32,7 +32,7 @@ simd_integer_arith(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, result = LLVMBuildMul(comp_ctx->builder, lhs, rhs, "product"); break; default: - HANDLE_FAILURE("Unsupport arith_op"); + HANDLE_FAILURE("Unsupported arith_op"); break; } diff --git a/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp b/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp index 79c72503e..967bf14b5 100644 --- a/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp +++ b/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp @@ -423,7 +423,7 @@ jmp_from_label_to_label(x86::Assembler &a, bh_list *jmp_info_list, /** * Encode detecting compare result register according to condition code - * and then jumping to suitable label when the condtion is met + * and then jumping to suitable label when the condition is met * * @param cc the compiler context * @param a the assembler to emit the code @@ -431,7 +431,7 @@ jmp_from_label_to_label(x86::Assembler &a, bh_list *jmp_info_list, * @param label_src the index of src label * @param op the opcode of condition operation * @param r1 the label info when condition is met - * @param r2 the label info when condition is unmet, do nonthing if VOID + * @param r2 the label info when condition is unmet, do nothing if VOID * @param is_last_insn if current insn is the last insn of current block * * @return true if success, false if failed @@ -2589,7 +2589,7 @@ alu_r_r_r_i32(x86::Assembler &a, ALU_OP op, int32 reg_no_dst, int32 reg_no1_src, if (reg_no2_src == REG_EDX_IDX) { /* convert `REM_S edx, eax, edx` into `mov esi, edx` and `REM_S edx eax, rsi` to - avoid overwritting edx when a.cdq() */ + avoid overwriting edx when a.cdq() */ a.mov(regs_i32[REG_I32_FREE_IDX], regs_i32[REG_EDX_IDX]); reg_no2_src = REG_I32_FREE_IDX; } @@ -2609,7 +2609,7 @@ alu_r_r_r_i32(x86::Assembler &a, ALU_OP op, int32 reg_no_dst, int32 reg_no1_src, if (reg_no2_src == REG_EDX_IDX) { /* convert `REM_U edx, eax, edx` into `mov esi, edx` and `REM_U edx eax, rsi` to - avoid overwritting edx when unsigned extend + avoid overwriting edx when unsigned extend eax to edx:eax */ a.mov(regs_i32[REG_I32_FREE_IDX], regs_i32[REG_EDX_IDX]); reg_no2_src = REG_I32_FREE_IDX; @@ -5602,7 +5602,7 @@ fail: a.jmp(imm); \ if (!err_handler->err) { \ /* The offset written by asmjit is always 0, we patch it \ - again, 6 is the size of jmp instruciton */ \ + again, 6 is the size of jmp instruction */ \ stream = (char *)a.code()->sectionById(0)->buffer().data() \ + a.code()->sectionById(0)->buffer().size() - 6; \ _offset = label_offsets[label_dst] \ @@ -6169,7 +6169,7 @@ fail: * Replace all the jmp address pre-saved when the code cache hasn't been * allocated with actual address after code cache allocated * - * @param cc compiler context containting the allocated code cacha info + * @param cc compiler context containing the allocated code cacha info * @param jmp_info_list the jmp info list */ static void @@ -6557,7 +6557,7 @@ at_cmpxchg_r_ra_base_r_offset_imm(x86::Assembler &a, uint32 bytes_dst, * @param a the assembler to emit the code * @param bytes_dst the bytes number of the data to actual operated on(load, * compare, replacement) could be 1(byte), 2(short), 4(int32), 8(int64) - * @param data_xchg the immediate data for exchange(conditionally replacment + * @param data_xchg the immediate data for exchange(conditionally replacement * value) * @param reg_no_base the no of register that stores the base address * of src&dst memory @@ -6587,7 +6587,7 @@ at_cmpxchg_imm_ra_base_r_offset_r(x86::Assembler &a, uint32 bytes_dst, * @param a the assembler to emit the code * @param bytes_dst the bytes number of the data to actual operated on(load, * compare, replacement) could be 1(byte), 2(short), 4(int32), 8(int64) - * @param data_xchg the immediate data for exchange(conditionally replacment + * @param data_xchg the immediate data for exchange(conditionally replacement * value) * @param reg_no_base the no of register that stores the base address * of src&dst memory @@ -8820,7 +8820,7 @@ jit_codegen_compile_call_to_fast_jit(const WASMModule *module, uint32 func_idx) /* If yes, set eax to 0, return to caller */ - /* Pop all integer arument registers */ + /* Pop all integer argument registers */ for (i = 0; i < MAX_REG_INTS; i++) { a.pop(regs_i64[reg_idx_of_int_args[i]]); } @@ -9084,7 +9084,7 @@ jit_codegen_compile_call_to_fast_jit(const WASMModule *module, uint32 func_idx) a.mov(m, x86::rdx); } - /* Pop all integer arument registers */ + /* Pop all integer argument registers */ for (i = 0; i < MAX_REG_INTS; i++) { a.pop(regs_i64[reg_idx_of_int_args[i]]); } diff --git a/core/iwasm/fast-jit/fe/jit_emit_compare.c b/core/iwasm/fast-jit/fe/jit_emit_compare.c index 8fe48f142..02619a4d2 100644 --- a/core/iwasm/fast-jit/fe/jit_emit_compare.c +++ b/core/iwasm/fast-jit/fe/jit_emit_compare.c @@ -14,7 +14,7 @@ jit_compile_op_compare_integer(JitCompContext *cc, IntCond cond, bool is64Bit) JitReg lhs, rhs, res, const_zero, const_one; if (cond < INT_EQZ || cond > INT_GE_U) { - jit_set_last_error(cc, "unsupported comparation operation"); + jit_set_last_error(cc, "unsupported comparison operation"); goto fail; } diff --git a/core/iwasm/fast-jit/fe/jit_emit_control.c b/core/iwasm/fast-jit/fe/jit_emit_control.c index 9274e7217..04140b6ae 100644 --- a/core/iwasm/fast-jit/fe/jit_emit_control.c +++ b/core/iwasm/fast-jit/fe/jit_emit_control.c @@ -1230,7 +1230,7 @@ jit_compile_op_br_table(JitCompContext *cc, uint32 *br_depths, uint32 br_count, copy_arities = check_copy_arities(block_dst, cc->jit_frame); if (!copy_arities) { - /* No need to create new basic block, direclty jump to + /* No need to create new basic block, directly jump to the existing basic block when no need to copy arities */ if (i == br_count) { if (block_dst->label_type == LABEL_TYPE_LOOP) { diff --git a/core/iwasm/fast-jit/iwasm_fast_jit.cmake b/core/iwasm/fast-jit/iwasm_fast_jit.cmake index c5012bd36..676258075 100644 --- a/core/iwasm/fast-jit/iwasm_fast_jit.cmake +++ b/core/iwasm/fast-jit/iwasm_fast_jit.cmake @@ -1,8 +1,14 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR}) +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) +set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR}) add_definitions(-DWASM_ENABLE_FAST_JIT=1) if (WAMR_BUILD_FAST_JIT_DUMP EQUAL 1) add_definitions(-DWASM_ENABLE_FAST_JIT_DUMP=1) diff --git a/core/iwasm/fast-jit/jit_frontend.c b/core/iwasm/fast-jit/jit_frontend.c index ca5521a14..566783b6f 100644 --- a/core/iwasm/fast-jit/jit_frontend.c +++ b/core/iwasm/fast-jit/jit_frontend.c @@ -31,7 +31,7 @@ get_global_base_offset(const WASMModule *module) * (module->import_memory_count + module->memory_count); #if WASM_ENABLE_JIT != 0 - /* If the module dosen't have memory, reserve one mem_info space + /* If the module doesn't have memory, reserve one mem_info space with empty content to align with llvm jit compiler */ if (mem_inst_size == 0) mem_inst_size = (uint32)sizeof(WASMMemoryInstance); @@ -1169,7 +1169,7 @@ init_func_translation(JitCompContext *cc) time_started = jit_cc_new_reg_I64(cc); /* Call os_time_thread_cputime_us() to get time_started firstly as there is stack frame switching below, calling native in them - may cause register spilling work inproperly */ + may cause register spilling work improperly */ if (!jit_emit_callnative(cc, os_time_thread_cputime_us, time_started, NULL, 0)) { return NULL; diff --git a/core/iwasm/fast-jit/jit_ir.h b/core/iwasm/fast-jit/jit_ir.h index bef3fcc0c..6b3acfa0b 100644 --- a/core/iwasm/fast-jit/jit_ir.h +++ b/core/iwasm/fast-jit/jit_ir.h @@ -94,7 +94,7 @@ typedef uint32 JitReg; /* * Constant index flag of non-constant-value (constant value flag is * not set in register no. field) integer, floating point and vector - * regisers. If this flag is set, the rest bits of the register + * registers. If this flag is set, the rest bits of the register * no. represent an index to the constant value table of the * corresponding type of the register and the register is read-only. */ @@ -1084,7 +1084,7 @@ typedef struct JitCompContext { /* Capacity of register annotations of each kind. */ uint32 _capacity[JIT_REG_KIND_L32]; - /* Constant vallues of each kind. */ + /* Constant values of each kind. */ uint8 *_value[JIT_REG_KIND_L32]; /* Next element on the list of values with the same hash code. */ @@ -1145,7 +1145,7 @@ typedef struct JitCompContext { JitInsn **_table; } _insn_hash_table; - /* indicate if the last comparision is about floating-point numbers or not + /* indicate if the last comparison is about floating-point numbers or not */ bool last_cmp_on_fp; } JitCompContext; @@ -1203,7 +1203,7 @@ typedef struct JitCompContext { * Annotation disabling functions jit_annl_disable_NAME, * jit_anni_disable_NAME and jit_annr_disable_NAME, which release * memory of the annotations. Before calling these functions, - * resources owned by the annotations must be explictely released. + * resources owned by the annotations must be explicitly released. */ #define ANN_LABEL(TYPE, NAME) void jit_annl_disable_##NAME(JitCompContext *cc); #define ANN_INSN(TYPE, NAME) void jit_anni_disable_##NAME(JitCompContext *cc); @@ -1559,7 +1559,7 @@ _jit_cc_new_insn_norm(JitCompContext *cc, JitReg *result, JitInsn *insn); * * @param cc the compilationo context * @param result returned result of the instruction. If the value is - * non-zero, it is the result of the constant-folding or an exsiting + * non-zero, it is the result of the constant-folding or an existing * equivalent instruction, in which case no instruction is added into * the compilation context. Otherwise, a new normalized instruction * has been added into the compilation context. diff --git a/core/iwasm/fast-jit/jit_regalloc.c b/core/iwasm/fast-jit/jit_regalloc.c index 70ca228ac..96e5a57cf 100644 --- a/core/iwasm/fast-jit/jit_regalloc.c +++ b/core/iwasm/fast-jit/jit_regalloc.c @@ -221,7 +221,7 @@ get_reg_stride(JitReg reg) * @param rc the regalloc context * @param vreg the virtual register * - * @return the spill slot encoded in a consant register + * @return the spill slot encoded in a constant register */ static JitReg rc_alloc_spill_slot(RegallocContext *rc, JitReg vreg) @@ -478,7 +478,7 @@ reload_vreg(RegallocContext *rc, JitReg vreg, JitInsn *cur_insn) JitReg fp_reg = rc->cc->fp_reg, offset; if (!vr->slot && !(vr->slot = rc_alloc_spill_slot(rc, vreg))) - /* Cannot allocte spill slot (due to OOM or frame size limit). */ + /* Cannot allocate spill slot (due to OOM or frame size limit). */ return NULL; offset = offset_of_spill_slot(rc->cc, vr->slot); @@ -579,7 +579,7 @@ spill_vreg(RegallocContext *rc, JitReg vreg, JitInsn *cur_insn) /** * Allocate a hard register for the virtual register. Necessary - * reloade instruction will be inserted after the given instruction. + * reload instruction will be inserted after the given instruction. * * @param rc the regalloc context * @param vreg the virtual register @@ -665,7 +665,7 @@ allocate_hreg(RegallocContext *rc, JitReg vreg, JitInsn *insn, int distance) /** * Allocate a hard register for the virtual register if not allocated - * yet. Necessary spill and reloade instructions will be inserted + * yet. Necessary spill and reload instructions will be inserted * before/after and after the given instruction. This operation will * convert the virtual register's state from 1 or 3 to 2. * diff --git a/core/iwasm/include/aot_comp_option.h b/core/iwasm/include/aot_comp_option.h index a97275d24..839176623 100644 --- a/core/iwasm/include/aot_comp_option.h +++ b/core/iwasm/include/aot_comp_option.h @@ -8,6 +8,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { /* Enables or disables bounds checks for stack frames. When enabled, the AOT * compiler generates code to check if the stack pointer is within the @@ -69,6 +73,7 @@ typedef struct AOTCompOption { bool enable_perf_profiling; bool enable_memory_profiling; bool disable_llvm_intrinsics; + bool disable_llvm_jump_tables; bool disable_llvm_lto; bool enable_llvm_pgo; bool enable_stack_estimation; @@ -88,4 +93,8 @@ typedef struct AOTCompOption { const char *builtin_intrinsics; } AOTCompOption, *aot_comp_option_t; +#ifdef __cplusplus +} #endif + +#endif /* end of __AOT_COMP_OPTION_H__ */ diff --git a/core/iwasm/include/wasm_c_api.h b/core/iwasm/include/wasm_c_api.h index 9fc460148..241a0eec8 100644 --- a/core/iwasm/include/wasm_c_api.h +++ b/core/iwasm/include/wasm_c_api.h @@ -46,7 +46,7 @@ extern "C" { // Auxiliaries // Machine types -#if (__STDC_VERSION__) > 199901L +#if defined(__STDC_VERSION__) && (__STDC_VERSION__) > 199901L inline void assertions(void) { static_assert(sizeof(float) == sizeof(uint32_t), "incompatible float type"); static_assert(sizeof(double) == sizeof(uint64_t), "incompatible double type"); diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index 65bb0e767..e559d995e 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -126,6 +126,21 @@ typedef WASMFunctionInstanceCommon *wasm_function_inst_t; struct WASMMemoryInstance; typedef struct WASMMemoryInstance *wasm_memory_inst_t; +typedef struct wasm_frame_t { + /* wasm_instance_t */ + void *instance; + uint32_t module_offset; + uint32_t func_index; + uint32_t func_offset; + const char *func_name_wp; + + uint32_t *sp; + uint8_t *frame_ref; + uint32_t *lp; +} WASMCApiFrame; + +typedef WASMCApiFrame wasm_frame_t; + /* WASM section */ typedef struct wasm_section_t { struct wasm_section_t *next; @@ -865,6 +880,35 @@ wasm_runtime_create_exec_env(wasm_module_inst_t module_inst, WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env); +/** + * @brief Copy callstack frames. + * + * Caution: This is not a thread-safe function. Ensure the exec_env + * is suspended before calling it from another thread. + * + * Usage: In the callback to read frames fields use APIs + * for wasm_frame_t from wasm_c_api.h + * + * Note: The function is async-signal-safe if called with verified arguments. + * Meaning it's safe to call it from a signal handler even on a signal + * interruption from another thread if next variables hold valid pointers + * - exec_env + * - exec_env->module_inst + * - exec_env->module_inst->module + * + * @param exec_env the execution environment that containes frames + * @param buffer the buffer of size equal length * sizeof(wasm_frame_t) to copy + * frames to + * @param length the number of frames to copy + * @param skip_n the number of frames to skip from the top of the stack + * + * @return number of copied frames + */ +WASM_RUNTIME_API_EXTERN uint32_t +wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_t *buffer, + const uint32_t length, const uint32_t skip_n, + char *error_buf, uint32_t error_buf_size); + /** * Get the singleton execution environment for the instance. * @@ -1778,6 +1822,20 @@ WASM_RUNTIME_API_EXTERN void wasm_runtime_set_native_stack_boundary(wasm_exec_env_t exec_env, uint8_t *native_stack_boundary); +/** + * Set the instruction count limit to the execution environment. + * By default the instruction count limit is -1, which means no limit. + * However, if the instruction count limit is set to a positive value, + * the execution will be terminated when the instruction count reaches + * the limit. + * + * @param exec_env the execution environment + * @param instruction_count the instruction count limit + */ +WASM_RUNTIME_API_EXTERN void +wasm_runtime_set_instruction_count_limit(wasm_exec_env_t exec_env, + int instruction_count); + /** * Dump runtime memory consumption, including: * Exec env memory consumption @@ -2315,7 +2373,7 @@ wasm_runtime_detach_shared_heap(wasm_module_inst_t module_inst); * @param size required memory size * @param p_native_addr native address of allocated memory * - * @return return the allocated memory address, which re-uses part of the wasm + * @return return the allocated memory address, which reuses part of the wasm * address space and is in the range of [UINT32 - shared_heap_size + 1, UINT32] * (when the wasm memory is 32-bit) or [UINT64 - shared_heap_size + 1, UINT64] * (when the wasm memory is 64-bit). Note that it is not an absolute address. diff --git a/core/iwasm/interpreter/wasm.h b/core/iwasm/interpreter/wasm.h index 6023b0702..ddc0b15b4 100644 --- a/core/iwasm/interpreter/wasm.h +++ b/core/iwasm/interpreter/wasm.h @@ -1243,7 +1243,7 @@ wasm_value_type_size_internal(uint8 value_type, uint8 pointer_size) return sizeof(int16); #endif else { - bh_assert(0); + bh_assert(0 && "Unknown value type. It should be handled ahead."); } #if WASM_ENABLE_GC == 0 (void)pointer_size; diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index ddf47aeee..d3e8f0337 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -1494,10 +1494,13 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst, } \ os_mutex_unlock(&exec_env->wait_lock); \ } \ + CHECK_INSTRUCTION_LIMIT(); \ goto *handle_table[*frame_ip++]; \ } while (0) #else -#define HANDLE_OP_END() FETCH_OPCODE_AND_DISPATCH() +#define HANDLE_OP_END() \ + CHECK_INSTRUCTION_LIMIT(); \ + FETCH_OPCODE_AND_DISPATCH() #endif #else /* else of WASM_ENABLE_LABELS_AS_VALUES */ @@ -1520,9 +1523,12 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst, } \ os_mutex_unlock(&exec_env->wait_lock); \ } \ + CHECK_INSTRUCTION_LIMIT(); \ continue; #else -#define HANDLE_OP_END() continue +#define HANDLE_OP_END() \ + CHECK_INSTRUCTION_LIMIT(); \ + continue; #endif #endif /* end of WASM_ENABLE_LABELS_AS_VALUES */ @@ -1540,6 +1546,18 @@ get_global_addr(uint8 *global_data, WASMGlobalInstance *global) #endif } +#if WASM_ENABLE_INSTRUCTION_METERING != 0 +#define CHECK_INSTRUCTION_LIMIT() \ + if (instructions_left == 0) { \ + wasm_set_exception(module, "instruction limit exceeded"); \ + goto got_exception; \ + } \ + else if (instructions_left > 0) \ + instructions_left--; +#else +#define CHECK_INSTRUCTION_LIMIT() (void)0 +#endif + static void wasm_interp_call_func_bytecode(WASMModuleInstance *module, WASMExecEnv *exec_env, @@ -1583,6 +1601,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint32 local_idx, local_offset, global_idx; uint8 local_type, *global_addr; uint32 cache_index, type_index, param_cell_num, cell_num; + +#if WASM_ENABLE_INSTRUCTION_METERING != 0 + int instructions_left = -1; + if (exec_env) { + instructions_left = exec_env->instructions_to_execute; + } +#endif + #if WASM_ENABLE_EXCE_HANDLING != 0 int32_t exception_tag_index; #endif @@ -1896,7 +1922,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, UNWIND_CSP(relative_depth, LABEL_TYPE_FUNCTION); /* push exception values for catch * The values are copied to the CALLER FRAME - * (prev_frame->sp) same behvior ad WASM_OP_RETURN + * (prev_frame->sp) same behavior ad WASM_OP_RETURN */ if (cell_num_to_copy > 0) { word_copy(prev_frame->sp, @@ -4925,7 +4951,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of i32 */ + /* numeric instructions of i32 */ HANDLE_OP(WASM_OP_I32_CLZ) { DEF_OP_BIT_COUNT(uint32, I32, clz32); @@ -5082,7 +5108,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of i64 */ + /* numeric instructions of i64 */ HANDLE_OP(WASM_OP_I64_CLZ) { DEF_OP_BIT_COUNT(uint64, I64, clz64); @@ -5239,7 +5265,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of f32 */ + /* numeric instructions of f32 */ HANDLE_OP(WASM_OP_F32_ABS) { DEF_OP_MATH(float32, F32, fabsf); @@ -5343,7 +5369,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of f64 */ + /* numeric instructions of f64 */ HANDLE_OP(WASM_OP_F64_ABS) { DEF_OP_MATH(float64, F64, fabs); @@ -5746,7 +5772,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, { mem_offset_t dst, src, len; uint8 *mdst, *msrc; - uint64 dlen; len = POP_MEM_OFFSET(); src = POP_MEM_OFFSET(); @@ -5759,24 +5784,17 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, /* skip dst memidx */ frame_ip += 1; #endif + // TODO: apply memidx #if WASM_ENABLE_THREAD_MGR != 0 linear_mem_size = get_linear_mem_size(); #endif - - dlen = linear_mem_size - dst; - /* dst boundary check */ #ifndef OS_ENABLE_HW_BOUND_CHECK CHECK_BULK_MEMORY_OVERFLOW(dst, len, mdst); -#if WASM_ENABLE_SHARED_HEAP != 0 - if (app_addr_in_shared_heap((uint64)dst, len)) - dlen = get_shared_heap_end_off() - dst + 1; -#endif #else /* else of OS_ENABLE_HW_BOUND_CHECK */ #if WASM_ENABLE_SHARED_HEAP != 0 if (app_addr_in_shared_heap((uint64)dst, len)) { shared_heap_addr_app_to_native((uint64)dst, mdst); - dlen = get_shared_heap_end_off() - dst + 1; } else #endif @@ -5794,6 +5812,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, /* skip src memidx */ frame_ip += 1; #endif + // TODO: apply memidx #if WASM_ENABLE_THREAD_MGR != 0 linear_mem_size = get_linear_mem_size(); #endif @@ -5813,15 +5832,21 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, } #endif -#if WASM_ENABLE_MEMORY64 == 0 - /* allowing the destination and source to overlap */ - bh_memmove_s(mdst, (uint32)dlen, msrc, (uint32)len); -#else - /* use memmove when memory64 is enabled since len - may be larger than UINT32_MAX */ - memmove(mdst, msrc, len); - (void)dlen; -#endif + /* + * avoid unnecessary operations + * + * since dst and src both are valid indexes in the + * linear memory, mdst and msrc can't be NULL + * + * The spec. converts memory.copy into i32.load8 and + * i32.store8; the following are runtime-specific + * optimizations. + * + */ + if (len && mdst != msrc) { + /* allowing the destination and source to overlap */ + memmove(mdst, msrc, len); + } break; } case WASM_OP_MEMORY_FILL: @@ -6642,7 +6667,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, tag++, t++) { /* compare the module and the external index with the - * imort tag data */ + * import tag data */ if ((cur_func->u.func_import->import_module == tag->u.tag_import->import_module) && (ext_exception diff --git a/core/iwasm/interpreter/wasm_interp_fast.c b/core/iwasm/interpreter/wasm_interp_fast.c index 8538d376e..4c7b246d5 100644 --- a/core/iwasm/interpreter/wasm_interp_fast.c +++ b/core/iwasm/interpreter/wasm_interp_fast.c @@ -21,6 +21,10 @@ #include "../common/wasm_shared_memory.h" #endif +#if WASM_ENABLE_SIMDE != 0 +#include "simde/wasm/simd128.h" +#endif + typedef int32 CellType_I32; typedef int64 CellType_I64; typedef float32 CellType_F32; @@ -85,6 +89,19 @@ typedef float64 CellType_F64; goto unaligned_atomic; \ } while (0) +#if WASM_ENABLE_INSTRUCTION_METERING != 0 +#define CHECK_INSTRUCTION_LIMIT() \ + if (instructions_left == 0) { \ + wasm_set_exception(module, "instruction limit exceeded"); \ + goto got_exception; \ + } \ + else if (instructions_left > 0) \ + instructions_left--; + +#else +#define CHECK_INSTRUCTION_LIMIT() (void)0 +#endif + static inline uint32 rotl32(uint32 n, uint32 c) { @@ -438,6 +455,8 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame) (type) GET_I64_FROM_ADDR(frame_lp + *(int16 *)(frame_ip + off)) #define GET_OPERAND_F64(type, off) \ (type) GET_F64_FROM_ADDR(frame_lp + *(int16 *)(frame_ip + off)) +#define GET_OPERAND_V128(off) \ + GET_V128_FROM_ADDR(frame_lp + *(int16 *)(frame_ip + off)) #define GET_OPERAND_REF(type, off) \ (type) GET_REF_FROM_ADDR(frame_lp + *(int16 *)(frame_ip + off)) @@ -488,6 +507,8 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame) #define POP_I64() (GET_I64_FROM_ADDR(frame_lp + GET_OFFSET())) +#define POP_V128() (GET_V128_FROM_ADDR(frame_lp + GET_OFFSET())) + #define POP_F64() (GET_F64_FROM_ADDR(frame_lp + GET_OFFSET())) #define POP_REF() \ @@ -989,6 +1010,22 @@ fail: SET_FRAME_REF((unsigned)(dst_offsets[0] + 1)); \ } \ } \ + else if (cells[0] == 4) { \ + PUT_V128_TO_ADDR( \ + frame_lp + dst_offsets[0], \ + GET_V128_FROM_ADDR(frame_lp + src_offsets[0])); \ + /* Ignore constants because they are not reference */ \ + if (src_offsets[0] >= 0) { \ + CLEAR_FRAME_REF((unsigned)src_offsets[0]); \ + CLEAR_FRAME_REF((unsigned)(src_offsets[0] + 1)); \ + CLEAR_FRAME_REF((unsigned)(src_offsets[0] + 2)); \ + CLEAR_FRAME_REF((unsigned)(src_offsets[0] + 3)); \ + SET_FRAME_REF((unsigned)dst_offsets[0]); \ + SET_FRAME_REF((unsigned)(dst_offsets[0] + 1)); \ + SET_FRAME_REF((unsigned)(dst_offsets[0] + 2)); \ + SET_FRAME_REF((unsigned)(dst_offsets[0] + 3)); \ + } \ + } \ } \ else { \ if (!copy_stack_values(module, frame_lp, arity, frame_ref, \ @@ -1029,6 +1066,11 @@ fail: frame_lp + dst_offsets[0], \ GET_I64_FROM_ADDR(frame_lp + src_offsets[0])); \ } \ + else if (cells[0] == 4) { \ + PUT_V128_TO_ADDR( \ + frame_lp + dst_offsets[0], \ + GET_V128_FROM_ADDR(frame_lp + src_offsets[0])); \ + } \ } \ else { \ if (!copy_stack_values(module, frame_lp, arity, total_cell, \ @@ -1396,6 +1438,7 @@ wasm_interp_dump_op_count() do { \ const void *p_label_addr = *(void **)frame_ip; \ frame_ip += sizeof(void *); \ + CHECK_INSTRUCTION_LIMIT(); \ goto *p_label_addr; \ } while (0) #else @@ -1407,6 +1450,7 @@ wasm_interp_dump_op_count() /* int32 relative offset was emitted in 64-bit target */ \ p_label_addr = label_base + (int32)LOAD_U32_WITH_2U16S(frame_ip); \ frame_ip += sizeof(int32); \ + CHECK_INSTRUCTION_LIMIT(); \ goto *p_label_addr; \ } while (0) #else @@ -1417,6 +1461,7 @@ wasm_interp_dump_op_count() /* uint32 label address was emitted in 32-bit target */ \ p_label_addr = (void *)(uintptr_t)LOAD_U32_WITH_2U16S(frame_ip); \ frame_ip += sizeof(int32); \ + CHECK_INSTRUCTION_LIMIT(); \ goto *p_label_addr; \ } while (0) #endif @@ -1493,6 +1538,13 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint8 *maddr = NULL; uint32 local_idx, local_offset, global_idx; uint8 opcode = 0, local_type, *global_addr; + +#if WASM_ENABLE_INSTRUCTION_METERING != 0 + int instructions_left = -1; + if (exec_env) { + instructions_left = exec_env->instructions_to_execute; + } +#endif #if !defined(OS_ENABLE_HW_BOUND_CHECK) \ || WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 #if WASM_CONFIGURABLE_BOUNDS_CHECKS != 0 @@ -1668,6 +1720,11 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, GET_OPERAND(uint64, I64, off)); ret_offset += 2; } + else if (ret_types[ret_idx] == VALUE_TYPE_V128) { + PUT_V128_TO_ADDR(prev_frame->lp + ret_offset, + GET_OPERAND_V128(off)); + ret_offset += 4; + } #if WASM_ENABLE_GC != 0 else if (wasm_is_type_reftype(ret_types[ret_idx])) { PUT_REF_TO_ADDR(prev_frame->lp + ret_offset, @@ -1830,6 +1887,27 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, } HANDLE_OP_END(); } +#if WASM_ENABLE_SIMD != 0 + HANDLE_OP(WASM_OP_SELECT_128) + { + cond = frame_lp[GET_OFFSET()]; + addr1 = GET_OFFSET(); + addr2 = GET_OFFSET(); + addr_ret = GET_OFFSET(); + + if (!cond) { + if (addr_ret != addr1) + PUT_V128_TO_ADDR(frame_lp + addr_ret, + GET_V128_FROM_ADDR(frame_lp + addr1)); + } + else { + if (addr_ret != addr2) + PUT_V128_TO_ADDR(frame_lp + addr_ret, + GET_V128_FROM_ADDR(frame_lp + addr2)); + } + HANDLE_OP_END(); + } +#endif #if WASM_ENABLE_GC != 0 HANDLE_OP(WASM_OP_SELECT_T) @@ -3507,6 +3585,24 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } +#if WASM_ENABLE_SIMDE != 0 + HANDLE_OP(EXT_OP_SET_LOCAL_FAST_V128) + HANDLE_OP(EXT_OP_TEE_LOCAL_FAST_V128) + { + /* clang-format off */ +#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 + local_offset = *frame_ip++; +#else + local_offset = *frame_ip; + frame_ip += 2; +#endif + /* clang-format on */ + PUT_V128_TO_ADDR((uint32 *)(frame_lp + local_offset), + GET_OPERAND_V128(0)); + frame_ip += 2; + HANDLE_OP_END(); + } +#endif HANDLE_OP(WASM_OP_GET_GLOBAL) { global_idx = read_uint32(frame_ip); @@ -3543,7 +3639,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, GET_I64_FROM_ADDR((uint32 *)global_addr)); HANDLE_OP_END(); } - +#if WASM_ENABLE_SIMDE != 0 + HANDLE_OP(WASM_OP_GET_GLOBAL_V128) + { + global_idx = read_uint32(frame_ip); + bh_assert(global_idx < module->e->global_count); + global = globals + global_idx; + global_addr = get_global_addr(global_data, global); + addr_ret = GET_OFFSET(); + PUT_V128_TO_ADDR(frame_lp + addr_ret, + GET_V128_FROM_ADDR((uint32 *)global_addr)); + HANDLE_OP_END(); + } +#endif HANDLE_OP(WASM_OP_SET_GLOBAL) { global_idx = read_uint32(frame_ip); @@ -3610,6 +3718,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, GET_I64_FROM_ADDR(frame_lp + addr1)); HANDLE_OP_END(); } +#if WASM_ENABLE_SIMDE != 0 + HANDLE_OP(WASM_OP_SET_GLOBAL_V128) + { + global_idx = read_uint32(frame_ip); + bh_assert(global_idx < module->e->global_count); + global = globals + global_idx; + global_addr = get_global_addr(global_data, global); + addr1 = GET_OFFSET(); + PUT_V128_TO_ADDR((uint32 *)global_addr, + GET_V128_FROM_ADDR(frame_lp + addr1)); + HANDLE_OP_END(); + } +#endif /* memory load instructions */ HANDLE_OP(WASM_OP_I32_LOAD) @@ -4125,7 +4246,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of i32 */ + /* numeric instructions of i32 */ HANDLE_OP(WASM_OP_I32_CLZ) { DEF_OP_BIT_COUNT(uint32, I32, clz32); @@ -4295,7 +4416,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of i64 */ + /* numeric instructions of i64 */ HANDLE_OP(WASM_OP_I64_CLZ) { DEF_OP_BIT_COUNT(uint64, I64, clz64); @@ -4452,7 +4573,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of f32 */ + /* numeric instructions of f32 */ HANDLE_OP(WASM_OP_F32_ABS) { DEF_OP_MATH(float32, F32, fabsf); @@ -4557,7 +4678,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } - /* numberic instructions of f64 */ + /* numeric instructions of f64 */ HANDLE_OP(WASM_OP_F64_ABS) { DEF_OP_MATH(float64, F64, fabs); @@ -4855,6 +4976,28 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP_END(); } +#if WASM_ENABLE_SIMDE != 0 + HANDLE_OP(EXT_OP_COPY_STACK_TOP_V128) + { + addr1 = GET_OFFSET(); + addr2 = GET_OFFSET(); + + PUT_V128_TO_ADDR(frame_lp + addr2, + GET_V128_FROM_ADDR(frame_lp + addr1)); + +#if WASM_ENABLE_GC != 0 + /* Ignore constants because they are not reference */ + if (addr1 >= 0) { + if (*FRAME_REF(addr1)) { + CLEAR_FRAME_REF(addr1); + SET_FRAME_REF(addr2); + } + } +#endif + + HANDLE_OP_END(); + } +#endif HANDLE_OP(EXT_OP_COPY_STACK_VALUES) { @@ -5061,7 +5204,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, { uint32 dst, src, len; uint8 *mdst, *msrc; - uint64 dlen; len = POP_I32(); src = POP_I32(); @@ -5071,15 +5213,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, linear_mem_size = get_linear_mem_size(); #endif - dlen = linear_mem_size - dst; - #ifndef OS_ENABLE_HW_BOUND_CHECK CHECK_BULK_MEMORY_OVERFLOW(src, len, msrc); CHECK_BULK_MEMORY_OVERFLOW(dst, len, mdst); -#if WASM_ENABLE_SHARED_HEAP != 0 - if (app_addr_in_shared_heap((uint64)dst, len)) - dlen = (uint64)get_shared_heap_end_off() - dst + 1; -#endif #else /* else of OS_ENABLE_HW_BOUND_CHECK */ #if WASM_ENABLE_SHARED_HEAP != 0 if (app_addr_in_shared_heap((uint64)src, len)) @@ -5095,7 +5231,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, #if WASM_ENABLE_SHARED_HEAP != 0 if (app_addr_in_shared_heap((uint64)dst, len)) { shared_heap_addr_app_to_native((uint64)dst, mdst); - dlen = (uint64)get_shared_heap_end_off() - dst + 1; } else #endif @@ -5106,8 +5241,21 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, } #endif /* end of OS_ENABLE_HW_BOUND_CHECK */ - /* allowing the destination and source to overlap */ - bh_memmove_s(mdst, (uint32)dlen, msrc, len); + /* + * avoid unnecessary operations + * + * since dst and src both are valid indexes in the + * linear memory, mdst and msrc can't be NULL + * + * The spec. converts memory.copy into i32.load8 and + * i32.store8; the following are runtime-specific + * optimizations. + * + */ + if (len && mdst != msrc) { + /* allowing the destination and source to overlap */ + memmove(mdst, msrc, len); + } break; } case WASM_OP_MEMORY_FILL: @@ -5713,6 +5861,1572 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, #endif goto call_func_from_entry; } +#if WASM_ENABLE_SIMDE != 0 +#define SIMD_V128_TO_SIMDE_V128(s_v) \ + ({ \ + bh_assert(sizeof(V128) == sizeof(simde_v128_t)); \ + simde_v128_t se_v; \ + bh_memcpy_s(&se_v, sizeof(simde_v128_t), &(s_v), sizeof(V128)); \ + se_v; \ + }) + +#define SIMDE_V128_TO_SIMD_V128(sv, v) \ + do { \ + bh_assert(sizeof(V128) == sizeof(simde_v128_t)); \ + bh_memcpy_s(&(v), sizeof(V128), &(sv), sizeof(simde_v128_t)); \ + } while (0) + + HANDLE_OP(WASM_OP_SIMD_PREFIX) + { + GET_OPCODE(); + + switch (opcode) { + /* Memory */ + case SIMD_v128_load: + { + uint32 offset, addr; + offset = read_uint32(frame_ip); + addr = POP_I32(); + addr_ret = GET_OFFSET(); + CHECK_MEMORY_OVERFLOW(16); + PUT_V128_TO_ADDR(frame_lp + addr_ret, LOAD_V128(maddr)); + break; + } +#define SIMD_LOAD_OP(simde_func) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + addr = POP_I32(); \ + addr_ret = GET_OFFSET(); \ + CHECK_MEMORY_OVERFLOW(8); \ + \ + simde_v128_t simde_result = simde_func(maddr); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + \ + } while (0) + case SIMD_v128_load8x8_s: + { + SIMD_LOAD_OP(simde_wasm_i16x8_load8x8); + break; + } + case SIMD_v128_load8x8_u: + { + SIMD_LOAD_OP(simde_wasm_u16x8_load8x8); + break; + } + case SIMD_v128_load16x4_s: + { + SIMD_LOAD_OP(simde_wasm_i32x4_load16x4); + break; + } + case SIMD_v128_load16x4_u: + { + SIMD_LOAD_OP(simde_wasm_u32x4_load16x4); + break; + } + case SIMD_v128_load32x2_s: + { + SIMD_LOAD_OP(simde_wasm_i64x2_load32x2); + break; + } + case SIMD_v128_load32x2_u: + { + SIMD_LOAD_OP(simde_wasm_u64x2_load32x2); + break; + } +#define SIMD_LOAD_SPLAT_OP(simde_func, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + addr = POP_I32(); \ + addr_ret = GET_OFFSET(); \ + CHECK_MEMORY_OVERFLOW(width / 8); \ + \ + simde_v128_t simde_result = simde_func(maddr); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + + case SIMD_v128_load8_splat: + { + SIMD_LOAD_SPLAT_OP(simde_wasm_v128_load8_splat, 8); + break; + } + case SIMD_v128_load16_splat: + { + SIMD_LOAD_SPLAT_OP(simde_wasm_v128_load16_splat, 16); + break; + } + case SIMD_v128_load32_splat: + { + SIMD_LOAD_SPLAT_OP(simde_wasm_v128_load32_splat, 32); + break; + } + case SIMD_v128_load64_splat: + { + SIMD_LOAD_SPLAT_OP(simde_wasm_v128_load64_splat, 64); + break; + } + case SIMD_v128_store: + { + uint32 offset, addr; + offset = read_uint32(frame_ip); + V128 data = POP_V128(); + addr = POP_I32(); + + CHECK_MEMORY_OVERFLOW(16); + STORE_V128(maddr, data); + break; + } + + /* Basic */ + case SIMD_v128_const: + { + uint8 *orig_ip = frame_ip; + + frame_ip += sizeof(V128); + addr_ret = GET_OFFSET(); + + PUT_V128_TO_ADDR(frame_lp + addr_ret, *(V128 *)orig_ip); + break; + } + /* TODO: Add a faster SIMD implementation */ + case SIMD_v8x16_shuffle: + { + V128 indices; + bh_memcpy_s(&indices, sizeof(V128), frame_ip, + sizeof(V128)); + frame_ip += sizeof(V128); + + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + addr_ret = GET_OFFSET(); + + V128 result; + for (int i = 0; i < 16; i++) { + uint8_t index = indices.i8x16[i]; + if (index < 16) { + result.i8x16[i] = v1.i8x16[index]; + } + else { + result.i8x16[i] = v2.i8x16[index - 16]; + } + } + + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); + break; + } + case SIMD_v8x16_swizzle: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + addr_ret = GET_OFFSET(); + simde_v128_t simde_result = simde_wasm_i8x16_swizzle( + SIMD_V128_TO_SIMDE_V128(v1), + SIMD_V128_TO_SIMDE_V128(v2)); + + V128 result; + SIMDE_V128_TO_SIMD_V128(simde_result, result); + + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); + break; + } + + /* Splat */ +#define SIMD_SPLAT_OP(simde_func, pop_func, val_type) \ + do { \ + val_type v = pop_func(); \ + addr_ret = GET_OFFSET(); \ + \ + simde_v128_t simde_result = simde_func(v); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + +#define SIMD_SPLAT_OP_I32(simde_func) SIMD_SPLAT_OP(simde_func, POP_I32, uint32) +#define SIMD_SPLAT_OP_I64(simde_func) SIMD_SPLAT_OP(simde_func, POP_I64, uint64) +#define SIMD_SPLAT_OP_F32(simde_func) \ + SIMD_SPLAT_OP(simde_func, POP_F32, float32) +#define SIMD_SPLAT_OP_F64(simde_func) \ + SIMD_SPLAT_OP(simde_func, POP_F64, float64) + + case SIMD_i8x16_splat: + { + val = POP_I32(); + addr_ret = GET_OFFSET(); + + simde_v128_t simde_result = simde_wasm_i8x16_splat(val); + + V128 result; + SIMDE_V128_TO_SIMD_V128(simde_result, result); + + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); + break; + } + case SIMD_i16x8_splat: + { + SIMD_SPLAT_OP_I32(simde_wasm_i16x8_splat); + break; + } + case SIMD_i32x4_splat: + { + SIMD_SPLAT_OP_I32(simde_wasm_i32x4_splat); + break; + } + case SIMD_i64x2_splat: + { + SIMD_SPLAT_OP_I64(simde_wasm_i64x2_splat); + break; + } + case SIMD_f32x4_splat: + { + SIMD_SPLAT_OP_F32(simde_wasm_f32x4_splat); + break; + } + case SIMD_f64x2_splat: + { + SIMD_SPLAT_OP_F64(simde_wasm_f64x2_splat); + break; + } +#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 +#define SIMD_LANE_HANDLE_UNALIGNED_ACCESS() +#else +#define SIMD_LANE_HANDLE_UNALIGNED_ACCESS() (void)*frame_ip++ +#endif /* WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 */ + +#define SIMD_EXTRACT_LANE_OP(register, return_type, push_elem) \ + do { \ + uint8 lane = *frame_ip++; \ + SIMD_LANE_HANDLE_UNALIGNED_ACCESS(); \ + V128 v = POP_V128(); \ + push_elem((return_type)(v.register[lane])); \ + } while (0) +#define SIMD_REPLACE_LANE_OP(register, return_type, pop_elem) \ + do { \ + uint8 lane = *frame_ip++; \ + SIMD_LANE_HANDLE_UNALIGNED_ACCESS(); \ + return_type replacement = pop_elem(); \ + V128 v = POP_V128(); \ + v.register[lane] = replacement; \ + addr_ret = GET_OFFSET(); \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, v); \ + } while (0) + case SIMD_i8x16_extract_lane_s: + { + SIMD_EXTRACT_LANE_OP(i8x16, int8, PUSH_I32); + break; + } + case SIMD_i8x16_extract_lane_u: + { + SIMD_EXTRACT_LANE_OP(i8x16, uint8, PUSH_I32); + break; + } + case SIMD_i8x16_replace_lane: + { + SIMD_REPLACE_LANE_OP(i8x16, int8, POP_I32); + break; + } + case SIMD_i16x8_extract_lane_s: + { + SIMD_EXTRACT_LANE_OP(i16x8, int16, PUSH_I32); + break; + } + case SIMD_i16x8_extract_lane_u: + { + SIMD_EXTRACT_LANE_OP(i16x8, uint16, PUSH_I32); + break; + } + case SIMD_i16x8_replace_lane: + { + SIMD_REPLACE_LANE_OP(i16x8, int16, POP_I32); + break; + } + case SIMD_i32x4_extract_lane: + { + SIMD_EXTRACT_LANE_OP(i32x4, int32, PUSH_I32); + break; + } + case SIMD_i32x4_replace_lane: + { + SIMD_REPLACE_LANE_OP(i32x4, int32, POP_I32); + break; + } + case SIMD_i64x2_extract_lane: + { + SIMD_EXTRACT_LANE_OP(i64x2, int64, PUSH_I64); + break; + } + case SIMD_i64x2_replace_lane: + { + SIMD_REPLACE_LANE_OP(i64x2, int64, POP_I64); + break; + } + case SIMD_f32x4_extract_lane: + { + SIMD_EXTRACT_LANE_OP(f32x4, float32, PUSH_F32); + break; + } + case SIMD_f32x4_replace_lane: + { + SIMD_REPLACE_LANE_OP(f32x4, float32, POP_F32); + break; + } + case SIMD_f64x2_extract_lane: + { + SIMD_EXTRACT_LANE_OP(f64x2, float64, PUSH_F64); + break; + } + case SIMD_f64x2_replace_lane: + { + SIMD_REPLACE_LANE_OP(f64x2, float64, POP_F64); + break; + } + +#define SIMD_DOUBLE_OP(simde_func) \ + do { \ + V128 v2 = POP_V128(); \ + V128 v1 = POP_V128(); \ + addr_ret = GET_OFFSET(); \ + \ + simde_v128_t simde_result = simde_func(SIMD_V128_TO_SIMDE_V128(v1), \ + SIMD_V128_TO_SIMDE_V128(v2)); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + + /* i8x16 comparison operations */ + case SIMD_i8x16_eq: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + addr_ret = GET_OFFSET(); + + simde_v128_t simde_result = + simde_wasm_i8x16_eq(SIMD_V128_TO_SIMDE_V128(v1), + SIMD_V128_TO_SIMDE_V128(v2)); + + V128 result; + SIMDE_V128_TO_SIMD_V128(simde_result, result); + + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); + break; + } + case SIMD_i8x16_ne: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_ne); + break; + } + case SIMD_i8x16_lt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_lt); + break; + } + case SIMD_i8x16_lt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_lt); + break; + } + case SIMD_i8x16_gt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_gt); + break; + } + case SIMD_i8x16_gt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_gt); + break; + } + case SIMD_i8x16_le_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_le); + break; + } + case SIMD_i8x16_le_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_le); + break; + } + case SIMD_i8x16_ge_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_ge); + break; + } + case SIMD_i8x16_ge_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_ge); + break; + } + + /* i16x8 comparison operations */ + case SIMD_i16x8_eq: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_eq); + break; + } + case SIMD_i16x8_ne: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_ne); + break; + } + case SIMD_i16x8_lt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_lt); + break; + } + case SIMD_i16x8_lt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_lt); + break; + } + case SIMD_i16x8_gt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_gt); + break; + } + case SIMD_i16x8_gt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_gt); + break; + } + case SIMD_i16x8_le_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_le); + break; + } + case SIMD_i16x8_le_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_le); + break; + } + case SIMD_i16x8_ge_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_ge); + break; + } + case SIMD_i16x8_ge_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_ge); + break; + } + + /* i32x4 comparison operations */ + case SIMD_i32x4_eq: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_eq); + break; + } + case SIMD_i32x4_ne: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_ne); + break; + } + case SIMD_i32x4_lt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_lt); + break; + } + case SIMD_i32x4_lt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_lt); + break; + } + case SIMD_i32x4_gt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_gt); + break; + } + case SIMD_i32x4_gt_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_gt); + break; + } + case SIMD_i32x4_le_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_le); + break; + } + case SIMD_i32x4_le_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_le); + break; + } + case SIMD_i32x4_ge_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_ge); + break; + } + case SIMD_i32x4_ge_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_ge); + break; + } + + /* f32x4 comparison operations */ + case SIMD_f32x4_eq: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_eq); + break; + } + case SIMD_f32x4_ne: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_ne); + break; + } + case SIMD_f32x4_lt: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_lt); + break; + } + case SIMD_f32x4_gt: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_gt); + break; + } + case SIMD_f32x4_le: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_le); + break; + } + case SIMD_f32x4_ge: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_ge); + break; + } + + /* f64x2 comparison operations */ + case SIMD_f64x2_eq: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_eq); + break; + } + case SIMD_f64x2_ne: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_ne); + break; + } + case SIMD_f64x2_lt: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_lt); + break; + } + case SIMD_f64x2_gt: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_gt); + break; + } + case SIMD_f64x2_le: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_le); + break; + } + case SIMD_f64x2_ge: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_ge); + break; + } + + /* v128 bitwise operations */ +#define SIMD_V128_BITWISE_OP_COMMON(result_expr_0, result_expr_1) \ + do { \ + V128 result; \ + result.i64x2[0] = (result_expr_0); \ + result.i64x2[1] = (result_expr_1); \ + addr_ret = GET_OFFSET(); \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + + case SIMD_v128_not: + { + V128 value = POP_V128(); + SIMD_V128_BITWISE_OP_COMMON(~value.i64x2[0], + ~value.i64x2[1]); + break; + } + case SIMD_v128_and: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + SIMD_V128_BITWISE_OP_COMMON(v1.i64x2[0] & v2.i64x2[0], + v1.i64x2[1] & v2.i64x2[1]); + break; + } + case SIMD_v128_andnot: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + SIMD_V128_BITWISE_OP_COMMON( + v1.i64x2[0] & (~v2.i64x2[0]), + v1.i64x2[1] & (~v2.i64x2[1])); + break; + } + case SIMD_v128_or: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + SIMD_V128_BITWISE_OP_COMMON(v1.i64x2[0] | v2.i64x2[0], + v1.i64x2[1] | v2.i64x2[1]); + break; + } + case SIMD_v128_xor: + { + V128 v2 = POP_V128(); + V128 v1 = POP_V128(); + SIMD_V128_BITWISE_OP_COMMON(v1.i64x2[0] ^ v2.i64x2[0], + v1.i64x2[1] ^ v2.i64x2[1]); + break; + } + case SIMD_v128_bitselect: + { + V128 v1 = POP_V128(); + V128 v2 = POP_V128(); + V128 v3 = POP_V128(); + addr_ret = GET_OFFSET(); + + simde_v128_t simde_result = simde_wasm_v128_bitselect( + SIMD_V128_TO_SIMDE_V128(v3), + SIMD_V128_TO_SIMDE_V128(v2), + SIMD_V128_TO_SIMDE_V128(v1)); + + V128 result; + SIMDE_V128_TO_SIMD_V128(simde_result, result); + + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); + break; + } + case SIMD_v128_any_true: + { + V128 value = POP_V128(); + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = + value.i64x2[0] != 0 || value.i64x2[1] != 0; + break; + } + +#define SIMD_LOAD_LANE_COMMON(vec, register, lane, width) \ + do { \ + addr_ret = GET_OFFSET(); \ + CHECK_MEMORY_OVERFLOW(width / 8); \ + if (width == 64) { \ + vec.register[lane] = GET_I64_FROM_ADDR((uint32 *)maddr); \ + } \ + else { \ + vec.register[lane] = *(uint##width *)(maddr); \ + } \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, vec); \ + } while (0) + +#define SIMD_LOAD_LANE_OP(register, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + V128 vec = POP_V128(); \ + addr = POP_I32(); \ + int lane = *frame_ip++; \ + SIMD_LANE_HANDLE_UNALIGNED_ACCESS(); \ + SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ + } while (0) + + case SIMD_v128_load8_lane: + { + SIMD_LOAD_LANE_OP(i8x16, 8); + break; + } + case SIMD_v128_load16_lane: + { + SIMD_LOAD_LANE_OP(i16x8, 16); + break; + } + case SIMD_v128_load32_lane: + { + SIMD_LOAD_LANE_OP(i32x4, 32); + break; + } + case SIMD_v128_load64_lane: + { + SIMD_LOAD_LANE_OP(i64x2, 64); + break; + } +#define SIMD_STORE_LANE_OP(register, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + V128 vec = POP_V128(); \ + addr = POP_I32(); \ + int lane = *frame_ip++; \ + SIMD_LANE_HANDLE_UNALIGNED_ACCESS(); \ + CHECK_MEMORY_OVERFLOW(width / 8); \ + if (width == 64) { \ + STORE_I64(maddr, vec.register[lane]); \ + } \ + else { \ + *(uint##width *)(maddr) = vec.register[lane]; \ + } \ + } while (0) + + case SIMD_v128_store8_lane: + { + SIMD_STORE_LANE_OP(i8x16, 8); + break; + } + + case SIMD_v128_store16_lane: + { + SIMD_STORE_LANE_OP(i16x8, 16); + break; + } + + case SIMD_v128_store32_lane: + { + SIMD_STORE_LANE_OP(i32x4, 32); + break; + } + + case SIMD_v128_store64_lane: + { + SIMD_STORE_LANE_OP(i64x2, 64); + break; + } +#define SIMD_LOAD_ZERO_OP(register, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + addr = POP_I32(); \ + int32 lane = 0; \ + V128 vec = { 0 }; \ + SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ + } while (0) + + case SIMD_v128_load32_zero: + { + SIMD_LOAD_ZERO_OP(i32x4, 32); + break; + } + case SIMD_v128_load64_zero: + { + SIMD_LOAD_ZERO_OP(i64x2, 64); + break; + } + +#define SIMD_SINGLE_OP(simde_func) \ + do { \ + V128 v1 = POP_V128(); \ + addr_ret = GET_OFFSET(); \ + \ + simde_v128_t simde_result = simde_func(SIMD_V128_TO_SIMDE_V128(v1)); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + + /* Float conversion */ + case SIMD_f32x4_demote_f64x2_zero: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_demote_f64x2_zero); + break; + } + case SIMD_f64x2_promote_low_f32x4_zero: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_promote_low_f32x4); + break; + } + + /* i8x16 operations */ + case SIMD_i8x16_abs: + { + SIMD_SINGLE_OP(simde_wasm_i8x16_abs); + break; + } + case SIMD_i8x16_neg: + { + SIMD_SINGLE_OP(simde_wasm_i8x16_neg); + break; + } + case SIMD_i8x16_popcnt: + { + SIMD_SINGLE_OP(simde_wasm_i8x16_popcnt); + break; + } + case SIMD_i8x16_all_true: + { + V128 v1 = POP_V128(); + + bool result = simde_wasm_i8x16_all_true( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + + case SIMD_i8x16_bitmask: + { + V128 v1 = POP_V128(); + + uint32_t result = simde_wasm_i8x16_bitmask( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i8x16_narrow_i16x8_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_narrow_i16x8); + break; + } + case SIMD_i8x16_narrow_i16x8_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_narrow_i16x8); + break; + } + case SIMD_f32x4_ceil: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_ceil); + break; + } + case SIMD_f32x4_floor: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_floor); + break; + } + case SIMD_f32x4_trunc: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_trunc); + break; + } + case SIMD_f32x4_nearest: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_nearest); + break; + } +#define SIMD_LANE_SHIFT(simde_func) \ + do { \ + int32 c = POP_I32(); \ + V128 v1 = POP_V128(); \ + addr_ret = GET_OFFSET(); \ + \ + simde_v128_t simde_result = \ + simde_func(SIMD_V128_TO_SIMDE_V128(v1), c); \ + \ + V128 result; \ + SIMDE_V128_TO_SIMD_V128(simde_result, result); \ + \ + PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \ + } while (0) + case SIMD_i8x16_shl: + { + SIMD_LANE_SHIFT(simde_wasm_i8x16_shl); + break; + } + case SIMD_i8x16_shr_s: + { + SIMD_LANE_SHIFT(simde_wasm_i8x16_shr); + break; + } + case SIMD_i8x16_shr_u: + { + SIMD_LANE_SHIFT(simde_wasm_u8x16_shr); + break; + } + case SIMD_i8x16_add: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_add); + break; + } + case SIMD_i8x16_add_sat_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_add_sat); + break; + } + case SIMD_i8x16_add_sat_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_add_sat); + break; + } + case SIMD_i8x16_sub: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_sub); + break; + } + case SIMD_i8x16_sub_sat_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_sub_sat); + break; + } + case SIMD_i8x16_sub_sat_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_sub_sat); + break; + } + case SIMD_f64x2_ceil: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_ceil); + break; + } + case SIMD_f64x2_floor: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_floor); + break; + } + case SIMD_i8x16_min_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_min); + break; + } + case SIMD_i8x16_min_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_min); + break; + } + case SIMD_i8x16_max_s: + { + SIMD_DOUBLE_OP(simde_wasm_i8x16_max); + break; + } + case SIMD_i8x16_max_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_max); + break; + } + case SIMD_f64x2_trunc: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_trunc); + break; + } + case SIMD_i8x16_avgr_u: + { + SIMD_DOUBLE_OP(simde_wasm_u8x16_avgr); + break; + } + case SIMD_i16x8_extadd_pairwise_i8x16_s: + { + SIMD_SINGLE_OP(simde_wasm_i16x8_extadd_pairwise_i8x16); + break; + } + case SIMD_i16x8_extadd_pairwise_i8x16_u: + { + SIMD_SINGLE_OP(simde_wasm_u16x8_extadd_pairwise_u8x16); + break; + } + case SIMD_i32x4_extadd_pairwise_i16x8_s: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_extadd_pairwise_i16x8); + break; + } + case SIMD_i32x4_extadd_pairwise_i16x8_u: + { + SIMD_SINGLE_OP(simde_wasm_u32x4_extadd_pairwise_u16x8); + break; + } + + /* i16x8 operations */ + case SIMD_i16x8_abs: + { + SIMD_SINGLE_OP(simde_wasm_i16x8_abs); + break; + } + case SIMD_i16x8_neg: + { + SIMD_SINGLE_OP(simde_wasm_i16x8_neg); + break; + } + case SIMD_i16x8_q15mulr_sat_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_q15mulr_sat); + break; + } + case SIMD_i16x8_all_true: + { + V128 v1 = POP_V128(); + + bool result = simde_wasm_i16x8_all_true( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i16x8_bitmask: + { + V128 v1 = POP_V128(); + + uint32_t result = simde_wasm_i16x8_bitmask( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i16x8_narrow_i32x4_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_narrow_i32x4); + break; + } + case SIMD_i16x8_narrow_i32x4_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_narrow_i32x4); + break; + } + case SIMD_i16x8_extend_low_i8x16_s: + { + SIMD_SINGLE_OP(simde_wasm_i16x8_extend_low_i8x16); + break; + } + case SIMD_i16x8_extend_high_i8x16_s: + { + SIMD_SINGLE_OP(simde_wasm_i16x8_extend_high_i8x16); + break; + } + case SIMD_i16x8_extend_low_i8x16_u: + { + SIMD_SINGLE_OP(simde_wasm_u16x8_extend_low_u8x16); + break; + } + case SIMD_i16x8_extend_high_i8x16_u: + { + SIMD_SINGLE_OP(simde_wasm_u16x8_extend_high_u8x16); + break; + } + case SIMD_i16x8_shl: + { + SIMD_LANE_SHIFT(simde_wasm_i16x8_shl); + break; + } + case SIMD_i16x8_shr_s: + { + SIMD_LANE_SHIFT(simde_wasm_i16x8_shr); + break; + } + case SIMD_i16x8_shr_u: + { + SIMD_LANE_SHIFT(simde_wasm_u16x8_shr); + break; + } + case SIMD_i16x8_add: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_add); + break; + } + case SIMD_i16x8_add_sat_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_add_sat); + break; + } + case SIMD_i16x8_add_sat_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_add_sat); + break; + } + case SIMD_i16x8_sub: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_sub); + break; + } + case SIMD_i16x8_sub_sat_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_sub_sat); + break; + } + case SIMD_i16x8_sub_sat_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_sub_sat); + break; + } + case SIMD_f64x2_nearest: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_nearest); + break; + } + case SIMD_i16x8_mul: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_mul); + break; + } + case SIMD_i16x8_min_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_min); + break; + } + case SIMD_i16x8_min_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_min); + break; + } + case SIMD_i16x8_max_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_max); + break; + } + case SIMD_i16x8_max_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_max); + break; + } + case SIMD_i16x8_avgr_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_avgr); + break; + } + case SIMD_i16x8_extmul_low_i8x16_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_extmul_low_i8x16); + break; + } + case SIMD_i16x8_extmul_high_i8x16_s: + { + SIMD_DOUBLE_OP(simde_wasm_i16x8_extmul_high_i8x16); + break; + } + case SIMD_i16x8_extmul_low_i8x16_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_extmul_low_u8x16); + break; + } + case SIMD_i16x8_extmul_high_i8x16_u: + { + SIMD_DOUBLE_OP(simde_wasm_u16x8_extmul_high_u8x16); + break; + } + + /* i32x4 operations */ + case SIMD_i32x4_abs: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_abs); + break; + } + case SIMD_i32x4_neg: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_neg); + break; + } + case SIMD_i32x4_all_true: + { + V128 v1 = POP_V128(); + + bool result = simde_wasm_i32x4_all_true( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i32x4_bitmask: + { + V128 v1 = POP_V128(); + + uint32_t result = simde_wasm_i32x4_bitmask( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i32x4_extend_low_i16x8_s: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_extend_low_i16x8); + break; + } + case SIMD_i32x4_extend_high_i16x8_s: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_extend_high_i16x8); + break; + } + case SIMD_i32x4_extend_low_i16x8_u: + { + SIMD_SINGLE_OP(simde_wasm_u32x4_extend_low_u16x8); + break; + } + case SIMD_i32x4_extend_high_i16x8_u: + { + SIMD_SINGLE_OP(simde_wasm_u32x4_extend_high_u16x8); + break; + } + case SIMD_i32x4_shl: + { + SIMD_LANE_SHIFT(simde_wasm_i32x4_shl); + break; + } + case SIMD_i32x4_shr_s: + { + SIMD_LANE_SHIFT(simde_wasm_i32x4_shr); + break; + } + case SIMD_i32x4_shr_u: + { + SIMD_LANE_SHIFT(simde_wasm_u32x4_shr); + break; + } + case SIMD_i32x4_add: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_add); + break; + } + case SIMD_i32x4_sub: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_sub); + break; + } + case SIMD_i32x4_mul: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_mul); + break; + } + case SIMD_i32x4_min_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_min); + break; + } + case SIMD_i32x4_min_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_min); + break; + } + case SIMD_i32x4_max_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_max); + break; + } + case SIMD_i32x4_max_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_max); + break; + } + case SIMD_i32x4_dot_i16x8_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_dot_i16x8); + break; + } + case SIMD_i32x4_extmul_low_i16x8_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_extmul_low_i16x8); + break; + } + case SIMD_i32x4_extmul_high_i16x8_s: + { + SIMD_DOUBLE_OP(simde_wasm_i32x4_extmul_high_i16x8); + break; + } + case SIMD_i32x4_extmul_low_i16x8_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_extmul_low_u16x8); + break; + } + case SIMD_i32x4_extmul_high_i16x8_u: + { + SIMD_DOUBLE_OP(simde_wasm_u32x4_extmul_high_u16x8); + break; + } + + /* i64x2 operations */ + case SIMD_i64x2_abs: + { + SIMD_SINGLE_OP(simde_wasm_i64x2_abs); + break; + } + case SIMD_i64x2_neg: + { + SIMD_SINGLE_OP(simde_wasm_i64x2_neg); + break; + } + case SIMD_i64x2_all_true: + { + V128 v1 = POP_V128(); + + bool result = simde_wasm_i64x2_all_true( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i64x2_bitmask: + { + V128 v1 = POP_V128(); + + uint32_t result = simde_wasm_i64x2_bitmask( + SIMD_V128_TO_SIMDE_V128(v1)); + + addr_ret = GET_OFFSET(); + frame_lp[addr_ret] = result; + break; + } + case SIMD_i64x2_extend_low_i32x4_s: + { + SIMD_SINGLE_OP(simde_wasm_i64x2_extend_low_i32x4); + break; + } + case SIMD_i64x2_extend_high_i32x4_s: + { + SIMD_SINGLE_OP(simde_wasm_i64x2_extend_high_i32x4); + break; + } + case SIMD_i64x2_extend_low_i32x4_u: + { + SIMD_SINGLE_OP(simde_wasm_u64x2_extend_low_u32x4); + break; + } + case SIMD_i64x2_extend_high_i32x4_u: + { + SIMD_SINGLE_OP(simde_wasm_u64x2_extend_high_u32x4); + break; + } + case SIMD_i64x2_shl: + { + SIMD_LANE_SHIFT(simde_wasm_i64x2_shl); + break; + } + case SIMD_i64x2_shr_s: + { + SIMD_LANE_SHIFT(simde_wasm_i64x2_shr); + break; + } + case SIMD_i64x2_shr_u: + { + SIMD_LANE_SHIFT(simde_wasm_u64x2_shr); + break; + } + case SIMD_i64x2_add: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_add); + break; + } + case SIMD_i64x2_sub: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_sub); + break; + } + case SIMD_i64x2_mul: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_mul); + break; + } + case SIMD_i64x2_eq: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_eq); + break; + } + case SIMD_i64x2_ne: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_ne); + break; + } + case SIMD_i64x2_lt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_lt); + break; + } + case SIMD_i64x2_gt_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_gt); + break; + } + case SIMD_i64x2_le_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_le); + break; + } + case SIMD_i64x2_ge_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_ge); + break; + } + case SIMD_i64x2_extmul_low_i32x4_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_extmul_low_i32x4); + break; + } + case SIMD_i64x2_extmul_high_i32x4_s: + { + SIMD_DOUBLE_OP(simde_wasm_i64x2_extmul_high_i32x4); + break; + } + case SIMD_i64x2_extmul_low_i32x4_u: + { + SIMD_DOUBLE_OP(simde_wasm_u64x2_extmul_low_u32x4); + break; + } + case SIMD_i64x2_extmul_high_i32x4_u: + { + SIMD_DOUBLE_OP(simde_wasm_u64x2_extmul_high_u32x4); + break; + } + + /* f32x4 opertions */ + case SIMD_f32x4_abs: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_abs); + break; + } + case SIMD_f32x4_neg: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_neg); + break; + } + case SIMD_f32x4_sqrt: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_sqrt); + break; + } + case SIMD_f32x4_add: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_add); + break; + } + case SIMD_f32x4_sub: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_sub); + break; + } + case SIMD_f32x4_mul: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_mul); + break; + } + case SIMD_f32x4_div: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_div); + break; + } + case SIMD_f32x4_min: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_min); + break; + } + case SIMD_f32x4_max: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_max); + break; + } + case SIMD_f32x4_pmin: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_pmin); + break; + } + case SIMD_f32x4_pmax: + { + SIMD_DOUBLE_OP(simde_wasm_f32x4_pmax); + break; + } + + /* f64x2 operations */ + case SIMD_f64x2_abs: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_abs); + break; + } + case SIMD_f64x2_neg: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_neg); + break; + } + case SIMD_f64x2_sqrt: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_sqrt); + break; + } + case SIMD_f64x2_add: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_add); + break; + } + case SIMD_f64x2_sub: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_sub); + break; + } + case SIMD_f64x2_mul: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_mul); + break; + } + case SIMD_f64x2_div: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_div); + break; + } + case SIMD_f64x2_min: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_min); + break; + } + case SIMD_f64x2_max: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_max); + break; + } + case SIMD_f64x2_pmin: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_pmin); + break; + } + case SIMD_f64x2_pmax: + { + SIMD_DOUBLE_OP(simde_wasm_f64x2_pmax); + break; + } + + /* Conversion operations */ + case SIMD_i32x4_trunc_sat_f32x4_s: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_trunc_sat_f32x4); + break; + } + case SIMD_i32x4_trunc_sat_f32x4_u: + { + SIMD_SINGLE_OP(simde_wasm_u32x4_trunc_sat_f32x4); + break; + } + case SIMD_f32x4_convert_i32x4_s: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_convert_i32x4); + break; + } + case SIMD_f32x4_convert_i32x4_u: + { + SIMD_SINGLE_OP(simde_wasm_f32x4_convert_u32x4); + break; + } + case SIMD_i32x4_trunc_sat_f64x2_s_zero: + { + SIMD_SINGLE_OP(simde_wasm_i32x4_trunc_sat_f64x2_zero); + break; + } + case SIMD_i32x4_trunc_sat_f64x2_u_zero: + { + SIMD_SINGLE_OP(simde_wasm_u32x4_trunc_sat_f64x2_zero); + break; + } + case SIMD_f64x2_convert_low_i32x4_s: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_convert_low_i32x4); + break; + } + case SIMD_f64x2_convert_low_i32x4_u: + { + SIMD_SINGLE_OP(simde_wasm_f64x2_convert_low_u32x4); + break; + } + + default: + wasm_set_exception(module, "unsupported SIMD opcode"); + } + HANDLE_OP_END(); + } +#endif HANDLE_OP(WASM_OP_CALL) { @@ -5890,8 +7604,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, } for (i = 0; i < cur_func->param_count; i++) { - if (cur_func->param_types[i] == VALUE_TYPE_I64 - || cur_func->param_types[i] == VALUE_TYPE_F64) { + if (cur_func->param_types[i] == VALUE_TYPE_V128) { + PUT_V128_TO_ADDR( + outs_area->lp, + GET_OPERAND_V128(2 * (cur_func->param_count - i - 1))); + outs_area->lp += 4; + } + else if (cur_func->param_types[i] == VALUE_TYPE_I64 + || cur_func->param_types[i] == VALUE_TYPE_F64) { PUT_I64_TO_ADDR( outs_area->lp, GET_OPERAND(uint64, I64, diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 559d1c33e..6317badc5 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -246,7 +246,7 @@ type2str(uint8 type) "", /* reserved */ "arrayref", "structref", - "i32ref", + "i31ref", "eqref", "anyref", "externref", @@ -319,7 +319,8 @@ is_byte_a_type(uint8 type) } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) static V128 read_i8x16(uint8 *p_buf, char *error_buf, uint32 error_buf_size) { @@ -332,7 +333,8 @@ read_i8x16(uint8 *p_buf, char *error_buf, uint32 error_buf_size) return result; } -#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */ +#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \ + (WASM_ENABLE_FAST_INTERP != 0) */ #endif /* end of WASM_ENABLE_SIMD */ static void * @@ -377,7 +379,6 @@ memory_realloc(void *mem_old, uint32 size_old, uint32 size_new, char *error_buf, mem = mem_new; \ } while (0) -#if WASM_ENABLE_GC != 0 static bool check_type_index(const WASMModule *module, uint32 type_count, uint32 type_index, char *error_buf, uint32 error_buf_size) @@ -390,6 +391,7 @@ check_type_index(const WASMModule *module, uint32 type_count, uint32 type_index, return true; } +#if WASM_ENABLE_GC != 0 static bool check_array_type(const WASMModule *module, uint32 type_index, char *error_buf, uint32 error_buf_size) @@ -399,7 +401,7 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf, return false; } if (module->types[type_index]->type_flag != WASM_TYPE_ARRAY) { - set_error_buf(error_buf, error_buf_size, "unkown array type"); + set_error_buf(error_buf, error_buf_size, "unknown array type"); return false; } @@ -407,6 +409,29 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf, } #endif +/* + * if no GC is enabled, an valid type is always a function type. + * but if GC is enabled, we need to check the type flag + */ +static bool +check_function_type(const WASMModule *module, uint32 type_index, + char *error_buf, uint32 error_buf_size) +{ + if (!check_type_index(module, module->type_count, type_index, error_buf, + error_buf_size)) { + return false; + } + +#if WASM_ENABLE_GC != 0 + if (module->types[type_index]->type_flag != WASM_TYPE_FUNC) { + set_error_buf(error_buf, error_buf_size, "unknown function type"); + return false; + } +#endif + + return true; +} + static bool check_function_index(const WASMModule *module, uint32 function_index, char *error_buf, uint32 error_buf_size) @@ -513,14 +538,15 @@ destroy_init_expr_data_recursive(WASMModule *module, void *data) if (wasm_type->type_flag == WASM_TYPE_STRUCT) { WASMStructType *struct_type = (WASMStructType *)wasm_type; - WASMRefTypeMap *ref_type_map = struct_type->ref_type_maps; WASMRefType *ref_type; uint8 field_type; + uint16 ref_type_map_index = 0; for (i = 0; i < struct_init_values->count; i++) { field_type = struct_type->fields[i].field_type; if (wasm_is_type_multi_byte_type(field_type)) - ref_type = ref_type_map->ref_type; + ref_type = + struct_type->ref_type_maps[ref_type_map_index++].ref_type; else ref_type = NULL; if (wasm_reftype_is_subtype_of(field_type, ref_type, @@ -724,7 +750,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, goto fail; break; #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) /* v128.const */ case INIT_EXPR_TYPE_V128_CONST: { @@ -753,7 +780,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, #endif break; } -#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */ +#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \ + (WASM_ENABLE_FAST_INTERP != 0) */ #endif /* end of WASM_ENABLE_SIMD */ #if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0 @@ -815,7 +843,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, #else cur_value.gc_obj = NULL_REF; - if (!is_byte_a_type(type1)) { + if (!is_byte_a_type(type1) + || wasm_is_type_multi_byte_type(type1)) { p--; read_leb_uint32(p, p_end, type_idx); if (!check_type_index(module, module->type_count, type_idx, @@ -953,7 +982,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, if (struct_type->base_type.type_flag != WASM_TYPE_STRUCT) { set_error_buf(error_buf, error_buf_size, - "unkown struct type"); + "unknown struct type"); goto fail; } field_count = struct_type->field_count; @@ -1019,7 +1048,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, if (module->types[type_idx]->type_flag != WASM_TYPE_STRUCT) { set_error_buf(error_buf, error_buf_size, - "unkown struct type"); + "unknown struct type"); goto fail; } @@ -1058,7 +1087,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, if (array_type->base_type.type_flag != WASM_TYPE_ARRAY) { set_error_buf(error_buf, error_buf_size, - "unkown array type"); + "unknown array type"); goto fail; } @@ -1073,23 +1102,25 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end, } if (opcode1 == WASM_OP_ARRAY_NEW) { - WASMValue len_val; - - if (!(array_init_values = loader_malloc( - sizeof(WASMArrayNewInitValues), - error_buf, error_buf_size))) { - goto fail; - } - array_init_values->type_idx = type_idx; + WASMValue len_val = { 0 }; + uint64 size = 0; if (!pop_const_expr_stack( &const_expr_ctx, NULL, VALUE_TYPE_I32, NULL, NULL, &len_val, error_buf, error_buf_size)) { - destroy_init_expr_data_recursive( - module, array_init_values); goto fail; } + + size = + sizeof(WASMArrayNewInitValues) + + sizeof(WASMValue) * (uint64)len_val.i32; + if (!(array_init_values = loader_malloc( + size, error_buf, error_buf_size))) { + goto fail; + } + + array_init_values->type_idx = type_idx; array_init_values->length = len_val.i32; if (!pop_const_expr_stack( @@ -2471,8 +2502,8 @@ load_function_import(const uint8 **p_buf, const uint8 *buf_end, read_leb_uint32(p, p_end, declare_type_index); *p_buf = p; - if (declare_type_index >= parent_module->type_count) { - set_error_buf(error_buf, error_buf_size, "unknown type"); + if (!check_function_type(parent_module, declare_type_index, error_buf, + error_buf_size)) { return false; } @@ -2885,8 +2916,8 @@ load_tag_import(const uint8 **p_buf, const uint8 *buf_end, /* get type */ read_leb_uint32(p, p_end, declare_type_index); /* compare against module->types */ - if (declare_type_index >= parent_module->type_count) { - set_error_buf(error_buf, error_buf_size, "unknown tag type"); + if (!check_function_type(parent_module, declare_type_index, error_buf, + error_buf_size)) { goto fail; } @@ -3251,6 +3282,13 @@ load_import_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, CHECK_BUF(p, p_end, 1); /* 0x70 */ u8 = read_uint8(p); +#if WASM_ENABLE_GC != 0 + if (wasm_is_reftype_htref_nullable(u8)) { + int32 heap_type; + read_leb_int32(p, p_end, heap_type); + (void)heap_type; + } +#endif read_leb_uint32(p, p_end, flags); read_leb_uint32(p, p_end, u32); if (flags & 1) @@ -3298,7 +3336,7 @@ load_import_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, /* valtype */ CHECK_BUF(p, p_end, 1); global_type = read_uint8(p); - if (wasm_is_type_multi_byte_type(global_type)) { + if (wasm_is_reftype_htref_nullable(global_type)) { int32 heap_type; read_leb_int32(p, p_end, heap_type); (void)heap_type; @@ -3555,8 +3593,9 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, for (i = 0; i < func_count; i++) { /* Resolve function type */ read_leb_uint32(p, p_end, type_index); - if (type_index >= module->type_count) { - set_error_buf(error_buf, error_buf_size, "unknown type"); + + if (!check_function_type(module, type_index, error_buf, + error_buf_size)) { return false; } @@ -3825,11 +3864,11 @@ load_table_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, uint8 flag; bool has_init = false; - CHECK_BUF(buf, buf_end, 1); + CHECK_BUF(p, p_end, 1); flag = read_uint8(p); if (flag == TABLE_INIT_EXPR_FLAG) { - CHECK_BUF(buf, buf_end, 1); + CHECK_BUF(p, p_end, 1); flag = read_uint8(p); if (flag != 0x00) { @@ -4171,7 +4210,8 @@ load_export_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, return false; } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) /* TODO: check func type, if it has v128 param or result, report error */ #endif @@ -4961,8 +5001,8 @@ load_tag_section(const uint8 *buf, const uint8 *buf_end, const uint8 *buf_code, /* get type */ read_leb_uint32(p, p_end, tag_type); /* compare against module->types */ - if (tag_type >= module->type_count) { - set_error_buf(error_buf, error_buf_size, "unknown type"); + if (!check_function_type(module, tag_type, error_buf, + error_buf_size)) { return false; } @@ -5703,6 +5743,7 @@ orcjit_thread_callback(void *arg) static void orcjit_stop_compile_threads(WASMModule *module) { +#if WASM_ENABLE_LAZY_JIT != 0 uint32 i, thread_num = (uint32)(sizeof(module->orcjit_thread_args) / sizeof(OrcJitThreadArg)); @@ -5711,6 +5752,7 @@ orcjit_stop_compile_threads(WASMModule *module) if (module->orcjit_threads[i]) os_thread_join(module->orcjit_threads[i], NULL); } +#endif } static bool @@ -6368,6 +6410,18 @@ create_module(char *name, char *error_buf, uint32 error_buf_size) } #endif +#if WASM_ENABLE_LIBC_WASI != 0 +#if WASM_ENABLE_UVWASI == 0 + module->wasi_args.stdio[0] = os_invalid_raw_handle(); + module->wasi_args.stdio[1] = os_invalid_raw_handle(); + module->wasi_args.stdio[2] = os_invalid_raw_handle(); +#else + module->wasi_args.stdio[0] = os_get_invalid_handle(); + module->wasi_args.stdio[1] = os_get_invalid_handle(); + module->wasi_args.stdio[2] = os_get_invalid_handle(); +#endif /* WASM_ENABLE_UVWASI == 0 */ +#endif /* WASM_ENABLE_LIBC_WASI != 0 */ + (void)ret; return module; @@ -7287,6 +7341,9 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache, case WASM_OP_SELECT: case WASM_OP_DROP_64: case WASM_OP_SELECT_64: +#if WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0 + case WASM_OP_SELECT_128: +#endif break; #if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0 @@ -7344,6 +7401,10 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache, case WASM_OP_SET_GLOBAL: case WASM_OP_GET_GLOBAL_64: case WASM_OP_SET_GLOBAL_64: +#if WASM_ENABLE_SIMDE != 0 + case WASM_OP_GET_GLOBAL_V128: + case WASM_OP_SET_GLOBAL_V128: +#endif case WASM_OP_SET_GLOBAL_AUX_STACK: skip_leb_uint32(p, p_end); /* local index */ break; @@ -7720,7 +7781,8 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache, } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) case WASM_OP_SIMD_PREFIX: { uint32 opcode1; @@ -7813,7 +7875,8 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache, } break; } -#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */ +#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \ + (WASM_ENABLE_FAST_INTERP != 0) */ #endif /* end of WASM_ENABLE_SIMD */ #if WASM_ENABLE_SHARED_MEMORY != 0 @@ -7988,6 +8051,10 @@ typedef struct WASMLoaderContext { int32 *i32_consts; uint32 i32_const_max_num; uint32 i32_const_num; + /* const buffer for V128 */ + V128 *v128_consts; + uint32 v128_const_max_num; + uint32 v128_const_num; /* processed code */ uint8 *p_code_compiled; @@ -8221,6 +8288,8 @@ wasm_loader_ctx_destroy(WASMLoaderContext *ctx) wasm_runtime_free(ctx->i64_consts); if (ctx->i32_consts) wasm_runtime_free(ctx->i32_consts); + if (ctx->v128_consts) + wasm_runtime_free(ctx->v128_consts); #endif wasm_runtime_free(ctx); } @@ -8278,6 +8347,11 @@ wasm_loader_ctx_init(WASMFunction *func, char *error_buf, uint32 error_buf_size) loader_malloc(sizeof(int32) * loader_ctx->i32_const_max_num, error_buf, error_buf_size))) goto fail; + loader_ctx->v128_const_max_num = 8; + if (!(loader_ctx->v128_consts = + loader_malloc(sizeof(V128) * loader_ctx->v128_const_max_num, + error_buf, error_buf_size))) + goto fail; if (func->param_cell_num >= (int32)INT16_MAX - func->local_cell_num) { set_error_buf(error_buf, error_buf_size, @@ -9136,6 +9210,7 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode, bool *preserved, char *error_buf, uint32 error_buf_size) { + uint32 i = 0; int16 preserved_offset = (int16)local_index; @@ -9159,11 +9234,27 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode, loader_ctx->preserved_local_offset++; emit_label(EXT_OP_COPY_STACK_TOP); } +#if WASM_ENABLE_SIMDE != 0 + else if (local_type == VALUE_TYPE_V128) { + if (loader_ctx->p_code_compiled) + loader_ctx->preserved_local_offset += 4; + emit_label(EXT_OP_COPY_STACK_TOP_V128); + } +#endif else { if (loader_ctx->p_code_compiled) loader_ctx->preserved_local_offset += 2; emit_label(EXT_OP_COPY_STACK_TOP_I64); } + + /* overflow */ + if (preserved_offset > loader_ctx->preserved_local_offset) { + set_error_buf_v(error_buf, error_buf_size, + "too much local cells 0x%x", + loader_ctx->preserved_local_offset); + return false; + } + emit_operand(loader_ctx, local_index); emit_operand(loader_ctx, preserved_offset); emit_label(opcode); @@ -9171,10 +9262,15 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode, loader_ctx->frame_offset_bottom[i] = preserved_offset; } - if (is_32bit_type(cur_type)) + if (cur_type == VALUE_TYPE_V128) { + i += 4; + } + else if (is_32bit_type(cur_type)) { i++; - else + } + else { i += 2; + } } (void)error_buf; @@ -9203,7 +9299,10 @@ preserve_local_for_block(WASMLoaderContext *loader_ctx, uint8 opcode, return false; } - if (is_32bit_type(cur_type)) { + if (cur_type == VALUE_TYPE_V128) { + i += 4; + } + else if (is_32bit_type(cur_type)) { i++; } else { @@ -9542,6 +9641,15 @@ cmp_i32_const(const void *p_i32_const1, const void *p_i32_const2) return (i32_const1 < i32_const2) ? -1 : (i32_const1 > i32_const2) ? 1 : 0; } +static int +cmp_v128_const(const void *p_v128_const1, const void *p_v128_const2) +{ + V128 v128_const1 = *(V128 *)p_v128_const1; + V128 v128_const2 = *(V128 *)p_v128_const2; + + return memcmp(&v128_const1, &v128_const2, sizeof(V128)); +} + static bool wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value, int16 *offset, char *error_buf, @@ -9575,6 +9683,32 @@ wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value, } ctx->i64_consts[ctx->i64_const_num++] = *(int64 *)value; } + else if (type == VALUE_TYPE_V128) { + /* No slot left, emit const instead */ + if (ctx->v128_const_num * 4 > INT16_MAX - 2) { + *offset = 0; + return true; + } + + /* Traverse the list if the const num is small */ + if (ctx->v128_const_num < 10) { + for (uint32 i = 0; i < ctx->v128_const_num; i++) { + if (memcmp(&ctx->v128_consts[i], value, sizeof(V128)) + == 0) { + *offset = -1; + return true; + } + } + } + + if (ctx->v128_const_num >= ctx->v128_const_max_num) { + MEM_REALLOC(ctx->v128_consts, + sizeof(V128) * ctx->v128_const_max_num, + sizeof(V128) * (ctx->v128_const_max_num * 2)); + ctx->v128_const_max_num *= 2; + } + ctx->v128_consts[ctx->v128_const_num++] = *(V128 *)value; + } else { /* Treat i32 and f32 as the same by reading i32 value from the raw bytes */ @@ -9617,9 +9751,25 @@ wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value, *offset = 0; return true; } - *offset = -(uint32)(ctx->i64_const_num * 2 + ctx->i32_const_num) - + (uint32)(i64_const - ctx->i64_consts) * 2; + + /* constant index is encoded as negative value */ + *offset = -(int32)(ctx->i64_const_num * 2 + ctx->i32_const_num) + + (int32)(i64_const - ctx->i64_consts) * 2; } + else if (type == VALUE_TYPE_V128) { + V128 key = *(V128 *)value, *v128_const; + v128_const = bsearch(&key, ctx->v128_consts, ctx->v128_const_num, + sizeof(V128), cmp_v128_const); + if (!v128_const) { /* not found, emit const instead */ + *offset = 0; + return true; + } + + /* constant index is encoded as negative value */ + *offset = -(int32)(ctx->v128_const_num) + + (int32)(v128_const - ctx->v128_consts); + } + else { int32 key = *(int32 *)value, *i32_const; i32_const = bsearch(&key, ctx->i32_consts, ctx->i32_const_num, @@ -9628,8 +9778,10 @@ wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value, *offset = 0; return true; } - *offset = -(uint32)(ctx->i32_const_num) - + (uint32)(i32_const - ctx->i32_consts); + + /* constant index is encoded as negative value */ + *offset = -(int32)(ctx->i32_const_num) + + (int32)(i32_const - ctx->i32_consts); } return true; @@ -9816,17 +9968,23 @@ reserve_block_ret(WASMLoaderContext *loader_ctx, uint8 opcode, block_type, &return_types, &reftype_maps, &reftype_map_count); #endif - /* If there is only one return value, use EXT_OP_COPY_STACK_TOP/_I64 instead - * of EXT_OP_COPY_STACK_VALUES for interpreter performance. */ + /* If there is only one return value, use EXT_OP_COPY_STACK_TOP/_I64/V128 + * instead of EXT_OP_COPY_STACK_VALUES for interpreter performance. */ if (return_count == 1) { uint8 cell = (uint8)wasm_value_type_cell_num(return_types[0]); - if (cell <= 2 /* V128 isn't supported whose cell num is 4 */ - && block->dynamic_offset != *(loader_ctx->frame_offset - cell)) { + if (block->dynamic_offset != *(loader_ctx->frame_offset - cell)) { /* insert op_copy before else opcode */ if (opcode == WASM_OP_ELSE) skip_label(); - emit_label(cell == 1 ? EXT_OP_COPY_STACK_TOP - : EXT_OP_COPY_STACK_TOP_I64); +#if WASM_ENABLE_SIMDE != 0 + if (cell == 4) { + emit_label(EXT_OP_COPY_STACK_TOP_V128); + } +#endif + if (cell <= 2) { + emit_label(cell == 1 ? EXT_OP_COPY_STACK_TOP + : EXT_OP_COPY_STACK_TOP_I64); + } emit_operand(loader_ctx, *(loader_ctx->frame_offset - cell)); emit_operand(loader_ctx, block->dynamic_offset); @@ -9861,11 +10019,37 @@ reserve_block_ret(WASMLoaderContext *loader_ctx, uint8 opcode, for (i = (int32)return_count - 1; i >= 0; i--) { uint8 cells = (uint8)wasm_value_type_cell_num(return_types[i]); - frame_offset -= cells; - dynamic_offset -= cells; - if (dynamic_offset != *frame_offset) { - value_count++; - total_cel_num += cells; + if (frame_offset - cells < loader_ctx->frame_offset_bottom) { + set_error_buf(error_buf, error_buf_size, "frame offset underflow"); + goto fail; + } + + if (cells == 4) { + bool needs_copy = false; + int16 v128_dynamic = dynamic_offset - cells; + + for (int j = 0; j < 4; j++) { + if (*(frame_offset - j - 1) != (v128_dynamic + j)) { + needs_copy = true; + break; + } + } + + if (needs_copy) { + value_count++; + total_cel_num += cells; + } + + frame_offset -= cells; + dynamic_offset = v128_dynamic; + } + else { + frame_offset -= cells; + dynamic_offset -= cells; + if (dynamic_offset != *frame_offset) { + value_count++; + total_cel_num += cells; + } } } @@ -9901,19 +10085,50 @@ reserve_block_ret(WASMLoaderContext *loader_ctx, uint8 opcode, dynamic_offset = dynamic_offset_org; for (i = (int32)return_count - 1, j = 0; i >= 0; i--) { uint8 cell = (uint8)wasm_value_type_cell_num(return_types[i]); - frame_offset -= cell; - dynamic_offset -= cell; - if (dynamic_offset != *frame_offset) { - /* cell num */ - cells[j] = cell; - /* src offset */ - src_offsets[j] = *frame_offset; - /* dst offset */ - dst_offsets[j] = dynamic_offset; - j++; + + if (cell == 4) { + bool needs_copy = false; + int16 v128_dynamic = dynamic_offset - cell; + + for (int k = 0; k < 4; k++) { + if (*(frame_offset - k - 1) != (v128_dynamic + k)) { + needs_copy = true; + break; + } + } + + if (needs_copy) { + cells[j] = cell; + src_offsets[j] = *(frame_offset - cell); + dst_offsets[j] = v128_dynamic; + j++; + } + + frame_offset -= cell; + dynamic_offset = v128_dynamic; } + else { + frame_offset -= cell; + dynamic_offset -= cell; + if (dynamic_offset != *frame_offset) { + cells[j] = cell; + /* src offset */ + src_offsets[j] = *frame_offset; + /* dst offset */ + dst_offsets[j] = dynamic_offset; + j++; + } + } + if (opcode == WASM_OP_ELSE) { - *frame_offset = dynamic_offset; + if (cell == 4) { + for (int k = 0; k < cell; k++) { + *(frame_offset + k) = dynamic_offset + k; + } + } + else { + *frame_offset = dynamic_offset; + } } else { loader_ctx->frame_offset = frame_offset; @@ -10072,7 +10287,8 @@ check_memory_access_align(uint8 opcode, uint32 align, char *error_buf, } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) static bool check_simd_memory_access_align(uint8 opcode, uint32 align, char *error_buf, uint32 error_buf_size) @@ -10298,7 +10514,7 @@ wasm_loader_check_br(WASMLoaderContext *loader_ctx, uint32 depth, uint8 opcode, * match block type. */ if (cur_block->is_stack_polymorphic) { #if WASM_ENABLE_GC != 0 - int32 j = reftype_map_count - 1; + int32 j = (int32)reftype_map_count - 1; #endif for (i = (int32)arity - 1; i >= 0; i--) { #if WASM_ENABLE_GC != 0 @@ -10601,7 +10817,7 @@ check_block_stack(WASMLoaderContext *loader_ctx, BranchBlock *block, * match block type. */ if (block->is_stack_polymorphic) { #if WASM_ENABLE_GC != 0 - int32 j = return_reftype_map_count - 1; + int32 j = (int32)return_reftype_map_count - 1; #endif for (i = (int32)return_count - 1; i >= 0; i--) { #if WASM_ENABLE_GC != 0 @@ -11076,6 +11292,13 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func, bool disable_emit, preserve_local = false, if_condition_available = true; float32 f32_const; float64 f64_const; + /* + * It means that the fast interpreter detected an exception while preparing, + * typically near the block opcode, but it did not immediately trigger + * the exception. The loader should be capable of identifying it near + * the end opcode and then raising the exception. + */ + bool pending_exception = false; LOG_OP("\nProcessing func | [%d] params | [%d] locals | [%d] return\n", func->param_cell_num, func->local_cell_num, func->ret_cell_num); @@ -11169,6 +11392,39 @@ re_scan: } } + if (loader_ctx->v128_const_num > 0) { + V128 *v128_consts_old = loader_ctx->v128_consts; + + /* Sort the v128 consts */ + qsort(v128_consts_old, loader_ctx->v128_const_num, sizeof(V128), + cmp_v128_const); + + /* Remove the duplicated v128 consts */ + uint32 k = 1; + for (i = 1; i < loader_ctx->v128_const_num; i++) { + if (!(memcmp(&v128_consts_old[i], &v128_consts_old[i - 1], + sizeof(V128)) + == 0)) { + v128_consts_old[k++] = v128_consts_old[i]; + } + } + + if (k < loader_ctx->v128_const_num) { + V128 *v128_consts_new; + /* Try to reallocate memory with a smaller size */ + if ((v128_consts_new = + wasm_runtime_malloc((uint32)sizeof(V128) * k))) { + bh_memcpy_s(v128_consts_new, (uint32)sizeof(V128) * k, + v128_consts_old, (uint32)sizeof(V128) * k); + /* Free the old memory */ + wasm_runtime_free(v128_consts_old); + loader_ctx->v128_consts = v128_consts_new; + loader_ctx->v128_const_max_num = k; + } + loader_ctx->v128_const_num = k; + } + } + if (loader_ctx->i32_const_num > 0) { int32 *i32_consts_old = loader_ctx->i32_consts; @@ -11330,15 +11586,17 @@ re_scan: } else { int32 type_index; + /* Resolve the leb128 encoded type index as block type */ p--; p_org = p - 1; pb_read_leb_int32(p, p_end, type_index); - if ((uint32)type_index >= module->type_count) { - set_error_buf(error_buf, error_buf_size, - "unknown type"); + + if (!check_function_type(module, type_index, error_buf, + error_buf_size)) { goto fail; } + block_type.is_value_type = false; block_type.u.type = (WASMFuncType *)module->types[type_index]; @@ -11393,6 +11651,16 @@ re_scan: cell_num = wasm_value_type_cell_num( wasm_type->types[wasm_type->param_count - i - 1]); loader_ctx->frame_offset -= cell_num; + + if (loader_ctx->frame_offset + < loader_ctx->frame_offset_bottom) { + LOG_DEBUG( + "frame_offset underflow, roll back and " + "let following stack checker report it\n"); + loader_ctx->frame_offset += cell_num; + pending_exception = true; + break; + } #endif } } @@ -11417,7 +11685,7 @@ re_scan: if (!check_offset_push(loader_ctx, error_buf, error_buf_size)) goto fail; - /* for following dummy value assignemnt */ + /* for following dummy value assignment */ loader_ctx->frame_offset -= cell_num; } @@ -11729,7 +11997,7 @@ re_scan: */ cur_block->label_type = LABEL_TYPE_CATCH; - /* RESET_STACK removes the values pushed in TRY or pervious + /* RESET_STACK removes the values pushed in TRY or previous * CATCH Blocks */ RESET_STACK(); @@ -11771,7 +12039,7 @@ re_scan: /* replace frame_csp by LABEL_TYPE_CATCH_ALL */ cur_block->label_type = LABEL_TYPE_CATCH_ALL; - /* RESET_STACK removes the values pushed in TRY or pervious + /* RESET_STACK removes the values pushed in TRY or previous * CATCH Blocks */ RESET_STACK(); @@ -11915,6 +12183,15 @@ re_scan: } } +#if WASM_ENABLE_FAST_INTERP != 0 + if (pending_exception) { + set_error_buf( + error_buf, error_buf_size, + "There is a pending exception needs to be handled"); + goto fail; + } +#endif + break; } @@ -12125,7 +12402,7 @@ re_scan: } if (module->types[type_idx1]->type_flag != WASM_TYPE_FUNC) { set_error_buf(error_buf, error_buf_size, - "unkown function type"); + "unknown function type"); goto fail; } if (!wasm_loader_pop_nullable_typeidx(loader_ctx, &type, @@ -12142,7 +12419,7 @@ re_scan: } if (module->types[type_idx]->type_flag != WASM_TYPE_FUNC) { set_error_buf(error_buf, error_buf_size, - "unkown function type"); + "unknown function type"); goto fail; } if (!wasm_func_type_is_super_of( @@ -12369,8 +12646,8 @@ re_scan: /* skip elem idx */ POP_TBL_ELEM_IDX(); - if (type_idx >= module->type_count) { - set_error_buf(error_buf, error_buf_size, "unknown type"); + if (!check_function_type(module, type_idx, error_buf, + error_buf_size)) { goto fail; } @@ -12489,10 +12766,20 @@ re_scan: #endif } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) else if (*(loader_ctx->frame_ref - 1) == VALUE_TYPE_V128) { loader_ctx->frame_ref -= 4; loader_ctx->stack_cell_num -= 4; +#if WASM_ENABLE_FAST_INTERP != 0 + skip_label(); + loader_ctx->frame_offset -= 4; + if ((*(loader_ctx->frame_offset) + > loader_ctx->start_dynamic_offset) + && (*(loader_ctx->frame_offset) + < loader_ctx->max_dynamic_offset)) + loader_ctx->dynamic_offset -= 4; +#endif } #endif #endif @@ -12543,8 +12830,7 @@ re_scan: case VALUE_TYPE_F64: #if WASM_ENABLE_FAST_INTERP == 0 *(p - 1) = WASM_OP_SELECT_64; -#endif -#if WASM_ENABLE_FAST_INTERP != 0 +#else if (loader_ctx->p_code_compiled) { uint8 opcode_tmp = WASM_OP_SELECT_64; #if WASM_ENABLE_LABELS_AS_VALUES != 0 @@ -12552,8 +12838,7 @@ re_scan: *(void **)(p_code_compiled_tmp - sizeof(void *)) = handle_table[opcode_tmp]; -#else -#if UINTPTR_MAX == UINT64_MAX +#elif UINTPTR_MAX == UINT64_MAX /* emit int32 relative offset in 64-bit target */ int32 offset = @@ -12566,7 +12851,6 @@ re_scan: *(uint32 *)(p_code_compiled_tmp - sizeof(uint32)) = (uint32)(uintptr_t)handle_table[opcode_tmp]; -#endif #endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */ #else /* else of WASM_ENABLE_LABELS_AS_VALUES */ #if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 @@ -12579,10 +12863,45 @@ re_scan: #endif /* end of WASM_ENABLE_FAST_INTERP */ break; #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) case VALUE_TYPE_V128: +#if WASM_ENABLE_FAST_INTERP == 0 + *(p - 1) = WASM_OP_SELECT_128; +#else + if (loader_ctx->p_code_compiled) { + uint8 opcode_tmp = WASM_OP_SELECT_128; +#if WASM_ENABLE_LABELS_AS_VALUES != 0 +#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 + *(void **)(p_code_compiled_tmp + - sizeof(void *)) = + handle_table[opcode_tmp]; +#elif UINTPTR_MAX == UINT64_MAX + /* emit int32 relative offset in 64-bit target + */ + int32 offset = + (int32)((uint8 *)handle_table[opcode_tmp] + - (uint8 *)handle_table[0]); + *(int32 *)(p_code_compiled_tmp + - sizeof(int32)) = offset; +#else + /* emit uint32 label address in 32-bit target */ + *(uint32 *)(p_code_compiled_tmp + - sizeof(uint32)) = + (uint32)(uintptr_t)handle_table[opcode_tmp]; +#endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */ +#else /* else of WASM_ENABLE_LABELS_AS_VALUES */ +#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 + *(p_code_compiled_tmp - 1) = opcode_tmp; +#else + *(p_code_compiled_tmp - 2) = opcode_tmp; +#endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */ +#endif /* end of WASM_ENABLE_LABELS_AS_VALUES */ + } +#endif /* end of WASM_ENABLE_FAST_INTERP */ break; -#endif /* (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */ +#endif /* (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \ + (WASM_ENABLE_FAST_INTERP != 0) */ #endif /* WASM_ENABLE_SIMD != 0 */ default: { @@ -12677,11 +12996,12 @@ re_scan: uint8 opcode_tmp = WASM_OP_SELECT; if (type == VALUE_TYPE_V128) { -#if (WASM_ENABLE_SIMD == 0) \ - || ((WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)) +#if WASM_ENABLE_JIT != 0 \ + || WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0 + opcode_tmp = WASM_OP_SELECT_128; +#else set_error_buf(error_buf, error_buf_size, - "SIMD v128 type isn't supported"); - goto fail; + "v128 value type requires simd feature"); #endif } else { @@ -13174,10 +13494,21 @@ re_scan: emit_label(EXT_OP_SET_LOCAL_FAST); emit_byte(loader_ctx, (uint8)local_offset); } - else { + else if (is_64bit_type(local_type)) { emit_label(EXT_OP_SET_LOCAL_FAST_I64); emit_byte(loader_ctx, (uint8)local_offset); } +#if WASM_ENABLE_SIMDE != 0 + else if (local_type == VALUE_TYPE_V128) { + emit_label(EXT_OP_SET_LOCAL_FAST_V128); + emit_byte(loader_ctx, (uint8)local_offset); + } +#endif + else { + set_error_buf(error_buf, error_buf_size, + "unknown local type"); + goto fail; + } POP_OFFSET_TYPE(local_type); } } @@ -13250,6 +13581,12 @@ re_scan: emit_label(EXT_OP_TEE_LOCAL_FAST); emit_byte(loader_ctx, (uint8)local_offset); } +#if WASM_ENABLE_SIMDE != 0 + else if (local_type == VALUE_TYPE_V128) { + emit_label(EXT_OP_TEE_LOCAL_FAST_V128); + emit_byte(loader_ctx, (uint8)local_offset); + } +#endif else { emit_label(EXT_OP_TEE_LOCAL_FAST_I64); emit_byte(loader_ctx, (uint8)local_offset); @@ -13338,12 +13675,18 @@ re_scan: #endif *p_org = WASM_OP_GET_GLOBAL_64; } -#else /* else of WASM_ENABLE_FAST_INTERP */ +#else /* else of WASM_ENABLE_FAST_INTERP */ if (global_type == VALUE_TYPE_I64 || global_type == VALUE_TYPE_F64) { skip_label(); emit_label(WASM_OP_GET_GLOBAL_64); } +#if WASM_ENABLE_SIMDE != 0 + if (global_type == VALUE_TYPE_V128) { + skip_label(); + emit_label(WASM_OP_GET_GLOBAL_V128); + } +#endif /* end of WASM_ENABLE_SIMDE */ emit_uint32(loader_ctx, global_idx); PUSH_OFFSET_TYPE(global_type); #endif /* end of WASM_ENABLE_FAST_INTERP */ @@ -13427,7 +13770,7 @@ re_scan: func->has_op_set_global_aux_stack = true; #endif } -#else /* else of WASM_ENABLE_FAST_INTERP */ +#else /* else of WASM_ENABLE_FAST_INTERP */ if (global_type == VALUE_TYPE_I64 || global_type == VALUE_TYPE_F64) { skip_label(); @@ -13438,6 +13781,12 @@ re_scan: skip_label(); emit_label(WASM_OP_SET_GLOBAL_AUX_STACK); } +#if WASM_ENABLE_SIMDE != 0 + else if (global_type == VALUE_TYPE_V128) { + skip_label(); + emit_label(WASM_OP_SET_GLOBAL_V128); + } +#endif /* end of WASM_ENABLE_SIMDE */ emit_uint32(loader_ctx, global_idx); POP_OFFSET_TYPE(global_type); #endif /* end of WASM_ENABLE_FAST_INTERP */ @@ -13908,7 +14257,7 @@ re_scan: if (module->types[type_idx]->type_flag != WASM_TYPE_STRUCT) { set_error_buf(error_buf, error_buf_size, - "unkown struct type"); + "unknown struct type"); goto fail; } @@ -15282,7 +15631,8 @@ re_scan: } #if WASM_ENABLE_SIMD != 0 -#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) +#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \ + || (WASM_ENABLE_FAST_INTERP != 0) case WASM_OP_SIMD_PREFIX: { uint32 opcode1; @@ -15294,6 +15644,10 @@ re_scan: pb_read_leb_uint32(p, p_end, opcode1); +#if WASM_ENABLE_FAST_INTERP != 0 + emit_byte(loader_ctx, opcode1); +#endif + /* follow the order of enum WASMSimdEXTOpcode in wasm_opcode.h */ switch (opcode1) { @@ -15321,6 +15675,10 @@ re_scan: pb_read_leb_mem_offset(p, p_end, mem_offset); /* offset */ +#if WASM_ENABLE_FAST_INTERP != 0 + emit_uint32(loader_ctx, mem_offset); +#endif + POP_AND_PUSH(mem_offset_type, VALUE_TYPE_V128); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 func->has_memory_operations = true; @@ -15341,6 +15699,10 @@ re_scan: pb_read_leb_mem_offset(p, p_end, mem_offset); /* offset */ +#if WASM_ENABLE_FAST_INTERP != 0 + emit_uint32(loader_ctx, mem_offset); +#endif + POP_V128(); POP_MEM_OFFSET(); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 @@ -15352,7 +15714,15 @@ re_scan: /* basic operation */ case SIMD_v128_const: { +#if WASM_ENABLE_FAST_INTERP != 0 + uint64 high, low; +#endif CHECK_BUF1(p, p_end, 16); +#if WASM_ENABLE_FAST_INTERP != 0 + wasm_runtime_read_v128(p, &high, &low); + emit_uint64(loader_ctx, high); + emit_uint64(loader_ctx, low); +#endif p += 16; PUSH_V128(); break; @@ -15364,12 +15734,17 @@ re_scan: CHECK_BUF1(p, p_end, 16); mask = read_i8x16(p, error_buf, error_buf_size); - p += 16; if (!check_simd_shuffle_mask(mask, error_buf, error_buf_size)) { goto fail; } - +#if WASM_ENABLE_FAST_INTERP != 0 + uint64 high, low; + wasm_runtime_read_v128(p, &high, &low); + emit_uint64(loader_ctx, high); + emit_uint64(loader_ctx, low); +#endif + p += 16; POP2_AND_PUSH(VALUE_TYPE_V128, VALUE_TYPE_V128); break; } @@ -15440,14 +15815,25 @@ re_scan: error_buf_size)) { goto fail; } - +#if WASM_ENABLE_FAST_INTERP != 0 + emit_byte(loader_ctx, lane); +#endif if (replace[opcode1 - SIMD_i8x16_extract_lane_s]) { +#if WASM_ENABLE_FAST_INTERP != 0 + if (!(wasm_loader_pop_frame_ref_offset( + loader_ctx, + replace[opcode1 + - SIMD_i8x16_extract_lane_s], + error_buf, error_buf_size))) + goto fail; +#else if (!(wasm_loader_pop_frame_ref( loader_ctx, replace[opcode1 - SIMD_i8x16_extract_lane_s], error_buf, error_buf_size))) goto fail; +#endif /* end of WASM_ENABLE_FAST_INTERP != 0 */ } POP_AND_PUSH( @@ -15566,9 +15952,14 @@ re_scan: error_buf_size)) { goto fail; } - +#if WASM_ENABLE_FAST_INTERP != 0 + emit_uint32(loader_ctx, mem_offset); +#endif POP_V128(); POP_MEM_OFFSET(); +#if WASM_ENABLE_FAST_INTERP != 0 + emit_byte(loader_ctx, lane); +#endif if (opcode1 < SIMD_v128_store8_lane) { PUSH_V128(); } @@ -15591,7 +15982,9 @@ re_scan: pb_read_leb_mem_offset(p, p_end, mem_offset); /* offset */ - +#if WASM_ENABLE_FAST_INTERP != 0 + emit_uint32(loader_ctx, mem_offset); +#endif POP_AND_PUSH(mem_offset_type, VALUE_TYPE_V128); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 func->has_memory_operations = true; @@ -15940,7 +16333,8 @@ re_scan: } break; } -#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */ +#endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \ + (WASM_ENABLE_FAST_INTERP != 0) */ #endif /* end of WASM_ENABLE_SIMD */ #if WASM_ENABLE_SHARED_MEMORY != 0 @@ -16120,8 +16514,9 @@ re_scan: if (loader_ctx->p_code_compiled == NULL) goto re_scan; - func->const_cell_num = - loader_ctx->i64_const_num * 2 + loader_ctx->i32_const_num; + func->const_cell_num = loader_ctx->i64_const_num * 2 + + loader_ctx->v128_const_num * 4 + + loader_ctx->i32_const_num; if (func->const_cell_num > 0) { if (!(func->consts = loader_malloc((uint64)sizeof(uint32) * func->const_cell_num, @@ -16140,6 +16535,12 @@ re_scan: loader_ctx->i32_consts, (uint32)sizeof(int32) * loader_ctx->i32_const_num); } + if (loader_ctx->v128_const_num > 0) { + bh_memcpy_s(func->consts, + (uint32)sizeof(V128) * loader_ctx->v128_const_num, + loader_ctx->v128_consts, + (uint32)sizeof(V128) * loader_ctx->v128_const_num); + } } func->max_stack_cell_num = loader_ctx->preserved_local_offset diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index d20c28d7d..e66c08bab 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -665,7 +665,7 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end, const char *table_name, WASMTableImport *table, char *error_buf, uint32 error_buf_size) { - const uint8 *p = *p_buf, *p_end = buf_end; + const uint8 *p = *p_buf, *p_end = buf_end, *p_org; uint32 declare_elem_type = 0, table_flag = 0, declare_init_size = 0, declare_max_size = 0; @@ -678,7 +678,12 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end, #endif ); + /* the table flag can't exceed one byte, only check in debug build given + * the nature of mini-loader */ + p_org = p; read_leb_uint32(p, p_end, table_flag); + bh_assert(p - p_org <= 1); + (void)p_org; if (!wasm_table_check_flags(table_flag, error_buf, error_buf_size, false)) { return false; @@ -711,7 +716,7 @@ load_memory_import(const uint8 **p_buf, const uint8 *buf_end, const char *memory_name, WASMMemoryImport *memory, char *error_buf, uint32 error_buf_size) { - const uint8 *p = *p_buf, *p_end = buf_end; + const uint8 *p = *p_buf, *p_end = buf_end, *p_org; #if WASM_ENABLE_APP_FRAMEWORK != 0 uint32 pool_size = wasm_runtime_memory_pool_size(); uint32 max_page_count = pool_size * APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT @@ -724,7 +729,13 @@ load_memory_import(const uint8 **p_buf, const uint8 *buf_end, uint32 declare_init_page_count = 0; uint32 declare_max_page_count = 0; + /* the memory flag can't exceed one byte, only check in debug build given + * the nature of mini-loader */ + p_org = p; read_leb_uint32(p, p_end, mem_flag); + bh_assert(p - p_org <= 1); + (void)p_org; + if (!wasm_memory_check_flags(mem_flag, error_buf, error_buf_size, false)) { return false; } @@ -815,6 +826,8 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMTable *table, #endif ); + /* the table flag can't exceed one byte, only check in debug build given + * the nature of mini-loader */ p_org = p; read_leb_uint32(p, p_end, table->table_type.flags); bh_assert(p - p_org <= 1); @@ -854,6 +867,8 @@ load_memory(const uint8 **p_buf, const uint8 *buf_end, WASMMemory *memory, bool is_memory64 = false; #endif + /* the memory flag can't exceed one byte, only check in debug build given + * the nature of mini-loader */ p_org = p; read_leb_uint32(p, p_end, memory->flags); bh_assert(p - p_org <= 1); @@ -2457,7 +2472,7 @@ orcjit_thread_callback(void *arg) i + j * group_stride + module->import_function_count, (void *)func_addr); - /* Try to switch to call this llvm jit funtion instead of + /* Try to switch to call this llvm jit function instead of fast jit function from fast jit jitted code */ jit_compiler_set_call_to_llvm_jit( module, @@ -2478,6 +2493,7 @@ orcjit_thread_callback(void *arg) static void orcjit_stop_compile_threads(WASMModule *module) { +#if WASM_ENABLE_LAZY_JIT != 0 uint32 i, thread_num = (uint32)(sizeof(module->orcjit_thread_args) / sizeof(OrcJitThreadArg)); @@ -2486,6 +2502,7 @@ orcjit_stop_compile_threads(WASMModule *module) if (module->orcjit_threads[i]) os_thread_join(module->orcjit_threads[i], NULL); } +#endif } static bool @@ -3122,6 +3139,18 @@ create_module(char *name, char *error_buf, uint32 error_buf_size) } #endif +#if WASM_ENABLE_LIBC_WASI != 0 +#if WASM_ENABLE_LIBC_UVWASI == 0 + module->wasi_args.stdio[0] = os_invalid_raw_handle(); + module->wasi_args.stdio[1] = os_invalid_raw_handle(); + module->wasi_args.stdio[2] = os_invalid_raw_handle(); +#else + module->wasi_args.stdio[0] = os_get_invalid_handle(); + module->wasi_args.stdio[1] = os_get_invalid_handle(); + module->wasi_args.stdio[2] = os_get_invalid_handle(); +#endif /* WASM_ENABLE_UVWASI == 0 */ +#endif /* WASM_ENABLE_LIBC_WASI != 0 */ + (void)ret; return module; } @@ -4763,6 +4792,11 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode, loader_ctx->preserved_local_offset += 2; emit_label(EXT_OP_COPY_STACK_TOP_I64); } + + /* overflow */ + bh_assert(preserved_offset + <= loader_ctx->preserved_local_offset); + emit_operand(loader_ctx, local_index); emit_operand(loader_ctx, preserved_offset); emit_label(opcode); diff --git a/core/iwasm/interpreter/wasm_opcode.h b/core/iwasm/interpreter/wasm_opcode.h index 76647454b..37d32b122 100644 --- a/core/iwasm/interpreter/wasm_opcode.h +++ b/core/iwasm/interpreter/wasm_opcode.h @@ -278,6 +278,16 @@ typedef enum WASMOpcode { DEBUG_OP_BREAK = 0xdc, /* debug break point */ #endif +#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_FAST_INTERP != 0 \ + || WASM_ENABLE_WAMR_COMPILER != 0 && WASM_ENABLE_SIMD != 0 + EXT_OP_SET_LOCAL_FAST_V128 = 0xdd, + EXT_OP_TEE_LOCAL_FAST_V128 = 0xde, + EXT_OP_COPY_STACK_TOP_V128 = 0xdf, + WASM_OP_GET_GLOBAL_V128 = 0xe0, + WASM_OP_SET_GLOBAL_V128 = 0xe1, + WASM_OP_SELECT_128 = 0xe2, +#endif + /* Post-MVP extend op prefix */ WASM_OP_GC_PREFIX = 0xfb, WASM_OP_MISC_PREFIX = 0xfc, @@ -779,16 +789,27 @@ typedef enum WASMAtomicEXTOpcode { #else #define DEF_DEBUG_BREAK_HANDLE() #endif - #define SET_GOTO_TABLE_ELEM(opcode) [opcode] = HANDLE_OPCODE(opcode) -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_SIMD != 0 +#if WASM_ENABLE_SIMDE != 0 #define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() \ SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX), #else #define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() #endif +#if WASM_ENABLE_SIMD != 0 && WASM_ENABLE_SIMDE != 0 +#define DEF_EXT_V128_HANDLE() \ + SET_GOTO_TABLE_ELEM(EXT_OP_SET_LOCAL_FAST_V128), /* 0xdd */ \ + SET_GOTO_TABLE_ELEM(EXT_OP_TEE_LOCAL_FAST_V128), /* 0xde */ \ + SET_GOTO_TABLE_ELEM(EXT_OP_COPY_STACK_TOP_V128), /* 0xdf */ \ + SET_GOTO_TABLE_ELEM(WASM_OP_GET_GLOBAL_V128), /* 0xe0 */ \ + SET_GOTO_TABLE_ELEM(WASM_OP_SET_GLOBAL_V128), /* 0xe1 */ \ + SET_GOTO_TABLE_ELEM(WASM_OP_SELECT_128), /* 0xe2 */ + +#else +#define DEF_EXT_V128_HANDLE() +#endif /* * Macro used to generate computed goto tables for the C interpreter. */ @@ -1020,7 +1041,7 @@ typedef enum WASMAtomicEXTOpcode { SET_GOTO_TABLE_ELEM(WASM_OP_MISC_PREFIX), /* 0xfc */ \ SET_GOTO_TABLE_SIMD_PREFIX_ELEM() /* 0xfd */ \ SET_GOTO_TABLE_ELEM(WASM_OP_ATOMIC_PREFIX), /* 0xfe */ \ - DEF_DEBUG_BREAK_HANDLE() \ + DEF_DEBUG_BREAK_HANDLE() DEF_EXT_V128_HANDLE() \ }; #ifdef __cplusplus diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index 18c56417e..3cc2afe04 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -3523,13 +3523,6 @@ call_wasm_with_hw_bound_check(WASMModuleInstance *module_inst, #endif bool ret = true; - /* Check native stack overflow firstly to ensure we have enough - native stack to run the following codes before actually calling - the aot function in invokeNative function. */ - if (!wasm_runtime_detect_native_stack_overflow(exec_env)) { - return; - } - if (!exec_env_tls) { if (!os_thread_signal_inited()) { wasm_set_exception(module_inst, "thread signal env not inited"); @@ -3548,6 +3541,13 @@ call_wasm_with_hw_bound_check(WASMModuleInstance *module_inst, } } + /* Check native stack overflow firstly to ensure we have enough + native stack to run the following codes before actually calling + the aot function in invokeNative function. */ + if (!wasm_runtime_detect_native_stack_overflow(exec_env)) { + return; + } + wasm_exec_env_push_jmpbuf(exec_env, &jmpbuf_node); if (os_setjmp(jmpbuf_node.jmpbuf) == 0) { @@ -4195,6 +4195,55 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst, #endif /* end of (WASM_ENABLE_MEMORY_PROFILING != 0) \ || (WASM_ENABLE_MEMORY_TRACING != 0) */ +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +uint32 +wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_t *buffer, + uint32 length, uint32 skip_n, char *error_buf, + uint32_t error_buf_size) +{ + /* + * Note for devs: please refrain from such modifications inside of + * wasm_interp_copy_callstack + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_copy_callstack in + * wasm_export.h + */ + WASMModuleInstance *module_inst = + (WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env); + WASMInterpFrame *cur_frame = wasm_exec_env_get_cur_frame(exec_env); + uint8 *top_boundary = exec_env->wasm_stack.top_boundary; + uint8 *bottom = exec_env->wasm_stack.bottom; + uint32 count = 0; + + WASMCApiFrame record_frame; + while (cur_frame && (uint8_t *)cur_frame >= bottom + && (uint8_t *)cur_frame + sizeof(WASMInterpFrame) <= top_boundary + && count < (skip_n + length)) { + if (!cur_frame->function) { + cur_frame = cur_frame->prev_frame; + continue; + } + if (count < skip_n) { + ++count; + cur_frame = cur_frame->prev_frame; + continue; + } + record_frame.instance = module_inst; + record_frame.module_offset = 0; + // It's safe to dereference module_inst->e because "e" is asigned only + // once in wasm_instantiate + record_frame.func_index = + (uint32)(cur_frame->function - module_inst->e->functions); + buffer[count - skip_n] = record_frame; + cur_frame = cur_frame->prev_frame; + ++count; + } + return count >= skip_n ? count - skip_n : 0; +} +#endif // WAMR_ENABLE_COPY_CALLSTACK + #if WASM_ENABLE_DUMP_CALL_STACK != 0 bool wasm_interp_create_call_stack(struct WASMExecEnv *exec_env) diff --git a/core/iwasm/interpreter/wasm_runtime.h b/core/iwasm/interpreter/wasm_runtime.h index 0acb8de31..8d8e640b4 100644 --- a/core/iwasm/interpreter/wasm_runtime.h +++ b/core/iwasm/interpreter/wasm_runtime.h @@ -738,6 +738,14 @@ wasm_get_table_inst(const WASMModuleInstance *module_inst, uint32 tbl_idx) } #if WASM_ENABLE_DUMP_CALL_STACK != 0 + +#if WAMR_ENABLE_COPY_CALLSTACK != 0 +uint32 +wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_t *buffer, + uint32 length, uint32 skip_n, char *error_buf, + uint32_t error_buf_size); +#endif // WAMR_ENABLE_COPY_CALLSTACK + bool wasm_interp_create_call_stack(struct WASMExecEnv *exec_env); diff --git a/core/iwasm/libraries/debug-engine/debug_engine.c b/core/iwasm/libraries/debug-engine/debug_engine.c index 0ffc78ad9..340e657e8 100644 --- a/core/iwasm/libraries/debug-engine/debug_engine.c +++ b/core/iwasm/libraries/debug-engine/debug_engine.c @@ -58,7 +58,7 @@ static WASMDebugEngine *g_debug_engine; static uint32 current_instance_id = 1; static uint32 -allocate_instance_id() +allocate_instance_id(void) { uint32 id; @@ -302,7 +302,7 @@ wasm_debug_control_thread_destroy(WASMDebugInstance *debug_instance) } static WASMDebugEngine * -wasm_debug_engine_create() +wasm_debug_engine_create(void) { WASMDebugEngine *engine; @@ -326,7 +326,7 @@ wasm_debug_engine_create() } void -wasm_debug_engine_destroy() +wasm_debug_engine_destroy(void) { if (g_debug_engine) { wasm_debug_handler_deinit(); diff --git a/core/iwasm/libraries/debug-engine/debug_engine.h b/core/iwasm/libraries/debug-engine/debug_engine.h index 68738213e..275eeaad1 100644 --- a/core/iwasm/libraries/debug-engine/debug_engine.h +++ b/core/iwasm/libraries/debug-engine/debug_engine.h @@ -133,7 +133,7 @@ bool wasm_debug_engine_init(char *ip_addr, int32 process_port); void -wasm_debug_engine_destroy(); +wasm_debug_engine_destroy(void); WASMExecEnv * wasm_debug_instance_get_current_env(WASMDebugInstance *instance); diff --git a/core/iwasm/libraries/debug-engine/gdbserver.c b/core/iwasm/libraries/debug-engine/gdbserver.c index fbd876ac3..2cf1e686a 100644 --- a/core/iwasm/libraries/debug-engine/gdbserver.c +++ b/core/iwasm/libraries/debug-engine/gdbserver.c @@ -38,7 +38,7 @@ static const struct packet_handler_elem packet_handler_table[255] = { }; WASMGDBServer * -wasm_create_gdbserver(const char *host, int32 *port) +wasm_create_gdbserver(const char *host, int *port) { bh_socket_t listen_fd = (bh_socket_t)-1; WASMGDBServer *server; diff --git a/core/iwasm/libraries/debug-engine/gdbserver.h b/core/iwasm/libraries/debug-engine/gdbserver.h index 9e279a2e6..41ed94dec 100644 --- a/core/iwasm/libraries/debug-engine/gdbserver.h +++ b/core/iwasm/libraries/debug-engine/gdbserver.h @@ -51,7 +51,7 @@ typedef struct WASMGDBServer { } WASMGDBServer; WASMGDBServer * -wasm_create_gdbserver(const char *host, int32 *port); +wasm_create_gdbserver(const char *host, int *port); bool wasm_gdbserver_listen(WASMGDBServer *server); diff --git a/core/iwasm/libraries/debug-engine/handler.c b/core/iwasm/libraries/debug-engine/handler.c index 905ca2f7c..743165dd9 100644 --- a/core/iwasm/libraries/debug-engine/handler.c +++ b/core/iwasm/libraries/debug-engine/handler.c @@ -34,7 +34,7 @@ static char *tmpbuf; static korp_mutex tmpbuf_lock; int -wasm_debug_handler_init() +wasm_debug_handler_init(void) { int ret; tmpbuf = wasm_runtime_malloc(MAX_PACKET_SIZE); @@ -51,7 +51,7 @@ wasm_debug_handler_init() } void -wasm_debug_handler_deinit() +wasm_debug_handler_deinit(void) { wasm_runtime_free(tmpbuf); tmpbuf = NULL; @@ -204,8 +204,7 @@ handle_general_query(WASMGDBServer *server, char *payload) if (!strcmp(name, "Supported")) { os_mutex_lock(&tmpbuf_lock); snprintf(tmpbuf, MAX_PACKET_SIZE, - "qXfer:libraries:read+;PacketSize=%" PRIx32 ";", - MAX_PACKET_SIZE); + "qXfer:libraries:read+;PacketSize=%x;", MAX_PACKET_SIZE); write_packet(server, tmpbuf); os_mutex_unlock(&tmpbuf_lock); } @@ -384,7 +383,7 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid) if (status == 0) { os_mutex_lock(&tmpbuf_lock); - snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02x", status); + (void)snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02" PRIx32, status); write_packet(server, tmpbuf); os_mutex_unlock(&tmpbuf_lock); return; @@ -400,17 +399,38 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid) os_mutex_lock(&tmpbuf_lock); // TODO: how name a wasm thread? - len += snprintf(tmpbuf, MAX_PACKET_SIZE, "T%02xthread:%" PRIx64 ";name:%s;", - gdb_status, (uint64)(uintptr_t)tid, "nobody"); + len = snprintf(tmpbuf, MAX_PACKET_SIZE, + "T%02" PRIx32 "thread:%" PRIx64 ";name:%s;", gdb_status, + (uint64)(uintptr_t)tid, "nobody"); + if (len < 0 || len >= MAX_PACKET_SIZE) { + os_mutex_unlock(&tmpbuf_lock); + return; + } + if (tids_count > 0) { - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:"); + int n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:"); + if (n < 0 || n >= MAX_PACKET_SIZE - len) { + os_mutex_unlock(&tmpbuf_lock); + return; + } + + len += n; while (i < tids_count) { - if (i == tids_count - 1) - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, - "%" PRIx64 ";", (uint64)(uintptr_t)tids[i]); - else - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, - "%" PRIx64 ",", (uint64)(uintptr_t)tids[i]); + if (i == tids_count - 1) { + n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, + "%" PRIx64 ";", (uint64)(uintptr_t)tids[i]); + } + else { + n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, + "%" PRIx64 ",", (uint64)(uintptr_t)tids[i]); + } + + if (n < 0 || n >= MAX_PACKET_SIZE - len) { + os_mutex_unlock(&tmpbuf_lock); + return; + } + + len += n; i++; } } @@ -427,32 +447,45 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid) /* When exception occurs, use reason:exception so the description can be * correctly processed by LLDB */ uint32 exception_len = strlen(exception); - len += + int n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "thread-pcs:%" PRIx64 ";00:%s;reason:%s;description:", pc, pc_string, "exception"); + if (n < 0 || n >= MAX_PACKET_SIZE - len) { + os_mutex_unlock(&tmpbuf_lock); + return; + } + + len += n; /* The description should be encoded as HEX */ for (i = 0; i < exception_len; i++) { - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "%02x", - exception[i]); + n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "%02x", + exception[i]); + if (n < 0 || n >= MAX_PACKET_SIZE - len) { + os_mutex_unlock(&tmpbuf_lock); + return; + } + + len += n; } - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, ";"); + + (void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, ";"); } else { if (status == WAMR_SIG_TRAP) { - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, - "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, - pc_string, "breakpoint"); + (void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, + "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, + pc_string, "breakpoint"); } else if (status == WAMR_SIG_SINGSTEP) { - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, - "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, - pc_string, "trace"); + (void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, + "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, + pc_string, "trace"); } else { /* status > 0 (== 0 is checked at the function beginning) */ - len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, - "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, - pc_string, "signal"); + (void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, + "thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc, + pc_string, "signal"); } } write_packet(server, tmpbuf); @@ -624,7 +657,8 @@ void handle_get_write_memory(WASMGDBServer *server, char *payload) { size_t hex_len; - int32 offset, act_len; + int offset; + int32 act_len; uint64 maddr, mlen; char *buff; bool ret; diff --git a/core/iwasm/libraries/debug-engine/handler.h b/core/iwasm/libraries/debug-engine/handler.h index af2566da5..698663c7b 100644 --- a/core/iwasm/libraries/debug-engine/handler.h +++ b/core/iwasm/libraries/debug-engine/handler.h @@ -9,10 +9,10 @@ #include "gdbserver.h" int -wasm_debug_handler_init(); +wasm_debug_handler_init(void); void -wasm_debug_handler_deinit(); +wasm_debug_handler_deinit(void); void handle_interrupt(WASMGDBServer *server); diff --git a/core/iwasm/libraries/lib-rats/lib_rats.cmake b/core/iwasm/libraries/lib-rats/lib_rats.cmake index e17a6b25a..36bad1c51 100644 --- a/core/iwasm/libraries/lib-rats/lib_rats.cmake +++ b/core/iwasm/libraries/lib-rats/lib_rats.cmake @@ -2,6 +2,13 @@ # Copyright (c) 2020-2021 Alibaba Cloud # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + set (LIB_RATS_DIR ${CMAKE_CURRENT_LIST_DIR}) if ("$ENV{SGX_SSL_DIR}" STREQUAL "") diff --git a/core/iwasm/libraries/lib-socket/inc/wasi_socket_ext.h b/core/iwasm/libraries/lib-socket/inc/wasi_socket_ext.h index 98429bbb0..78eb457f5 100644 --- a/core/iwasm/libraries/lib-socket/inc/wasi_socket_ext.h +++ b/core/iwasm/libraries/lib-socket/inc/wasi_socket_ext.h @@ -991,7 +991,7 @@ __wasi_sock_get_ipv6_only(__wasi_fd_t fd, bool *option) /** * TODO: modify recv() and send() * since don't want to re-compile the wasi-libc, - * we tend to keep original implentations of recv() and send(). + * we tend to keep original implementations of recv() and send(). */ #ifdef __cplusplus diff --git a/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake b/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake index 8ddddffeb..c6a4430f7 100644 --- a/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake +++ b/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.8...3.16) +cmake_minimum_required (VERSION 3.14) project(socket_wasi_ext LANGUAGES C) diff --git a/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c b/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c index 1172d0a77..f573d35b8 100644 --- a/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c +++ b/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c @@ -12,6 +12,26 @@ #include #include +/* + * Avoid direct TLS access to allow a single library to be + * linked to both of threaded and non-threaded applications. + * + * wasi-libc's errno is a TLS variable, exposed directly via + * errno.h. if we use it here, LLVM may lower it differently, + * depending on enabled features like atomcs and bulk-memory. + * we tweak the way to access errno here in order to make us + * compatible with both of threaded and non-threaded applications. + * __errno_location() should be reasonably stable because + * it was introduced as an alternative ABI for non-C software. + * https://github.com/WebAssembly/wasi-libc/pull/347 + */ +#if defined(errno) +#undef errno +#endif +int * +__errno_location(void); +#define errno (*__errno_location()) + #define HANDLE_ERROR(error) \ if (error != __WASI_ERRNO_SUCCESS) { \ errno = error; \ diff --git a/core/iwasm/libraries/lib-wasi-threads/stress-test/stress_test_threads_creation.c b/core/iwasm/libraries/lib-wasi-threads/stress-test/stress_test_threads_creation.c index c4c2d2857..79baebfa4 100644 --- a/core/iwasm/libraries/lib-wasi-threads/stress-test/stress_test_threads_creation.c +++ b/core/iwasm/libraries/lib-wasi-threads/stress-test/stress_test_threads_creation.c @@ -65,7 +65,7 @@ test(int iter_num, int max_threads_num, int retry_num, int retry_time_us) } while ((__atomic_load_n(&threads_in_use, __ATOMIC_SEQ_CST) != 0)) { - // Casting to int* to supress compiler warning + // Casting to int* to suppress compiler warning __builtin_wasm_memory_atomic_wait32((int *)(&threads_in_use), 0, second_us); } diff --git a/core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake b/core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake index 7a3bfbdce..f197b21d6 100644 --- a/core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake +++ b/core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake @@ -1,9 +1,16 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + set (LIBC_WASI_DIR ${CMAKE_CURRENT_LIST_DIR}) -set (LIBUV_VERSION v1.46.0) +set (LIBUV_VERSION v1.51.0) add_definitions (-DWASM_ENABLE_LIBC_WASI=1 -DWASM_ENABLE_UVWASI=1) @@ -22,15 +29,10 @@ else() GIT_REPOSITORY https://github.com/libuv/libuv.git GIT_TAG ${LIBUV_VERSION} ) - FetchContent_GetProperties(libuv) - if (NOT libuv_POPULATED) - message("-- Fetching libuv ..") - FetchContent_Populate(libuv) - include_directories("${libuv_SOURCE_DIR}/include") - add_subdirectory(${libuv_SOURCE_DIR} ${libuv_BINARY_DIR} EXCLUDE_FROM_ALL) - set (LIBUV_LIBRARIES uv_a) - set_target_properties(uv_a PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() + FetchContent_MakeAvailable(libuv) + include_directories("${libuv_SOURCE_DIR}/include") + set (LIBUV_LIBRARIES uv_a) + set_target_properties(uv_a PROPERTIES POSITION_INDEPENDENT_CODE 1) endif() ## uvwasi @@ -41,17 +43,12 @@ else() FetchContent_Declare( uvwasi GIT_REPOSITORY https://github.com/nodejs/uvwasi.git - GIT_TAG main + GIT_TAG 392e1f1c1c8a2d2102c9f2e0b9f35959a149d133 ) - FetchContent_GetProperties(uvwasi) - if (NOT uvwasi_POPULATED) - message("-- Fetching uvwasi ..") - FetchContent_Populate(uvwasi) - include_directories("${uvwasi_SOURCE_DIR}/include") - add_subdirectory(${uvwasi_SOURCE_DIR} ${uvwasi_BINARY_DIR} EXCLUDE_FROM_ALL) - set (UVWASI_LIBRARIES uvwasi_a) - set_target_properties(uvwasi_a PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() + FetchContent_MakeAvailable(uvwasi) + include_directories("${uvwasi_SOURCE_DIR}/include") + set (UVWASI_LIBRARIES uvwasi_a) + set_target_properties(uvwasi_a PROPERTIES POSITION_INDEPENDENT_CODE 1) endif() set (UV_A_LIBS ${LIBUV_LIBRARIES} ${UVWASI_LIBRARIES}) diff --git a/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.h b/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.h index d958fa39c..580ce7987 100644 --- a/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.h +++ b/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.h @@ -26,7 +26,7 @@ typedef __wasi_dircookie_t wasi_dircookie_t; // result are not guaranteed to be zero'ed by us so the result essentially // contains garbage from the WASM app perspective. To prevent this, we return // uint32 directly instead so as not to be reliant on the correct behaviour of -// any current/future WASI SDK implemenations. +// any current/future WASI SDK implementations. typedef uint32_t wasi_errno_t; typedef __wasi_event_t wasi_event_t; typedef __wasi_exitcode_t wasi_exitcode_t; diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include/wasmtime_ssp.h b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include/wasmtime_ssp.h index ed8463866..3972c76ed 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include/wasmtime_ssp.h +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include/wasmtime_ssp.h @@ -6,7 +6,7 @@ */ /** - * The defitions of type, macro and structure in this file should be + * The definitions of type, macro and structure in this file should be * consistent with those in wasi-libc: * https://github.com/WebAssembly/wasi-libc/blob/main/libc-bottom-half/headers/public/wasi/api.h */ diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index d26c460fe..bef4c19f3 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -1222,43 +1222,56 @@ __wasi_errno_t readlinkat_dup(os_file_handle handle, const char *path, size_t *p_len, char **out_buf) { - char *buf = NULL; - size_t len = 32; - size_t len_org = len; + __wasi_errno_t error; + struct __wasi_filestat_t stat = { 0 }; + size_t buf_len; + /* + * use fstatat to get a better estimation + * If path is a symbolic link, do not dereference it: + * instead return information about the link itself, + * like lstat(). + */ + error = os_fstatat(handle, path, &stat, 0); + if (error != __WASI_ESUCCESS) { + stat.st_size = 0; + } + + /* + * Some magic symlinks report `st_size` as zero. In that case, take + * 32 as the initial buffer size. Otherwise, use `st_size + 1`. + */ + buf_len = stat.st_size ? stat.st_size + 1 : 32; for (;;) { - char *newbuf = wasm_runtime_malloc((uint32)len); + size_t bytes_read = 0; + char *buf; - if (newbuf == NULL) { - if (buf) - wasm_runtime_free(buf); + buf = wasm_runtime_malloc((uint32)buf_len); + if (buf == NULL) { *out_buf = NULL; return __WASI_ENOMEM; } - if (buf != NULL) { - bh_memcpy_s(newbuf, (uint32)len, buf, (uint32)len_org); - wasm_runtime_free(buf); - } - - buf = newbuf; - size_t bytes_read = 0; - __wasi_errno_t error = - os_readlinkat(handle, path, buf, len, &bytes_read); + error = os_readlinkat(handle, path, buf, buf_len, &bytes_read); if (error != __WASI_ESUCCESS) { wasm_runtime_free(buf); + *p_len = 0; *out_buf = NULL; return error; } - if ((size_t)bytes_read + 1 < len) { - buf[bytes_read] = '\0'; - *p_len = len; - *out_buf = buf; + /* not truncated */ + if (bytes_read < buf_len) { + buf[bytes_read] = '\0'; + *p_len = bytes_read + 1; + *out_buf = buf; return __WASI_ESUCCESS; } - len_org = len; - len *= 2; + + /* truncated, try again with a bigger buf */ + wasm_runtime_free(buf); + buf = NULL; + buf_len *= 2; } } @@ -3021,9 +3034,9 @@ fd_table_destroy(struct fd_table *ft) fd_object_release(NULL, ft->entries[i].object); } } - rwlock_destroy(&ft->lock); wasm_runtime_free(ft->entries); } + rwlock_destroy(&ft->lock); } void @@ -3035,9 +3048,9 @@ fd_prestats_destroy(struct fd_prestats *pt) wasm_runtime_free((void *)pt->prestats[i].dir); } } - rwlock_destroy(&pt->lock); wasm_runtime_free(pt->prestats); } + rwlock_destroy(&pt->lock); } bool diff --git a/core/iwasm/libraries/simde/simde.cmake b/core/iwasm/libraries/simde/simde.cmake new file mode 100644 index 000000000..60fd6d975 --- /dev/null +++ b/core/iwasm/libraries/simde/simde.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2024 Amazon Inc. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# simde is a header only library + +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + +set (LIB_SIMDE_DIR ${CMAKE_CURRENT_LIST_DIR}) + +add_definitions (-DWASM_ENABLE_SIMDE=1) + +include_directories(${LIB_SIMDE_DIR} ${LIB_SIMDE_DIR}/simde) + +include(FetchContent) + +FetchContent_Declare( + simde + GIT_REPOSITORY https://github.com/simd-everywhere/simde + GIT_TAG v0.8.2 +) + +message("-- Fetching simde ..") +FetchContent_MakeAvailable(simde) +include_directories("${simde_SOURCE_DIR}") diff --git a/core/iwasm/libraries/wasi-nn/README.md b/core/iwasm/libraries/wasi-nn/README.md index 99a766467..2e926a032 100644 --- a/core/iwasm/libraries/wasi-nn/README.md +++ b/core/iwasm/libraries/wasi-nn/README.md @@ -37,7 +37,7 @@ There is a big difference between the two sets of functions, `tensor_type`. ```c #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 -typedef enum { fp16 = 0, fp32, fp64, bf16, u8, i32, i64 } tensor_type; +typedef enum { fp16 = 0, fp32, fp64, u8, i32, i64 } tensor_type; #else typedef enum { fp16 = 0, fp32, up8, ip32 } tensor_type; #endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */ diff --git a/core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake b/core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake index 6c921bbc9..c698e8c5f 100644 --- a/core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake +++ b/core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake @@ -1,6 +1,13 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + include(FetchContent) set(CJSON_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/cjson") diff --git a/core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake b/core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake index 8f4f8d1aa..29dd46390 100644 --- a/core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake +++ b/core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake @@ -1,6 +1,13 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + include(FetchContent) set(LLAMA_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/llama.cpp") diff --git a/core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake b/core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake index d2b3f74e0..2561b5243 100644 --- a/core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake +++ b/core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake @@ -1,6 +1,13 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + include(FetchContent) set(TFLITE_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/tensorflow-src") diff --git a/core/iwasm/libraries/wasi-nn/cmake/wasi_nn.cmake b/core/iwasm/libraries/wasi-nn/cmake/wasi_nn.cmake index c6deab6fc..b771b1c40 100644 --- a/core/iwasm/libraries/wasi-nn/cmake/wasi_nn.cmake +++ b/core/iwasm/libraries/wasi-nn/cmake/wasi_nn.cmake @@ -39,7 +39,7 @@ if(WAMR_BUILD_WASI_NN_TFLITE EQUAL 1) target_link_libraries( wasi_nn_tflite PUBLIC - libiwasm + vmlib tensorflow-lite ) @@ -71,7 +71,7 @@ if(WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1) target_link_libraries( wasi_nn_openvino PUBLIC - libiwasm + vmlib openvino::runtime openvino::runtime::c ) @@ -100,7 +100,7 @@ if(WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1) target_link_libraries( wasi_nn_llamacpp PUBLIC - libiwasm + vmlib cjson common ggml diff --git a/core/iwasm/libraries/wasi-nn/include/wasi_nn.h b/core/iwasm/libraries/wasi-nn/include/wasi_nn.h index ad1f37deb..35b2d9bf0 100644 --- a/core/iwasm/libraries/wasi-nn/include/wasi_nn.h +++ b/core/iwasm/libraries/wasi-nn/include/wasi_nn.h @@ -15,23 +15,37 @@ #include #include "wasi_nn_types.h" +#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 +#define WASI_NN_IMPORT(name) \ + __attribute__((import_module("wasi_ephemeral_nn"), import_name(name))) +#else +#define WASI_NN_IMPORT(name) \ + __attribute__((import_module("wasi_nn"), import_name(name))) +#endif + /** * @brief Load an opaque sequence of bytes to use for inference. * * @param builder Model builder. + * @param builder_len The size of model builder. * @param encoding Model encoding. * @param target Execution target. * @param g Graph. * @return wasi_nn_error Execution status. */ +#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 +wasi_nn_error +load(graph_builder *builder, uint32_t builder_len, graph_encoding encoding, + execution_target target, graph *g) WASI_NN_IMPORT("load"); +#else wasi_nn_error load(graph_builder_array *builder, graph_encoding encoding, - execution_target target, graph *g) - __attribute__((import_module("wasi_nn"))); + execution_target target, graph *g) WASI_NN_IMPORT("load"); +#endif wasi_nn_error -load_by_name(const char *name, graph *g) - __attribute__((import_module("wasi_nn"))); +load_by_name(const char *name, uint32_t name_len, graph *g) + WASI_NN_IMPORT("load_by_name"); /** * INFERENCE @@ -47,7 +61,7 @@ load_by_name(const char *name, graph *g) */ wasi_nn_error init_execution_context(graph g, graph_execution_context *ctx) - __attribute__((import_module("wasi_nn"))); + WASI_NN_IMPORT("init_execution_context"); /** * @brief Define the inputs to use for inference. @@ -59,7 +73,7 @@ init_execution_context(graph g, graph_execution_context *ctx) */ wasi_nn_error set_input(graph_execution_context ctx, uint32_t index, tensor *tensor) - __attribute__((import_module("wasi_nn"))); + WASI_NN_IMPORT("set_input"); /** * @brief Compute the inference on the given inputs. @@ -68,7 +82,7 @@ set_input(graph_execution_context ctx, uint32_t index, tensor *tensor) * @return wasi_nn_error Execution status. */ wasi_nn_error -compute(graph_execution_context ctx) __attribute__((import_module("wasi_nn"))); +compute(graph_execution_context ctx) WASI_NN_IMPORT("compute"); /** * @brief Extract the outputs after inference. @@ -82,9 +96,16 @@ compute(graph_execution_context ctx) __attribute__((import_module("wasi_nn"))); * copied number of bytes. * @return wasi_nn_error Execution status. */ +#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 +wasi_nn_error +get_output(graph_execution_context ctx, uint32_t index, + tensor_data output_tensor, uint32_t output_tensor_max_size, + uint32_t *output_tensor_size) WASI_NN_IMPORT("get_output"); +#else wasi_nn_error get_output(graph_execution_context ctx, uint32_t index, tensor_data output_tensor, uint32_t *output_tensor_size) - __attribute__((import_module("wasi_nn"))); + WASI_NN_IMPORT("get_output"); +#endif #endif diff --git a/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h b/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h index 3ac694fc9..dd6b8f14a 100644 --- a/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h +++ b/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h @@ -19,30 +19,19 @@ extern "C" { */ // sync up with -// https://github.com/WebAssembly/wasi-nn/blob/main/wit/wasi-nn.wit#L136 Error -// codes returned by functions in this API. +// https://github.com/WebAssembly/wasi-nn/blob/71320d95b8c6d43f9af7f44e18b1839db85d89b4/wasi-nn.witx#L5-L17 +// Error codes returned by functions in this API. typedef enum { - // No error occurred. success = 0, - // Caller module passed an invalid argument. invalid_argument, - // Invalid encoding. invalid_encoding, - // The operation timed out. - timeout, - // Runtime Error. + missing_memory, + busy, runtime_error, - // Unsupported operation. unsupported_operation, - // Graph is too large. too_large, - // Graph not found. not_found, - // The operation is insecure or has insufficient privilege to be performed. - // e.g., cannot access a hardware feature requested - security, - // The operation failed for an unspecified reason. - unknown, + // for WasmEdge-wasi-nn end_of_sequence = 100, // End of Sequence Found. context_full = 101, // Context Full. @@ -66,9 +55,9 @@ typedef struct { #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 // sync up with -// https://github.com/WebAssembly/wasi-nn/blob/main/wit/wasi-nn.wit#L27 +// https://github.com/WebAssembly/wasi-nn/blob/71320d95b8c6d43f9af7f44e18b1839db85d89b4/wasi-nn.witx#L19-L28 // The type of the elements in a tensor. -typedef enum { fp16 = 0, fp32, fp64, bf16, u8, i32, i64 } tensor_type; +typedef enum { fp16 = 0, fp32, fp64, u8, i32, i64 } tensor_type; #else typedef enum { fp16 = 0, fp32, up8, ip32 } tensor_type; #endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */ @@ -88,9 +77,14 @@ typedef struct { // Describe the size of the tensor (e.g., 2x2x2x2 -> [2, 2, 2, 2]). To // represent a tensor containing a single value, use `[1]` for the tensor // dimensions. +#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 && defined(__wasm__) + tensor_dimensions dimensions; +#else tensor_dimensions *dimensions; +#endif // Describe the type of element in the tensor (e.g., f32). - tensor_type type; + uint8_t type; + uint8_t _pad[3]; // Contains the tensor data. tensor_data data; } tensor; @@ -142,39 +136,6 @@ typedef uint32_t graph_execution_context; /* Definition of 'wasi_nn.h' structs in WASM app format (using offset) */ -typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding, - execution_target, graph *); -typedef wasi_nn_error (*LOAD_BY_NAME)(void *, const char *, uint32_t, graph *); -typedef wasi_nn_error (*LOAD_BY_NAME_WITH_CONFIG)(void *, const char *, - uint32_t, void *, uint32_t, - graph *); -typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph, - graph_execution_context *); -typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t, - tensor *); -typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context); -typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t, - tensor_data, uint32_t *); -/* wasi-nn general APIs */ -typedef wasi_nn_error (*BACKEND_INITIALIZE)(void **); -typedef wasi_nn_error (*BACKEND_DEINITIALIZE)(void *); - -typedef struct { - LOAD load; - LOAD_BY_NAME load_by_name; - LOAD_BY_NAME_WITH_CONFIG load_by_name_with_config; - INIT_EXECUTION_CONTEXT init_execution_context; - SET_INPUT set_input; - COMPUTE compute; - GET_OUTPUT get_output; - BACKEND_INITIALIZE init; - BACKEND_DEINITIALIZE deinit; -} api_function; - -void -wasi_nn_dump_tensor_dimension(tensor_dimensions *dim, int32_t output_len, - char *output); - #ifdef __cplusplus } #endif diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn.c b/core/iwasm/libraries/wasi-nn/src/wasi_nn.c index 4697e931b..1a8ad03c6 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn.c +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn.c @@ -21,11 +21,24 @@ #include "wasm_export.h" #define HASHMAP_INITIAL_SIZE 20 -#define TFLITE_BACKEND_LIB "libwasi_nn_tflite.so" -#define OPENVINO_BACKEND_LIB "libwasi_nn_openvino.so" -#define LLAMACPP_BACKEND_LIB "libwasi_nn_llamacpp.so" +#if defined(__APPLE__) +#define LIB_EXTENTION ".dylib" +#else +#define LIB_EXTENTION ".so" +#endif +#define TFLITE_BACKEND_LIB "libwasi_nn_tflite" LIB_EXTENTION +#define OPENVINO_BACKEND_LIB "libwasi_nn_openvino" LIB_EXTENTION +#define LLAMACPP_BACKEND_LIB "libwasi_nn_llamacpp" LIB_EXTENTION /* Global variables */ +static korp_mutex wasi_nn_lock; +/* + * the "lookup" table is protected by wasi_nn_lock. + * + * an exception: during wasm_runtime_destroy, wasi_nn_destroy tears down + * the table without acquiring the lock. it's ok because there should be + * no other threads using the runtime at this point. + */ struct backends_api_functions { void *backend_handle; api_function functions; @@ -104,12 +117,18 @@ wasi_nn_initialize() { NN_DBG_PRINTF("[WASI NN General] Initializing wasi-nn"); + if (os_mutex_init(&wasi_nn_lock)) { + NN_ERR_PRINTF("Error while initializing global lock"); + return false; + } + // hashmap { instance: wasi_nn_ctx } hashmap = bh_hash_map_create(HASHMAP_INITIAL_SIZE, true, hash_func, key_equal_func, key_destroy_func, value_destroy_func); if (hashmap == NULL) { NN_ERR_PRINTF("Error while initializing hashmap"); + os_mutex_destroy(&wasi_nn_lock); return false; } @@ -170,6 +189,8 @@ wasi_nn_destroy() memset(&lookup[i].functions, 0, sizeof(api_function)); } + + os_mutex_destroy(&wasi_nn_lock); } /* Utils */ @@ -342,9 +363,10 @@ graph_encoding_to_backend_lib_name(graph_encoding encoding) static bool detect_and_load_backend(graph_encoding backend_hint, - struct backends_api_functions *backends, graph_encoding *loaded_backend) { + bool ret; + if (backend_hint > autodetect) return false; @@ -356,16 +378,23 @@ detect_and_load_backend(graph_encoding backend_hint, *loaded_backend = backend_hint; + os_mutex_lock(&wasi_nn_lock); /* if already loaded */ - if (lookup[backend_hint].backend_handle) + if (lookup[backend_hint].backend_handle) { + os_mutex_unlock(&wasi_nn_lock); return true; + } const char *backend_lib_name = graph_encoding_to_backend_lib_name(backend_hint); - if (!backend_lib_name) + if (!backend_lib_name) { + os_mutex_unlock(&wasi_nn_lock); return false; + } - return prepare_backend(backend_lib_name, backends + backend_hint); + ret = prepare_backend(backend_lib_name, lookup + backend_hint); + os_mutex_unlock(&wasi_nn_lock); + return ret; } /* WASI-NN implementation */ @@ -410,7 +439,7 @@ wasi_nn_load(wasm_exec_env_t exec_env, graph_builder_array_wasm *builder, } graph_encoding loaded_backend = autodetect; - if (!detect_and_load_backend(encoding, lookup, &loaded_backend)) { + if (!detect_and_load_backend(encoding, &loaded_backend)) { res = invalid_encoding; NN_ERR_PRINTF("load backend failed"); goto fail; @@ -468,7 +497,7 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len, NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME %s...", name); graph_encoding loaded_backend = autodetect; - if (!detect_and_load_backend(autodetect, lookup, &loaded_backend)) { + if (!detect_and_load_backend(autodetect, &loaded_backend)) { NN_ERR_PRINTF("load backend failed"); return invalid_encoding; } @@ -488,7 +517,6 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len, if (res != success) return res; - wasi_nn_ctx->backend = loaded_backend; wasi_nn_ctx->is_model_loaded = true; return success; } @@ -527,7 +555,7 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name, NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME_WITH_CONFIG %s %s...", name, config); graph_encoding loaded_backend = autodetect; - if (!detect_and_load_backend(autodetect, lookup, &loaded_backend)) { + if (!detect_and_load_backend(autodetect, &loaded_backend)) { NN_ERR_PRINTF("load backend failed"); return invalid_encoding; } @@ -548,7 +576,6 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name, if (res != success) return res; - wasi_nn_ctx->backend = loaded_backend; wasi_nn_ctx->is_model_loaded = true; return success; } @@ -697,6 +724,7 @@ static NativeSymbol native_symbols_wasi_nn[] = { REG_NATIVE_FUNC(get_output, "(ii*i*)i"), #else /* WASM_ENABLE_WASI_EPHEMERAL_NN == 0 */ REG_NATIVE_FUNC(load, "(*ii*)i"), + REG_NATIVE_FUNC(load_by_name, "(*i*)i"), REG_NATIVE_FUNC(init_execution_context, "(i*)i"), REG_NATIVE_FUNC(set_input, "(ii*)i"), REG_NATIVE_FUNC(compute, "(i)i"), diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c b/core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c index 58d29163c..23c867b0a 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c @@ -14,7 +14,7 @@ extern char const *LLAMA_COMMIT; extern char const *LLAMA_COMPILER; extern char const *LLAMA_BUILD_TARGET; -// compatable with WasmEdge +// compatible with WasmEdge // https://github.com/second-state/WasmEdge-WASINN-examples/blob/master/wasmedge-ggml/README.md#parameters // https://github.com/WasmEdge/WasmEdge/blob/master/plugins/wasi_nn/ggml.cpp struct wasi_nn_llama_config { diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c b/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c index db2f91db0..dcfec1ccb 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c @@ -58,7 +58,7 @@ dump_ov_shape_t(const ov_shape_t *shape, int32_t output_len, char *output) { int ret = 0; - ret = snprintf(output, output_len, "%ld,[", shape->rank); + ret = snprintf(output, output_len, "%" PRId64 ",[", shape->rank); if (!ret) return; @@ -66,7 +66,7 @@ dump_ov_shape_t(const ov_shape_t *shape, int32_t output_len, char *output) output += ret; for (unsigned i = 0; i < shape->rank && output_len; i++) { - ret = snprintf(output, output_len, " %ld", shape->dims[i]); + ret = snprintf(output, output_len, " %" PRId64, shape->dims[i]); if (!ret) return; @@ -161,8 +161,6 @@ wasi_nn_tensor_type_to_openvino_element_type(tensor_type wasi_nn_type) #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 case fp64: return F64; - case bf16: - return BF16; case i64: return I64; case u8: @@ -511,7 +509,7 @@ init_backend(void **ctx) *ctx = (void *)ov_ctx; return success; fail: - openvino_destroy((void *)ov_ctx); + os_free(ov_ctx); return ret; } diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn_private.h b/core/iwasm/libraries/wasi-nn/src/wasi_nn_private.h index bacae99ad..bb56f72fb 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn_private.h +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn_private.h @@ -15,4 +15,33 @@ typedef struct { void *backend_ctx; } WASINNContext; +typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding, + execution_target, graph *); +typedef wasi_nn_error (*LOAD_BY_NAME)(void *, const char *, uint32_t, graph *); +typedef wasi_nn_error (*LOAD_BY_NAME_WITH_CONFIG)(void *, const char *, + uint32_t, void *, uint32_t, + graph *); +typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph, + graph_execution_context *); +typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t, + tensor *); +typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context); +typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t, + tensor_data, uint32_t *); +/* wasi-nn general APIs */ +typedef wasi_nn_error (*BACKEND_INITIALIZE)(void **); +typedef wasi_nn_error (*BACKEND_DEINITIALIZE)(void *); + +typedef struct { + LOAD load; + LOAD_BY_NAME load_by_name; + LOAD_BY_NAME_WITH_CONFIG load_by_name_with_config; + INIT_EXECUTION_CONTEXT init_execution_context; + SET_INPUT set_input; + COMPUTE compute; + GET_OUTPUT get_output; + BACKEND_INITIALIZE init; + BACKEND_DEINITIALIZE deinit; +} api_function; + #endif diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn_tensorflowlite.cpp b/core/iwasm/libraries/wasi-nn/src/wasi_nn_tensorflowlite.cpp index 6a3b5a47d..09e12f0d2 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn_tensorflowlite.cpp +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn_tensorflowlite.cpp @@ -56,7 +56,7 @@ initialize_g(TFLiteContext *tfl_ctx, graph *g) os_mutex_lock(&tfl_ctx->g_lock); if (tfl_ctx->current_models == MAX_GRAPHS_PER_INST) { os_mutex_unlock(&tfl_ctx->g_lock); - NN_ERR_PRINTF("Excedded max graphs per WASM instance"); + NN_ERR_PRINTF("Exceeded max graphs per WASM instance"); return runtime_error; } *g = tfl_ctx->current_models++; @@ -70,7 +70,7 @@ initialize_graph_ctx(TFLiteContext *tfl_ctx, graph g, os_mutex_lock(&tfl_ctx->g_lock); if (tfl_ctx->current_interpreters == MAX_GRAPH_EXEC_CONTEXTS_PER_INST) { os_mutex_unlock(&tfl_ctx->g_lock); - NN_ERR_PRINTF("Excedded max graph execution context per WASM instance"); + NN_ERR_PRINTF("Exceeded max graph execution context per WASM instance"); return runtime_error; } *ctx = tfl_ctx->current_interpreters++; @@ -85,12 +85,8 @@ is_valid_graph(TFLiteContext *tfl_ctx, graph g) NN_ERR_PRINTF("Invalid graph: %d >= %d.", g, MAX_GRAPHS_PER_INST); return runtime_error; } - if (tfl_ctx->models[g].model_pointer == NULL) { - NN_ERR_PRINTF("Context (model) non-initialized."); - return runtime_error; - } if (tfl_ctx->models[g].model == NULL) { - NN_ERR_PRINTF("Context (tflite model) non-initialized."); + NN_ERR_PRINTF("Context (model) non-initialized."); return runtime_error; } return success; @@ -325,7 +321,7 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index, int size = model_tensor_size * sizeof(float); bh_memcpy_s(it, size, input_tensor->data, size); } - else { // TODO: Assumming uint8 quantized networks. + else { // TODO: Assuming uint8 quantized networks. TfLiteAffineQuantization *quant_info = (TfLiteAffineQuantization *)tensor->quantization.params; if (quant_info->scale->size != 1 || quant_info->zero_point->size != 1) { @@ -406,7 +402,7 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index, int size = model_tensor_size * sizeof(float); bh_memcpy_s(output_tensor, size, ot, size); } - else { // TODO: Assumming uint8 quantized networks. + else { // TODO: Assuming uint8 quantized networks. TfLiteAffineQuantization *quant_info = (TfLiteAffineQuantization *)tensor->quantization.params; if (quant_info->scale->size != 1 || quant_info->zero_point->size != 1) { @@ -472,32 +468,31 @@ deinit_backend(void *tflite_ctx) NN_DBG_PRINTF("Freeing memory."); for (int i = 0; i < MAX_GRAPHS_PER_INST; ++i) { tfl_ctx->models[i].model.reset(); - if (tfl_ctx->models[i].model_pointer) { - if (tfl_ctx->delegate) { - switch (tfl_ctx->models[i].target) { - case gpu: - { + if (tfl_ctx->delegate) { + switch (tfl_ctx->models[i].target) { + case gpu: + { #if WASM_ENABLE_WASI_NN_GPU != 0 - TfLiteGpuDelegateV2Delete(tfl_ctx->delegate); + TfLiteGpuDelegateV2Delete(tfl_ctx->delegate); #else - NN_ERR_PRINTF("GPU delegate delete but not enabled."); + NN_ERR_PRINTF("GPU delegate delete but not enabled."); #endif - break; - } - case tpu: - { -#if WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE != 0 - TfLiteExternalDelegateDelete(tfl_ctx->delegate); -#else - NN_ERR_PRINTF( - "External delegate delete but not enabled."); -#endif - break; - } - default: - break; + break; } + case tpu: + { +#if WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE != 0 + TfLiteExternalDelegateDelete(tfl_ctx->delegate); +#else + NN_ERR_PRINTF("External delegate delete but not enabled."); +#endif + break; + } + default: + break; } + } + if (tfl_ctx->models[i].model_pointer) { wasm_runtime_free(tfl_ctx->models[i].model_pointer); } tfl_ctx->models[i].model_pointer = NULL; diff --git a/core/iwasm/libraries/wasi-nn/test/Dockerfile.vx-delegate b/core/iwasm/libraries/wasi-nn/test/Dockerfile.vx-delegate index e05b30119..fdeff3022 100644 --- a/core/iwasm/libraries/wasi-nn/test/Dockerfile.vx-delegate +++ b/core/iwasm/libraries/wasi-nn/test/Dockerfile.vx-delegate @@ -37,7 +37,10 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake- WORKDIR /tmp RUN git clone https://github.com/VeriSilicon/TIM-VX.git tim-vx \ && git clone https://github.com/VeriSilicon/tflite-vx-delegate.git \ - && git clone https://github.com/tensorflow/tensorflow.git + && git clone https://github.com/tensorflow/tensorflow.git --branch v2.12.0 + +WORKDIR /tmp/tensorflow +RUN git cherry-pick -n 5115fa96d7c5b41451674892317be43e30b7c389 # Build TIM-VX @@ -99,28 +102,24 @@ RUN cp --parents \ ENV VIVANTE_SDK_DIR=/tmp/tim-vx/prebuilt-sdk/x86_64_linux/ ENV VSIMULATOR_CONFIG=czl -ENV LD_LIBRARY_PATH=/tmp/tim-vx/prebuilt-sdk/x86_64_linux/lib:/usr/local/lib:/lib/x86_64-linux-gnu/:/lib64/:/usr/lib:$LD_LIBRARY_PATH - # Build WASI-NN WORKDIR /home/wamr COPY . . -WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build +WORKDIR /home/wamr/product-mini/platforms/linux -# hadolint ignore=SC2086 -RUN cmake \ - -DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}:/usr/local/lib/ \ - -DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}:/usr/local/include/ \ +RUN rm -rf build \ + && cmake -S . -B build\ + -DCMAKE_LIBRARY_PATH="/usr/local/lib/" \ + -DCMAKE_INCLUDE_PATH="/usr/local/include/" \ -DWAMR_BUILD_WASI_NN=1 \ -DWAMR_BUILD_WASI_NN_TFLITE=1\ -DWAMR_BUILD_WASI_NN_ENABLE_EXT=1 \ -DWASI_NN_EXT_DELEGATE_PATH="/usr/lib/libvx_delegate.so" \ - .. + && cmake --build build -j "$(grep -c ^processor /proc/cpuinfo)" -RUN make -j "$(grep -c ^processor /proc/cpuinfo)" - -RUN cp /home/wamr/core/iwasm/libraries/wasi-nn/test/build/iwasm /run/iwasm \ +RUN cp /home/wamr/product-mini/platforms/linux/build/iwasm /run/iwasm \ && cp /home/wamr/product-mini/platforms/linux/build/lib*.so /usr/lib ENTRYPOINT [ "/run/iwasm" ] diff --git a/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke b/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke index fe3a8c512..133b19185 100644 --- a/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke +++ b/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke @@ -13,7 +13,7 @@ RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends cmake -RUN rustup target add wasm32-wasi +RUN rustup target add wasm32-wasip1 # # Openvino @@ -30,21 +30,23 @@ RUN apt-get update \ && apt-get upgrade -y \ && apt-get install --no-install-recommends -y openvino-2023.2.0 +# Activate after upgrading to wasi-nn 0.7.0 +# # +# # wasi-nn +# # compilation requirements +# WORKDIR /workspaces/wasi-nn +# RUN git clone https://github.com/bytecodealliance/wasi-nn.git . \ +# # update new wasmtime's cli (#100). Apr 27, 2024 +# && git checkout 556890b121dd1171665d835aba4d04a7e29e37dc # -# wasi-nn -# compilation requirements -WORKDIR /workspaces/wasi-nn -RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git . - -WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/ -RUN cargo build --target=wasm32-wasi - -WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/build -RUN cp ../target/wasm32-wasi/debug/wasi-nn-example.wasm . \ - && wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.xml \ - && wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.bin -# There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory, -# /workspaces/wasi-nn/rust/examples/classification-example/build +# WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/ +# RUN cargo build --target=wasm32-wasip1 +# +# ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet +# RUN cp target/wasm32-wasip1/debug/wasi-nn-example.wasm . \ +# && wget -q --no-clobber $FIXTURE/mobilenet.xml \ +# && wget -q --no-clobber $FIXTURE/mobilenet.bin +# # There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory, # # wasmedge @@ -52,46 +54,49 @@ WORKDIR /tmp RUN wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh \ && chmod a+x ./install.sh # RUN ./install.sh -p /opt/wasmedge --plugins wasi_nn-tensorflowlite wasi_nn-openvino -RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 \ +RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 -v 0.14.0 \ && /opt/wasmedge/bin/wasmedge --version ENV PATH=/opt/wasmedge/bin:${PATH} # ENV WASMEDGE_LIB_DIR=/opt/wasmedge/lib # # wasmedge-wasinn-examples +# based on wasi-nn 0.6.0 WORKDIR /workspaces/wasmedge-wasinn-examples RUN git clone --depth 1 https://github.com/second-state/WasmEdge-WASINN-examples.git . -COPY core/iwasm/libraries/wasi-nn/test/bump_wasi_nn_to_0_6_0.patch . -RUN git apply ./bump_wasi_nn_to_0_6_0.patch -# recompile with wasi-nn 0.6.0 +# recompile with debug info +ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/ RUN pushd rust \ - && cargo build --target=wasm32-wasi \ + && cargo build --target=wasm32-wasip1 \ && popd \ - && ./download_mobilenet.sh . \ + && wget -q --no-clobber $FIXTURE/mobilenet.xml \ + && wget -q --no-clobber $FIXTURE/mobilenet.bin \ && ls -l mobilenet.xml mobilenet.bin WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/ RUN pushd rust \ - && cargo build --target=wasm32-wasi \ + && cargo build --target=wasm32-wasip1 \ && popd \ - && ./download_mobilenet.sh . \ + && wget -q --no-clobber $FIXTURE/mobilenet.xml \ + && wget -q --no-clobber $FIXTURE/mobilenet.bin \ + && wget -q --no-clobber $FIXTURE/tensor-1x224x224x3-f32.bgr \ && ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/ RUN pushd openvino-road-seg-adas \ - && cargo build --target=wasm32-wasi + && cargo build --target=wasm32-wasip1 WORKDIR /workspaces/wasmedge-wasinn-examples/tflite-birds_v1-image/ RUN pushd rust \ - && cargo build --target=wasm32-wasi + && cargo build --target=wasm32-wasip1 # mount models when running WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen RUN wget --progress=dot:giga https://www.modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/master/qwen1_5-0_5b-chat-q2_k.gguf -RUN cargo build --target=wasm32-wasi - +RUN cargo build --target=wasm32-wasip1 +# # # iwasm. build from source WORKDIR /workspaces/wamr @@ -107,9 +112,10 @@ RUN OpenVINO_DIR=/usr/lib/openvino-2023.2.0 \ -DWAMR_BUILD_WASI_NN_LLAMACPP=1 \ && cmake --build build \ && cmake --install build - + ENV LD_LIBRARY_PATH=/usr/local/lib + # add smoke test script COPY core/iwasm/libraries/wasi-nn/test/run_smoke_test.py / diff --git a/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py b/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py index 304b0c977..489e6e59f 100644 --- a/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py +++ b/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py @@ -53,7 +53,7 @@ def execute_openvino_road_segmentation_adas_once( """ wasm_file = ( - "./openvino-road-seg-adas/target/wasm32-wasi/debug/openvino-road-seg-adas.wasm" + "./openvino-road-seg-adas/target/wasm32-wasip1/debug/openvino-road-seg-adas.wasm" ) wasm_args = [ "./model/road-segmentation-adas-0001.xml", @@ -70,7 +70,7 @@ def execute_openvino_mobilenet_raw_once( execute openvino-mobilenet-image with iwasm and wasmedge """ - wasm_file = "./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet.wasm" + wasm_file = "./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet.wasm" wasm_args = [ "mobilenet.xml", "mobilenet.bin", @@ -87,7 +87,7 @@ def execute_openvino_mobilenet_image_once( """ wasm_file = ( - "./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet-image.wasm" + "./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet-image.wasm" ) wasm_args = [ "mobilenet.xml", @@ -105,7 +105,7 @@ def execute_tflite_birds_v1_image_once( """ wasm_file = ( - "rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-tflite-bird-image.wasm" + "rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-tflite-bird-image.wasm" ) wasm_args = ["lite-model_aiy_vision_classifier_birds_V1_3.tflite", "bird.jpg"] return execute_once(runtime_bin, runtime_args, wasm_file, wasm_args, cwd) @@ -163,7 +163,7 @@ def execute_tflite_birds_v1_image(iwasm_bin: str, wasmedge_bin: str, cwd: Path): iwasm_output = execute_tflite_birds_v1_image_once( iwasm_bin, [ - "--map-dir=.:.", + "--map-dir=.::.", ], cwd, ) @@ -181,7 +181,7 @@ def execute_openvino_mobilenet_image(iwasm_bin: str, wasmedge_bin: str, cwd: Pat iwasm_output = execute_openvino_mobilenet_image_once( iwasm_bin, [ - "--map-dir=.:.", + "--map-dir=.::.", ], cwd, ) @@ -199,7 +199,7 @@ def execute_openvino_mobilenet_raw(iwasm_bin: str, wasmedge_bin: str, cwd: Path) iwasm_output = execute_openvino_mobilenet_raw_once( iwasm_bin, [ - "--map-dir=.:.", + "--map-dir=.::.", ], cwd, ) @@ -236,7 +236,7 @@ def execute_openvino_road_segmentation_adas( iwasm_output = execute_openvino_road_segmentation_adas_once( iwasm_bin, [ - "--map-dir=.:.", + "--map-dir=.::.", ], cwd, ) @@ -262,7 +262,7 @@ def execute_openvino_road_segmentation_adas( def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path): iwasm_args = ["--dir=."] - wasm_file = ["./target/wasm32-wasi/debug/wasmedge-ggml-qwen.wasm"] + wasm_file = ["./target/wasm32-wasip1/debug/wasmedge-ggml-qwen.wasm"] wasm_args = ["./qwen1_5-0_5b-chat-q2_k.gguf"] cmd = [iwasm_bin] @@ -286,7 +286,7 @@ def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path): p.stdin.write(b"hi\n") p.stdin.flush() - # ASSITANT + # ASSISTANT p.stdout.readline() # xxx p.stdout.readline() @@ -296,7 +296,7 @@ def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path): p.stdin.write(prompt.encode()) p.stdin.write(b"\n") p.stdin.flush() - # ASSITANT + # ASSISTANT p.stdout.readline() # xxx answer = p.stdout.readline().decode("utf-8") diff --git a/core/iwasm/libraries/wasi-nn/test/utils.c b/core/iwasm/libraries/wasi-nn/test/utils.c index 9e43ec985..690c37f0e 100644 --- a/core/iwasm/libraries/wasi-nn/test/utils.c +++ b/core/iwasm/libraries/wasi-nn/test/utils.c @@ -58,7 +58,7 @@ wasm_load(char *model_name, graph *g, execution_target target) wasi_nn_error wasm_load_by_name(const char *model_name, graph *g) { - wasi_nn_error res = load_by_name(model_name, g); + wasi_nn_error res = load_by_name(model_name, strlen(model_name), g); return res; } @@ -108,7 +108,8 @@ run_inference(execution_target target, float *input, uint32_t *input_size, uint32_t num_output_tensors) { graph graph; - if (wasm_load(model_name, &graph, target) != success) { + + if (wasm_load_by_name(model_name, &graph) != success) { NN_ERR_PRINTF("Error when loading model."); exit(1); } diff --git a/core/shared/mem-alloc/ems/ems_alloc.c b/core/shared/mem-alloc/ems/ems_alloc.c index e272b3014..74214b224 100644 --- a/core/shared/mem-alloc/ems/ems_alloc.c +++ b/core/shared/mem-alloc/ems/ems_alloc.c @@ -40,7 +40,7 @@ hmu_is_in_heap(void *hmu, gc_uint8 *heap_base_addr, gc_uint8 *heap_end_addr) * the node will be removed from the tree, and the left, right and * parent pointers of the node @p will be set to be NULL. Other fields * won't be touched. The tree will be re-organized so that the order - * conditions are still satisified. + * conditions are still satisfied. */ static bool remove_tree_node(gc_heap_t *heap, hmu_tree_node_t *p) @@ -648,7 +648,7 @@ gc_realloc_vo_internal(void *vheap, void *ptr, gc_size_t size, const char *file, hmu_old = obj_to_hmu(obj_old); tot_size_old = hmu_get_size(hmu_old); if (tot_size <= tot_size_old) - /* current node alreay meets requirement */ + /* current node already meets requirement */ return obj_old; } diff --git a/core/shared/mem-alloc/ems/ems_gc.h b/core/shared/mem-alloc/ems/ems_gc.h index ff65b4e7c..9913ca2b6 100644 --- a/core/shared/mem-alloc/ems/ems_gc.h +++ b/core/shared/mem-alloc/ems/ems_gc.h @@ -115,7 +115,7 @@ gc_init_with_struct_and_pool(char *struct_buf, gc_size_t struct_buf_size, char *pool_buf, gc_size_t pool_buf_size); /** - * Destroy heap which is initilized from a buffer + * Destroy heap which is initialized from a buffer * * @param handle handle to heap needed destroy * diff --git a/core/shared/mem-alloc/ems/ems_gc_internal.h b/core/shared/mem-alloc/ems/ems_gc_internal.h index c902d5711..c90494201 100644 --- a/core/shared/mem-alloc/ems/ems_gc_internal.h +++ b/core/shared/mem-alloc/ems/ems_gc_internal.h @@ -287,7 +287,7 @@ typedef struct gc_heap_struct { additional memory fails. When the fast mode fails, the marking process can still be done in the slow mode, which doesn't need additional memory (by walking through all - blocks and marking sucessors of marked nodes until no new + blocks and marking successors of marked nodes until no new node is marked). TODO: slow mode is not implemented. */ unsigned is_fast_marking_failed : 1; @@ -319,7 +319,7 @@ typedef struct gc_heap_struct { * the nodes, a new space will be allocated from heap */ extra_info_node_t *extra_info_normal_nodes[EXTRA_INFO_NORMAL_NODE_CNT]; /* Used to store extra information such as finalizer for specified nodes, we - * introduce a seperate space to store these information so only nodes who + * introduce a separate space to store these information so only nodes who * really require extra information will occupy additional memory spaces. */ extra_info_node_t **extra_info_nodes; gc_size_t extra_info_node_cnt; diff --git a/core/shared/mem-alloc/ems/ems_hmu.c b/core/shared/mem-alloc/ems/ems_hmu.c index e4c79e339..ea84d98cd 100644 --- a/core/shared/mem-alloc/ems/ems_hmu.c +++ b/core/shared/mem-alloc/ems/ems_hmu.c @@ -9,7 +9,7 @@ /** * Set default value to prefix and suffix - * @param hmu should not be NULL and should have been correctly initilized + * @param hmu should not be NULL and should have been correctly initialized * (except prefix and suffix part) * @param tot_size is offered here because hmu_get_size can not be used * till now. tot_size should not be smaller than OBJ_EXTRA_SIZE. diff --git a/core/shared/mem-alloc/ems/ems_kfc.c b/core/shared/mem-alloc/ems/ems_kfc.c index 8ab2df545..2d5a4b13e 100644 --- a/core/shared/mem-alloc/ems/ems_kfc.c +++ b/core/shared/mem-alloc/ems/ems_kfc.c @@ -208,8 +208,28 @@ gc_get_heap_struct_size() static void adjust_ptr(uint8 **p_ptr, intptr_t offset) { - if (*p_ptr) - *p_ptr = (uint8 *)((intptr_t)(*p_ptr) + offset); + if ((!*p_ptr)) { + return; + } + + /* + * to resolve a possible signed integer overflow issue + * when p_ptr is over 0x8000000000000000 by not using + * `(intptr_t)` + */ + uintptr_t offset_val = 0; +#if UINTPTR_MAX == UINT64_MAX + offset_val = labs(offset); +#else + offset_val = abs(offset); +#endif + + if (offset > 0) { + *p_ptr = (uint8 *)((uintptr_t)(*p_ptr) + offset_val); + } + else { + *p_ptr = (uint8 *)((uintptr_t)(*p_ptr) - offset_val); + } } int @@ -232,7 +252,7 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size) heap_max_size = (uint32)(pool_buf_end - base_addr_new) & (uint32)~7; if (pool_buf_end < base_addr_new || heap_max_size < heap->current_size) { - LOG_ERROR("[GC_ERROR]heap migrate invlaid pool buf size\n"); + LOG_ERROR("[GC_ERROR]heap migrate invalid pool buf size\n"); return GC_ERROR; } diff --git a/core/shared/mem-alloc/mem_alloc.cmake b/core/shared/mem-alloc/mem_alloc.cmake index 5f47cce13..76d1706dc 100644 --- a/core/shared/mem-alloc/mem_alloc.cmake +++ b/core/shared/mem-alloc/mem_alloc.cmake @@ -24,6 +24,10 @@ if (WAMR_BUILD_GC_CORRUPTION_CHECK EQUAL 0) add_definitions (-DBH_ENABLE_GC_CORRUPTION_CHECK=0) endif () +if (DEFINED WAMR_BUILD_GC_HEAP_SIZE_DEFAULT) + add_definitions ("-DGC_HEAP_SIZE_DEFAULT=${WAMR_BUILD_GC_HEAP_SIZE_DEFAULT}") +endif () + file (GLOB_RECURSE source_all ${MEM_ALLOC_DIR}/ems/*.c ${MEM_ALLOC_DIR}/tlsf/*.c diff --git a/core/shared/platform/alios/alios_platform.c b/core/shared/platform/alios/alios_platform.c index b5663e3a2..a3752b439 100644 --- a/core/shared/platform/alios/alios_platform.c +++ b/core/shared/platform/alios/alios_platform.c @@ -79,3 +79,9 @@ os_dcache_flush() void os_icache_flush(void *start, size_t len) {} + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/platform/common/posix/posix_file.c b/core/shared/platform/common/posix/posix_file.c index 9ae0a03a2..d90f38ec5 100644 --- a/core/shared/platform/common/posix/posix_file.c +++ b/core/shared/platform/common/posix/posix_file.c @@ -1032,4 +1032,10 @@ char * os_realpath(const char *path, char *resolved_path) { return realpath(path, resolved_path); -} \ No newline at end of file +} + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/platform/common/posix/posix_memmap.c b/core/shared/platform/common/posix/posix_memmap.c index 1d972f5fa..d5cad885c 100644 --- a/core/shared/platform/common/posix/posix_memmap.c +++ b/core/shared/platform/common/posix/posix_memmap.c @@ -61,14 +61,16 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) request_size += HUGE_PAGE_SIZE; #endif - if ((size_t)request_size < size) - /* integer overflow */ + if ((size_t)request_size < size) { + os_printf("mmap failed: request size overflow due to paging\n"); return NULL; + } #if WASM_ENABLE_MEMORY64 == 0 - if (request_size > 16 * (uint64)UINT32_MAX) - /* at most 64 G is allowed */ + if (request_size > 16 * (uint64)UINT32_MAX) { + os_printf("mmap failed: for memory64 at most 64G is allowed\n"); return NULL; + } #endif if (prot & MMAP_PROT_READ) @@ -155,7 +157,7 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) if (addr == MAP_FAILED) { os_printf("mmap failed with errno: %d, hint: %p, size: %" PRIu64 - ", prot: %d, flags: %d", + ", prot: %d, flags: %d\n", errno, hint, request_size, map_prot, map_flags); return NULL; } diff --git a/core/shared/platform/common/posix/posix_thread.c b/core/shared/platform/common/posix/posix_thread.c index 1d1024606..80b7d6545 100644 --- a/core/shared/platform/common/posix/posix_thread.c +++ b/core/shared/platform/common/posix/posix_thread.c @@ -495,7 +495,7 @@ os_thread_jit_write_protect_np(bool enabled) #define SIG_ALT_STACK_SIZE (32 * 1024) /** - * Whether thread signal enviornment is initialized: + * Whether thread signal environment is initialized: * the signal handler is registered, the stack pages are touched, * the stack guard pages are set and signal alternate stack are set. */ @@ -696,7 +696,7 @@ os_thread_signal_init(os_signal_handler handler) memset(&prev_sig_act_SIGSEGV, 0, sizeof(struct sigaction)); memset(&prev_sig_act_SIGBUS, 0, sizeof(struct sigaction)); - /* Install signal hanlder */ + /* Install signal handler */ sig_act.sa_sigaction = signal_callback; sig_act.sa_flags = SA_SIGINFO | SA_NODEFER; #if WASM_DISABLE_STACK_HW_BOUND_CHECK == 0 diff --git a/core/shared/platform/esp-idf/espidf_file.c b/core/shared/platform/esp-idf/espidf_file.c index be50a2900..4d78df38a 100644 --- a/core/shared/platform/esp-idf/espidf_file.c +++ b/core/shared/platform/esp-idf/espidf_file.c @@ -1032,4 +1032,10 @@ char * os_realpath(const char *path, char *resolved_path) { return realpath(path, resolved_path); -} \ No newline at end of file +} + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/platform/include/platform_api_extension.h b/core/shared/platform/include/platform_api_extension.h index 37b8399b8..d57d0eac7 100644 --- a/core/shared/platform/include/platform_api_extension.h +++ b/core/shared/platform/include/platform_api_extension.h @@ -209,7 +209,7 @@ int os_cond_wait(korp_cond *cond, korp_mutex *mutex); /** - * Wait a condition varible or return if time specified passes. + * Wait a condition variable or return if time specified passes. * * @param cond pointer to condition variable * @param mutex pointer to mutex to protect the condition variable @@ -766,7 +766,7 @@ int os_socket_get_recv_timeout(bh_socket_t socket, uint64 *timeout_us); /** - * Enable re-use of local addresses + * Enable reuse of local addresses * * @param socket the socket to set * @param is_enabled 1 to enable or 0 to disable @@ -777,7 +777,7 @@ int os_socket_set_reuse_addr(bh_socket_t socket, bool is_enabled); /** - * Get whether re-use of local addresses is enabled + * Get whether reuse of local addresses is enabled * * @param socket the socket to set * @param is_enabled 1 for enabled or 0 for disabled @@ -788,7 +788,7 @@ int os_socket_get_reuse_addr(bh_socket_t socket, bool *is_enabled); /** - * Enable re-use of local ports + * Enable reuse of local ports * * @param socket the socket to set * @param is_enabled 1 to enable or 0 to disable @@ -799,7 +799,7 @@ int os_socket_set_reuse_port(bh_socket_t socket, bool is_enabled); /** - * Get whether re-use of local ports is enabled + * Get whether reuse of local ports is enabled * * @param socket the socket to set * @param is_enabled 1 for enabled or 0 for disabled @@ -1120,7 +1120,7 @@ os_dumps_proc_mem_info(char *out, unsigned int size); /** * NOTES: - * Fileystem APIs are required for WASI libc support. If you don't need to + * Filesystem APIs are required for WASI libc support. If you don't need to * support WASI libc, there is no need to implement these APIs. With a * few exceptions, each filesystem function has been named after the equivalent * POSIX filesystem function with an os_ prefix. @@ -1134,12 +1134,12 @@ os_dumps_proc_mem_info(char *out, unsigned int size); * os_file_handle: the file handle type used in the WASI libc fd * table. Filesystem implementations can use it as a means to store any * necessary platform-specific information which may not be directly available - * through the raw OS file handle. Similiar to POSIX file descriptors, file + * through the raw OS file handle. Similar to POSIX file descriptors, file * handles may also refer to sockets, directories, symbolic links or character * devices and any of the filesystem operations which make sense for these * resource types should be supported as far as possible. * - * os_dir_stream: a directory stream type in which fileystem implementations + * os_dir_stream: a directory stream type in which filesystem implementations * can store any necessary state to iterate over the entries in a directory. */ @@ -1166,7 +1166,7 @@ os_fstatat(os_file_handle handle, const char *path, struct __wasi_filestat_t *buf, __wasi_lookupflags_t lookup_flags); /** - * Obtain the file status flags for the provided handle. This is similiar to the + * Obtain the file status flags for the provided handle. This is similar to the * POSIX function fcntl called with the F_GETFL command. * * @param handle the handle for which to obtain the file status flags @@ -1176,7 +1176,7 @@ __wasi_errno_t os_file_get_fdflags(os_file_handle handle, __wasi_fdflags_t *flags); /** - * Set the file status flags for the provided handle. This is similiar to the + * Set the file status flags for the provided handle. This is similar to the * POSIX function fcntl called with the F_SETFL command. * * @param handle the handle for which to set the file status flags @@ -1235,7 +1235,7 @@ os_openat(os_file_handle handle, const char *path, __wasi_oflags_t oflags, wasi_libc_file_access_mode access_mode, os_file_handle *out); /** - * Obtain the file access mode for the provided handle. This is similiar to the + * Obtain the file access mode for the provided handle. This is similar to the * POSIX function fcntl called with the F_GETFL command combined with the * O_ACCMODE mask. * @@ -1480,9 +1480,9 @@ os_file_handle os_convert_stdin_handle(os_raw_file_handle raw_stdin); /** - * Converts a raw file handle to STDOUT to a correponding file handle to STDOUT. - * If the provided raw file handle is invalid, the platform-default raw handle - * for STDOUT will be used. + * Converts a raw file handle to STDOUT to a corresponding file handle to + * STDOUT. If the provided raw file handle is invalid, the platform-default raw + * handle for STDOUT will be used. * * @param raw_stdout a raw file handle to STDOUT * @@ -1492,9 +1492,9 @@ os_file_handle os_convert_stdout_handle(os_raw_file_handle raw_stdout); /** - * Converts a raw file handle to STDERR to a correponding file handle to STDERR. - * If the provided raw file handle is invalid, the platform-default raw handle - * for STDERR will be used. + * Converts a raw file handle to STDERR to a corresponding file handle to + * STDERR. If the provided raw file handle is invalid, the platform-default raw + * handle for STDERR will be used. * * @param raw_stderr a raw file handle to STDERR * @@ -1607,6 +1607,15 @@ os_is_dir_stream_valid(os_dir_stream *dir_stream); os_file_handle os_get_invalid_handle(void); +/** + * Returns an invalid raw file handle that is guaranteed to cause failure when + * called with any filesystem operation. + * + * @return the invalid raw file handle + */ +os_raw_file_handle +os_invalid_raw_handle(void); + /** * Checks whether the given file handle is valid. An invalid handle is * guaranteed to cause failure when called with any filesystem operation. diff --git a/core/shared/platform/linux-sgx/sgx_ipfs.c b/core/shared/platform/linux-sgx/sgx_ipfs.c index 4f4bbef9b..3a46a4170 100644 --- a/core/shared/platform/linux-sgx/sgx_ipfs.c +++ b/core/shared/platform/linux-sgx/sgx_ipfs.c @@ -53,7 +53,7 @@ convert_sgx_errno(int error) * continue (only used when no EXXX is returned) */ case SGX_ERROR_FILE_CANT_WRITE_RECOVERY_FILE: return EIO; - /* When openeing the file, recovery is needed, but the recovery + /* When opening the file, recovery is needed, but the recovery * process failed */ case SGX_ERROR_FILE_RECOVERY_NEEDED: return EIO; diff --git a/core/shared/platform/linux-sgx/sgx_platform.c b/core/shared/platform/linux-sgx/sgx_platform.c index d97883a8e..db350bc8f 100644 --- a/core/shared/platform/linux-sgx/sgx_platform.c +++ b/core/shared/platform/linux-sgx/sgx_platform.c @@ -149,8 +149,10 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) page_size = getpagesize(); aligned_size = (size + page_size - 1) & ~(page_size - 1); - if (aligned_size >= UINT32_MAX) + if (aligned_size >= UINT32_MAX) { + os_printf("mmap failed: request size overflow due to paging\n"); return NULL; + } ret = sgx_alloc_rsrv_mem(aligned_size); if (ret == NULL) { diff --git a/core/shared/platform/linux-sgx/sgx_socket.h b/core/shared/platform/linux-sgx/sgx_socket.h index edf977dd6..b1a91cf1c 100644 --- a/core/shared/platform/linux-sgx/sgx_socket.h +++ b/core/shared/platform/linux-sgx/sgx_socket.h @@ -51,7 +51,7 @@ extern "C" { #define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ -#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */ +#define TCP_QUICKACK 12 /* Bock/re-enable quick ACKs. */ #define TCP_CONGESTION 13 /* Congestion control algorithm. */ #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ diff --git a/core/shared/platform/nuttx/nuttx_platform.c b/core/shared/platform/nuttx/nuttx_platform.c index dcefb7e84..da5bf8673 100644 --- a/core/shared/platform/nuttx/nuttx_platform.c +++ b/core/shared/platform/nuttx/nuttx_platform.c @@ -10,6 +10,8 @@ #include #endif +#include + int bh_platform_init() { @@ -115,11 +117,18 @@ os_dcache_flush() && defined(CONFIG_ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS) up_textheap_data_sync(); #endif +#ifndef CONFIG_BUILD_KERNEL + up_flush_dcache_all(); +#endif } void os_icache_flush(void *start, size_t len) -{} +{ +#ifndef CONFIG_BUILD_KERNEL + up_invalidate_icache((uintptr_t)start, (uintptr_t)start + len); +#endif +} #if (WASM_MEM_DUAL_BUS_MIRROR != 0) void * diff --git a/core/shared/platform/riot/riot_platform.c b/core/shared/platform/riot/riot_platform.c index 9accc5eb8..b48033247 100644 --- a/core/shared/platform/riot/riot_platform.c +++ b/core/shared/platform/riot/riot_platform.c @@ -95,3 +95,9 @@ os_dcache_flush(void) void os_icache_flush(void *start, size_t len) {} + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/platform/riot/riot_thread.c b/core/shared/platform/riot/riot_thread.c index a9062bfec..893ed0b45 100644 --- a/core/shared/platform/riot/riot_thread.c +++ b/core/shared/platform/riot/riot_thread.c @@ -282,7 +282,7 @@ os_thread_join(korp_tid thread, void **value_ptr) mutex_unlock(&thread_data->wait_list_lock); sema_wait(&node.sem); - // get the return value pointer conted may not be availible after return + // get the return value pointer conted may not be available after return if (value_ptr) (*value_ptr) = node.ret; /* Wait some time for the thread to be actually terminated */ diff --git a/core/shared/platform/rt-thread/rtt_file.c b/core/shared/platform/rt-thread/rtt_file.c index b9fd1f9fa..f858f7eae 100644 --- a/core/shared/platform/rt-thread/rtt_file.c +++ b/core/shared/platform/rt-thread/rtt_file.c @@ -192,3 +192,9 @@ posix_fallocate(int __fd, off_t __offset, off_t __length) errno = ENOSYS; return -1; } + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/platform/windows/win_file.c b/core/shared/platform/windows/win_file.c index 770c5c741..55ea77ac7 100644 --- a/core/shared/platform/windows/win_file.c +++ b/core/shared/platform/windows/win_file.c @@ -1810,3 +1810,9 @@ os_realpath(const char *path, char *resolved_path) return resolved_path; } + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return INVALID_HANDLE_VALUE; +} diff --git a/core/shared/platform/windows/win_memmap.c b/core/shared/platform/windows/win_memmap.c index db0f38a56..994c3e4e2 100644 --- a/core/shared/platform/windows/win_memmap.c +++ b/core/shared/platform/windows/win_memmap.c @@ -39,9 +39,10 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) page_size = os_getpagesize(); request_size = (size + page_size - 1) & ~(page_size - 1); - if (request_size < size) - /* integer overflow */ + if (request_size < size) { + printf("mmap failed: request size overflow due to paging\n"); return NULL; + } #if WASM_ENABLE_JIT != 0 /** diff --git a/core/shared/platform/zephyr/zephyr_platform.c b/core/shared/platform/zephyr/zephyr_platform.c index b383def67..3280e542f 100644 --- a/core/shared/platform/zephyr/zephyr_platform.c +++ b/core/shared/platform/zephyr/zephyr_platform.c @@ -255,3 +255,9 @@ set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func, exec_mem_alloc_func = alloc_func; exec_mem_free_func = free_func; } + +os_raw_file_handle +os_invalid_raw_handle(void) +{ + return -1; +} diff --git a/core/shared/utils/bh_assert.h b/core/shared/utils/bh_assert.h index b7c995af8..ec9e632af 100644 --- a/core/shared/utils/bh_assert.h +++ b/core/shared/utils/bh_assert.h @@ -26,7 +26,7 @@ bh_assert_internal(int64 v, const char *file_name, int line_number, #define __has_extension(a) 0 #endif -#if __STDC_VERSION__ >= 201112L \ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \ || (defined(__GNUC__) && __GNUC__ * 0x100 + __GNUC_MINOR__ >= 0x406) \ || __has_extension(c_static_assert) diff --git a/core/shared/utils/bh_list.c b/core/shared/utils/bh_list.c index 7102d42a1..3265ba601 100644 --- a/core/shared/utils/bh_list.c +++ b/core/shared/utils/bh_list.c @@ -7,7 +7,7 @@ #if BH_DEBUG != 0 /** - * Test whehter a pointer value has exist in given list. + * Test whether a pointer value has exist in given list. * * @param list pointer to list. * @param elem pointer to elem that will be inserted into list. diff --git a/core/version.h b/core/version.h index 4fe37e2d7..85e033390 100644 --- a/core/version.h +++ b/core/version.h @@ -3,9 +3,22 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + #ifndef _WAMR_VERSION_H_ #define _WAMR_VERSION_H_ + +/* clang-format off */ #define WAMR_VERSION_MAJOR 2 -#define WAMR_VERSION_MINOR 2 -#define WAMR_VERSION_PATCH 0 +#define WAMR_VERSION_MINOR 3 +#define WAMR_VERSION_PATCH 1 +/* clang-format on */ + #endif diff --git a/core/version.h.in b/core/version.h.in new file mode 100644 index 000000000..e28df65ce --- /dev/null +++ b/core/version.h.in @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + +#ifndef _WAMR_VERSION_H_ +#define _WAMR_VERSION_H_ + +/* clang-format off */ +#define WAMR_VERSION_MAJOR @WAMR_VERSION_MAJOR@ +#define WAMR_VERSION_MINOR @WAMR_VERSION_MINOR@ +#define WAMR_VERSION_PATCH @WAMR_VERSION_PATCH@ +/* clang-format on */ + +#endif diff --git a/doc/build_wamr.md b/doc/build_wamr.md index cde884457..94dd96284 100644 --- a/doc/build_wamr.md +++ b/doc/build_wamr.md @@ -132,7 +132,11 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM ### **Enable 128-bit SIMD feature** - **WAMR_BUILD_SIMD**=1/0, default to enable if not set -> Note: only supported in AOT mode x86-64 target. +> Note: supported in AOT mode, JIT mode, and fast-interpreter mode with SIMDe library. + +### **Enable SIMDe library for SIMD in fast interpreter** +- **WAMR_BUILD_LIB_SIMDE**=1/0, default to disable if not set +> Note: If enabled, SIMDe (SIMD Everywhere) library will be used to implement SIMD operations in fast interpreter mode. ### **Enable Exception Handling** - **WAMR_BUILD_EXCE_HANDLING**=1/0, default to disable if not set @@ -142,6 +146,9 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM ### **Enable Garbage Collection** - **WAMR_BUILD_GC**=1/0, default to disable if not set +### **Set the Garbage Collection heap size** +- **WAMR_BUILD_GC_HEAP_SIZE_DEFAULT**=n, default to 128 kB (131072) if not set + ### **Configure Debug** - **WAMR_BUILD_CUSTOM_NAME_SECTION**=1/0, load the function name from custom name section, default to disable if not set @@ -320,6 +327,10 @@ And the wasm app can calls below APIs to allocate/free memory from/to the shared - **WAMR_BUILD_SHRUNK_MEMORY**=1/0, default to enable if not set > Note: When enabled, this feature will reduce memory usage by decreasing the size of the linear memory, particularly when the `memory.grow` opcode is not used and memory usage is somewhat predictable. +## **Instruction metering** +- **WAMR_BUILD_INSTRUCTION_METERING**=1/0, default to disable if not set +> Note: Enabling this feature allows limiting the number of instructions a wasm module instance can execute. Use the `wasm_runtime_set_instruction_count_limit(...)` API before calling `wasm_runtime_call_*(...)` APIs to enforce this limit. + ## **Combination of configurations:** We can combine the configurations. For example, if we want to disable interpreter, enable AOT and WASI, we can run command: @@ -332,4 +343,21 @@ Or if we want to enable interpreter, disable AOT and WASI, and build as X86_32, ``` Bash cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_LIBC_WASI=0 -DWAMR_BUILD_TARGET=X86_32 +``` + +When enabling SIMD for fast interpreter mode, you'll need to enable both SIMD and the SIMDe library: + +``` Bash + +cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_LIB_SIMDE=1 +``` + +For Valgrind, begin with the following configurations and add additional ones as needed: + +``` Bash + #... + -DCMAKE_BUILD_TYPE=Debug \ + -DWAMR_DISABLE_HW_BOUND_CHECK=0 \ + -DWAMR_DISABLE_WRITE_GS_BASE=0 + #... ``` \ No newline at end of file diff --git a/doc/build_wasm_app.md b/doc/build_wasm_app.md index 95d237346..2cea78069 100644 --- a/doc/build_wasm_app.md +++ b/doc/build_wasm_app.md @@ -90,7 +90,7 @@ There are some useful options that are used to compile C/C++ to Wasm (for a full - **-Wl,--max-memory=\** Maximum size of the linear memory, which must be a multiple of 65536 -- **-z stack-size=\** The auxiliary stack size, which is an area of linear memory, must be smaller than the initial memory size. +- **-z stack-size=\** The auxiliary stack size, which is an area of linear memory, must be smaller than the initial memory size. - **-Wl,--strip-all** Strip all symbols @@ -275,7 +275,7 @@ You can cross compile your project by using the toolchain provided by WAMR. Assume the original `CMakeLists.txt` for `test.c` likes below: ``` cmake -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.14) project(hello_world) add_executable(hello_world test.c) ``` @@ -343,7 +343,7 @@ Usage: wamrc [options] -o output_file wasm_file Use --cpu-features=+help to list all the features supported --opt-level=n Set the optimization level (0 to 3, default is 3) --size-level=n Set the code size level (0 to 3, default is 3) - -sgx Generate code for SGX platform (Intel Software Guard Extention) + -sgx Generate code for SGX platform (Intel Software Guard Extension) --bounds-checks=1/0 Enable or disable the bounds checks for memory access: by default it is disabled in all 64-bit platforms except SGX and in these platforms runtime does bounds checks with hardware trap, diff --git a/doc/embed_wamr.md b/doc/embed_wamr.md index 9a6f685c7..7d9c46f9d 100644 --- a/doc/embed_wamr.md +++ b/doc/embed_wamr.md @@ -22,7 +22,12 @@ set (WAMR_ROOT_DIR path/to/wamr/root) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) -target_link_libraries (your_project vmlib) +# include bh_read_file.h +include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) + +add_executable (your_project main.c ${UNCOMMON_SHARED_SOURCE}) + +target_link_libraries (your_project vmlib -lm) ``` Examples can be found in [CMakeLists.txt of linux platform](../product-mini/platforms/linux/CMakeLists.txt) and [other platforms](../product-mini/platforms). The available features to configure can be found in [Build WAMR vmcore](./build_wamr.md#wamr-vmcore-cmake-building-configurations). @@ -31,6 +36,10 @@ Developer can also use Makefile to embed WAMR, by defining macros and including ## The runtime initialization ``` C + #include "bh_platform.h" + #include "bh_read_file.h" + #include "wasm_export.h" + char *buffer, error_buf[128]; wasm_module_t module; wasm_module_inst_t module_inst; @@ -42,7 +51,7 @@ Developer can also use Makefile to embed WAMR, by defining macros and including wasm_runtime_init(); /* read WASM file into a memory buffer */ - buffer = read_wasm_binary_to_buffer(…, &size); + buffer = bh_read_file_to_buffer(…, &size); /* add line below if we want to export native functions to WASM app */ wasm_runtime_register_natives(...); diff --git a/doc/other_wasm_compilers.md b/doc/other_wasm_compilers.md index 5aa505ab3..1ab5901fa 100644 --- a/doc/other_wasm_compilers.md +++ b/doc/other_wasm_compilers.md @@ -62,7 +62,7 @@ You will get ```test.wasm``` which is the WASM app binary. ## Using Docker -Another method availble is using [Docker](https://www.docker.com/). We assume you've already configured Docker (see Platform section above) and have a running interactive shell. Currently the Dockerfile only supports compiling apps with clang, with Emscripten planned for the future. +Another method available is using [Docker](https://www.docker.com/). We assume you've already configured Docker (see Platform section above) and have a running interactive shell. Currently the Dockerfile only supports compiling apps with clang, with Emscripten planned for the future. Use the clang-8 command below to build the WASM C source code into the WASM binary. diff --git a/doc/ref_types.md b/doc/ref_types.md index 7fefa999d..2cd300497 100644 --- a/doc/ref_types.md +++ b/doc/ref_types.md @@ -4,6 +4,6 @@ WebAssembly [reference-types](https://github.com/WebAssembly/reference-types) pr WAMR has implemented the reference-types proposal. WAMR allows a native method to pass a host object to a WASM application as an `externref` parameter or receives a host object from a WASM application as an `externref` result. Internally, WAMR won't try to parse or dereference `externref`. It is an opaque type. -The restriction of using `externref` in a native method is the host object has to be the value of a `unintptr_t` variable. In other words, it takes **8 bytes** on 64-bit machine and **4 bytes** on 32-bit machines. Please keep that in mind especially when calling `wasm_runtime_call_wasm`. +The restriction of using `externref` in a native method is the host object has to be the value of a `uintptr_t` variable. In other words, it takes **8 bytes** on 64-bit machine and **4 bytes** on 32-bit machines. Please keep that in mind especially when calling `wasm_runtime_call_wasm`. Please ref to the [sample](../samples/ref-types) for more details. diff --git a/doc/semantic_version.md b/doc/semantic_version.md deleted file mode 100644 index 9fdd65d60..000000000 --- a/doc/semantic_version.md +++ /dev/null @@ -1,21 +0,0 @@ -# WAMR uses semantic versioning - -WAMR uses the _semantic versioning_ to replace the current _date versioning_ system. - -There are three parts in the new version string: - -- _major_. Any incompatible modification, on both ABI and APIs, will lead an increment - in the value of _major_. APIs includes: `wasm_export.h`, `wasm_c_api.h`, - _sections in AOT files_, and so on. -- _minor_. It represents new features. It includes not just MVP or POST-MVP features - but also WASI features and WAMR private ones. -- _patch_. It represents patches. - -## Legacy versions - -All legacy versions(tags) will keep their current status. No existing release names -and links will be changed. - -## Reference - -- [Semantic Versioning 2.0.0](https://semver.org/) diff --git a/doc/source_debugging_aot.md b/doc/source_debugging_aot.md index 129287bde..62ed51e0b 100644 --- a/doc/source_debugging_aot.md +++ b/doc/source_debugging_aot.md @@ -90,7 +90,7 @@ wamrc -o test.aot test.wasm function of the AOT-compiled wasm module. * WAMR AOT debugging uses the GDB JIT loader mechanism to load - the debug info of the debugee module. + the debug info of the debuggee module. On some platforms including macOS, you need to enable it explicitly. (`settings set plugin.jit-loader.gdb.enable on`) diff --git a/doc/stability_release.md b/doc/stability_release.md new file mode 100644 index 000000000..78e034a3d --- /dev/null +++ b/doc/stability_release.md @@ -0,0 +1,33 @@ +# Semantic Versioning + +WAMR has adopted [semantic versioning](https://semver.org/) to replace the former *date versioning system*. The new version string consists of three parts: + +- *major*: Any change that is not compatible with previous versions, affecting either the ABI or APIs, will result in an increase in the major version number. APIs include: wasm_export.h, wasm_c_api.h, sections in AOT files, among others. +- *minor*: This number increases with the addition of new features. This encompasses not only MVP (Minimum Viable Product) or POST-MVP features but also WebAssembly System Interface (WASI) features and WAMR-specific features. +- *patch*: This number is incremented for patches. + +## Legacy releases + +All previous versions (tags) will retain their current status. There will be no changes to existing release names and links. + +# Release Process + +WAMR has been deployed across various devices. A frequent release cycle would strain customers' testing resources and add extra deployment work. Two factors can trigger a new WAMR release: + +- Community requests, particularly following the integration of significant and new features. +- Security vulnerabilities and critical bug fixes that ensure correctness. + +Patch releases will be made only to address security vulnerabilities and critical issues related to default behavior in prior releases. + +Once a release decision has been made: + +- Create a PR that: + 1. Modifies *build-scripts/version.cmake*. + 2. Executes cmake configuration to update the version. + 3. Updates *RELEASE_NOTES.md*. +- A checklist of the PR includes + - [ ] *build-scripts/version.cmake* + - [ ] *core/version.h* + - [ ] *RELEASE_NOTES.md* +- Once the PR is merged, create a new tag. +- Initiate the release process by triggering *the binary release processes* in *Actions*. diff --git a/doc/stability_wasm_proposals.md b/doc/stability_wasm_proposals.md index 98617d15b..e2bbe54e8 100644 --- a/doc/stability_wasm_proposals.md +++ b/doc/stability_wasm_proposals.md @@ -15,7 +15,6 @@ Users can turn those features on or off by using compilation options. If a relev | Proposal | >= Phase 4 | Compilation Option | | ------------------------------------- | ---------- | ------------------------ | | Bulk memory operations | Yes | `WAMR_BUILD_BULK_MEMORY` | -| Extended Constant Expressions | Yes | N/A | | Fixed-width SIMD[^1] | Yes | `WAMR_BUILD_SIMD` | | Multi-value | Yes | N/A | | Non-trapping float-to-int conversions | Yes | N/A | @@ -35,7 +34,7 @@ Users can turn those features on or off by using compilation options. If a relev | Multiple memories[^3] | Yes | `WAMR_BUILD_MULTI_MEMORY` | | Reference-Typed Strings | No | `WAMR_BUILD_STRINGREF` | | Tail call | Yes | `WAMR_BUILD_TAIL_CALL` | -| Thread[^4] | Yes | `WAMR_BUILD_SHARED_MEMORY` | +| Threads[^4] | Yes | `WAMR_BUILD_SHARED_MEMORY` | | Typed Function References | Yes | `WAMR_BUILD_GC` | [^2]: @@ -54,6 +53,7 @@ Users can turn those features on or off by using compilation options. If a relev | Branch Hinting | Yes | | Custom Annotation Syntax in the Text Format | Yes | | Exception handling[^5] | Yes | +| Extended Constant Expressions | Yes | | Import/Export of Mutable Globals | Yes | | JS String Builtins | Yes | | Relaxed SIMD | Yes | diff --git a/idf_component.yml b/idf_component.yml index ff25b32cb..a8083a742 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "2.0.0" +version: "2.2.0~3" description: WebAssembly Micro Runtime - A lightweight standalone WebAssembly (Wasm) runtime with small footprint, high performance and highly configurable features url: https://bytecodealliance.org/ repository: https://github.com/bytecodealliance/wasm-micro-runtime.git @@ -11,5 +11,7 @@ targets: - esp32s3 - esp32c3 - esp32c6 + - esp32p4 + - esp32c5 examples: - path: product-mini/platforms/esp-idf \ No newline at end of file diff --git a/language-bindings/python/src/wamr/wasmcapi/ffi.py b/language-bindings/python/src/wamr/wasmcapi/ffi.py index 82292335b..e8a084c14 100644 --- a/language-bindings/python/src/wamr/wasmcapi/ffi.py +++ b/language-bindings/python/src/wamr/wasmcapi/ffi.py @@ -112,12 +112,12 @@ def wasm_vec_to_list(vec): wasm_frame_vec_t, wasm_extern_vec_t, ] - known_vec_pointer_type = [POINTER(type) for type in known_vec_type] + known_vec_pointer_type = [POINTER(vec_type) for vec_type in known_vec_type] - if any([isinstance(vec, type) for type in known_vec_pointer_type]): + if any([isinstance(vec, pointer_type) for pointer_type in known_vec_pointer_type]): vec = dereference(vec) return [vec.data[i] for i in range(vec.num_elems)] - elif any([isinstance(vec, type) for type in known_vec_type]): + elif any([isinstance(vec, vec_type) for vec_type in known_vec_type]): return [vec.data[i] for i in range(vec.num_elems)] else: raise RuntimeError("not a known vector type") @@ -405,7 +405,7 @@ def __compare_wasm_val_t(self, other): elif WASM_F32 == self.kind: return self.of.f32 == other.of.f32 elif WASM_F64 == self.kind: - return self.of.f64 == other.of.f63 + return self.of.f64 == other.of.f64 elif WASM_EXTERNREF == self.kind: raise RuntimeError("FIXME") else: diff --git a/language-bindings/python/utils/create_lib.sh b/language-bindings/python/utils/create_lib.sh index 801186e97..157135880 100755 --- a/language-bindings/python/utils/create_lib.sh +++ b/language-bindings/python/utils/create_lib.sh @@ -17,6 +17,7 @@ cmake \ -DWAMR_BUILD_LIB_PTHREAD=1 \ -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DWAMR_BUILD_LIB_WASI=1 \ + -DBUILD_SHARED_LIBS=ON \ .. make -j diff --git a/language-bindings/python/wamr-api/README.md b/language-bindings/python/wamr-api/README.md index 38a440144..b2ef1e105 100644 --- a/language-bindings/python/wamr-api/README.md +++ b/language-bindings/python/wamr-api/README.md @@ -1,14 +1,17 @@ -# WARM API +# WAMR API -* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`. +* **Notice**: The python package `wamr.wamrapi.wamr` requires a python version >= `3.10`. ## Setup ### Pre-requisites +#### Install requirements +Before proceeding it is necessary to make sure your Python environment is correctly configured. To do ths open a terminal session in this directory and perfom the following: -Install requirements, ```shell +python3 -m venv venv +source venv/bin/activate pip install -r requirements.txt ``` diff --git a/product-mini/README.md b/product-mini/README.md index 1e7a1f3cf..5563d9579 100644 --- a/product-mini/README.md +++ b/product-mini/README.md @@ -87,8 +87,8 @@ make ``` Note: -By default, the LLVM Orc JIT with Lazy compilation is enabled to speedup the lanuching process and reduce -the JIT compilation time by creating backend threads to compile the WASM functions parallely, and for the +By default, the LLVM Orc JIT with Lazy compilation is enabled to speedup the launching process and reduce +the JIT compilation time by creating backend threads to compile the WASM functions parallelly, and for the main thread, the functions in the module will not be compiled until they are firstly called and haven't been compiled by the compilation threads. @@ -114,7 +114,7 @@ mkdir build && cd build cmake .. -DWAMR_BUILD_FAST_JTI=1 -DWAMR_BUILD_JIT=1 make ``` -The Multi-tier JIT is a two level JIT tier-up engine, which launchs Fast JIT to run the wasm module as soon as possible and creates backend threads to compile the LLVM JIT functions at the same time, and when the LLVM JIT functions are compiled, the runtime will switch the extecution from the Fast JIT jitted code to LLVM JIT jitted code gradually, so as to gain the best performance. +The Multi-tier JIT is a two level JIT tier-up engine, which launches Fast JIT to run the wasm module as soon as possible and creates backend threads to compile the LLVM JIT functions at the same time, and when the LLVM JIT functions are compiled, the runtime will switch the extecution from the Fast JIT jitted code to LLVM JIT jitted code gradually, so as to gain the best performance. ## Linux SGX (Intel Software Guard Extension) @@ -335,7 +335,7 @@ $ cd build $ cmake .. $ make $ # check output in distribution/wasm -$ # include/ includes all necesary head files +$ # include/ includes all necessary head files $ # lib includes libiwasm.so ``` @@ -350,7 +350,7 @@ $ cmake .. -DWAMR_BUILD_TARGET=AARCH64 -DANDROID_ABI=arm64-v8a # 64-bit ARM C ## NuttX -WAMR is intergrated with NuttX, just enable the WAMR in Kconfig option (Application Configuration/Interpreters). +WAMR is integrated with NuttX, just enable the WAMR in Kconfig option (Application Configuration/Interpreters). ## ESP-IDF diff --git a/product-mini/app-samples/hello-world-cmake/CMakeLists.txt b/product-mini/app-samples/hello-world-cmake/CMakeLists.txt index b41fe0a51..6131b6977 100644 --- a/product-mini/app-samples/hello-world-cmake/CMakeLists.txt +++ b/product-mini/app-samples/hello-world-cmake/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.14) project(hello_world) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument") diff --git a/product-mini/platforms/android/CMakeLists.txt b/product-mini/platforms/android/CMakeLists.txt index 5c0525917..19bc1b11e 100644 --- a/product-mini/platforms/android/CMakeLists.txt +++ b/product-mini/platforms/android/CMakeLists.txt @@ -107,6 +107,8 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") @@ -135,6 +137,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/common/libc_wasi.c b/product-mini/platforms/common/libc_wasi.c index 2f0b35125..b0f86e5f4 100644 --- a/product-mini/platforms/common/libc_wasi.c +++ b/product-mini/platforms/common/libc_wasi.c @@ -47,7 +47,7 @@ libc_wasi_print_help(void) "--map-dir=\n"); printf(" --addr-pool= Grant wasi access to the given network " "addresses in\n"); - printf(" CIDR notation to the program, seperated " + printf(" CIDR notation to the program, separated " "with ',',\n"); printf(" for example:\n"); printf(" --addr-pool=1.2.3.4/15,2.3.4.5/16\n"); diff --git a/product-mini/platforms/common/wasm_proposal.c b/product-mini/platforms/common/wasm_proposal.c new file mode 100644 index 000000000..3c04d46ec --- /dev/null +++ b/product-mini/platforms/common/wasm_proposal.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include + +#include "bh_platform.h" + +void +wasm_proposal_print_status(void) +{ + printf("About Wasm Proposals:\n"); + printf(" Always-on:\n"); + printf(" - Multi-value\n"); + printf(" - Non-trapping float-to-int conversions\n"); + printf(" - Sign-extension operators\n"); + printf(" - WebAssembly C and C++ API\n"); + printf(" Compilation Configurable. 0 is OFF. 1 is ON:\n"); + printf(" - Bulk Memory Operation via WASM_ENABLE_BULK_MEMORY: %u\n", + WASM_ENABLE_BULK_MEMORY); + printf(" - Fixed-Width SIMD via WASM_ENABLE_SIMD: %u\n", + WASM_ENABLE_SIMD); + printf(" - Garbage Collection via WASM_ENABLE_GC: %u\n", WASM_ENABLE_GC); + printf( + " - Legacy Exception Handling via WASM_ENABLE_EXCE_HANDLING: %u\n", + WASM_ENABLE_EXCE_HANDLING); + printf(" - Memory64 via WASM_ENABLE_MEMORY64: %u\n", + WASM_ENABLE_MEMORY64); + printf(" - Multiple Memory via WASM_ENABLE_MULTI_MEMORY: %u\n", + WASM_ENABLE_MULTI_MEMORY); + printf(" - Reference Types via WASM_ENABLE_REF_TYPES: %u\n", + WASM_ENABLE_REF_TYPES); + printf(" - Reference-Typed Strings via WASM_ENABLE_REF_TYPES: %u\n", + WASM_ENABLE_REF_TYPES); + printf(" - Tail Call via WASM_ENABLE_TAIL_CALL: %u\n", + WASM_ENABLE_TAIL_CALL); + printf(" - Threads via WASM_ENABLE_SHARED_MEMORY: %u\n", + WASM_ENABLE_SHARED_MEMORY); + printf(" - Typed Function References via WASM_ENABLE_GC: %u\n", + WASM_ENABLE_GC); + printf(" Unsupported (>= Phase4):\n"); + printf(" - Branch Hinting\n"); + printf(" - Custom Annotation Syntax in the Text Format\n"); + printf(" - Exception handling\n"); + printf(" - Extended Constant Expressions\n"); + printf(" - Import/Export of Mutable Globals\n"); + printf(" - JS String Builtins\n"); + printf(" - Relaxed SIMD\n"); +} diff --git a/product-mini/platforms/cosmopolitan/CMakeLists.txt b/product-mini/platforms/cosmopolitan/CMakeLists.txt index 8533ea68c..7676ea6fb 100644 --- a/product-mini/platforms/cosmopolitan/CMakeLists.txt +++ b/product-mini/platforms/cosmopolitan/CMakeLists.txt @@ -132,6 +132,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (vmlib) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -160,6 +161,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) install (TARGETS iwasm DESTINATION bin) @@ -168,6 +171,8 @@ target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN add_library (libiwasm STATIC ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/darwin/CMakeLists.txt b/product-mini/platforms/darwin/CMakeLists.txt index 12ed8052f..cd7c8bc88 100644 --- a/product-mini/platforms/darwin/CMakeLists.txt +++ b/product-mini/platforms/darwin/CMakeLists.txt @@ -1,10 +1,12 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm) +option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) + set (WAMR_BUILD_PLATFORM "darwin") # Reset default linker flags @@ -115,21 +117,41 @@ set (CMAKE_MACOSX_RPATH True) set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) +target_link_libraries (iwasm vmlib) -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) -install (TARGETS libiwasm DESTINATION lib) +set_version_info (vmlib) -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) +target_include_directories(vmlib INTERFACE + $ +) -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) +set (WAMR_PUBLIC_HEADERS + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h + ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h +) +set_target_properties (vmlib PROPERTIES + OUTPUT_NAME iwasm + PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}" +) + +target_link_libraries (vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) + +install (TARGETS vmlib + EXPORT iwasmTargets + DESTINATION lib + PUBLIC_HEADER DESTINATION include +) + +install_iwasm_package () diff --git a/product-mini/platforms/esp-idf/CMakeLists.txt b/product-mini/platforms/esp-idf/CMakeLists.txt index 8472df8dd..309949a20 100644 --- a/product-mini/platforms/esp-idf/CMakeLists.txt +++ b/product-mini/platforms/esp-idf/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # from ESP-IDF 4.0 examples/build_system/cmake/idf_as_lib -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.14) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/product-mini/platforms/esp-idf/README.md b/product-mini/platforms/esp-idf/README.md new file mode 100644 index 000000000..eb71f09cd --- /dev/null +++ b/product-mini/platforms/esp-idf/README.md @@ -0,0 +1,91 @@ +# How to Use WAMR with ESP-IDF + +ESP-IDF is the official development framework for Espressif SoCs, supporting Windows, Linux, and macOS. WAMR (WebAssembly Micro Runtime) can be integrated as a standard [ESP-IDF](https://github.com/espressif/esp-idf) component. + +## 1. Setup the ESP-IDF Development Environment + +This example demonstrates how to use WAMR with ESP-IDF. Before proceeding, ensure you have the ESP-IDF development environment installed. For the relevant process, please refer to ESP-IDF [documents](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html). + +### Prerequisites + +#### Software Requirements + +* ESP-IDF v4.4.0 and above. + +#### Hardware Requirements + +* A development board with one of the following SoCs: + + - ESP32 + + - ESP32-C3 + + - ESP32-S3 + + - ESP32-C6 + + - ESP32-P4 + + - ESP32-C5 + +* See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it. + +> Note: Different chips require different ESP-IDF versions, please check [ESP-IDF Release and SoC Compatibility](https://github.com/espressif/esp-idf?tab=readme-ov-file#esp-idf-release-and-soc-compatibility) before proceeding. + +### Installation Steps + +1. Navigate to the ESP-IDF root directory. + +2. Run the installation script based on your OS: + + - Linux/MacOS + + ``` + ./install.sh + ``` + + - Windows + + ``` + ./install.bat + ``` + +3. If successful, you should see: + + ``` + All done! You can now run: + + . ./export.sh + ``` + +## 2. Compiling and Running the Project + +### Set the Target Chip + +Switch to the project directory and specify the target chip: + +```bash +idf.py set-target +``` + +### Configure the project + +Open the configuration menu: + +```bash +idf.py menuconfig +``` + +To modify WAMR settings, navigate to: `Component config -> WASM Micro Runtime` + +### Build and Flash + +Run the following command to compile, flash, and monitor the application: + +```bash +idf.py -p PORT flash monitor +``` + +(To exit the serial monitor, type ``Ctrl-]``.) + +See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects. \ No newline at end of file diff --git a/product-mini/platforms/esp-idf/build_and_run.sh b/product-mini/platforms/esp-idf/build_and_run.sh index 7ce1b57a5..4b8d248cb 100755 --- a/product-mini/platforms/esp-idf/build_and_run.sh +++ b/product-mini/platforms/esp-idf/build_and_run.sh @@ -7,16 +7,20 @@ ESP32_TARGET="esp32" ESP32C3_TARGET="esp32c3" ESP32S3_TARGET="esp32s3" ESP32C6_TARGET="esp32c6" +ESP32P4_TARGET="esp32p4" +ESP32C5_TARGET="esp32c5" usage () { echo "USAGE:" - echo "$0 $ESP32_TARGET|$ESP32C3_TARGET|$ESP32S3_TARGET" + echo "$0 $ESP32_TARGET|$ESP32C3_TARGET|$ESP32S3_TARGET|$ESP32C6_TARGET|$ESP32P4_TARGET|$ESP32C5_TARGET" echo "Example:" echo " $0 $ESP32_TARGET" echo " $0 $ESP32C3_TARGET" echo " $0 $ESP32S3_TARGET" echo " $0 $ESP32C6_TARGET" + echo " $0 $ESP32P4_TARGET" + echo " $0 $ESP32C5_TARGET" exit 1 } @@ -26,12 +30,18 @@ fi TARGET=$1 +if [ "$TARGET" = "$ESP32C5_TARGET" ]; then + IDF_ST_CMD="idf.py --preview set-target $TARGET" +else + IDF_ST_CMD="idf.py set-target $TARGET" +fi + if [[ -z "${WAMR_PATH}" ]]; then export WAMR_PATH=$PWD/../../.. fi rm -rf build -idf.py set-target $TARGET +$IDF_ST_CMD idf.py build idf.py flash diff --git a/product-mini/platforms/freebsd/CMakeLists.txt b/product-mini/platforms/freebsd/CMakeLists.txt index dd1bbc41a..fccc52323 100644 --- a/product-mini/platforms/freebsd/CMakeLists.txt +++ b/product-mini/platforms/freebsd/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm) @@ -113,17 +113,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/ios/CMakeLists.txt b/product-mini/platforms/ios/CMakeLists.txt index ea5a4f4b9..ca54aa155 100644 --- a/product-mini/platforms/ios/CMakeLists.txt +++ b/product-mini/platforms/ios/CMakeLists.txt @@ -139,6 +139,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/linux-sgx/CMakeLists.txt b/product-mini/platforms/linux-sgx/CMakeLists.txt index 20b3fdfac..af911a0db 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm) @@ -98,6 +98,11 @@ if (NOT DEFINED WAMR_BUILD_STATIC_PGO) set (WAMR_BUILD_STATIC_PGO 0) endif () +if (NOT DEFINED WAMR_BUILD_REF_TYPES) + # Enable reference types by default + set (WAMR_BUILD_REF_TYPES 1) +endif () + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -ffunction-sections -fdata-sections \ -Wall -Wno-unused-parameter -Wno-pedantic \ @@ -107,6 +112,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt index aa3de6dac..5104769d7 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm) @@ -78,6 +78,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux-sgx/enclave-sample/App/App.cpp b/product-mini/platforms/linux-sgx/enclave-sample/App/App.cpp index 9f24cdaa0..fc997868b 100644 --- a/product-mini/platforms/linux-sgx/enclave-sample/App/App.cpp +++ b/product-mini/platforms/linux-sgx/enclave-sample/App/App.cpp @@ -153,7 +153,7 @@ enclave_init(sgx_enclave_id_t *p_eid) return 0; } - /* reopen the file with write capablity */ + /* reopen the file with write capability */ fp = freopen(token_path, "wb", fp); if (fp == NULL) return 0; @@ -228,7 +228,7 @@ print_help() printf(" to the program, for example:\n"); printf(" --dir= --dir=\n"); printf(" --addr-pool= Grant wasi access to the given network addresses in\n"); - printf(" CIDR notation to the program, seperated with ',',\n"); + printf(" CIDR notation to the program, separated with ',',\n"); printf(" for example:\n"); printf(" --addr-pool=1.2.3.4/15,2.3.4.5/16\n"); printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n"); diff --git a/product-mini/platforms/linux-sgx/enclave-sample/App/pal_api.h b/product-mini/platforms/linux-sgx/enclave-sample/App/pal_api.h index 6f6ae7327..2db1fbb25 100644 --- a/product-mini/platforms/linux-sgx/enclave-sample/App/pal_api.h +++ b/product-mini/platforms/linux-sgx/enclave-sample/App/pal_api.h @@ -67,7 +67,7 @@ struct wamr_pal_create_process_args { // Mandatory field. Must not be NULL. const char *path; - // Argments array pass to new process. + // Arguments array pass to new process. // // The arguments to the command. By convention, the argv[0] should be the // program name. And the last element of the array must be NULL to indicate diff --git a/product-mini/platforms/linux/CMakeLists.txt b/product-mini/platforms/linux/CMakeLists.txt index 321c4a955..cef8329d7 100644 --- a/product-mini/platforms/linux/CMakeLists.txt +++ b/product-mini/platforms/linux/CMakeLists.txt @@ -7,6 +7,8 @@ include(CheckPIESupported) project (iwasm) +option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) + set (CMAKE_VERBOSE_MAKEFILE OFF) set (WAMR_BUILD_PLATFORM "linux") @@ -126,13 +128,7 @@ endif () # if enable wasi-nn, both wasi-nn-backends and iwasm # need to use same WAMR (dynamic) libraries if (WAMR_BUILD_WASI_NN EQUAL 1) - set (WAMR_BUILD_SHARED 1) -endif () - -if (NOT DEFINED WAMR_BUILD_SHARED) - set (WAMR_BUILD_SHARED 0) -elseif (WAMR_BUILD_SHARED EQUAL 1) - message ("build WAMR as shared libraries") + set (BUILD_SHARED_LIBS ON) endif () set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) @@ -140,8 +136,6 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) -set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -170,23 +164,40 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_link_libraries(iwasm - $<$:libiwasm> $<$>:vmlib> - ${LLVM_AVAILABLE_LIBS} - ${UV_A_LIBS} - -lm - -ldl - -lpthread -) +target_link_libraries(iwasm vmlib) install (TARGETS iwasm DESTINATION bin) -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) -install (TARGETS libiwasm DESTINATION lib) +set_version_info (vmlib) -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) +target_include_directories(vmlib INTERFACE + $ +) -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) +set (WAMR_PUBLIC_HEADERS + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h + ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h +) + +set_target_properties (vmlib PROPERTIES + OUTPUT_NAME iwasm + PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}" + POSITION_INDEPENDENT_CODE ON +) + +target_link_libraries (vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) + +install (TARGETS vmlib + EXPORT iwasmTargets + DESTINATION lib + PUBLIC_HEADER DESTINATION include +) + +install_iwasm_package () diff --git a/product-mini/platforms/nuttx/CMakeLists.txt b/product-mini/platforms/nuttx/CMakeLists.txt index 27ddd9fa9..997a82e41 100644 --- a/product-mini/platforms/nuttx/CMakeLists.txt +++ b/product-mini/platforms/nuttx/CMakeLists.txt @@ -7,7 +7,19 @@ set(WAMR_BUILD_PLATFORM nuttx) if(CONFIG_ARCH_ARMV6M) set(WAMR_BUILD_TARGET THUMBV6M) elseif(CONFIG_ARCH_ARMV7A) - set(WAMR_BUILD_TARGET THUMBV7) + if(CONFIG_ARM_THUMB) + if(CONFIG_ARCH_FPU) + set(WAMR_BUILD_TARGET THUMBV7_VFP) + else() + set(WAMR_BUILD_TARGET THUMBV7) + endif() + else() + if(CONFIG_ARCH_FPU) + set(WAMR_BUILD_TARGET ARMV7_VFP) + else() + set(WAMR_BUILD_TARGET ARMV7) + endif() + endif() elseif(CONFIG_ARCH_ARMV7M) set(WAMR_BUILD_TARGET THUMBV7EM) elseif(CONFIG_ARCH_ARMV8M) @@ -200,7 +212,7 @@ set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) # enable WAMR build system include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -# NuttX wamr lib complie required: `WAMR_SOURCES` `WAMR_CFLAGS` `WAMR_INCDIRS` +# NuttX wamr lib compile required: `WAMR_SOURCES` `WAMR_CFLAGS` `WAMR_INCDIRS` # `WAMR_DEFINITIONS` set(WAMR_SOURCES ${WAMR_RUNTIME_LIB_SOURCE}) set(WAMR_CFLAGS -Wno-shadow -Wno-unused-variable diff --git a/product-mini/platforms/posix/main.c b/product-mini/platforms/posix/main.c index af50223a4..2790a12eb 100644 --- a/product-mini/platforms/posix/main.c +++ b/product-mini/platforms/posix/main.c @@ -18,6 +18,8 @@ #include "../common/libc_wasi.c" #endif +#include "../common/wasm_proposal.c" + #if BH_HAS_DLFCN #include #endif @@ -50,7 +52,11 @@ print_help(void) printf(" --multi-tier-jit Run the wasm app with multi-tier jit mode\n"); #endif printf(" --stack-size=n Set maximum stack size in bytes, default is 64 KB\n"); - printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB\n"); +#if WASM_ENABLE_LIBC_WASI !=0 + printf(" --heap-size=n Set maximum heap size in bytes, default is 0 KB when libc wasi is enabled\n"); +#else + printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n"); +#endif #if WASM_ENABLE_FAST_JIT != 0 printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n"); printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024); @@ -798,6 +804,8 @@ main(int argc, char *argv[]) wasm_runtime_get_version(&major, &minor, &patch); printf("iwasm %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, minor, patch); + printf("\n"); + wasm_proposal_print_status(); return 0; } else { diff --git a/product-mini/platforms/riot/CMakeLists.txt b/product-mini/platforms/riot/CMakeLists.txt index 003283262..cc98146c5 100644 --- a/product-mini/platforms/riot/CMakeLists.txt +++ b/product-mini/platforms/riot/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2020 TU Bergakademie Freiberg Karl Fessel # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.14) set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") @@ -62,3 +62,5 @@ include_directories(SYSTEM ${RIOT_INCLUDES_LIST}) # executable linking is done by RIOT build system add_library( wamr ${WAMR_RUNTIME_LIB_SOURCE}) + +set_version_info (wamr) diff --git a/product-mini/platforms/riot/Makefile b/product-mini/platforms/riot/Makefile index 8c7aef30c..d564a85a1 100644 --- a/product-mini/platforms/riot/Makefile +++ b/product-mini/platforms/riot/Makefile @@ -22,7 +22,7 @@ QUIET ?= 1 ARCHIVES += $(BINDIR)/libwamr.a -#Load the usual RIOT make infastructure +#Load the usual RIOT make infrastructure include $(RIOTBASE)/Makefile.include diff --git a/product-mini/platforms/rt-thread/iwasm.c b/product-mini/platforms/rt-thread/iwasm.c index f8932bdec..9c2b43b79 100644 --- a/product-mini/platforms/rt-thread/iwasm.c +++ b/product-mini/platforms/rt-thread/iwasm.c @@ -395,7 +395,7 @@ iwasm(int argc, char **argv) else { exception = app_instance_main(wasm_module_inst, argc - i_arg_begin, &argv[i_arg_begin]); - rt_kprintf("finshed run app_instance_main\n"); + rt_kprintf("finished run app_instance_main\n"); } if (exception) @@ -448,4 +448,4 @@ fail1: wasm_runtime_destroy(); return 0; } -MSH_CMD_EXPORT(iwasm, Embeded VM of WebAssembly); +MSH_CMD_EXPORT(iwasm, Embedded VM of WebAssembly); diff --git a/product-mini/platforms/vxworks/CMakeLists.txt b/product-mini/platforms/vxworks/CMakeLists.txt index 0dc5d9699..3f08a72ad 100644 --- a/product-mini/platforms/vxworks/CMakeLists.txt +++ b/product-mini/platforms/vxworks/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm) @@ -78,17 +78,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/windows/CMakeLists.txt b/product-mini/platforms/windows/CMakeLists.txt index 40e925b16..2a4017d68 100644 --- a/product-mini/platforms/windows/CMakeLists.txt +++ b/product-mini/platforms/windows/CMakeLists.txt @@ -1,18 +1,20 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (iwasm C ASM CXX) # set (CMAKE_VERBOSE_MAKEFILE 1) +option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) + set (WAMR_BUILD_PLATFORM "windows") # Reset default linker flags set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -add_definitions(-DCOMPILING_WASM_RUNTIME_API=1) +set(CMAKE_CXX_STANDARD 17) # Set WAMR_BUILD_TARGET, currently values supported: # "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA" @@ -105,7 +107,6 @@ endif() set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") if (NOT MINGW) @@ -132,30 +133,46 @@ endif () include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +add_executable (iwasm main.c ${PLATFORM_SHARED_SOURCE} ${UNCOMMON_SHARED_SOURCE} ${UTILS_SHARED_SOURCE}) + +set_version_info (iwasm) install (TARGETS iwasm DESTINATION bin) -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) +target_link_libraries (iwasm vmlib) +add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) + +target_include_directories(vmlib INTERFACE + $ +) + +set (WAMR_PUBLIC_HEADERS + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h + ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h +) + +set_target_properties (vmlib PROPERTIES + OUTPUT_NAME libiwasm + PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}" + POSITION_INDEPENDENT_CODE ON +) + +target_link_libraries (vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) if (MINGW) - target_link_libraries (iwasm ws2_32) -endif () - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) - -if (MINGW) - target_link_libraries (libiwasm ws2_32) + target_link_libraries (vmlib ws2_32) endif () if (WIN32) - target_link_libraries(libiwasm ntdll) - - target_link_libraries(iwasm ntdll) + target_link_libraries(vmlib ntdll) endif() + +install (TARGETS vmlib + EXPORT iwasmTargets + DESTINATION lib + PUBLIC_HEADER DESTINATION include +) + +install_iwasm_package () diff --git a/product-mini/platforms/windows/main.c b/product-mini/platforms/windows/main.c index e85e869c2..7537216dc 100644 --- a/product-mini/platforms/windows/main.c +++ b/product-mini/platforms/windows/main.c @@ -44,7 +44,11 @@ print_help() printf(" --multi-tier-jit Run the wasm app with multi-tier jit mode\n"); #endif printf(" --stack-size=n Set maximum stack size in bytes, default is 64 KB\n"); - printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB\n"); +#if WASM_ENABLE_LIBC_WASI !=0 + printf(" --heap-size=n Set maximum heap size in bytes, default is 0 KB when libc wasi is enabled\n"); +#else + printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n"); +#endif #if WASM_ENABLE_GC != 0 printf(" --gc-heap-size=n Set maximum gc heap size in bytes,\n"); printf(" default is %u KB\n", GC_HEAP_SIZE_DEFAULT / 1024); diff --git a/product-mini/platforms/zephyr/simple/CMakeLists.txt b/product-mini/platforms/zephyr/simple/CMakeLists.txt index 78dd32285..46dc3ea0c 100644 --- a/product-mini/platforms/zephyr/simple/CMakeLists.txt +++ b/product-mini/platforms/zephyr/simple/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.14) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(wamr) diff --git a/product-mini/platforms/zephyr/simple/Dockerfile b/product-mini/platforms/zephyr/simple/Dockerfile index a4c69a8ff..c3fb1325d 100644 --- a/product-mini/platforms/zephyr/simple/Dockerfile +++ b/product-mini/platforms/zephyr/simple/Dockerfile @@ -1,9 +1,15 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Refer to https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html +# for more information on how to set up the Zephyr development environment. FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Asian/Shanghai +ARG ZEPHYR_SDK_VERSION=0.16.9 +# In west_lite.yml, the Zephyr version is set to v3.7.0 +#ARG ZEPHYR_VERSION=3.7.0 # Install dependencies for Zephyr # hadolint ignore=DL3008 @@ -16,28 +22,34 @@ RUN apt-get update && apt-get install -y --no-install-recommends git cmake ninja # Install the Zephyr Software Development Kit (SDK) WORKDIR /opt # hadolint ignore=DL4006 -RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/zephyr-sdk-0.16.3_linux-x86_64.tar.xz \ - && wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/sha256.sum | shasum --check --ignore-missing \ - && tar xvf zephyr-sdk-0.16.3_linux-x86_64.tar.xz && rm zephyr-sdk-0.16.3_linux-x86_64.tar.xz +RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz \ + && wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \ + && tar xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz -WORKDIR /opt/zephyr-sdk-0.16.3 +WORKDIR /opt/zephyr-sdk-${ZEPHYR_SDK_VERSION} # hadolint ignore=DL4006 -RUN yes | ./setup.sh +# Install host tools and Register Zephyr SDK CMake package +RUN ./setup.sh -h -c # Get Zephyr +WORKDIR /root/zephyrproject/smoke-test + # hadolint ignore=DL3013 -RUN pip3 install --no-cache-dir west && west init -m https://github.com/zephyrproject-rtos/zephyr --mr v3.5.0 /root/zephyrproject +RUN pip3 install --no-cache-dir west +COPY ./west_lite.yml ./west.yml + +# init the west workspace with a minimal manifest +RUN west init -l WORKDIR /root/zephyrproject -RUN west update +RUN west update --stats -WORKDIR /root/zephyrproject/zephyr -RUN west zephyr-export && pip install --no-cache-dir -r ~/zephyrproject/zephyr/scripts/requirements.txt +WORKDIR /root/zephyrproject/modules/zephyr +RUN west zephyr-export && pip install --no-cache-dir -r ./scripts/requirements.txt + +ENV ZEPHYR_BASE="/root/zephyrproject/modules/zephyr" # Git clone wamr -WORKDIR /root -RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime.git - -WORKDIR /root/wasm-micro-runtime/product-mini/platforms/zephyr/simple - -ENV ZEPHYR_BASE="/root/zephyrproject/zephyr" +WORKDIR /root/zephyrproject/modules/ +RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime.git wasm-micro-runtime +WORKDIR /root/zephyrproject/modules/wasm-micro-runtime/product-mini/platforms/zephyr diff --git a/product-mini/platforms/zephyr/simple/README.md b/product-mini/platforms/zephyr/simple/README.md index 5f8bd41ae..3f1a74c6b 100644 --- a/product-mini/platforms/zephyr/simple/README.md +++ b/product-mini/platforms/zephyr/simple/README.md @@ -47,9 +47,9 @@ to setup for local development. ## Building for a Specific Board With an environment setup either locally or in a Docker container, you can build -for a Zephyr suppported board using +for a Zephyr supported board using [`west`](https://docs.zephyrproject.org/latest/develop/west/index.html). There -are already [configuaration files](./boards) for a few boards in this sample. +are already [configuration files](./boards) for a few boards in this sample. However, if you are using a new board, you will need to add your own file for the board, or define configuration in the [`prj.conf](./prj.conf). After doing so, use the following command with your board identifier to build the sample @@ -87,6 +87,12 @@ is a 64-bit ARM target for emulating the Cortex-A53 platform. west build . -b qemu_cortex_a53 -p always -- -DWAMR_BUILD_TARGET=AARCH64 ``` +[ARC QEMU](https://docs.zephyrproject.org/latest/boards/qemu/arc/doc/index.html) +is a 32-bit ARC target for emulating the ARC platform. + +```shell +west build . -b qemu_arc/qemu_arc_em -p always -- -DWAMR_BUILD_TARGET=ARC +``` ## Flashing or Running Image diff --git a/product-mini/platforms/zephyr/simple/west_lite.yml b/product-mini/platforms/zephyr/simple/west_lite.yml new file mode 100644 index 000000000..447affdb4 --- /dev/null +++ b/product-mini/platforms/zephyr/simple/west_lite.yml @@ -0,0 +1,15 @@ +# The west manifest file for WAMR on Zephyr smoke test. +# +manifest: + # + # Please add items below based on alphabetical order + projects: + - name: zephyr + url: https://github.com/zephyrproject-rtos/zephyr + revision: v3.7.0 + clone-depth: 1 + path: modules/zephyr + west-commands: scripts/west-commands.yml + + self: + path: smoke-test diff --git a/product-mini/platforms/zephyr/user-mode/CMakeLists.txt b/product-mini/platforms/zephyr/user-mode/CMakeLists.txt index 16c9b26dc..8e7b819b1 100644 --- a/product-mini/platforms/zephyr/user-mode/CMakeLists.txt +++ b/product-mini/platforms/zephyr/user-mode/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.13.1) +cmake_minimum_required(VERSION 3.14) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(wamr_user_mode LANGUAGES C) diff --git a/product-mini/platforms/zephyr/user-mode/lib-wamr-zephyr/CMakeLists.txt b/product-mini/platforms/zephyr/user-mode/lib-wamr-zephyr/CMakeLists.txt index 7c68a71ac..347fddf3e 100644 --- a/product-mini/platforms/zephyr/user-mode/lib-wamr-zephyr/CMakeLists.txt +++ b/product-mini/platforms/zephyr/user-mode/lib-wamr-zephyr/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.14) set (WAMR_BUILD_PLATFORM "zephyr") diff --git a/samples/basic/src/free_buffer_early.c b/samples/basic/src/free_buffer_early.c index c4d71d18f..b55b6eb1d 100644 --- a/samples/basic/src/free_buffer_early.c +++ b/samples/basic/src/free_buffer_early.c @@ -5,6 +5,7 @@ #include "wasm_export.h" #include "bh_read_file.h" +#include "bh_getopt.h" void my_log(uint32 log_level, const char *file, int line, const char *fmt, ...) diff --git a/samples/basic/src/native_impl.c b/samples/basic/src/native_impl.c index 1374c8dd8..0d0c45ae5 100644 --- a/samples/basic/src/native_impl.c +++ b/samples/basic/src/native_impl.c @@ -7,7 +7,7 @@ #include "wasm_export.h" #include "math.h" -// The first parameter is not exec_env because it is invoked by native funtions +// The first parameter is not exec_env because it is invoked by native functions void reverse(char *str, int len) { diff --git a/samples/bh-atomic/CMakeLists.txt b/samples/bh-atomic/CMakeLists.txt index f69052742..177cf2c5e 100644 --- a/samples/bh-atomic/CMakeLists.txt +++ b/samples/bh-atomic/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2023 Midokura Japan KK. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(bh_atomic) string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) diff --git a/samples/debug-tools/cmake/FindEMSCRIPTEN.cmake b/samples/cmake/FindEMSCRIPTEN.cmake similarity index 100% rename from samples/debug-tools/cmake/FindEMSCRIPTEN.cmake rename to samples/cmake/FindEMSCRIPTEN.cmake diff --git a/samples/debug-tools/cmake/FindWAMRC.cmake b/samples/cmake/FindWAMRC.cmake similarity index 100% rename from samples/debug-tools/cmake/FindWAMRC.cmake rename to samples/cmake/FindWAMRC.cmake diff --git a/samples/debug-tools/cmake/FindWASISDK.cmake b/samples/cmake/FindWASISDK.cmake similarity index 58% rename from samples/debug-tools/cmake/FindWASISDK.cmake rename to samples/cmake/FindWASISDK.cmake index 0caf374df..65b9647d9 100644 --- a/samples/debug-tools/cmake/FindWASISDK.cmake +++ b/samples/cmake/FindWASISDK.cmake @@ -16,9 +16,10 @@ string(REGEX MATCH [0-9]+\.[0-9]+\.*[0-9]* WASISDK_VERSION ${WASISDK_HOME}) find_package_handle_standard_args(WASISDK REQUIRED_VARS WASISDK_HOME VERSION_VAR WASISDK_VERSION) if(WASISDK_FOUND) - set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang) - set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++) - set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake) - set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot) + set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang) + set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++) + set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake) + set(WASISDK_PTHREAD_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk-pthread.cmake) + set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot) endif() -mark_as_advanced(WASISDK_CC_COMMAND WASISDK_CXX_COMMAND WASISDK_TOOLCHAIN WASISDK_SYSROOT WASISDK_HOME) +mark_as_advanced(WASISDK_CC_COMMAND WASISDK_CXX_COMMAND WASISDK_TOOLCHAIN WASISDK_PTHREAD_TOOLCHAIN WASISDK_SYSROOT WASISDK_HOME) diff --git a/samples/debug-tools/CMakeLists.txt b/samples/debug-tools/CMakeLists.txt index 411106bb3..512507d6e 100644 --- a/samples/debug-tools/CMakeLists.txt +++ b/samples/debug-tools/CMakeLists.txt @@ -7,7 +7,7 @@ include(CheckPIESupported) project(debug_tools_sample) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) find_package(WASISDK REQUIRED) option(SOURCE_MAP_DEMO "Enable source map demo" OFF) diff --git a/samples/debug-tools/wasm-apps/CMakeLists.txt b/samples/debug-tools/wasm-apps/CMakeLists.txt index 527b5f37a..9858b98da 100644 --- a/samples/debug-tools/wasm-apps/CMakeLists.txt +++ b/samples/debug-tools/wasm-apps/CMakeLists.txt @@ -7,7 +7,7 @@ project (debut_tools_wasm) set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line) -list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake) +list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake) find_package (WAMRC REQUIRED) option(SOURCE_MAP_DEMO "Enable source map demo" OFF) diff --git a/samples/file/CMakeLists.txt b/samples/file/CMakeLists.txt index c3a69ccc8..a5184718b 100644 --- a/samples/file/CMakeLists.txt +++ b/samples/file/CMakeLists.txt @@ -1,9 +1,25 @@ # Copyright (C) 2022 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(file) ################ wasm application ############### add_subdirectory(src) -add_subdirectory(wasm-app) + +# Use ExternalProject to avoid incorporating WAMR library compilation flags into the +# compilation of the wasm application, which could lead to compatibility +# issues due to different targets. +# Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi' +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake) +find_package(WASISDK REQUIRED) + +include(ExternalProject) +ExternalProject_Add(wasm-app + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-app" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-app -B build + -DWASI_SDK_PREFIX=${WASISDK_HOME} + -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN} + BUILD_COMMAND ${CMAKE_COMMAND} --build build + INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/samples/file/wasm-app/CMakeLists.txt b/samples/file/wasm-app/CMakeLists.txt index 4af87a3fd..a80f0c8f0 100644 --- a/samples/file/wasm-app/CMakeLists.txt +++ b/samples/file/wasm-app/CMakeLists.txt @@ -1,26 +1,11 @@ # Copyright (C) 2022 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) -project(wasm-app) +cmake_minimum_required(VERSION 3.14) +project(file_wasm) -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) +set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line) -if (APPLE) - set (HAVE_FLAG_SEARCH_PATHS_FIRST 0) - set (CMAKE_C_LINK_FLAGS "") - set (CMAKE_CXX_LINK_FLAGS "") -endif () - -set (CMAKE_SYSTEM_PROCESSOR wasm32) - -if (NOT DEFINED WASI_SDK_DIR) - set (WASI_SDK_DIR "/opt/wasi-sdk") -endif () - -set (CMAKE_C_COMPILER_TARGET "wasm32-wasi") -set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument") - -add_executable(file.wasm main.c) -target_link_libraries(file.wasm) +add_executable(file main.c) +set_target_properties (file PROPERTIES SUFFIX .wasm) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file.wasm DESTINATION wasm-app) diff --git a/samples/file/wasm-app/main.c b/samples/file/wasm-app/main.c index 6e6204cca..e794a273f 100644 --- a/samples/file/wasm-app/main.c +++ b/samples/file/wasm-app/main.c @@ -18,7 +18,7 @@ #define WORLD_OFFSET 7 #define NAME_REPLACMENT "James" #define NAME_REPLACMENT_LEN (sizeof(NAME_REPLACMENT) - 1) -#define ADDITIONAL_SPACE 1 * 1024 * 1024 +#define ADDITIONAL_SPACE 16 * 1024 int main(int argc, char **argv) diff --git a/samples/linux-perf/CMakeLists.txt b/samples/linux-perf/CMakeLists.txt index e9882c835..efcc8c07e 100644 --- a/samples/linux-perf/CMakeLists.txt +++ b/samples/linux-perf/CMakeLists.txt @@ -15,7 +15,7 @@ endif() set(CMAKE_CXX_STANDARD 17) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) find_package(WASISDK REQUIRED) ################ runtime settings ################ diff --git a/samples/linux-perf/README.md b/samples/linux-perf/README.md index 5a8dc578f..0dd25a99e 100644 --- a/samples/linux-perf/README.md +++ b/samples/linux-perf/README.md @@ -30,7 +30,7 @@ $ ./FlameGraph/stackcollapse-perf.pl out.perf > out.folded $ ./FlameGraph/flamegraph.pl out.folded > perf.svg ``` -In this result, you'll see two modules's profiling result and all wasm functions are named as "aot_func#N" which is a little hard to distinguish. +In this result, you'll see two modules' profiling result and all wasm functions are named as "aot_func#N" which is a little hard to distinguish. ![perf.png](./pics/perf.png) diff --git a/samples/linux-perf/cmake/FindWASISDK.cmake b/samples/linux-perf/cmake/FindWASISDK.cmake deleted file mode 100644 index 5cdfea41e..000000000 --- a/samples/linux-perf/cmake/FindWASISDK.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -include(FindPackageHandleStandardArgs) - -file(GLOB WASISDK_SEARCH_PATH "/opt/wasi-sdk-*") -find_path(WASISDK_HOME - NAMES share/wasi-sysroot - PATHS ${WASISDK_SEARCH_PATH} - NO_DEFAULT_PATH - REQUIRED -) - -string(REGEX MATCH [0-9]+\.[0-9]+\.*[0-9]* WASISDK_VERSION ${WASISDK_HOME}) - -find_package_handle_standard_args(WASISDK REQUIRED_VARS WASISDK_HOME VERSION_VAR WASISDK_VERSION) - -if(WASISDK_FOUND) - set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang) - set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++) - set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake) - set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot) -endif() diff --git a/samples/mem-allocator/CMakeLists.txt b/samples/mem-allocator/CMakeLists.txt index f157dfbde..9f3e49db9 100644 --- a/samples/mem-allocator/CMakeLists.txt +++ b/samples/mem-allocator/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2023 Midokura Japan KK. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(mem_allocator_create) string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) diff --git a/samples/multi-module/README.md b/samples/multi-module/README.md index 731ba62c2..5aac0a5f4 100644 --- a/samples/multi-module/README.md +++ b/samples/multi-module/README.md @@ -12,7 +12,7 @@ $ make $ # It will build multi_module runtime and $ # wasm file under the ./build . $ # If you have built wamrc, -$ # aot file will also genrate. +$ # aot file will also generate. $ ./multi_module mC.wasm $ ... $ ./multi_module mC.aot diff --git a/samples/multi-module/wasm-apps/CMakeLists.txt b/samples/multi-module/wasm-apps/CMakeLists.txt index 8dbb52686..6460a99e6 100644 --- a/samples/multi-module/wasm-apps/CMakeLists.txt +++ b/samples/multi-module/wasm-apps/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.8...3.16) +cmake_minimum_required (VERSION 3.14) project(wasm-apps) message(CHECK_START "Detecting WABT") diff --git a/samples/native-lib/README.md b/samples/native-lib/README.md index be1cc6e74..8af01b23c 100644 --- a/samples/native-lib/README.md +++ b/samples/native-lib/README.md @@ -2,7 +2,7 @@ This sample demonstrates how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm. -The native library should provide `get_native_lib` API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to regiter the native library, for example: +The native library should provide `get_native_lib` API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to register the native library, for example: ```C static int diff --git a/samples/native-lib/wasm-app/CMakeLists.txt b/samples/native-lib/wasm-app/CMakeLists.txt index ffcd9005a..e5bea6010 100644 --- a/samples/native-lib/wasm-app/CMakeLists.txt +++ b/samples/native-lib/wasm-app/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(wasm-app) set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) diff --git a/samples/printversion/CMakeLists.txt b/samples/printversion/CMakeLists.txt new file mode 100644 index 000000000..6e97cb72c --- /dev/null +++ b/samples/printversion/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2025 Midokura Japan KK. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +cmake_minimum_required(VERSION 3.16) + +project(printversion LANGUAGES C) + +add_executable(printversion printversion.c) +find_package(iwasm REQUIRED) +target_link_libraries(printversion iwasm::vmlib) diff --git a/samples/printversion/printversion.c b/samples/printversion/printversion.c new file mode 100644 index 000000000..91b244fe2 --- /dev/null +++ b/samples/printversion/printversion.c @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2025 Midokura Japan KK. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include +#include +#include + +#include + +int +main(int argc, char **argv) +{ + uint32_t major; + uint32_t minor; + uint32_t patch; + wasm_runtime_get_version(&major, &minor, &patch); + printf("wasm-micro-runtime %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, + minor, patch); +} diff --git a/samples/printversion/test.sh b/samples/printversion/test.sh new file mode 100755 index 000000000..a51c1849c --- /dev/null +++ b/samples/printversion/test.sh @@ -0,0 +1,24 @@ +#! /bin/sh + +# Copyright (C) 2025 Midokura Japan KK. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +set -e + +DIST=$(mktemp -d) + +# WAMR_BUILD_SIMD=0 to avoid fetching simde, which is +# not relevant to this particular test. +cmake -B build-wamr \ +-D CMAKE_INSTALL_PREFIX=${DIST} \ +-D WAMR_BUILD_SIMD=0 \ +../.. +cmake --build build-wamr -t install + +cmake -B build-app \ +-D CMAKE_PREFIX_PATH=${DIST} \ +-D CMAKE_INSTALL_PREFIX=${DIST} \ +. +cmake --build build-app + +./build-app/printversion diff --git a/samples/sgx-ra/CMakeLists.txt b/samples/sgx-ra/CMakeLists.txt index 3f5f23e97..48ff9ee56 100644 --- a/samples/sgx-ra/CMakeLists.txt +++ b/samples/sgx-ra/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (c) 2020-2021 Alibaba Cloud # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.1.4) +cmake_minimum_required(VERSION 3.14) project(sgx-ra) ################ runtime settings ############## diff --git a/samples/sgx-ra/non-sgx-verify/README.md b/samples/sgx-ra/non-sgx-verify/README.md index e4e9d87d4..5b9b35430 100644 --- a/samples/sgx-ra/non-sgx-verify/README.md +++ b/samples/sgx-ra/non-sgx-verify/README.md @@ -1,5 +1,5 @@ # Examples of evidence verification without Intel SGX -Intel SGX evidence generated using WAMR can be validated on trusted plaforms without Intel SGX, or an Intel processors. +Intel SGX evidence generated using WAMR can be validated on trusted platforms without Intel SGX, or an Intel processors. ## Using C# The sample [csharp/](csharp/) demonstrates such validation using C# as a managed language. diff --git a/samples/sgx-ra/wasm-app/CMakeLists.txt b/samples/sgx-ra/wasm-app/CMakeLists.txt index afba7dfb6..93907b7f0 100644 --- a/samples/sgx-ra/wasm-app/CMakeLists.txt +++ b/samples/sgx-ra/wasm-app/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (c) 2020-2021 Alibaba Cloud # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(wasm-app) set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) diff --git a/samples/socket-api/README.md b/samples/socket-api/README.md index 911dfb7ab..522cbf47b 100644 --- a/samples/socket-api/README.md +++ b/samples/socket-api/README.md @@ -54,7 +54,7 @@ The output of client is like: [Client] Connect socket [Client] Client receive [Client] 115 bytes received: -Buffer recieved: +Buffer received: Say Hi from the Server Say Hi from the Server Say Hi from the Server @@ -117,7 +117,7 @@ The output is: ```bash Wait for client to connect Client connected, sleeping for 10s -Shuting down +Shutting down ``` ```bash @@ -195,7 +195,7 @@ The output of client is like: [Client] Create socket [Client] Client send [Client] Client receive -[Client] Buffer recieved: Hello from server +[Client] Buffer received: Hello from server [Client] BYE ``` diff --git a/samples/socket-api/sample_test_run.py b/samples/socket-api/sample_test_run.py index ec0060281..6e9153b24 100755 --- a/samples/socket-api/sample_test_run.py +++ b/samples/socket-api/sample_test_run.py @@ -121,7 +121,6 @@ def main(): print("\n================================") print("Test address resolving") cmd = "./iwasm --allow-resolve=*.com addr_resolve.wasm github.com" - cmd = "./multicast_server FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2" run_cmd(cmd, args.working_directory) # wait for a second diff --git a/samples/socket-api/wasm-src/CMakeLists.txt b/samples/socket-api/wasm-src/CMakeLists.txt index 8f11e0a6b..38e813916 100644 --- a/samples/socket-api/wasm-src/CMakeLists.txt +++ b/samples/socket-api/wasm-src/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.8...3.18) +cmake_minimum_required(VERSION 3.14) project(socket_api_sample_wasm_app) message(CHECK_START "Detecting WABT") diff --git a/samples/socket-api/wasm-src/tcp_client.c b/samples/socket-api/wasm-src/tcp_client.c index aad449483..ec5009b13 100644 --- a/samples/socket-api/wasm-src/tcp_client.c +++ b/samples/socket-api/wasm-src/tcp_client.c @@ -97,7 +97,7 @@ main(int argc, char *argv[]) printf("[Client] %d bytes received:\n", total_size); if (total_size > 0) { - printf("Buffer recieved:\n%s\n", buffer); + printf("Buffer received:\n%s\n", buffer); } close(socket_fd); diff --git a/samples/socket-api/wasm-src/tcp_server.c b/samples/socket-api/wasm-src/tcp_server.c index 2798dc252..2cc03e2b8 100644 --- a/samples/socket-api/wasm-src/tcp_server.c +++ b/samples/socket-api/wasm-src/tcp_server.c @@ -37,7 +37,7 @@ run(void *arg) } } - printf("[Server] Shuting down the new connection #%u ..\n", new_socket); + printf("[Server] Shutting down the new connection #%u ..\n", new_socket); shutdown(new_socket, SHUT_RDWR); return NULL; @@ -137,14 +137,14 @@ main(int argc, char *argv[]) pthread_join(workers[i], NULL); } - printf("[Server] Shuting down ..\n"); + printf("[Server] Shutting down ..\n"); shutdown(socket_fd, SHUT_RDWR); sleep(3); printf("[Server] BYE \n"); return EXIT_SUCCESS; fail: - printf("[Server] Shuting down ..\n"); + printf("[Server] Shutting down ..\n"); if (socket_fd >= 0) close(socket_fd); sleep(3); diff --git a/samples/socket-api/wasm-src/timeout_server.c b/samples/socket-api/wasm-src/timeout_server.c index c71cf4553..2aaf0b5ef 100644 --- a/samples/socket-api/wasm-src/timeout_server.c +++ b/samples/socket-api/wasm-src/timeout_server.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) printf("Client connected, sleeping for 10s\n"); sleep(10); - printf("Shuting down\n"); + printf("Shutting down\n"); shutdown(client_socket_fd, SHUT_RDWR); close(client_socket_fd); shutdown(socket_fd, SHUT_RDWR); diff --git a/samples/socket-api/wasm-src/udp_client.c b/samples/socket-api/wasm-src/udp_client.c index 810a455f8..c800764a9 100644 --- a/samples/socket-api/wasm-src/udp_client.c +++ b/samples/socket-api/wasm-src/udp_client.c @@ -75,7 +75,7 @@ main(int argc, char *argv[]) if (ret > 0) { buffer[ret] = '\0'; - printf("[Client] Buffer recieved: %s\n", buffer); + printf("[Client] Buffer received: %s\n", buffer); } close(socket_fd); diff --git a/samples/socket-api/wasm-src/udp_server.c b/samples/socket-api/wasm-src/udp_server.c index 588964145..2feac5720 100644 --- a/samples/socket-api/wasm-src/udp_server.c +++ b/samples/socket-api/wasm-src/udp_server.c @@ -106,7 +106,7 @@ main(int argc, char *argv[]) printf("[Server] Achieve maximum amount of connections\n"); } - printf("[Server] Shuting down ..\n"); + printf("[Server] Shutting down ..\n"); shutdown(socket_fd, SHUT_RDWR); close(socket_fd); sleep(3); @@ -114,7 +114,7 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; fail: - printf("[Server] Shuting down ..\n"); + printf("[Server] Shutting down ..\n"); if (socket_fd >= 0) close(socket_fd); sleep(3); diff --git a/samples/wasi-threads/CMakeLists.txt b/samples/wasi-threads/CMakeLists.txt index 467f5fd1f..08cc3a7ff 100644 --- a/samples/wasi-threads/CMakeLists.txt +++ b/samples/wasi-threads/CMakeLists.txt @@ -49,6 +49,7 @@ set(WAMR_BUILD_LIBC_BUILTIN 1) set(WAMR_BUILD_FAST_INTERP 1) set(WAMR_BUILD_LIBC_WASI 1) set(WAMR_BUILD_LIB_WASI_THREADS 1) +set(WAMR_BUILD_REF_TYPES 1) # compiling and linking flags if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) @@ -65,7 +66,24 @@ add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) ################ wasm application ################ -add_subdirectory(wasm-apps) +# Use ExternalProject to avoid incorporating WAMR library compilation flags into the +# compilation of the wasm application, which could lead to compatibility +# issues due to different targets. +# Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi' + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake) +find_package(WASISDK REQUIRED) + +include(ExternalProject) +ExternalProject_Add(wasm-apps + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps -B build + -DWASI_SDK_PREFIX=${WASISDK_HOME} + -DCMAKE_TOOLCHAIN_FILE=${WASISDK_PTHREAD_TOOLCHAIN} + BUILD_COMMAND ${CMAKE_COMMAND} --build build + INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR} +) + ################ wamr runtime ################ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) diff --git a/samples/wasi-threads/wasm-apps/CMakeLists.txt b/samples/wasi-threads/wasm-apps/CMakeLists.txt index 87f21e9fd..27e06b634 100644 --- a/samples/wasi-threads/wasm-apps/CMakeLists.txt +++ b/samples/wasi-threads/wasm-apps/CMakeLists.txt @@ -1,28 +1,10 @@ # Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -if (APPLE) - set (HAVE_FLAG_SEARCH_PATHS_FIRST 0) - set (CMAKE_C_LINK_FLAGS "") - set (CMAKE_CXX_LINK_FLAGS "") -endif () +cmake_minimum_required (VERSION 3.14) +project (wasi_threads_wasm) -if (NOT DEFINED WASI_SDK_DIR) - set (WASI_SDK_DIR "/opt/wasi-sdk") -endif () - -if (DEFINED WASI_SYSROOT) - set (CMAKE_SYSROOT "${WASI_SYSROOT}") -endif () - -set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang") -set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR}/bin/clang") -set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads") - -if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1) - set (CMAKE_C_FLAGS "") - set (CMAKE_CXX_FLAGS "") -endif () +set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line) function (compile_sample SOURCE_FILE) get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE) @@ -41,6 +23,8 @@ function (compile_sample SOURCE_FILE) LINKER:--export=malloc LINKER:--export=free ) + + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WASM_MODULE} DESTINATION wasm-apps) endfunction () -compile_sample(no_pthread.c wasi_thread_start.S) \ No newline at end of file +compile_sample(no_pthread.c wasi_thread_start.S) diff --git a/samples/wasm-c-api-imports/README.md b/samples/wasm-c-api-imports/README.md index 9b61a6e74..44ac35fc1 100644 --- a/samples/wasm-c-api-imports/README.md +++ b/samples/wasm-c-api-imports/README.md @@ -93,14 +93,14 @@ also not economical to code for those functions. Using module names as a filter seems to be a simple way. But some private additional c/c++ libraries are supported in WAMR. Those supporting will bring more import items that don't use `wasi_snapshot_preview1` as module names but are still -covered by the WASM runtime. Like `env.pthread_`. Plus, [the native lib registeration](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md) +covered by the WASM runtime. Like `env.pthread_`. Plus, [the native lib registration](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md) provides another possible way to fill in the requirement of _the import section_. Let's take summarize. A proper `wasm_extern_vec_t *imports` should include: 1. provides all necessary host implementations for items in _the import section_ 2. should not override runtime provided implementation or covered by native - registrations. functinal or econmical. + registrations. functional or econmical. 3. keep them in a right order ## A recommendation diff --git a/samples/wasm-c-api/CMakeLists.txt b/samples/wasm-c-api/CMakeLists.txt index b8783f4ae..06dc92d5e 100644 --- a/samples/wasm-c-api/CMakeLists.txt +++ b/samples/wasm-c-api/CMakeLists.txt @@ -129,7 +129,7 @@ if (${WAT2WASM_VERSION} VERSION_LESS 1.0.26) set(WAT2WASM_FLAGS "--enable-reference-types") endif () -if(${WAMR_BUILD_AOT} EQUAL 1) +if(${WAMR_BUILD_AOT} EQUAL 1 AND ${WAMR_BUILD_INTERP} EQUAL 0) ## locate wamrc find_program(WAMRC wamrc @@ -205,12 +205,3 @@ foreach(EX ${EXAMPLES}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) endforeach() - -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - find_program(VALGRIND - valgrind - REQUIRED - ) - - # run `ctest -T memcheck -V --test-dir build` -endif() diff --git a/samples/wasm-c-api/README.md b/samples/wasm-c-api/README.md index b23276706..22595d155 100644 --- a/samples/wasm-c-api/README.md +++ b/samples/wasm-c-api/README.md @@ -1,6 +1,6 @@ WAMR supports *wasm-c-api* in both *interpreter* mode and *aot* mode. -Before staring, we need to download and intall [WABT](https://github.com/WebAssembly/wabt/releases/latest). +Before staring, we need to download and install [WABT](https://github.com/WebAssembly/wabt/releases/latest). ``` shell $ cd /opt diff --git a/samples/workload/README.md b/samples/workload/README.md index 0e6a3a41b..af13d5d3e 100644 --- a/samples/workload/README.md +++ b/samples/workload/README.md @@ -1,4 +1,4 @@ -All workloads have similar requirment of software dependencies, including **emsdk** and **binaryen** +All workloads have similar requirement of software dependencies, including **emsdk** and **binaryen** > There might be slight differences when using MacOS and other Linux distro than Ubuntu. This document targets Ubuntu 20.04 as an example. diff --git a/test-tools/addr2line/addr2line.py b/test-tools/addr2line/addr2line.py index 421b0bdb2..800ba3750 100644 --- a/test-tools/addr2line/addr2line.py +++ b/test-tools/addr2line/addr2line.py @@ -206,7 +206,7 @@ def get_line_info_from_function_addr_sourcemapping( if not line: continue - m = re.match("(.*):(\d+):(\d+)", line) + m = re.match(r"(.*):(\d+):(\d+)", line) if m: function_file, function_line, function_column = m.groups() continue diff --git a/test-tools/aot-analyzer/src/aot_file.cc b/test-tools/aot-analyzer/src/aot_file.cc index 14ce06387..a8ad3cffb 100644 --- a/test-tools/aot-analyzer/src/aot_file.cc +++ b/test-tools/aot-analyzer/src/aot_file.cc @@ -48,22 +48,22 @@ AoTFile::ParseTargetInfo() CHECK_RESULT(ReadT(&abi_type, this, "uint16_t")); target_info_.abi_type = abi_type; - // exectuion type + // execution type uint16_t e_type = 0; CHECK_RESULT(ReadT(&e_type, this, "uint16_t")); target_info_.e_type = e_type; - // exectuion machine + // execution machine uint16_t e_machine = 0; CHECK_RESULT(ReadT(&e_machine, this, "uint16_t")); target_info_.e_machine = e_machine; - // exectuion version + // execution version uint32_t e_version = 0; CHECK_RESULT(ReadT(&e_version, this, "uint32_t")); target_info_.e_version = e_version; - // exectuion flags + // execution flags uint32_t e_flags = 0; CHECK_RESULT(ReadT(&e_flags, this, "uint32_t")); target_info_.e_flags = e_flags; @@ -165,7 +165,7 @@ AoTFile::GetExectuionTypeName(uint16_t e_type) break; } default: - name = "bad exectuion type"; + name = "bad execution type"; } return name; } @@ -251,7 +251,7 @@ AoTFile::GetExectuionMachineName(uint16_t e_machine) break; } default: - machine = "bad exectuion machine type"; + machine = "bad execution machine type"; } return machine; } diff --git a/test-tools/aot-analyzer/src/main.cc b/test-tools/aot-analyzer/src/main.cc index f42e9217b..0dee1c8d1 100644 --- a/test-tools/aot-analyzer/src/main.cc +++ b/test-tools/aot-analyzer/src/main.cc @@ -163,12 +163,12 @@ DumpInfo(AoTFile *aot) printf("Binary type: %s\n", aot->GetBinTypeName(target_info.bin_type).c_str()); printf("ABI type: %d\n", target_info.abi_type); - printf("Exectuion type: %s\n", + printf("Execution type: %s\n", aot->GetExectuionTypeName(target_info.e_type).c_str()); - printf("Exectuion machine: %s\n", + printf("Execution machine: %s\n", aot->GetExectuionMachineName(target_info.e_machine).c_str()); - printf("Exectuion version: %u\n", target_info.e_version); - printf("Exectuion flags: %u\n", target_info.e_flags); + printf("Execution version: %u\n", target_info.e_version); + printf("Execution flags: %u\n", target_info.e_flags); printf("Feature flags: %" PRId64 "\n", target_info.feature_flags); printf("Reserved: %" PRId64 "\n", target_info.reserved); printf("Arch: %s\n", target_info.arch); @@ -546,7 +546,7 @@ ProgramMain(int argc, char **argv) reader = new WasmFile(filename); } else { - printf("unkown file extension: %s\n", dot); + printf("unknown file extension: %s\n", dot); continue; } diff --git a/test-tools/append-aot-to-wasm/append_aot_to_wasm.py b/test-tools/append-aot-to-wasm/append_aot_to_wasm.py index 9a0740464..bba411ade 100644 --- a/test-tools/append-aot-to-wasm/append_aot_to_wasm.py +++ b/test-tools/append-aot-to-wasm/append_aot_to_wasm.py @@ -104,7 +104,7 @@ def create_custom_section_aligned( full_content_bin = b"" pos = start_pos - # custome section id 0 + # custom section id 0 pos, full_content_bin = build_content(full_content_bin, pos, b"\x00") # custom section length diff --git a/test-tools/binarydump-tool/CMakeLists.txt b/test-tools/binarydump-tool/CMakeLists.txt index d322b42b6..744f72c3c 100644 --- a/test-tools/binarydump-tool/CMakeLists.txt +++ b/test-tools/binarydump-tool/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project(binarydump) diff --git a/test-tools/binarydump-tool/binarydump.c b/test-tools/binarydump-tool/binarydump.c index 050de6dfa..9070dd521 100644 --- a/test-tools/binarydump-tool/binarydump.c +++ b/test-tools/binarydump-tool/binarydump.c @@ -15,7 +15,7 @@ read_file_to_buffer(const char *filename, int *ret_size) FILE *file; int file_size, read_size; - if (!(file = fopen(filename, "r"))) + if (!(file = fopen(filename, "rb"))) return NULL; fseek(file, 0, SEEK_END); diff --git a/test-tools/dynamic-aot-debug/README.md b/test-tools/dynamic-aot-debug/README.md index 6325a803a..f9611c4bb 100644 --- a/test-tools/dynamic-aot-debug/README.md +++ b/test-tools/dynamic-aot-debug/README.md @@ -70,7 +70,7 @@ gdbserver hostip:port ./iwasm test.aot #### Local remote debugging ```bash -expport OBJ_PATH=~/aot_debug +export OBJ_PATH=~/aot_debug cd ~/aot_debug # This directory contains iwasm, test.c, test obj file and dynamic_aot_debug.py gdb ./iwasm (gdb) target remote hostip:port diff --git a/test-tools/pick-up-emscripten-headers/collect_files.py b/test-tools/pick-up-emscripten-headers/collect_files.py index 7e832145f..c110551c5 100755 --- a/test-tools/pick-up-emscripten-headers/collect_files.py +++ b/test-tools/pick-up-emscripten-headers/collect_files.py @@ -40,7 +40,7 @@ external_repos = { } } -# TOOD: can we use headers from wasi-libc and clang directly ? +# TODO: can we use headers from wasi-libc and clang directly ? emscripten_headers_src_dst = [ ("include/compat/emmintrin.h", "sse/emmintrin.h"), ("include/compat/immintrin.h", "sse/immintrin.h"), @@ -159,7 +159,7 @@ def download_repo(name, root): download_flag.touch() # leave download files in /tmp - logger.info(f"Has downloaed and stored in {store_dir.relative_to(root)}") + logger.info(f"Has downloaded and stored in {store_dir.relative_to(root)}") return True diff --git a/test-tools/wamr-ide/Script/build.sh b/test-tools/wamr-ide/Script/build.sh index c30cb5af2..856105afb 100755 --- a/test-tools/wamr-ide/Script/build.sh +++ b/test-tools/wamr-ide/Script/build.sh @@ -26,7 +26,7 @@ else exit 1 fi -# setup docker command exectuion without sudo permission +# setup docker command execution without sudo permission sudo groupadd docker sudo gpasswd -a ${USER} docker sudo service docker restart diff --git a/test-tools/wamr-ide/VSCode-Extension/formatters/rust.py b/test-tools/wamr-ide/VSCode-Extension/formatters/rust.py index 6fd5f1682..91c639687 100644 --- a/test-tools/wamr-ide/VSCode-Extension/formatters/rust.py +++ b/test-tools/wamr-ide/VSCode-Extension/formatters/rust.py @@ -170,9 +170,9 @@ def obj_summary(valobj, unavailable='{...}'): return unavailable -def sequence_summary(childern, maxsize=32): +def sequence_summary(children, maxsize=32): s = '' - for child in childern: + for child in children: if len(s) > 0: s += ', ' s += obj_summary(child) diff --git a/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt b/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt index 81d998bc8..a6298c5e1 100644 --- a/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt +++ b/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project(Main) diff --git a/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat b/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat index faf316ab3..d96703ad1 100644 --- a/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat +++ b/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat @@ -12,7 +12,7 @@ IF %ERRORLEVEL% GTR 0 ( call docker images>nul 2>nul IF %ERRORLEVEL% GTR 0 ( - echo "Docker is not ready, please lanuch docker desktop firstly." + echo "Docker is not ready, please launch docker desktop firstly." echo exit /b 2 ) diff --git a/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt b/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt index 6177d27e7..500ad8fe3 100644 --- a/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt +++ b/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt @@ -1,168 +1,192 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required(VERSION 3.14) -if (NOT DEFINED CMAKE_C_COMPILER) -set (CMAKE_C_COMPILER "clang") -endif () -if (NOT DEFINED CMAKE_CXX_COMPILER) -set (CMAKE_CXX_COMPILER "clang++") -endif () +project(wamr_fuzzing LANGUAGES ASM C CXX) -project(wasm_mutator) +include(CMakePrintHelpers) -set (CMAKE_BUILD_TYPE Debug) - -string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -set (CMAKE_C_STANDARD 11) -set (CMAKE_CXX_STANDARD 17) - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (APPLE) - add_definitions(-DBH_PLATFORM_DARWIN) -endif () - -if(CUSTOM_MUTATOR EQUAL 1) - add_compile_definitions(CUSTOM_MUTATOR) +# Ensure Clang is used as the compiler +if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" + OR NOT CMAKE_ASM_COMPILER_ID STREQUAL "Clang") + message(FATAL_ERROR "Please use Clang as the C compiler for libFuzzer compatibility.") endif() -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () +# +# Global settings +# +set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () +string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () +# Reset default linker flags +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Disable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 0) -endif () +# Check if the compiler supports the sanitizer flags +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag("-fsanitize=address" HAS_ADDRESS_SANITIZER) +check_cxx_compiler_flag("-fsanitize=memory" HAS_MEMORY_SANITIZER) +check_cxx_compiler_flag("-fsanitize=undefined" HAS_UNDEFINED_SANITIZER) -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 0) -endif () +# Determine WAMR_BUILD_TARGET based on system properties +if(NOT DEFINED WAMR_BUILD_TARGET) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") + set(WAMR_BUILD_TARGET "AARCH64") + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") + set(WAMR_BUILD_TARGET "RISCV64") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WAMR_BUILD_TARGET "X86_64") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(WAMR_BUILD_TARGET "X86_32") + else() + message(SEND_ERROR "Unsupported build target platform!") + endif() +endif() -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () +if(APPLE) + add_definitions(-DBH_PLATFORM_DARWIN) +endif() -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple modules - set (WAMR_BUILD_MULTI_MODULE 0) -endif () +# Disable hardware bound check and enable AOT validator +set(WAMR_DISABLE_HW_BOUND_CHECK 1) +set(WAMR_BUILD_AOT_VALIDATOR 1) -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () +set(REPO_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) +message(STATUS "REPO_ROOT_DIR: ${REPO_ROOT_DIR}") -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () +# Use LLVM_DIR from command line if defined +# LLVM_DIR should be something like /path/to/llvm/build/lib/cmake/llvm +if(DEFINED LLVM_DIR) + set(LLVM_DIR $ENV{LLVM_DIR}) +else() + set(LLVM_SRC_ROOT ${REPO_ROOT_DIR}/core/deps/llvm) + set(LLVM_BUILD_ROOT ${LLVM_SRC_ROOT}/build) + set(LLVM_DIR ${LLVM_BUILD_ROOT}/lib/cmake/llvm) +endif() -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () +# if LLVM_DIR is an existing directory, use it +if(NOT EXISTS ${LLVM_DIR}) + message(FATAL_ERROR "LLVM_DIR not found: ${LLVM_DIR}") +endif() -if (NOT DEFINED WAMR_BUILD_REF_TYPES) - # Enable reference type by default - set (WAMR_BUILD_REF_TYPES 1) -endif () +find_package(LLVM REQUIRED CONFIG) -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () +include_directories(${LLVM_INCLUDE_DIRS}) +separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS}) +add_definitions(${LLVM_DEFINITIONS_LIST}) -# sanitizer may use kHandleSignalExclusive to handle SIGSEGV -# like `UBSAN_OPTIONS=handle_segv=2:...` -set (WAMR_DISABLE_HW_BOUND_CHECK 1) - -set (REPO_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) -message([ceith]:REPO_ROOT_DIR, ${REPO_ROOT_DIR}) - -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - -add_definitions(-DWAMR_USE_MEM_POOL=0 -DWASM_ENABLE_FUZZ_TEST=1) - -# Enable fuzzer -add_compile_options(-fsanitize=fuzzer) -add_link_options(-fsanitize=fuzzer) - -# if not calling from oss-fuzz helper, enable all support sanitizers -# oss-fuzz will define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in CFLAGS and CXXFLAGS -set(CFLAGS_ENV $ENV{CFLAGS}) -string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" IN_OSS_FUZZ) -if (IN_OSS_FUZZ EQUAL -1) - message("[ceith]:Enable ASan and UBSan in non-oss-fuzz environment") - add_compile_options( - -fprofile-instr-generate -fcoverage-mapping - -fno-sanitize-recover=all - -fsanitize=address,undefined - # reference: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html - # -fsanitize=undefined: All of the checks listed above other than float-divide-by-zero, - # unsigned-integer-overflow, implicit-conversion, local-bounds and - # the nullability-* group of checks. - # - # for now, we disable below from UBSan - # -alignment - # -implicit-conversion - # - -fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability - -fno-sanitize=alignment - ) - add_link_options(-fsanitize=address -fprofile-instr-generate) -endif () - -include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake) -include(${REPO_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -add_library(vmlib - ${WAMR_RUNTIME_LIB_SOURCE} +list( + APPEND + REQUIRED_LLVM_LIBS + LLVMDemangle + LLVMSupport + LLVMTableGen + LLVMTableGenGlobalISel + LLVMCore + LLVMFuzzerCLI + LLVMFuzzMutate + LLVMFileCheck + LLVMInterfaceStub + LLVMIRReader + LLVMCodeGen + LLVMSelectionDAG + LLVMAsmPrinter + LLVMMIRParser + LLVMGlobalISel + LLVMBinaryFormat + LLVMBitReader + LLVMBitWriter + LLVMBitstreamReader + LLVMDWARFLinker + LLVMExtensions + LLVMFrontendOpenACC + LLVMFrontendOpenMP + LLVMTransformUtils + LLVMInstrumentation + LLVMAggressiveInstCombine + LLVMInstCombine + LLVMScalarOpts + LLVMipo + LLVMVectorize + LLVMObjCARCOpts + LLVMCoroutines + LLVMCFGuard + LLVMLinker + LLVMAnalysis + LLVMLTO + LLVMMC + LLVMMCParser + LLVMMCDisassembler + LLVMMCA + LLVMObjCopy + LLVMObject + LLVMObjectYAML + LLVMOption + LLVMRemarks + LLVMDebuginfod + LLVMDebugInfoDWARF + LLVMDebugInfoGSYM + LLVMDebugInfoMSF + LLVMDebugInfoCodeView + LLVMDebugInfoPDB + LLVMSymbolize + LLVMDWP + LLVMExecutionEngine + LLVMInterpreter + LLVMJITLink + LLVMMCJIT + LLVMOrcJIT + LLVMOrcShared + LLVMOrcTargetProcess + LLVMRuntimeDyld + LLVMTarget + LLVMX86CodeGen + LLVMX86AsmParser + LLVMX86Disassembler + LLVMX86TargetMCA + LLVMX86Desc + LLVMX86Info + LLVMAsmParser + LLVMLineEditor + LLVMProfileData + LLVMCoverage + LLVMPasses + LLVMTextAPI + LLVMDlltoolDriver + LLVMLibDriver + LLVMXRay + LLVMWindowsDriver + LLVMWindowsManifest ) -add_executable(wasm_mutator_fuzz wasm_mutator_fuzz.cc) -target_link_libraries(wasm_mutator_fuzz vmlib -lm) +set(SHARED_DIR ${REPO_ROOT_DIR}/core/shared) +set(IWASM_DIR ${REPO_ROOT_DIR}/core/iwasm) + +# Global setting +add_compile_options(-Wno-unused-command-line-argument) + +# Enable fuzzer +add_definitions(-DWASM_ENABLE_FUZZ_TEST=1) +# '-fsanitize=vptr' not allowed with '-fno-rtti +# But, LLVM by default, disables the use of `rtti` in the compiler +add_compile_options(-fsanitize=fuzzer -fno-sanitize=vptr) +add_link_options(-fsanitize=fuzzer -fno-sanitize=vptr) + +# Enable sanitizers if not in oss-fuzz environment +set(CFLAGS_ENV $ENV{CFLAGS}) +string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" FUZZ_POS) +if (FUZZ_POS GREATER -1) + set(IN_OSS_FUZZ 1) +else() + set(IN_OSS_FUZZ 0) +endif() + +add_subdirectory(aot-compiler) +add_subdirectory(wasm-mutator) diff --git a/tests/fuzz/wasm-mutator-fuzz/README.md b/tests/fuzz/wasm-mutator-fuzz/README.md index acf210ae4..09fd757be 100644 --- a/tests/fuzz/wasm-mutator-fuzz/README.md +++ b/tests/fuzz/wasm-mutator-fuzz/README.md @@ -1,44 +1,53 @@ # WAMR fuzz test framework -## install wasm-tools +## Install wasm-tools + +Download the release suitable for your specific platform from https://github.com/bytecodealliance/wasm-tools/releases/latest, unpack it, and add the executable wasm-tools to the `PATH`. Then, you should be able to verify that the installation was successful by using the following command: ```bash -1.git clone https://github.com/bytecodealliance/wasm-tools -$ cd wasm-tools -2.This project can be installed and compiled from source with this Cargo command: -$ cargo install wasm-tools -3.Installation can be confirmed with: $ wasm-tools --version -4.Subcommands can be explored with: +# Or learn subcommands with $ wasm-tools help ``` +## Install clang Toolchain + +Refer to: https://apt.llvm.org/ and ensure that you have clang installed. + +```bash +$ clang --version + +$ clang++ --version +``` + ## Build ```bash -mkdir build && cd build # Without custom mutator (libfuzzer modify the buffer randomly) -cmake .. -# TODO: TBC. `wasm-tools mutate` is not supported yet -# With custom mutator (wasm-tools mutate) -cmake .. -DCUSTOM_MUTATOR=1 -make -j$(nproc) +$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=/lib/cmake/llvm + +# TBC: if `wasm-tools mutate` is supported or not +# Or With custom mutator (wasm-tools mutate) +$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=/lib/cmake/llvm -DCUSTOM_MUTATOR=1 + +# Then +$ cmake --build build ``` ## Manually generate wasm file in build -```bash +````bash # wasm-tools smith generate some valid wasm file # The generated wasm file is in corpus_dir under build # N - Number of files to be generated -./smith_wasm.sh N +$ ./smith_wasm.sh N # running ``` bash -cd build -./wasm-mutate-fuzz CORPUS_DIR - -``` +$ ./build/wasm-mutator/wasm_mutator_fuzz ./build/CORPUS_DIR + +$ ./build/aot-compiler/aot_compiler_fuzz ./build/CORPUS_DIR +```` ## Fuzzing Server @@ -49,20 +58,20 @@ $ pip install -r requirements.txt 2. Database Migration $ python3 app/manager.py db init -$ python3 app/manager.py db migrate -$ python3 app/manager.py db upgrade +$ python3 app/manager.py db migrate +$ python3 app/manager.py db upgrade 3. Change localhost to your machine's IP address -$ cd ../portal +$ cd ../portal $ vim .env # Change localhost to your machine's IP address # http://:16667 4. Run Server and Portal $ cd .. # Switch to the original directory If you want to customize the front-end deployment port: # defaut 9999 - $ vim .env # Please change the portal_port to the port you want to use + $ vim .env # Please change the portal_port to the port you want to use The server is deployed on port 16667 by default, If you want to change the server deployment port: - $ vim .env # Please change the server_port to the port you want to use + $ vim .env # Please change the server_port to the port you want to use $ vim portal/.env # Please change the VITE_SERVER_URL to the port you want to use # http://ip: diff --git a/tests/fuzz/wasm-mutator-fuzz/aot-compiler/CMakeLists.txt b/tests/fuzz/wasm-mutator-fuzz/aot-compiler/CMakeLists.txt new file mode 100644 index 000000000..5ca33906a --- /dev/null +++ b/tests/fuzz/wasm-mutator-fuzz/aot-compiler/CMakeLists.txt @@ -0,0 +1,83 @@ +# Copyright (C) 2025 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Set default build options with the ability to override from the command line +if(NOT WAMR_BUILD_INTERP) + set(WAMR_BUILD_INTERP 1) +endif() + +set(WAMR_BUILD_WAMR_COMPILER 1) +set(WAMR_BUILD_AOT 0) +set(WAMR_BUILD_INTERP 1) +set(WAMR_BUILD_JIT 0) + +include(${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake) +include(${SHARED_DIR}/mem-alloc/mem_alloc.cmake) +include(${SHARED_DIR}/utils/shared_utils.cmake) +include(${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) +include(${IWASM_DIR}/compilation/iwasm_compl.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) +include(${IWASM_DIR}/interpreter/iwasm_interp.cmake) +include(${IWASM_DIR}/aot/iwasm_aot.cmake) +include(${IWASM_DIR}/compilation/iwasm_compl.cmake) +include(${REPO_ROOT_DIR}/build-scripts/version.cmake) + +add_library(aotclib + ${PLATFORM_SHARED_SOURCE} + ${MEM_ALLOC_SHARED_SOURCE} + ${UTILS_SHARED_SOURCE} + ${UNCOMMON_SHARED_SOURCE} + ${THREAD_MGR_SOURCE} + ${IWASM_COMMON_SOURCE} + ${IWASM_INTERP_SOURCE} + ${IWASM_AOT_SOURCE} + ${IWASM_GC_SOURCE} + ${IWASM_COMPL_SOURCE} +) + +target_compile_definitions(aotclib + PUBLIC + -DWASM_ENABLE_WAMR_COMPILER=1 + -DWASM_ENABLE_FAST_INTERP=0 + -DWASM_ENABLE_INTERP=1 + -DWASM_ENABLE_BULK_MEMORY=1 + -DWASM_ENABLE_SHARED_MEMORY=1 + -DWASM_ENABLE_TAIL_CALL=1 + -DWASM_ENABLE_SIMD=1 + -DWASM_ENABLE_REF_TYPES=1 + -DWASM_ENABLE_MEMORY64=1 + -DWASM_ENABLE_GC=1 + -DWASM_ENABLE_CUSTOM_NAME_SECTION=1 + -DWASM_ENABLE_AOT_STACK_FRAME=1 + -DWASM_ENABLE_DUMP_CALL_STACK=1 + -DWASM_ENABLE_PERF_PROFILING=1 + -DWASM_ENABLE_LOAD_CUSTOM_SECTION=1 + -DWASM_ENABLE_THREAD_MGR=1 + ${LLVM_DEFINITIONS} +) + +target_include_directories(aotclib PUBLIC + ${IWASM_DIR}/include + ${SHARED_DIR}/include +) + +target_link_directories(aotclib PUBLIC ${LLVM_LIBRARY_DIR}) + +target_link_libraries(aotclib PUBLIC ${REQUIRED_LLVM_LIBS}) + +if(NOT IN_OSS_FUZZ) + message(STATUS "Enable ASan and UBSan in non-oss-fuzz environment for aotclib") + target_compile_options(aotclib PUBLIC + -fprofile-instr-generate -fcoverage-mapping + -fno-sanitize-recover=all + -fsanitize=address,undefined + -fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability + -fno-sanitize=alignment + ) + target_link_options(aotclib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate) +endif() + +add_executable(aot_compiler_fuzz aot_compiler_fuzz.cc) +target_link_libraries(aot_compiler_fuzz PRIVATE stdc++ aotclib) diff --git a/tests/fuzz/wasm-mutator-fuzz/aot-compiler/aot_compiler_fuzz.cc b/tests/fuzz/wasm-mutator-fuzz/aot-compiler/aot_compiler_fuzz.cc new file mode 100644 index 000000000..89b4bad0a --- /dev/null +++ b/tests/fuzz/wasm-mutator-fuzz/aot-compiler/aot_compiler_fuzz.cc @@ -0,0 +1,91 @@ +// Copyright (C) 2025 Intel Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include +#include +#include + +#include "aot_export.h" +#include "wasm_export.h" +#include "bh_read_file.h" + +static void +handle_aot_recent_error(const char *tag) +{ + const char *error = aot_get_last_error(); + if (strlen(error) == 0) { + error = "UNKNOWN ERROR"; + } + + std::cout << tag << " " << error << std::endl; +} + +extern "C" int +LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) +{ + wasm_module_t module = NULL; + char error_buf[128] = { 0 }; + AOTCompOption option = { 0 }; + aot_comp_data_t comp_data = NULL; + aot_comp_context_t comp_ctx = NULL; + + /* libfuzzer don't allow to modify the given Data, so make a copy here */ + std::vector myData(Data, Data + Size); + + if (Size >= 4 + && get_package_type(myData.data(), Size) != Wasm_Module_Bytecode) { + printf("Invalid wasm file: magic header not detected\n"); + return 0; + } + + wasm_runtime_init(); + + module = wasm_runtime_load((uint8_t *)myData.data(), Size, error_buf, 120); + if (!module) { + std::cout << "[LOADING] " << error_buf << std::endl; + goto DESTROY_RUNTIME; + } + + // TODO: target_arch and other fields + option.target_arch = "x86_64"; + option.target_abi = "gnu"; + option.enable_bulk_memory = true; + option.enable_thread_mgr = true; + option.enable_tail_call = true; + option.enable_simd = true; + option.enable_ref_types = true; + option.enable_gc = true; + + comp_data = + aot_create_comp_data(module, option.target_arch, option.enable_gc); + if (!comp_data) { + handle_aot_recent_error("[CREATING comp_data]"); + goto UNLOAD_MODULE; + } + + comp_ctx = aot_create_comp_context(comp_data, &option); + if (!comp_ctx) { + handle_aot_recent_error("[CREATING comp_context]"); + goto DESTROY_COMP_DATA; + } + + if (!aot_compile_wasm(comp_ctx)) { + handle_aot_recent_error("[COMPILING]"); + goto DESTROY_COMP_CTX; + } + +DESTROY_COMP_CTX: + aot_destroy_comp_context(comp_ctx); +DESTROY_COMP_DATA: + aot_destroy_comp_data(comp_data); +UNLOAD_MODULE: + wasm_runtime_unload(module); +DESTROY_RUNTIME: + wasm_runtime_destroy(); + + /* Values other than 0 and -1 are reserved for future use. */ + return 0; +} diff --git a/tests/fuzz/wasm-mutator-fuzz/clang_toolchain.cmake b/tests/fuzz/wasm-mutator-fuzz/clang_toolchain.cmake new file mode 100644 index 000000000..d16a0b207 --- /dev/null +++ b/tests/fuzz/wasm-mutator-fuzz/clang_toolchain.cmake @@ -0,0 +1,29 @@ +# Copyright (C) 2025 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Check for Clang C compiler +find_program(CLANG_C_COMPILER NAMES clang) +if(NOT CLANG_C_COMPILER) + message(FATAL_ERROR "Clang C compiler not found. Please install Clang.") +else() + message(STATUS "Clang C compiler found: ${CLANG_C_COMPILER}") + set(CMAKE_C_COMPILER ${CLANG_C_COMPILER}) +endif() + +# Check for Clang C++ compiler +find_program(CLANG_CXX_COMPILER NAMES clang++) +if(NOT CLANG_CXX_COMPILER) + message(FATAL_ERROR "Clang C++ compiler not found. Please install Clang.") +else() + message(STATUS "Clang C++ compiler found: ${CLANG_CXX_COMPILER}") + set(CMAKE_CXX_COMPILER ${CLANG_CXX_COMPILER}) +endif() + +# Check for Clang assembler +find_program(CLANG_ASM_COMPILER NAMES clang) +if(NOT CLANG_ASM_COMPILER) + message(FATAL_ERROR "Clang assembler not found. Please install Clang.") +else() + message(STATUS "Clang assembler found: ${CLANG_ASM_COMPILER}") + set(CMAKE_ASM_COMPILER ${CLANG_ASM_COMPILER}) +endif() diff --git a/tests/fuzz/wasm-mutator-fuzz/portal/package-lock.json b/tests/fuzz/wasm-mutator-fuzz/portal/package-lock.json index 3abb540a2..87dc143d0 100644 --- a/tests/fuzz/wasm-mutator-fuzz/portal/package-lock.json +++ b/tests/fuzz/wasm-mutator-fuzz/portal/package-lock.json @@ -19,19 +19,20 @@ "devDependencies": { "@types/react": "^18.0.17", "@types/react-dom": "^18.0.6", - "@vitejs/plugin-react": "^2.0.1", + "@vitejs/plugin-react": "^4.3.4", "typescript": "^4.6.4", - "vite": "^3.0.7" + "vite": "^6.2.2" } }, "node_modules/@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -85,47 +86,52 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.13.tgz", - "integrity": "sha512-5yUzC5LqyTFp2HLmDoxGQelcdYgSpP9xsnMWBphAscOdFrHSAVbLNzWiy32sVNDqJRDiJK6klfDnAgu6PAGSHw==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.13.tgz", - "integrity": "sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, + "license": "MIT", "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helpers": "^7.18.9", - "@babel/parser": "^7.18.13", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.13", - "@babel/types": "^7.18.13", - "convert-source-map": "^1.7.0", + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" + "json5": "^2.2.3", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -136,55 +142,63 @@ } }, "node_modules/@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.10.tgz", + "integrity": "sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.13", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" + "@babel/parser": "^7.26.10", + "@babel/types": "^7.26.10", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz", - "integrity": "sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", - "semver": "^6.3.0" + "@babel/compat-data": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -193,164 +207,69 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", - "dev": true, - "dependencies": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz", - "integrity": "sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz", - "integrity": "sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.9.tgz", - "integrity": "sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.10" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -358,62 +277,14 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.18.10.tgz", - "integrity": "sha512-gCy7Iikrpu3IZjYZolFE4M1Sm+nrh1/6za2Ewj77Z+XirT4TsbJcvOFOyF+fRPwU6AKKK136CZxx6L8AbSFG6A==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-jsx": "^7.18.6", - "@babel/types": "^7.18.10" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-development": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.18.6.tgz", - "integrity": "sha512-SA6HEjwYFKF7WDjWcMcMGUimmw/nhNRDWxr+KaLSCrkD/LMDBvWRmHAYgE1HDeF8KUuI8OAu+RT6EOtKxSW2qA==", - "dev": true, - "dependencies": { - "@babel/plugin-transform-react-jsx": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.18.6.tgz", - "integrity": "sha512-A0LQGx4+4Jv7u/tWzoJF7alZwnBDQd6cGLh9P+Ttk4dpiL+J5p7NSNv/9tlEFFJDq3kjxOavWmbm6t0Gk+A3Ig==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz", + "integrity": "sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -423,12 +294,13 @@ } }, "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.18.6.tgz", - "integrity": "sha512-utZmlASneDfdaMh0m/WausbjUjEdGrQJz0vFK93d7wD3xf5wBtX219+q6IlCNZeguIcxS2f/CvLZrlLSvSHQXw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.25.9.tgz", + "integrity": "sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -449,34 +321,33 @@ } }, "node_modules/@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.10.tgz", + "integrity": "sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", - "debug": "^4.1.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -484,14 +355,14 @@ } }, "node_modules/@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -505,69 +376,802 @@ "node": ">=10" } }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", - "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", "cpu": [ - "loong64" + "ppc64" ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.36.0.tgz", + "integrity": "sha512-jgrXjjcEwN6XpZXL0HUeOVGfjXhPyxAbbhD0BlXUB+abTOpbPiN5Wb3kOT7yb+uEtATNYF5x5gIfwutmuBA26w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.36.0.tgz", + "integrity": "sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.36.0.tgz", + "integrity": "sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.36.0.tgz", + "integrity": "sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.36.0.tgz", + "integrity": "sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.36.0.tgz", + "integrity": "sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.36.0.tgz", + "integrity": "sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.36.0.tgz", + "integrity": "sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.36.0.tgz", + "integrity": "sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.36.0.tgz", + "integrity": "sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.36.0.tgz", + "integrity": "sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.36.0.tgz", + "integrity": "sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.36.0.tgz", + "integrity": "sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.36.0.tgz", + "integrity": "sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.36.0.tgz", + "integrity": "sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.36.0.tgz", + "integrity": "sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.36.0.tgz", + "integrity": "sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.36.0.tgz", + "integrity": "sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.36.0.tgz", + "integrity": "sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -601,36 +1205,23 @@ "dev": true }, "node_modules/@vitejs/plugin-react": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-2.0.1.tgz", - "integrity": "sha512-uINzNHmjrbunlFtyVkST6lY1ewSfz/XwLufG0PIqvLGnpk2nOIOa/1CACTDNcKi1/RwaCzJLmsXwm1NsUVV/NA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz", + "integrity": "sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/core": "^7.18.10", - "@babel/plugin-transform-react-jsx": "^7.18.10", - "@babel/plugin-transform-react-jsx-development": "^7.18.6", - "@babel/plugin-transform-react-jsx-self": "^7.18.6", - "@babel/plugin-transform-react-jsx-source": "^7.18.6", - "magic-string": "^0.26.2", - "react-refresh": "^0.14.0" + "@babel/core": "^7.26.0", + "@babel/plugin-transform-react-jsx-self": "^7.25.9", + "@babel/plugin-transform-react-jsx-source": "^7.25.9", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.14.2" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "peerDependencies": { - "vite": "^3.0.0" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0" } }, "node_modules/antd": { @@ -703,9 +1294,9 @@ "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==" }, "node_modules/browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "funding": [ { @@ -715,13 +1306,18 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -731,9 +1327,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001384", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001384.tgz", - "integrity": "sha512-BBWt57kqWbc0GYZXb47wTXpmAgqr5LSibPzNjk/AWMdmJMQhLqOl3c/Kd4OAU/tu4NLfYkMx8Tlq3RVBkOBolQ==", + "version": "1.0.30001706", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz", + "integrity": "sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug==", "dev": true, "funding": [ { @@ -743,56 +1339,30 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } - ] - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } + ], + "license": "CC-BY-4.0" }, "node_modules/classnames": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, "node_modules/compute-scroll-into-view": { "version": "1.0.17", "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz", "integrity": "sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg==" }, "node_modules/convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.1" - } + "license": "MIT" }, "node_modules/copy-to-clipboard": { "version": "3.3.2", @@ -826,12 +1396,13 @@ "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -848,391 +1419,70 @@ "integrity": "sha512-Gj9hZN3a07cbR6zviMUBOMPdWxYhbMI+x+WS0NAIu2zFZmbK8ys9R79g+iG9qLnlCwpFoaB+fKy8Pdv470GsPA==" }, "node_modules/electron-to-chromium": { - "version": "1.4.233", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.233.tgz", - "integrity": "sha512-ejwIKXTg1wqbmkcRJh9Ur3hFGHFDZDw1POzdsVrB2WZjgRuRMHIQQKNpe64N/qh3ZtH2otEoRoS+s6arAAuAAw==", - "dev": true + "version": "1.5.121", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.121.tgz", + "integrity": "sha512-gpIEzIb3uvm6V8IK452TvzOvZ3EAF8D5i11SMUG7BjpF2aalh5KyKX5dO+GDW5m9Qdia1ejLm6WM5NOIOd7sbQ==", + "dev": true, + "license": "ISC" }, "node_modules/esbuild": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", - "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/linux-loong64": "0.14.54", - "esbuild-android-64": "0.14.54", - "esbuild-android-arm64": "0.14.54", - "esbuild-darwin-64": "0.14.54", - "esbuild-darwin-arm64": "0.14.54", - "esbuild-freebsd-64": "0.14.54", - "esbuild-freebsd-arm64": "0.14.54", - "esbuild-linux-32": "0.14.54", - "esbuild-linux-64": "0.14.54", - "esbuild-linux-arm": "0.14.54", - "esbuild-linux-arm64": "0.14.54", - "esbuild-linux-mips64le": "0.14.54", - "esbuild-linux-ppc64le": "0.14.54", - "esbuild-linux-riscv64": "0.14.54", - "esbuild-linux-s390x": "0.14.54", - "esbuild-netbsd-64": "0.14.54", - "esbuild-openbsd-64": "0.14.54", - "esbuild-sunos-64": "0.14.54", - "esbuild-windows-32": "0.14.54", - "esbuild-windows-64": "0.14.54", - "esbuild-windows-arm64": "0.14.54" - } - }, - "node_modules/esbuild-android-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", - "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-android-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", - "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-darwin-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", - "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", - "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-freebsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", - "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", - "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-32": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", - "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", - "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-arm": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", - "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", - "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", - "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", - "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-riscv64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", - "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-s390x": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", - "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-netbsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", - "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-openbsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", - "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-sunos-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", - "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-32": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", - "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", - "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", - "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1241,17 +1491,12 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -1261,27 +1506,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -1299,33 +1524,22 @@ "@babel/runtime": "^7.7.6" } }, - "node_modules/is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, + "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json2mq": { @@ -1337,10 +1551,11 @@ } }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, + "license": "MIT", "bin": { "json5": "lib/cli.js" }, @@ -1364,16 +1579,14 @@ "loose-envify": "cli.js" } }, - "node_modules/magic-string": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.2.tgz", - "integrity": "sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A==", + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, + "license": "ISC", "dependencies": { - "sourcemap-codec": "^1.4.8" - }, - "engines": { - "node": ">=12" + "yallist": "^3.0.2" } }, "node_modules/memoize-one": { @@ -1390,16 +1603,24 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -1408,10 +1629,11 @@ } }, "node_modules/node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", - "dev": true + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" }, "node_modules/object-assign": { "version": "4.1.1", @@ -1421,22 +1643,17 @@ "node": ">=0.10.0" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" }, "node_modules/postcss": { - "version": "8.4.16", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", - "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", + "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", "dev": true, "funding": [ { @@ -1446,12 +1663,17 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -2098,10 +2320,11 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/react-refresh": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", - "integrity": "sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", + "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2140,44 +2363,45 @@ "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/rollup": { - "version": "2.77.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz", - "integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.36.0.tgz", + "integrity": "sha512-zwATAXNQxUcd40zgtQG0ZafcRK4g004WtEl7kbuhTWPvf07PsfohXl39jVUvPF7jvNAIkKPQ2XrsDlWuxBd++Q==", "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.6" + }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=10.0.0" + "node": ">=18.0.0", + "npm": ">=8.0.0" }, "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.36.0", + "@rollup/rollup-android-arm64": "4.36.0", + "@rollup/rollup-darwin-arm64": "4.36.0", + "@rollup/rollup-darwin-x64": "4.36.0", + "@rollup/rollup-freebsd-arm64": "4.36.0", + "@rollup/rollup-freebsd-x64": "4.36.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.36.0", + "@rollup/rollup-linux-arm-musleabihf": "4.36.0", + "@rollup/rollup-linux-arm64-gnu": "4.36.0", + "@rollup/rollup-linux-arm64-musl": "4.36.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.36.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.36.0", + "@rollup/rollup-linux-riscv64-gnu": "4.36.0", + "@rollup/rollup-linux-s390x-gnu": "4.36.0", + "@rollup/rollup-linux-x64-gnu": "4.36.0", + "@rollup/rollup-linux-x64-musl": "4.36.0", + "@rollup/rollup-win32-arm64-msvc": "4.36.0", + "@rollup/rollup-win32-ia32-msvc": "4.36.0", + "@rollup/rollup-win32-x64-msvc": "4.36.0", "fsevents": "~2.3.2" } }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", @@ -2203,10 +2427,11 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -2217,58 +2442,20 @@ "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "node_modules/string-convert": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", "integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==" }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/toggle-selection": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", @@ -2288,9 +2475,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", - "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "dev": true, "funding": [ { @@ -2300,70 +2487,113 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" }, "bin": { - "browserslist-lint": "cli.js" + "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" } }, "node_modules/vite": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-3.0.9.tgz", - "integrity": "sha512-waYABTM+G6DBTCpYAxvevpG50UOlZuynR0ckTK5PawNVt7ebX6X7wNXHaGIO6wYYFXSM7/WcuFuO2QzhBB6aMw==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.2.tgz", + "integrity": "sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.14.47", - "postcss": "^8.4.16", - "resolve": "^1.22.1", - "rollup": ">=2.75.6 <2.77.0 || ~2.77.0" + "esbuild": "^0.25.0", + "postcss": "^8.5.3", + "rollup": "^4.30.1" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { - "fsevents": "~2.3.2" + "fsevents": "~2.3.3" }, "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", "less": "*", + "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", - "terser": "^5.4.0" + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" }, "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, "less": { "optional": true }, + "lightningcss": { + "optional": true + }, "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, + "sugarss": { + "optional": true + }, "terser": { "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true } } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" } }, "dependencies": { "@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "requires": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" } }, "@ant-design/colors": { @@ -2404,255 +2634,151 @@ } }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, "requires": { - "@babel/highlight": "^7.18.6" + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" } }, "@babel/compat-data": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.13.tgz", - "integrity": "sha512-5yUzC5LqyTFp2HLmDoxGQelcdYgSpP9xsnMWBphAscOdFrHSAVbLNzWiy32sVNDqJRDiJK6klfDnAgu6PAGSHw==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true }, "@babel/core": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.13.tgz", - "integrity": "sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, "requires": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helpers": "^7.18.9", - "@babel/parser": "^7.18.13", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.13", - "@babel/types": "^7.18.13", - "convert-source-map": "^1.7.0", + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" + "json5": "^2.2.3", + "semver": "^6.3.1" } }, "@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.10.tgz", + "integrity": "sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==", "dev": true, "requires": { - "@babel/types": "^7.18.13", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" - }, - "dependencies": { - "@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } - } - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" + "@babel/parser": "^7.26.10", + "@babel/types": "^7.26.10", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" } }, "@babel/helper-compilation-targets": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz", - "integrity": "sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dev": true, "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", - "semver": "^6.3.0" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "dev": true - }, - "@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", - "dev": true, - "requires": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" + "@babel/compat-data": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" } }, "@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" } }, "@babel/helper-module-transforms": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz", - "integrity": "sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, "@babel/helper-plugin-utils": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz", - "integrity": "sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true }, - "@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, "@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true }, "@babel/helpers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.9.tgz", - "integrity": "sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dev": true, "requires": { - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" - } - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" } }, "@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==", - "dev": true - }, - "@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-react-jsx": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.18.10.tgz", - "integrity": "sha512-gCy7Iikrpu3IZjYZolFE4M1Sm+nrh1/6za2Ewj77Z+XirT4TsbJcvOFOyF+fRPwU6AKKK136CZxx6L8AbSFG6A==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-jsx": "^7.18.6", - "@babel/types": "^7.18.10" - } - }, - "@babel/plugin-transform-react-jsx-development": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.18.6.tgz", - "integrity": "sha512-SA6HEjwYFKF7WDjWcMcMGUimmw/nhNRDWxr+KaLSCrkD/LMDBvWRmHAYgE1HDeF8KUuI8OAu+RT6EOtKxSW2qA==", - "dev": true, - "requires": { - "@babel/plugin-transform-react-jsx": "^7.18.6" + "@babel/types": "^7.26.10" } }, "@babel/plugin-transform-react-jsx-self": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.18.6.tgz", - "integrity": "sha512-A0LQGx4+4Jv7u/tWzoJF7alZwnBDQd6cGLh9P+Ttk4dpiL+J5p7NSNv/9tlEFFJDq3kjxOavWmbm6t0Gk+A3Ig==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz", + "integrity": "sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-react-jsx-source": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.18.6.tgz", - "integrity": "sha512-utZmlASneDfdaMh0m/WausbjUjEdGrQJz0vFK93d7wD3xf5wBtX219+q6IlCNZeguIcxS2f/CvLZrlLSvSHQXw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.25.9.tgz", + "integrity": "sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/runtime": { @@ -2664,43 +2790,39 @@ } }, "@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "dev": true, "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" } }, "@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.10.tgz", + "integrity": "sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==", "dev": true, "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", - "debug": "^4.1.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10", + "debug": "^4.3.1", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dev": true, "requires": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" } }, "@ctrl/tinycolor": { @@ -2708,51 +2830,400 @@ "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.4.1.tgz", "integrity": "sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw==" }, + "@esbuild/aix-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", + "dev": true, + "optional": true + }, "@esbuild/linux-loong64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", - "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", "dev": true, "optional": true }, "@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, "requires": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" } }, "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true }, "@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@rollup/rollup-android-arm-eabi": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.36.0.tgz", + "integrity": "sha512-jgrXjjcEwN6XpZXL0HUeOVGfjXhPyxAbbhD0BlXUB+abTOpbPiN5Wb3kOT7yb+uEtATNYF5x5gIfwutmuBA26w==", + "dev": true, + "optional": true + }, + "@rollup/rollup-android-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.36.0.tgz", + "integrity": "sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-darwin-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.36.0.tgz", + "integrity": "sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-darwin-x64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.36.0.tgz", + "integrity": "sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-freebsd-arm64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.36.0.tgz", + "integrity": "sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-freebsd-x64": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.36.0.tgz", + "integrity": "sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.36.0.tgz", + "integrity": "sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm-musleabihf": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.36.0.tgz", + "integrity": "sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.36.0.tgz", + "integrity": "sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm64-musl": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.36.0.tgz", + "integrity": "sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.36.0.tgz", + "integrity": "sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.36.0.tgz", + "integrity": "sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-riscv64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.36.0.tgz", + "integrity": "sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-s390x-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.36.0.tgz", + "integrity": "sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-x64-gnu": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.36.0.tgz", + "integrity": "sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-x64-musl": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.36.0.tgz", + "integrity": "sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-arm64-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.36.0.tgz", + "integrity": "sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-ia32-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.36.0.tgz", + "integrity": "sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-x64-msvc": { + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.36.0.tgz", + "integrity": "sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==", + "dev": true, + "optional": true + }, + "@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -2786,27 +3257,16 @@ "dev": true }, "@vitejs/plugin-react": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-2.0.1.tgz", - "integrity": "sha512-uINzNHmjrbunlFtyVkST6lY1ewSfz/XwLufG0PIqvLGnpk2nOIOa/1CACTDNcKi1/RwaCzJLmsXwm1NsUVV/NA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz", + "integrity": "sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug==", "dev": true, "requires": { - "@babel/core": "^7.18.10", - "@babel/plugin-transform-react-jsx": "^7.18.10", - "@babel/plugin-transform-react-jsx-development": "^7.18.6", - "@babel/plugin-transform-react-jsx-self": "^7.18.6", - "@babel/plugin-transform-react-jsx-source": "^7.18.6", - "magic-string": "^0.26.2", - "react-refresh": "^0.14.0" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" + "@babel/core": "^7.26.0", + "@babel/plugin-transform-react-jsx-self": "^7.25.9", + "@babel/plugin-transform-react-jsx-source": "^7.25.9", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.14.2" } }, "antd": { @@ -2871,67 +3331,38 @@ "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==" }, "browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" } }, "caniuse-lite": { - "version": "1.0.30001384", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001384.tgz", - "integrity": "sha512-BBWt57kqWbc0GYZXb47wTXpmAgqr5LSibPzNjk/AWMdmJMQhLqOl3c/Kd4OAU/tu4NLfYkMx8Tlq3RVBkOBolQ==", + "version": "1.0.30001706", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz", + "integrity": "sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug==", "dev": true }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, "classnames": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, "compute-scroll-into-view": { "version": "1.0.17", "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz", "integrity": "sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg==" }, "convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true }, "copy-to-clipboard": { "version": "3.3.2", @@ -2958,12 +3389,12 @@ "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" }, "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "requires": { - "ms": "2.1.2" + "ms": "^2.1.3" } }, "dom-align": { @@ -2972,205 +3403,57 @@ "integrity": "sha512-Gj9hZN3a07cbR6zviMUBOMPdWxYhbMI+x+WS0NAIu2zFZmbK8ys9R79g+iG9qLnlCwpFoaB+fKy8Pdv470GsPA==" }, "electron-to-chromium": { - "version": "1.4.233", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.233.tgz", - "integrity": "sha512-ejwIKXTg1wqbmkcRJh9Ur3hFGHFDZDw1POzdsVrB2WZjgRuRMHIQQKNpe64N/qh3ZtH2otEoRoS+s6arAAuAAw==", + "version": "1.5.121", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.121.tgz", + "integrity": "sha512-gpIEzIb3uvm6V8IK452TvzOvZ3EAF8D5i11SMUG7BjpF2aalh5KyKX5dO+GDW5m9Qdia1ejLm6WM5NOIOd7sbQ==", "dev": true }, "esbuild": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", - "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", "dev": true, "requires": { - "@esbuild/linux-loong64": "0.14.54", - "esbuild-android-64": "0.14.54", - "esbuild-android-arm64": "0.14.54", - "esbuild-darwin-64": "0.14.54", - "esbuild-darwin-arm64": "0.14.54", - "esbuild-freebsd-64": "0.14.54", - "esbuild-freebsd-arm64": "0.14.54", - "esbuild-linux-32": "0.14.54", - "esbuild-linux-64": "0.14.54", - "esbuild-linux-arm": "0.14.54", - "esbuild-linux-arm64": "0.14.54", - "esbuild-linux-mips64le": "0.14.54", - "esbuild-linux-ppc64le": "0.14.54", - "esbuild-linux-riscv64": "0.14.54", - "esbuild-linux-s390x": "0.14.54", - "esbuild-netbsd-64": "0.14.54", - "esbuild-openbsd-64": "0.14.54", - "esbuild-sunos-64": "0.14.54", - "esbuild-windows-32": "0.14.54", - "esbuild-windows-64": "0.14.54", - "esbuild-windows-arm64": "0.14.54" + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" } }, - "esbuild-android-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", - "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", - "dev": true, - "optional": true - }, - "esbuild-android-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", - "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", - "dev": true, - "optional": true - }, - "esbuild-darwin-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", - "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", - "dev": true, - "optional": true - }, - "esbuild-darwin-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", - "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", - "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", - "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", - "dev": true, - "optional": true - }, - "esbuild-linux-32": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", - "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", - "dev": true, - "optional": true - }, - "esbuild-linux-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", - "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", - "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", - "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", - "dev": true, - "optional": true - }, - "esbuild-linux-mips64le": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", - "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", - "dev": true, - "optional": true - }, - "esbuild-linux-ppc64le": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", - "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", - "dev": true, - "optional": true - }, - "esbuild-linux-riscv64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", - "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", - "dev": true, - "optional": true - }, - "esbuild-linux-s390x": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", - "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", - "dev": true, - "optional": true - }, - "esbuild-netbsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", - "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", - "dev": true, - "optional": true - }, - "esbuild-openbsd-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", - "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", - "dev": true, - "optional": true - }, - "esbuild-sunos-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", - "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", - "dev": true, - "optional": true - }, - "esbuild-windows-32": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", - "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", - "dev": true, - "optional": true - }, - "esbuild-windows-64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", - "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", - "dev": true, - "optional": true - }, - "esbuild-windows-arm64": { - "version": "0.14.54", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", - "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", - "dev": true, - "optional": true - }, "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true }, "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "optional": true }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3183,21 +3466,6 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, "highlight-words-core": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/highlight-words-core/-/highlight-words-core-1.2.2.tgz", @@ -3211,24 +3479,15 @@ "@babel/runtime": "^7.7.6" } }, - "is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true }, "json2mq": { @@ -3240,9 +3499,9 @@ } }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, "lodash": { @@ -3258,13 +3517,13 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, - "magic-string": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.2.tgz", - "integrity": "sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A==", + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "requires": { - "sourcemap-codec": "^1.4.8" + "yallist": "^3.0.2" } }, "memoize-one": { @@ -3278,21 +3537,21 @@ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true }, "node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "dev": true }, "object-assign": { @@ -3300,27 +3559,21 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true }, "postcss": { - "version": "8.4.16", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", - "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", + "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", "dev": true, "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" } }, "prop-types": { @@ -3777,9 +4030,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "react-refresh": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", - "integrity": "sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", + "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", "dev": true }, "react-router": { @@ -3809,32 +4062,35 @@ "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, "rollup": { - "version": "2.77.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz", - "integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.36.0.tgz", + "integrity": "sha512-zwATAXNQxUcd40zgtQG0ZafcRK4g004WtEl7kbuhTWPvf07PsfohXl39jVUvPF7jvNAIkKPQ2XrsDlWuxBd++Q==", "dev": true, "requires": { + "@rollup/rollup-android-arm-eabi": "4.36.0", + "@rollup/rollup-android-arm64": "4.36.0", + "@rollup/rollup-darwin-arm64": "4.36.0", + "@rollup/rollup-darwin-x64": "4.36.0", + "@rollup/rollup-freebsd-arm64": "4.36.0", + "@rollup/rollup-freebsd-x64": "4.36.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.36.0", + "@rollup/rollup-linux-arm-musleabihf": "4.36.0", + "@rollup/rollup-linux-arm64-gnu": "4.36.0", + "@rollup/rollup-linux-arm64-musl": "4.36.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.36.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.36.0", + "@rollup/rollup-linux-riscv64-gnu": "4.36.0", + "@rollup/rollup-linux-s390x-gnu": "4.36.0", + "@rollup/rollup-linux-x64-gnu": "4.36.0", + "@rollup/rollup-linux-x64-musl": "4.36.0", + "@rollup/rollup-win32-arm64-msvc": "4.36.0", + "@rollup/rollup-win32-ia32-msvc": "4.36.0", + "@rollup/rollup-win32-x64-msvc": "4.36.0", + "@types/estree": "1.0.6", "fsevents": "~2.3.2" } }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", @@ -3857,9 +4113,9 @@ } }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, "shallowequal": { @@ -3868,15 +4124,9 @@ "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" }, "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true - }, - "sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true }, "string-convert": { @@ -3884,27 +4134,6 @@ "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", "integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==" }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true - }, "toggle-selection": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", @@ -3917,27 +4146,32 @@ "dev": true }, "update-browserslist-db": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", - "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "dev": true, "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" } }, "vite": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-3.0.9.tgz", - "integrity": "sha512-waYABTM+G6DBTCpYAxvevpG50UOlZuynR0ckTK5PawNVt7ebX6X7wNXHaGIO6wYYFXSM7/WcuFuO2QzhBB6aMw==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.2.tgz", + "integrity": "sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==", "dev": true, "requires": { - "esbuild": "^0.14.47", - "fsevents": "~2.3.2", - "postcss": "^8.4.16", - "resolve": "^1.22.1", - "rollup": ">=2.75.6 <2.77.0 || ~2.77.0" + "esbuild": "^0.25.0", + "fsevents": "~2.3.3", + "postcss": "^8.5.3", + "rollup": "^4.30.1" } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true } } } diff --git a/tests/fuzz/wasm-mutator-fuzz/portal/package.json b/tests/fuzz/wasm-mutator-fuzz/portal/package.json index 01622ddf5..5019af623 100644 --- a/tests/fuzz/wasm-mutator-fuzz/portal/package.json +++ b/tests/fuzz/wasm-mutator-fuzz/portal/package.json @@ -20,8 +20,8 @@ "devDependencies": { "@types/react": "^18.0.17", "@types/react-dom": "^18.0.6", - "@vitejs/plugin-react": "^2.0.1", + "@vitejs/plugin-react": "^4.3.4", "typescript": "^4.6.4", - "vite": "^3.0.7" + "vite": "^6.2.2" } } diff --git a/tests/fuzz/wasm-mutator-fuzz/smith_wasm.sh b/tests/fuzz/wasm-mutator-fuzz/smith_wasm.sh index 02ac83174..097e5348b 100755 --- a/tests/fuzz/wasm-mutator-fuzz/smith_wasm.sh +++ b/tests/fuzz/wasm-mutator-fuzz/smith_wasm.sh @@ -41,7 +41,9 @@ function try_generate_wasm() printf -- "-- output ${GENERATED_WASM_NAME} in %d retries\n" $try_i } -WASM_SHAPE=" --allow-invalid-funcs true \ +WASM_SHAPE=" --ensure-termination \ +--export-everything true \ +--fuel 7 \ --generate-custom-sections true \ --min-funcs 5 \ --max-instructions 1024 \ diff --git a/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/CMakeLists.txt b/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/CMakeLists.txt new file mode 100644 index 000000000..b501baecf --- /dev/null +++ b/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/CMakeLists.txt @@ -0,0 +1,70 @@ +# Copyright (C) 2025 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +if(CUSTOM_MUTATOR EQUAL 1) + add_compile_definitions(CUSTOM_MUTATOR) +endif() + +# Set default build options with the ability to override from the command line +if(NOT WAMR_BUILD_INTERP) + set(WAMR_BUILD_INTERP 1) +endif() + +if(NOT WAMR_BUILD_AOT) + set(WAMR_BUILD_AOT 1) +endif() + +if(NOT WAMR_BUILD_JIT) + set(WAMR_BUILD_JIT 0) +endif() + +if(NOT WAMR_BUILD_LIBC_BUILTIN) + set(WAMR_BUILD_LIBC_BUILTIN 0) +endif() + +if(NOT WAMR_BUILD_LIBC_WASI) + set(WAMR_BUILD_LIBC_WASI 1) +endif() + +if(NOT WAMR_BUILD_FAST_INTERP) + set(WAMR_BUILD_FAST_INTERP 1) +endif() + +if(NOT WAMR_BUILD_MULTI_MODULE) + set(WAMR_BUILD_MULTI_MODULE 0) +endif() + +if(NOT WAMR_BUILD_LIB_PTHREAD) + set(WAMR_BUILD_LIB_PTHREAD 0) +endif() + +if(NOT WAMR_BUILD_MINI_LOADER) + set(WAMR_BUILD_MINI_LOADER 0) +endif() + +set(WAMR_BUILD_SIMD 1) +set(WAMR_BUILD_REF_TYPES 1) +set(WAMR_BUILD_GC 1) + +include(${REPO_ROOT_DIR}/build-scripts/runtime_lib.cmake) +include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake) + +add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +target_include_directories(vmlib PUBLIC ${RUNTIME_LIB_HEADER_LIST}) +target_link_directories(vmlib PUBLIC ${RUNTIME_LIB_LINK_LIST}) +target_link_libraries(vmlib PUBLIC ${REQUIRED_LLVM_LIBS}) + +add_executable(wasm_mutator_fuzz wasm_mutator_fuzz.cc) +target_link_libraries(wasm_mutator_fuzz PRIVATE vmlib m) + +if(NOT IN_OSS_FUZZ) + message(STATUS "Enable ASan and UBSan in non-oss-fuzz environment for vmlib") + target_compile_options(vmlib PUBLIC + -fprofile-instr-generate -fcoverage-mapping + -fno-sanitize-recover=all + -fsanitize=address,undefined + -fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability + -fno-sanitize=alignment + ) + target_link_options(vmlib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate) +endif() diff --git a/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/wasm_mutator_fuzz.cc b/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/wasm_mutator_fuzz.cc new file mode 100644 index 000000000..391d899cf --- /dev/null +++ b/tests/fuzz/wasm-mutator-fuzz/wasm-mutator/wasm_mutator_fuzz.cc @@ -0,0 +1,287 @@ +// Copyright (C) 2019 Intel Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "wasm_runtime_common.h" +#include "wasm_export.h" +#include "bh_read_file.h" +#include +#include +#include +#include +#include +#include + +using namespace std; + +static bool +is_supported_val_kind(wasm_valkind_t kind) +{ + return kind == WASM_I32 || kind == WASM_I64 || kind == WASM_F32 + || kind == WASM_F64 || kind == WASM_EXTERNREF + || kind == WASM_FUNCREF; +} + +static wasm_val_t +pre_defined_val(wasm_valkind_t kind) +{ + if (kind == WASM_I32) { + return wasm_val_t{ .kind = WASM_I32, .of = { .i32 = 2025 } }; + } + else if (kind == WASM_I64) { + return wasm_val_t{ .kind = WASM_I64, .of = { .i64 = 168 } }; + } + else if (kind == WASM_F32) { + return wasm_val_t{ .kind = WASM_F32, .of = { .f32 = 3.14159f } }; + } + else if (kind == WASM_F64) { + return wasm_val_t{ .kind = WASM_F64, .of = { .f64 = 2.71828 } }; + } + else if (kind == WASM_EXTERNREF) { + return wasm_val_t{ .kind = WASM_EXTERNREF, + .of = { .foreign = 0xabcddead } }; + } + // because aft is_supported_val_kind() check, so we can safely return as + // WASM_FUNCREF + else { + return wasm_val_t{ .kind = WASM_FUNCREF, .of = { .ref = nullptr } }; + } +} +void +print_execution_args(const wasm_export_t &export_type, + const std::vector &args, unsigned param_count) +{ + std::cout << "[EXECUTION] " << export_type.name << "("; + for (unsigned p_i = 0; p_i < param_count; p_i++) { + if (p_i != 0) { + std::cout << ", "; + } + + switch (args[p_i].kind) { + case WASM_I32: + std::cout << "i32:" << args[p_i].of.i32; + break; + case WASM_I64: + std::cout << "i64:" << args[p_i].of.i64; + break; + case WASM_F32: + std::cout << "f32:" << args[p_i].of.f32; + break; + case WASM_F64: + std::cout << "f64:" << args[p_i].of.f64; + break; + case WASM_EXTERNREF: + std::cout << "externref:" << args[p_i].of.foreign; + break; + default: + // because aft is_supported_val_kind() check, so we can safely + // return as WASM_FUNCREF + std::cout << "funcref:" << args[p_i].of.ref; + break; + } + } + std::cout << ")" << std::endl; +} + +static bool +execute_export_functions(wasm_module_t module, wasm_module_inst_t inst) +{ + int32_t export_count = wasm_runtime_get_export_count(module); + + for (int e_i = 0; e_i < export_count; e_i++) { + wasm_export_t export_type = { 0 }; + wasm_runtime_get_export_type(module, e_i, &export_type); + + if (export_type.kind != WASM_IMPORT_EXPORT_KIND_FUNC) { + continue; + } + + wasm_function_inst_t func = + wasm_runtime_lookup_function(inst, export_type.name); + if (!func) { + std::cout << "Failed to lookup function: " << export_type.name + << std::endl; + continue; + } + + wasm_func_type_t func_type = export_type.u.func_type; + uint32_t param_count = wasm_func_type_get_param_count(func_type); + + /* build arguments */ + std::vector args; + for (unsigned p_i = 0; p_i < param_count; p_i++) { + wasm_valkind_t param_type = + wasm_func_type_get_param_valkind(func_type, p_i); + + if (!is_supported_val_kind(param_type)) { + std::cout + << "Bypass execution because of unsupported value kind: " + << param_type << std::endl; + return true; + } + + wasm_val_t arg = pre_defined_val(param_type); + args.push_back(arg); + } + + /* build results storage */ + uint32_t result_count = wasm_func_type_get_result_count(func_type); + std::vector results = std::vector(result_count); + + print_execution_args(export_type, args, param_count); + + /* execute the function */ + wasm_exec_env_t exec_env = wasm_runtime_get_exec_env_singleton(inst); + if (!exec_env) { + std::cout << "Failed to get exec env" << std::endl; + return false; + } + + bool ret = + wasm_runtime_call_wasm_a(exec_env, func, result_count, + results.data(), param_count, args.data()); + if (!ret) { + const char *exception = wasm_runtime_get_exception(inst); + if (!exception) { + std::cout << "[EXECUTION] " << export_type.name + << "() failed. No exception info." << std::endl; + } + else { + std::cout << "[EXECUTION] " << export_type.name << "() failed. " + << exception << std::endl; + } + } + + wasm_runtime_clear_exception(inst); + } + + return true; +} + +extern "C" int +LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) +{ + /* libfuzzer don't allow us to modify the given Data, so we copy the data + * here */ + std::vector myData(Data, Data + Size); + + /* init runtime environment */ + wasm_runtime_init(); + + char error_buf[128] = { 0 }; + wasm_module_t module = + wasm_runtime_load((uint8_t *)myData.data(), Size, error_buf, 120); + if (!module) { + std::cout << "[LOADING] " << error_buf << std::endl; + wasm_runtime_destroy(); + /* return SUCCESS because the failure has been handled */ + return 0; + } + + wasm_module_inst_t inst = wasm_runtime_instantiate( + module, 8 * 1024 * 1024, 16 * 1024 * 1024, error_buf, 120); + if (!inst) { + std::cout << "[INSTANTIATE] " << error_buf << std::endl; + wasm_runtime_unload(module); + wasm_runtime_destroy(); + /* return SUCCESS because the failure has been handled */ + return 0; + } + + execute_export_functions(module, inst); + + wasm_runtime_deinstantiate(inst); + wasm_runtime_unload(module); + wasm_runtime_destroy(); + return 0; /* Values other than 0 and -1 are reserved for future use. */ +} + +/* Forward-declare the libFuzzer's mutator callback. */ +extern "C" size_t +LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize); + +/* The custom mutator: */ +#ifdef CUSTOM_MUTATOR +extern "C" size_t +LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, size_t MaxSize, + unsigned int Seed) +{ + if ((NULL != Data) && (Size > 10)) { + int mutate_ret = -1; + /* delete */ + if (access("./cur.wasm", 0) == 0) { + remove("./cur.wasm"); + } + + /* 1.write data to cur.wasm */ + FILE *fwrite_fp = fopen("./cur.wasm", "wb"); + if (NULL == fwrite_fp) { + printf("Faild to open cur.wasm file!\n"); + return 0; + } + fwrite(Data, sizeof(uint8_t), Size, fwrite_fp); + fclose(fwrite_fp); + fwrite_fp = NULL; + + /* 2.wasm-tools mutate modify cur.wasm */ + char cmd_tmp[150] = { 0 }; + + /* clang-format off */ + const char *preserve_semantic = (Seed % 2) ? "--preserve-semantics" : ""; + sprintf(cmd_tmp, "wasm-tools mutate cur.wasm --seed %d -o modified.wasm %s > /dev/null 2>&1", Seed, preserve_semantic); + /* clang-format on */ + mutate_ret = system(cmd_tmp); + memset(cmd_tmp, 0, sizeof(cmd_tmp)); + + if (mutate_ret != 0) { + /* If source file not valid, use libfuzzer's own modifier */ + return LLVMFuzzerMutate(Data, Size, MaxSize); + } + + /* 3.read modified file */ + int read_len = 0; + int file_len = 0; + int res = 0; + uint8_t *buf = NULL; + FILE *fread_fp = fopen("./modified.wasm", "rb"); + if (NULL == fread_fp) { + printf("Faild to open modified.wasm file!\n"); + exit(0); + } + + fseek(fread_fp, 0, SEEK_END); /* location to file end */ + file_len = ftell(fread_fp); /* get file size */ + buf = (uint8_t *)malloc(file_len); + + if (NULL != buf) { + fseek(fread_fp, 0, SEEK_SET); /* location to file start */ + read_len = fread(buf, 1, file_len, fread_fp); + if ((read_len == file_len) && (read_len < MaxSize)) { + /* 4.fill Data buffer */ + memcpy(Data, buf, read_len); + res = read_len; + } + else { + res = 0; + } + } + else { + res = 0; + } + + memset(buf, 0, file_len); + free(buf); + fclose(fread_fp); + fread_fp = NULL; + + return res; + } + else { + if (access("./modified.wasm", 0) == 0) { + remove("./modified.wasm"); + } + memset(Data, 0, Size); + Size = 0; + return 0; + } +} +#endif // CUSTOM_MUTATOR diff --git a/tests/fuzz/wasm-mutator-fuzz/wasm_mutator_fuzz.cc b/tests/fuzz/wasm-mutator-fuzz/wasm_mutator_fuzz.cc deleted file mode 100644 index 2d5a66703..000000000 --- a/tests/fuzz/wasm-mutator-fuzz/wasm_mutator_fuzz.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (C) 2019 Intel Corporation. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#include "wasm_runtime_common.h" -#include "wasm_export.h" -#include "bh_read_file.h" -#include -#include -#include -#include -#include -#include - -using namespace std; - -extern "C" int -LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) -{ - /* libfuzzer don't allow us to modify the given Data, so we copy the data - * here */ - std::vector myData(Data, Data + Size); - - /* init runtime environment */ - wasm_runtime_init(); - - char error_buf[128] = { 0 }; - wasm_module_t module = - wasm_runtime_load((uint8_t *)myData.data(), Size, error_buf, 120); - if (!module) { - std::cout << "[LOADING] " << error_buf << std::endl; - wasm_runtime_destroy(); - /* return SUCCESS because the failure has been handled */ - return 0; - } - - wasm_module_inst_t inst = wasm_runtime_instantiate( - module, 8 * 1024 * 1024, 16 * 1024 * 1024, error_buf, 120); - if (!inst) { - std::cout << "[INSTANTIATE] " << error_buf << std::endl; - wasm_runtime_unload(module); - wasm_runtime_destroy(); - /* return SUCCESS because the failure has been handled */ - return 0; - } - - std::cout << "PASS" << std::endl; - - wasm_runtime_deinstantiate(inst); - wasm_runtime_unload(module); - wasm_runtime_destroy(); - return 0; /* Values other than 0 and -1 are reserved for future use. */ -} - -/* Forward-declare the libFuzzer's mutator callback. */ -extern "C" size_t -LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize); - -/* The custom mutator: */ -#ifdef CUSTOM_MUTATOR -extern "C" size_t -LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, size_t MaxSize, - unsigned int Seed) -{ - if ((NULL != Data) && (Size > 10)) { - int mutate_ret = -1; - /* delete */ - if (access("./cur.wasm", 0) == 0) { - remove("./cur.wasm"); - } - - /* 1.write data to cur.wasm */ - FILE *fwrite_fp = fopen("./cur.wasm", "wb"); - if (NULL == fwrite_fp) { - printf("Faild to open cur.wasm file!\n"); - return 0; - } - fwrite(Data, sizeof(uint8_t), Size, fwrite_fp); - fclose(fwrite_fp); - fwrite_fp = NULL; - - /* 2.wasm-tools mutate modify cur.wasm */ - char cmd_tmp[150] = { 0 }; - - /* clang-format off */ - const char *preserve_semantic = (Seed % 2) ? "--preserve-semantics" : ""; - sprintf(cmd_tmp, "wasm-tools mutate cur.wasm --seed %d -o modified.wasm %s > /dev/null 2>&1", Seed, preserve_semantic); - /* clang-format on */ - mutate_ret = system(cmd_tmp); - memset(cmd_tmp, 0, sizeof(cmd_tmp)); - - if (mutate_ret != 0) { - /* If source file not valid, use libfuzzer's own modifier */ - return LLVMFuzzerMutate(Data, Size, MaxSize); - } - - /* 3.read modified file */ - int read_len = 0; - int file_len = 0; - int res = 0; - uint8_t *buf = NULL; - FILE *fread_fp = fopen("./modified.wasm", "rb"); - if (NULL == fread_fp) { - printf("Faild to open modified.wasm file!\n"); - exit(0); - } - - fseek(fread_fp, 0, SEEK_END); /* location to file end */ - file_len = ftell(fread_fp); /* get file size */ - buf = (uint8_t *)malloc(file_len); - - if (NULL != buf) { - fseek(fread_fp, 0, SEEK_SET); /* location to file start */ - read_len = fread(buf, 1, file_len, fread_fp); - if ((read_len == file_len) && (read_len < MaxSize)) { - /* 4.fill Data buffer */ - memcpy(Data, buf, read_len); - res = read_len; - } - else { - res = 0; - } - } - else { - res = 0; - } - - memset(buf, 0, file_len); - free(buf); - fclose(fread_fp); - fread_fp = NULL; - - return res; - } - else { - if (access("./modified.wasm", 0) == 0) { - remove("./modified.wasm"); - } - memset(Data, 0, Size); - Size = 0; - return 0; - } -} -#endif // CUSTOM_MUTATOR diff --git a/tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt b/tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt index 5fa171a9c..610de6afe 100644 --- a/tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt +++ b/tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.14) project(wasm_mutator) diff --git a/tests/standalone/test-invoke-native/CMakeLists.txt b/tests/standalone/test-invoke-native/CMakeLists.txt index 54cec530a..9ba585842 100644 --- a/tests/standalone/test-invoke-native/CMakeLists.txt +++ b/tests/standalone/test-invoke-native/CMakeLists.txt @@ -88,6 +88,11 @@ if (NOT DEFINED WAMR_BUILD_SIMD) set (WAMR_BUILD_SIMD 0) endif () +if (NOT DEFINED WAMR_BUILD_REF_TYPES) + # Enable reference types by default + set (WAMR_BUILD_REF_TYPES 1) +endif () + set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) diff --git a/tests/standalone/test-module-malloc/CMakeLists.txt b/tests/standalone/test-module-malloc/CMakeLists.txt index 8081f9fa4..bdaff6834 100644 --- a/tests/standalone/test-module-malloc/CMakeLists.txt +++ b/tests/standalone/test-module-malloc/CMakeLists.txt @@ -48,6 +48,9 @@ endif () if (NOT WAMR_BUILD_AOT) set (WAMR_BUILD_AOT 1) endif () +if (NOT WAMR_BUILD_REF_TYPES) + set (WAMR_BUILD_REF_TYPES 1) +endif () set (WAMR_BUILD_LIBC_BUILTIN 1) set (WAMR_BUILD_LIBC_WASI 1) diff --git a/tests/standalone/test-module-malloc/run.sh b/tests/standalone/test-module-malloc/run.sh index 644544f08..a89a11654 100755 --- a/tests/standalone/test-module-malloc/run.sh +++ b/tests/standalone/test-module-malloc/run.sh @@ -55,4 +55,3 @@ else ./iwasm --native-lib=./libtest_module_malloc.so wasm-app/test.aot fi fi - diff --git a/tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt b/tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt index c87187709..e75a81b33 100644 --- a/tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt +++ b/tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) project(wasm-app) set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) diff --git a/tests/standalone/test-pthread/threads-opcode-wasm-apps/CMakeLists.txt b/tests/standalone/test-pthread/threads-opcode-wasm-apps/CMakeLists.txt index 4f8e21ac8..fa5b59a1b 100644 --- a/tests/standalone/test-pthread/threads-opcode-wasm-apps/CMakeLists.txt +++ b/tests/standalone/test-pthread/threads-opcode-wasm-apps/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14) project(wasm-apps) -set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../wamr) +set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) if (APPLE) set (HAVE_FLAG_SEARCH_PATHS_FIRST 0) diff --git a/tests/standalone/test-running-modes/c-embed/CMakeLists.txt b/tests/standalone/test-running-modes/c-embed/CMakeLists.txt index 52064ac44..a79ca33b5 100644 --- a/tests/standalone/test-running-modes/c-embed/CMakeLists.txt +++ b/tests/standalone/test-running-modes/c-embed/CMakeLists.txt @@ -11,10 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -project(c_embed_test) - cmake_minimum_required(VERSION 3.14) +project(c_embed_test) + include(CheckPIESupported) string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) @@ -34,6 +34,11 @@ set(WAMR_BUILD_LIBC_WASI 1) set(WAMR_BUILD_SIMD 1) set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..) +if (NOT DEFINED WAMR_BUILD_REF_TYPES) + # Enable reference types by default + set (WAMR_BUILD_REF_TYPES 1) +endif () + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") if (NOT WAMR_BUILD_PLATFORM STREQUAL "darwin") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 528ae673c..8c963cadd 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -1,10 +1,17 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project(unit-test) +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5) + SET(CMAKE_BUILD_TYPE Debug) # add_definitions (-m32) @@ -22,18 +29,11 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) # Fetch Google test include (FetchContent) -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24") - FetchContent_Declare ( - googletest - URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip - DOWNLOAD_EXTRACT_TIMESTAMP ON - ) -else() - FetchContent_Declare ( - googletest - URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip - ) -endif() +FetchContent_Declare ( + googletest + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + DOWNLOAD_EXTRACT_TIMESTAMP TRUE +) FetchContent_MakeAvailable (googletest) SET(GOOGLETEST_INCLUDED 1) @@ -43,19 +43,27 @@ enable_testing() add_subdirectory(wasm-vm) add_subdirectory(interpreter) -add_subdirectory(aot) add_subdirectory(wasm-c-api) add_subdirectory(libc-builtin) add_subdirectory(shared-utils) -add_subdirectory(running-modes) -add_subdirectory(runtime-common) -add_subdirectory(custom-section) -add_subdirectory(compilation) add_subdirectory(linear-memory-wasm) add_subdirectory(linear-memory-aot) add_subdirectory(aot-stack-frame) add_subdirectory(linux-perf) add_subdirectory(gc) -add_subdirectory(memory64) add_subdirectory(tid-allocator) -add_subdirectory(shared-heap) \ No newline at end of file + +if (NOT WAMR_BUILD_TARGET STREQUAL "X86_32") + # should enable 32-bit llvm when X86_32 + add_subdirectory (aot) + add_subdirectory (custom-section) + add_subdirectory (compilation) + + # Fast-JIT or mem64 is not supported on X86_32 + add_subdirectory (running-modes) + add_subdirectory (memory64) + add_subdirectory (shared-heap) + + # HW_BOUND_CHECK is not supported on X86_32 + add_subdirectory (runtime-common) +endif () diff --git a/tests/unit/aot-stack-frame/CMakeLists.txt b/tests/unit/aot-stack-frame/CMakeLists.txt index 9ff066f08..90a61aea7 100644 --- a/tests/unit/aot-stack-frame/CMakeLists.txt +++ b/tests/unit/aot-stack-frame/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-aot-stack-frame) @@ -17,6 +17,7 @@ set (WAMR_BUILD_LIBC_BUILTIN 0) set (WAMR_BUILD_MULTI_MODULE 0) set (WAMR_DISABLE_HW_BOUND_CHECK 1) set (WAMR_DISABLE_WRITE_GS_BASE 1) +set (WAMR_BUILD_GC 1) include (../unit_common.cmake) @@ -31,15 +32,21 @@ file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) set (UNIT_SOURCE ${source_all}) set (unit_test_sources - ${UNIT_SOURCE} - ${PLATFORM_SHARED_SOURCE} - ${UTILS_SHARED_SOURCE} - ${MEM_ALLOC_SHARED_SOURCE} - ${NATIVE_INTERFACE_SOURCE} - ${IWASM_COMMON_SOURCE} - ${IWASM_INTERP_SOURCE} - ${IWASM_AOT_SOURCE} - ${WASM_APP_LIB_SOURCE_ALL} + ${UNIT_SOURCE} + ${WAMR_RUNTIME_LIB_SOURCE} + ${UNCOMMON_SHARED_SOURCE} + ${SRC_LIST} + ${PLATFORM_SHARED_SOURCE} + ${UTILS_SHARED_SOURCE} + ${MEM_ALLOC_SHARED_SOURCE} + ${LIB_HOST_AGENT_SOURCE} + ${NATIVE_INTERFACE_SOURCE} + ${LIBC_BUILTIN_SOURCE} + ${IWASM_COMMON_SOURCE} + ${IWASM_INTERP_SOURCE} + ${IWASM_AOT_SOURCE} + ${IWASM_COMPL_SOURCE} + ${WASM_APP_LIB_SOURCE_ALL} ) # Automatically build wasm-apps for this test diff --git a/tests/unit/aot-stack-frame/aot_stack_frame_test.cc b/tests/unit/aot-stack-frame/aot_stack_frame_test.cc index 9bea2b2a0..bcc1e246c 100644 --- a/tests/unit/aot-stack-frame/aot_stack_frame_test.cc +++ b/tests/unit/aot-stack-frame/aot_stack_frame_test.cc @@ -162,57 +162,6 @@ TEST_F(AOTStackFrameTest, test1) exec_env = wasm_runtime_create_exec_env(module_inst, 8 * 1024); ASSERT_TRUE(exec_env != NULL); - func_inst = wasm_runtime_lookup_function(module_inst, "test1"); - ASSERT_TRUE(func_inst != NULL); - - argv[0] = 33; - argv[1] = 44; - wasm_runtime_call_wasm(exec_env, func_inst, 2, argv); - ASSERT_TRUE(wasm_runtime_get_exception(module_inst)); - - frames = AOTStackFrameTest::my_frames; - frame_num = AOTStackFrameTest::my_frame_num; - - ASSERT_TRUE(frames != NULL); - ASSERT_TRUE(frame_num == 1); - - ASSERT_TRUE(frames[0]->lp[0] == 33); - ASSERT_TRUE(frames[0]->lp[1] == 44); - ASSERT_TRUE(frames[0]->lp[2] == 0x11223344); - ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); - ASSERT_TRUE(*(float *)(frames[0]->lp + 5) == 5566.7788f); - ASSERT_TRUE(*(double *)(frames[0]->lp + 6) == 99887766.55443322); - - wasm_runtime_destroy_exec_env(exec_env); - exec_env = NULL; - - wasm_runtime_deinstantiate(module_inst); - module_inst = NULL; - - wasm_runtime_unload(module); - module = NULL; -} - -TEST_F(AOTStackFrameTest, test2) -{ - MyAOTFrame *frame, **frames; - uint32 frame_num; - - aot_set_stack_frame_callback(aot_stack_frame_cb); - - bh_memcpy_s(test_aot_buf, sizeof(test_aot_buf), test_aot, sizeof(test_aot)); - - module = wasm_runtime_load(test_aot_buf, sizeof(test_aot), error_buf, - sizeof(error_buf)); - ASSERT_TRUE(module != NULL); - - module_inst = wasm_runtime_instantiate(module, 16384, 0, error_buf, - sizeof(error_buf)); - ASSERT_TRUE(module_inst != NULL); - - exec_env = wasm_runtime_create_exec_env(module_inst, 8 * 1024); - ASSERT_TRUE(exec_env != NULL); - func_inst = wasm_runtime_lookup_function(module_inst, "test2"); ASSERT_TRUE(func_inst != NULL); @@ -233,11 +182,9 @@ TEST_F(AOTStackFrameTest, test2) ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); ASSERT_TRUE(*(float *)(frames[0]->lp + 5) == 5566.7788f); ASSERT_TRUE(*(double *)(frames[0]->lp + 6) == 99887766.55443322); - ASSERT_TRUE(frames[0]->lp[8] == 0x1234); - ASSERT_TRUE(frames[0]->lp[9] == 0x5678); } -TEST_F(AOTStackFrameTest, test3) +TEST_F(AOTStackFrameTest, test2) { MyAOTFrame *frame, **frames; uint32 frame_num; @@ -271,18 +218,14 @@ TEST_F(AOTStackFrameTest, test3) ASSERT_TRUE(frames != NULL); ASSERT_TRUE(frame_num == 2); - ASSERT_TRUE(frames[0]->sp - frames[0]->lp == 5); - ASSERT_TRUE(frames[0]->ip_offset == 24); + // 5(i32) + 1(i64) local variables, occupied 7 * 4 bytes + ASSERT_TRUE(frames[0]->sp - frames[0]->lp == 7); + + // offset of ip from module load address + ASSERT_TRUE(frames[0]->ip_offset == 163); ASSERT_TRUE(frames[0]->lp[0] == 1234); ASSERT_TRUE(frames[0]->lp[1] == 5678); ASSERT_TRUE(frames[0]->lp[2] == 0x11223344); ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); - - ASSERT_TRUE(frames[1]->lp[0] == 0x1234); - ASSERT_TRUE(frames[1]->lp[1] == 0x5678); - ASSERT_TRUE(frames[1]->lp[2] == 0x11223344); - ASSERT_TRUE(*(uint64 *)(frames[1]->lp + 3) == 0x12345678ABCDEF99LL); - ASSERT_TRUE(*(float *)(frames[1]->lp + 5) == 5566.7788f); - ASSERT_TRUE(*(double *)(frames[1]->lp + 6) == 99887766.55443322); } diff --git a/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt b/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt index 9dd9565a5..7d80bbfbf 100644 --- a/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt +++ b/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt @@ -1,27 +1,41 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project(wasm-apps-aot-stack-frame) -add_custom_target(aot-stack-frame-test-wasm ALL - COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc - -S ${WAMR_ROOT_DIR}/wamr-compiler - && cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc - && /opt/wabt/bin/wat2wasm - -o ${CMAKE_CURRENT_BINARY_DIR}/test.wasm - ${CMAKE_CURRENT_LIST_DIR}/test.wast - && ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc/wamrc - --enable-dump-call-stack --bounds-checks=1 - -o ${CMAKE_CURRENT_BINARY_DIR}/test.aot - ${CMAKE_CURRENT_BINARY_DIR}/test.wasm - && cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump - -S ${WAMR_ROOT_DIR}/test-tools/binarydump-tool - && cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump - && ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump/binarydump - -o ${CMAKE_CURRENT_LIST_DIR}/test_aot.h -n test_aot - ${CMAKE_CURRENT_BINARY_DIR}/test.aot +set (WAMRC_OPTION --enable-dump-call-stack --bounds-checks=1 --enable-gc) +if (WAMR_BUILD_TARGET STREQUAL "X86_32") + set (WAMRC_OPTION ${WAMRC_OPTION} --target=i386) +endif () + +add_custom_target( + aot-stack-frame-test-wasm ALL + + # Step 1: Build wamrc + COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc + -S ${WAMR_ROOT_DIR}/wamr-compiler + COMMAND cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc + + # Step 2: Compile .wast to .wasm + COMMAND /opt/wabt/bin/wat2wasm + -o ${CMAKE_CURRENT_BINARY_DIR}/test.wasm ${CMAKE_CURRENT_LIST_DIR}/test.wast + + # Step 3: Compile .wasm to .aot using wamrc + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc/wamrc ${WAMRC_OPTION} + -o ${CMAKE_CURRENT_BINARY_DIR}/test.aot ${CMAKE_CURRENT_BINARY_DIR}/test.wasm + + # Step 4: Build binarydump tool + COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump + -S ${WAMR_ROOT_DIR}/test-tools/binarydump-tool + COMMAND cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump + + # Step 5: Generate .h file from .aot + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump/binarydump + -o ${CMAKE_CURRENT_LIST_DIR}/test_aot.h + -n test_aot + ${CMAKE_CURRENT_BINARY_DIR}/test.aot ) diff --git a/tests/unit/aot/CMakeLists.txt b/tests/unit/aot/CMakeLists.txt index 6b9c70c88..bb2216bdd 100644 --- a/tests/unit/aot/CMakeLists.txt +++ b/tests/unit/aot/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-aot) diff --git a/tests/unit/aot/aot_test.cc b/tests/unit/aot/aot_test.cc index 261b378e4..31d8cccb4 100644 --- a/tests/unit/aot/aot_test.cc +++ b/tests/unit/aot/aot_test.cc @@ -103,7 +103,7 @@ class AOTTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() { diff --git a/tests/unit/compilation/CMakeLists.txt b/tests/unit/compilation/CMakeLists.txt index 0941a39cc..65a9dfbda 100644 --- a/tests/unit/compilation/CMakeLists.txt +++ b/tests/unit/compilation/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-compilation) diff --git a/tests/unit/compilation/aot_compiler_test.cc b/tests/unit/compilation/aot_compiler_test.cc index 8592a4b61..6fbccbb17 100644 --- a/tests/unit/compilation/aot_compiler_test.cc +++ b/tests/unit/compilation/aot_compiler_test.cc @@ -44,7 +44,7 @@ class aot_compiler_test_suit : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_aot_file_test.cc b/tests/unit/compilation/aot_emit_aot_file_test.cc index 64c5533bb..8b0f63a8e 100644 --- a/tests/unit/compilation/aot_emit_aot_file_test.cc +++ b/tests/unit/compilation/aot_emit_aot_file_test.cc @@ -44,7 +44,7 @@ class aot_emit_aot_file_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_control_test.cc b/tests/unit/compilation/aot_emit_control_test.cc index a269f51eb..849189c90 100644 --- a/tests/unit/compilation/aot_emit_control_test.cc +++ b/tests/unit/compilation/aot_emit_control_test.cc @@ -39,7 +39,7 @@ class aot_emit_control_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_function_test.cc b/tests/unit/compilation/aot_emit_function_test.cc index 8c4c93fce..d10d639a1 100644 --- a/tests/unit/compilation/aot_emit_function_test.cc +++ b/tests/unit/compilation/aot_emit_function_test.cc @@ -38,7 +38,7 @@ class aot_emit_function_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_numberic_test.cc b/tests/unit/compilation/aot_emit_numberic_test.cc index f7e6e8ee7..70f119f9e 100644 --- a/tests/unit/compilation/aot_emit_numberic_test.cc +++ b/tests/unit/compilation/aot_emit_numberic_test.cc @@ -39,7 +39,7 @@ class aot_emit_numberic_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_parametric_test.cc b/tests/unit/compilation/aot_emit_parametric_test.cc index f9dabe1c8..aa7b08df3 100644 --- a/tests/unit/compilation/aot_emit_parametric_test.cc +++ b/tests/unit/compilation/aot_emit_parametric_test.cc @@ -38,7 +38,7 @@ class aot_emit_parametric_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_emit_table_test.cc b/tests/unit/compilation/aot_emit_table_test.cc index fc4bfe2f1..c77d16c6d 100644 --- a/tests/unit/compilation/aot_emit_table_test.cc +++ b/tests/unit/compilation/aot_emit_table_test.cc @@ -38,7 +38,7 @@ class aot_emit_table_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/compilation/aot_llvm_test.cc b/tests/unit/compilation/aot_llvm_test.cc index dcebe04b4..de4ab17c4 100644 --- a/tests/unit/compilation/aot_llvm_test.cc +++ b/tests/unit/compilation/aot_llvm_test.cc @@ -38,7 +38,7 @@ class aot_llvm_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/custom-section/CMakeLists.txt b/tests/unit/custom-section/CMakeLists.txt index 1529d0ea6..747a8b126 100644 --- a/tests/unit/custom-section/CMakeLists.txt +++ b/tests/unit/custom-section/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-custom-section) diff --git a/tests/unit/custom-section/custom_section_test.cc b/tests/unit/custom-section/custom_section_test.cc index 9bf04664a..e1ee9e15d 100644 --- a/tests/unit/custom-section/custom_section_test.cc +++ b/tests/unit/custom-section/custom_section_test.cc @@ -16,7 +16,7 @@ class CustomSectionTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/custom-section/wasm-apps/CMakeLists.txt b/tests/unit/custom-section/wasm-apps/CMakeLists.txt index a539dd236..6455db554 100644 --- a/tests/unit/custom-section/wasm-apps/CMakeLists.txt +++ b/tests/unit/custom-section/wasm-apps/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project(wasm-apps-custom-section) diff --git a/tests/unit/gc/CMakeLists.txt b/tests/unit/gc/CMakeLists.txt index e0f70d142..6d9670dfe 100644 --- a/tests/unit/gc/CMakeLists.txt +++ b/tests/unit/gc/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-wamr-gc) diff --git a/tests/unit/gc/wasm-apps/func1.wasm b/tests/unit/gc/wasm-apps/func1.wasm index 51b316b54..1553dec75 100644 Binary files a/tests/unit/gc/wasm-apps/func1.wasm and b/tests/unit/gc/wasm-apps/func1.wasm differ diff --git a/tests/unit/gc/wasm-apps/func1.wast b/tests/unit/gc/wasm-apps/func1.wast index 1b4941787..adc9640e7 100644 --- a/tests/unit/gc/wasm-apps/func1.wast +++ b/tests/unit/gc/wasm-apps/func1.wast @@ -26,10 +26,10 @@ (local (ref null struct)) local.get 0 - ref.test null array + ref.test (ref array) drop local.get 1 - ref.cast i31 + ref.cast (ref i31) drop ) ) diff --git a/tests/unit/gc/wasm-apps/func2.wasm b/tests/unit/gc/wasm-apps/func2.wasm index e5d852ce4..d8fc92d02 100644 Binary files a/tests/unit/gc/wasm-apps/func2.wasm and b/tests/unit/gc/wasm-apps/func2.wasm differ diff --git a/tests/unit/gc/wasm-apps/struct1.wasm b/tests/unit/gc/wasm-apps/struct1.wasm index 513442f96..d8fc92d02 100644 Binary files a/tests/unit/gc/wasm-apps/struct1.wasm and b/tests/unit/gc/wasm-apps/struct1.wasm differ diff --git a/tests/unit/gc/wasm-apps/struct2.wasm b/tests/unit/gc/wasm-apps/struct2.wasm index 497a96441..7d22e80fd 100644 Binary files a/tests/unit/gc/wasm-apps/struct2.wasm and b/tests/unit/gc/wasm-apps/struct2.wasm differ diff --git a/tests/unit/gc/wasm-apps/struct2.wast b/tests/unit/gc/wasm-apps/struct2.wast index 266841d62..8868c1bcd 100644 --- a/tests/unit/gc/wasm-apps/struct2.wast +++ b/tests/unit/gc/wasm-apps/struct2.wast @@ -1,18 +1,36 @@ (module (type $vec (struct (field f32) (field $y (mut f32)) (field $z f32))) - ;;(global (ref $vec) (struct.new_canon $vec (f32.const 1) (f32.const 2) (f32.const 3))) - (global (ref $vec) (struct.new_canon_default $vec)) + (global (ref $vec) (struct.new $vec (f32.const 1) (f32.const 2) (f32.const 3))) + (global (ref $vec) (struct.new_default $vec)) (func (export "new") (result anyref) - (struct.new_canon_default $vec) + (struct.new_default $vec) ) - (func $get_0 (param $v (ref $vec)) (result f32) + (func $get_0_0 (param $v (ref $vec)) (result f32) + (struct.get 0 0 (local.get $v)) + ) + (func (export "get_0_0") (result f32) + (call $get_0_0 (struct.new_default $vec)) + ) + (func $get_vec_0 (param $v (ref $vec)) (result f32) (struct.get $vec 0 (local.get $v)) ) - (func (export "get_0") (result f32) - (call $get_0 (struct.new_canon_default $vec)) + (func (export "get_vec_0") (result f32) + (call $get_vec_0 (struct.new_default $vec)) + ) + (func $get_0_y (param $v (ref $vec)) (result f32) + (struct.get 0 $y (local.get $v)) + ) + (func (export "get_0_y") (result f32) + (call $get_0_y (struct.new_default $vec)) + ) + (func $get_vec_y (param $v (ref $vec)) (result f32) + (struct.get $vec $y (local.get $v)) + ) + (func (export "get_vec_y") (result f32) + (call $get_vec_y (struct.new_default $vec)) ) (func $set_get_y (param $v (ref $vec)) (param $y f32) (result f32) @@ -20,7 +38,7 @@ (struct.get $vec $y (local.get $v)) ) (func (export "set_get_y") (param $y f32) (result f32) - (call $set_get_y (struct.new_canon_default $vec) (local.get $y)) + (call $set_get_y (struct.new_default $vec) (local.get $y)) ) (func $set_get_1 (param $v (ref $vec)) (param $y f32) (result f32) @@ -28,6 +46,6 @@ (struct.get $vec $y (local.get $v)) ) (func (export "set_get_1") (param $y f32) (result f32) - (call $set_get_1 (struct.new_canon_default $vec) (local.get $y)) + (call $set_get_1 (struct.new_default $vec) (local.get $y)) ) ) diff --git a/tests/unit/gc/wasm-apps/struct3.wasm b/tests/unit/gc/wasm-apps/struct3.wasm index 0da32361a..bae7fbcb8 100644 Binary files a/tests/unit/gc/wasm-apps/struct3.wasm and b/tests/unit/gc/wasm-apps/struct3.wasm differ diff --git a/tests/unit/gc/wasm-apps/test1.wasm b/tests/unit/gc/wasm-apps/test1.wasm index d907e457f..d8fc92d02 100644 Binary files a/tests/unit/gc/wasm-apps/test1.wasm and b/tests/unit/gc/wasm-apps/test1.wasm differ diff --git a/tests/unit/gc/wasm-apps/test2.wasm b/tests/unit/gc/wasm-apps/test2.wasm index 04507f174..2fa7567b6 100644 Binary files a/tests/unit/gc/wasm-apps/test2.wasm and b/tests/unit/gc/wasm-apps/test2.wasm differ diff --git a/tests/unit/gc/wasm-apps/test2.wast b/tests/unit/gc/wasm-apps/test2.wast index c2f7f3636..50d469708 100644 --- a/tests/unit/gc/wasm-apps/test2.wast +++ b/tests/unit/gc/wasm-apps/test2.wast @@ -14,11 +14,11 @@ (table.set $ta (i32.const 0) (ref.null any)) (table.set $ta (i32.const 1) (ref.null struct)) (table.set $ta (i32.const 2) (ref.null none)) - (table.set $ta (i32.const 3) (i31.new (i32.const 7))) - (table.set $ta (i32.const 4) (struct.new_canon_default $st)) - (table.set $ta (i32.const 5) (array.new_canon_default $at (i32.const 0))) - (table.set $ta (i32.const 6) (extern.internalize (local.get $x))) - (table.set $ta (i32.const 7) (extern.internalize (ref.null extern))) + (table.set $ta (i32.const 3) (ref.i31 (i32.const 7))) + (table.set $ta (i32.const 4) (struct.new_default $st)) + (table.set $ta (i32.const 5) (array.new_default $at (i32.const 0))) + (table.set $ta (i32.const 6) (any.convert_extern (local.get $x))) + (table.set $ta (i32.const 7) (any.convert_extern (ref.null extern))) (table.set $tf (i32.const 0) (ref.null nofunc)) (table.set $tf (i32.const 1) (ref.null func)) @@ -27,78 +27,71 @@ (table.set $te (i32.const 0) (ref.null noextern)) (table.set $te (i32.const 1) (ref.null extern)) (table.set $te (i32.const 2) (local.get $x)) - (table.set $te (i32.const 3) (extern.externalize (i31.new (i32.const 8)))) - (table.set $te (i32.const 4) (extern.externalize (struct.new_canon_default $st))) - (table.set $te (i32.const 5) (extern.externalize (ref.null any))) + (table.set $te (i32.const 3) (extern.convert_any (ref.i31 (i32.const 8)))) + (table.set $te (i32.const 4) (extern.convert_any (struct.new_default $st))) + (table.set $te (i32.const 5) (extern.convert_any (ref.null any))) ) (func (export "ref_test_null_data") (param $i i32) (result i32) (i32.add (ref.is_null (table.get $ta (local.get $i))) - (ref.test null none (table.get $ta (local.get $i))) + (ref.test nullref (table.get $ta (local.get $i))) ) ) - (func (export "ref_test_any") (param $i i32) (result i32) (i32.add - (ref.test any (table.get $ta (local.get $i))) - (ref.test null any (table.get $ta (local.get $i))) + (ref.test (ref any) (table.get $ta (local.get $i))) + (ref.test anyref (table.get $ta (local.get $i))) ) ) - (func (export "ref_test_eq") (param $i i32) (result i32) (i32.add - (ref.test eq (table.get $ta (local.get $i))) - (ref.test null eq (table.get $ta (local.get $i))) + (ref.test (ref eq) (table.get $ta (local.get $i))) + (ref.test eqref (table.get $ta (local.get $i))) ) ) - (func (export "ref_test_i31") (param $i i32) (result i32) (i32.add - (ref.test i31 (table.get $ta (local.get $i))) - (ref.test null i31 (table.get $ta (local.get $i))) + (ref.test (ref i31) (table.get $ta (local.get $i))) + (ref.test i31ref (table.get $ta (local.get $i))) ) ) - (func (export "ref_test_struct") (param $i i32) (result i32) (i32.add - (ref.test struct (table.get $ta (local.get $i))) - (ref.test null struct (table.get $ta (local.get $i))) + (ref.test (ref struct) (table.get $ta (local.get $i))) + (ref.test structref (table.get $ta (local.get $i))) ) ) - (func (export "ref_test_array") (param $i i32) (result i32) (i32.add - (ref.test array (table.get $ta (local.get $i))) - (ref.test null array (table.get $ta (local.get $i))) + (ref.test (ref array) (table.get $ta (local.get $i))) + (ref.test arrayref (table.get $ta (local.get $i))) ) ) (func (export "ref_test_null_func") (param $i i32) (result i32) (i32.add (ref.is_null (table.get $tf (local.get $i))) - (ref.test null nofunc (table.get $tf (local.get $i))) + (ref.test (ref null nofunc) (table.get $tf (local.get $i))) ) ) - (func (export "ref_test_func") (param $i i32) (result i32) (i32.add - (ref.test func (table.get $tf (local.get $i))) - (ref.test null func (table.get $tf (local.get $i))) + (ref.test (ref func) (table.get $tf (local.get $i))) + (ref.test funcref (table.get $tf (local.get $i))) ) ) (func (export "ref_test_null_extern") (param $i i32) (result i32) (i32.add (ref.is_null (table.get $te (local.get $i))) - (ref.test null noextern (table.get $te (local.get $i))) + (ref.test (ref null noextern) (table.get $te (local.get $i))) ) ) - (func (export "ref_test_extern") (param $i i32) (result i32) (i32.add - (ref.test extern (table.get $te (local.get $i))) - (ref.test null extern (table.get $te (local.get $i))) + (ref.test (ref extern) (table.get $te (local.get $i))) + (ref.test externref (table.get $te (local.get $i))) ) ) ) diff --git a/tests/unit/gc/wasm-apps/test3.wasm b/tests/unit/gc/wasm-apps/test3.wasm index 8ee87dc81..c85f0ee7b 100644 Binary files a/tests/unit/gc/wasm-apps/test3.wasm and b/tests/unit/gc/wasm-apps/test3.wasm differ diff --git a/tests/unit/gc/wasm-apps/test3.wast b/tests/unit/gc/wasm-apps/test3.wast index 4df02ce8f..e551b14b4 100644 --- a/tests/unit/gc/wasm-apps/test3.wast +++ b/tests/unit/gc/wasm-apps/test3.wast @@ -11,105 +11,105 @@ (table 20 (ref null struct)) (func $init - (table.set (i32.const 0) (struct.new_canon_default $t0)) - (table.set (i32.const 10) (struct.new_canon_default $t0)) - (table.set (i32.const 1) (struct.new_canon_default $t1)) - (table.set (i32.const 11) (struct.new_canon_default $t1')) - (table.set (i32.const 2) (struct.new_canon_default $t2)) - (table.set (i32.const 12) (struct.new_canon_default $t2')) - (table.set (i32.const 3) (struct.new_canon_default $t3)) - (table.set (i32.const 4) (struct.new_canon_default $t4)) + (table.set (i32.const 0) (struct.new_default $t0)) + (table.set (i32.const 10) (struct.new_default $t0)) + (table.set (i32.const 1) (struct.new_default $t1)) + (table.set (i32.const 11) (struct.new_default $t1')) + (table.set (i32.const 2) (struct.new_default $t2)) + (table.set (i32.const 12) (struct.new_default $t2')) + (table.set (i32.const 3) (struct.new_default $t3)) + (table.set (i32.const 4) (struct.new_default $t4)) ) (func (export "test-sub") (call $init) (block $l ;; must hold - (br_if $l (i32.eqz (ref.test null $t0 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t1 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test null $t1 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t2 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t3 (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t4 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t2 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t2) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t3 (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t3) (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t4 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t4) (table.get (i32.const 4))))) ;; must not hold - (br_if $l (ref.test $t0 (ref.null struct))) - (br_if $l (ref.test $t1 (ref.null struct))) - (br_if $l (ref.test $t2 (ref.null struct))) - (br_if $l (ref.test $t3 (ref.null struct))) - (br_if $l (ref.test $t4 (ref.null struct))) + (br_if $l (ref.test (ref $t0) (ref.null struct))) + (br_if $l (ref.test (ref $t1) (ref.null struct))) + (br_if $l (ref.test (ref $t2) (ref.null struct))) + (br_if $l (ref.test (ref $t3) (ref.null struct))) + (br_if $l (ref.test (ref $t4) (ref.null struct))) - (br_if $l (ref.test $t1 (table.get (i32.const 0)))) - (br_if $l (ref.test $t1 (table.get (i32.const 3)))) - (br_if $l (ref.test $t1 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 4)))) - (br_if $l (ref.test $t2 (table.get (i32.const 0)))) - (br_if $l (ref.test $t2 (table.get (i32.const 1)))) - (br_if $l (ref.test $t2 (table.get (i32.const 3)))) - (br_if $l (ref.test $t2 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 4)))) - (br_if $l (ref.test $t3 (table.get (i32.const 0)))) - (br_if $l (ref.test $t3 (table.get (i32.const 1)))) - (br_if $l (ref.test $t3 (table.get (i32.const 2)))) - (br_if $l (ref.test $t3 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 2)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 4)))) - (br_if $l (ref.test $t4 (table.get (i32.const 0)))) - (br_if $l (ref.test $t4 (table.get (i32.const 1)))) - (br_if $l (ref.test $t4 (table.get (i32.const 2)))) - (br_if $l (ref.test $t4 (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 2)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 3)))) (return) ) @@ -119,25 +119,25 @@ (func (export "test-canon") (call $init) (block $l - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 10))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 11))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 10))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 11))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 12))))) - (br_if $l (i32.eqz (ref.test $t1' (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t1' (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t1') (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t1') (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 11))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 11))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 12))))) - (br_if $l (i32.eqz (ref.test $t2' (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t2') (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t2 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t2) (table.get (i32.const 12))))) (return) ) diff --git a/tests/unit/gc/wasm-apps/test4.wasm b/tests/unit/gc/wasm-apps/test4.wasm index b4841a82c..e7522e88f 100644 Binary files a/tests/unit/gc/wasm-apps/test4.wasm and b/tests/unit/gc/wasm-apps/test4.wasm differ diff --git a/tests/unit/gc/wasm-apps/test4.wast b/tests/unit/gc/wasm-apps/test4.wast index 8bf02e430..eeec11faa 100644 --- a/tests/unit/gc/wasm-apps/test4.wast +++ b/tests/unit/gc/wasm-apps/test4.wast @@ -10,10 +10,10 @@ (func (export "init") (param $x externref) (table.set (i32.const 0) (ref.null any)) - (table.set (i32.const 1) (i31.new (i32.const 7))) - (table.set (i32.const 2) (struct.new_canon_default $st)) - (table.set (i32.const 3) (array.new_canon_default $at (i32.const 0))) - (table.set (i32.const 4) (extern.internalize (local.get $x))) + (table.set (i32.const 1) (ref.i31 (i32.const 7))) + (table.set (i32.const 2) (struct.new_default $st)) + (table.set (i32.const 3) (array.new_default $at (i32.const 0))) + (table.set (i32.const 4) (any.convert_extern (local.get $x))) (table.set (i32.const 5) (ref.null i31)) (table.set (i32.const 6) (ref.null struct)) (table.set (i32.const 7) (ref.null none)) @@ -21,26 +21,25 @@ (func (export "ref_cast_non_null") (param $i i32) (drop (ref.as_non_null (table.get (local.get $i)))) - (drop (ref.cast null any (table.get (local.get $i)))) + (drop (ref.cast (ref null any) (table.get (local.get $i)))) ) (func (export "ref_cast_null") (param $i i32) - (drop (ref.cast null any (table.get (local.get $i)))) - (drop (ref.cast null struct (table.get (local.get $i)))) - (drop (ref.cast null array (table.get (local.get $i)))) - (drop (ref.cast null i31 (table.get (local.get $i)))) - (drop (ref.cast null none (table.get (local.get $i)))) + (drop (ref.cast anyref (table.get (local.get $i)))) + (drop (ref.cast structref (table.get (local.get $i)))) + (drop (ref.cast arrayref (table.get (local.get $i)))) + (drop (ref.cast i31ref (table.get (local.get $i)))) + (drop (ref.cast nullref (table.get (local.get $i)))) ) (func (export "ref_cast_i31") (param $i i32) - (drop (ref.cast i31 (table.get (local.get $i)))) - (drop (ref.cast null i31 (table.get (local.get $i)))) + (drop (ref.cast (ref i31) (table.get (local.get $i)))) + (drop (ref.cast i31ref (table.get (local.get $i)))) ) (func (export "ref_cast_struct") (param $i i32) - (drop (ref.cast struct (table.get (local.get $i)))) - (drop (ref.cast null struct (table.get (local.get $i)))) + (drop (ref.cast (ref struct) (table.get (local.get $i)))) + (drop (ref.cast structref (table.get (local.get $i)))) ) (func (export "ref_cast_array") (param $i i32) - (drop (ref.cast array (table.get (local.get $i)))) - (drop (ref.cast null array (table.get (local.get $i)))) + (drop (ref.cast (ref array) (table.get (local.get $i)))) + (drop (ref.cast arrayref (table.get (local.get $i)))) ) ) - diff --git a/tests/unit/gc/wasm-apps/test5.wasm b/tests/unit/gc/wasm-apps/test5.wasm index 050ead4ae..e92d600d1 100644 Binary files a/tests/unit/gc/wasm-apps/test5.wasm and b/tests/unit/gc/wasm-apps/test5.wasm differ diff --git a/tests/unit/gc/wasm-apps/test5.wast b/tests/unit/gc/wasm-apps/test5.wast index 895473ce3..f74da50e8 100644 --- a/tests/unit/gc/wasm-apps/test5.wast +++ b/tests/unit/gc/wasm-apps/test5.wast @@ -11,75 +11,75 @@ (table 20 (ref null struct)) (func $init - (table.set (i32.const 0) (struct.new_canon_default $t0)) - (table.set (i32.const 10) (struct.new_canon_default $t0)) - (table.set (i32.const 1) (struct.new_canon_default $t1)) - (table.set (i32.const 11) (struct.new_canon_default $t1')) - (table.set (i32.const 2) (struct.new_canon_default $t2)) - (table.set (i32.const 12) (struct.new_canon_default $t2')) - (table.set (i32.const 3) (struct.new_canon_default $t3)) - (table.set (i32.const 4) (struct.new_canon_default $t4)) + (table.set (i32.const 0) (struct.new_default $t0)) + (table.set (i32.const 10) (struct.new_default $t0)) + (table.set (i32.const 1) (struct.new_default $t1)) + (table.set (i32.const 11) (struct.new_default $t1')) + (table.set (i32.const 2) (struct.new_default $t2)) + (table.set (i32.const 12) (struct.new_default $t2')) + (table.set (i32.const 3) (struct.new_default $t3)) + (table.set (i32.const 4) (struct.new_default $t4)) ) (func (export "test-sub") (call $init) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t0 (table.get (i32.const 0)))) - (drop (ref.cast null $t0 (table.get (i32.const 1)))) - (drop (ref.cast null $t0 (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (table.get (i32.const 3)))) - (drop (ref.cast null $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 4)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t1 (table.get (i32.const 1)))) - (drop (ref.cast null $t1 (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t1) (table.get (i32.const 1)))) + (drop (ref.cast (ref null $t1) (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t2 (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t2) (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t3 (table.get (i32.const 3)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t3) (table.get (i32.const 3)))) - (drop (ref.cast null $t4 (table.get (i32.const 4)))) + (drop (ref.cast (ref null $t4) (table.get (i32.const 4)))) - (drop (ref.cast $t0 (table.get (i32.const 0)))) - (drop (ref.cast $t0 (table.get (i32.const 1)))) - (drop (ref.cast $t0 (table.get (i32.const 2)))) - (drop (ref.cast $t0 (table.get (i32.const 3)))) - (drop (ref.cast $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 4)))) - (drop (ref.cast $t1 (table.get (i32.const 1)))) - (drop (ref.cast $t1 (table.get (i32.const 2)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 2)))) - (drop (ref.cast $t2 (table.get (i32.const 2)))) + (drop (ref.cast (ref $t2) (table.get (i32.const 2)))) - (drop (ref.cast $t3 (table.get (i32.const 3)))) + (drop (ref.cast (ref $t3) (table.get (i32.const 3)))) - (drop (ref.cast $t4 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t4) (table.get (i32.const 4)))) ) (func (export "test-canon") (call $init) - (drop (ref.cast $t0 (table.get (i32.const 0)))) - (drop (ref.cast $t0 (table.get (i32.const 1)))) - (drop (ref.cast $t0 (table.get (i32.const 2)))) - (drop (ref.cast $t0 (table.get (i32.const 3)))) - (drop (ref.cast $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 4)))) - (drop (ref.cast $t0 (table.get (i32.const 10)))) - (drop (ref.cast $t0 (table.get (i32.const 11)))) - (drop (ref.cast $t0 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 10)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 11)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 12)))) - (drop (ref.cast $t1' (table.get (i32.const 1)))) - (drop (ref.cast $t1' (table.get (i32.const 2)))) + (drop (ref.cast (ref $t1') (table.get (i32.const 1)))) + (drop (ref.cast (ref $t1') (table.get (i32.const 2)))) - (drop (ref.cast $t1 (table.get (i32.const 11)))) - (drop (ref.cast $t1 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 11)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 12)))) - (drop (ref.cast $t2' (table.get (i32.const 2)))) + (drop (ref.cast (ref $t2') (table.get (i32.const 2)))) - (drop (ref.cast $t2 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t2) (table.get (i32.const 12)))) ) ) diff --git a/tests/unit/gc/wasm-apps/test6.wasm b/tests/unit/gc/wasm-apps/test6.wasm index b1abc1472..f6b7a9e4a 100644 Binary files a/tests/unit/gc/wasm-apps/test6.wasm and b/tests/unit/gc/wasm-apps/test6.wasm differ diff --git a/tests/unit/gc/wasm-apps/test6.wast b/tests/unit/gc/wasm-apps/test6.wast index 0959b36f0..cd8a5bf29 100644 --- a/tests/unit/gc/wasm-apps/test6.wast +++ b/tests/unit/gc/wasm-apps/test6.wast @@ -12,13 +12,13 @@ (func (export "init") (table.set (i32.const 0) (ref.null eq)) (table.set (i32.const 1) (ref.null i31)) - (table.set (i32.const 2) (i31.new (i32.const 7))) - (table.set (i32.const 3) (i31.new (i32.const 7))) - (table.set (i32.const 4) (i31.new (i32.const 8))) - (table.set (i32.const 5) (struct.new_canon_default $st)) - (table.set (i32.const 6) (struct.new_canon_default $st)) - (table.set (i32.const 7) (array.new_canon_default $at (i32.const 0))) - (table.set (i32.const 8) (array.new_canon_default $at (i32.const 0))) + (table.set (i32.const 2) (ref.i31 (i32.const 7))) + (table.set (i32.const 3) (ref.i31 (i32.const 7))) + (table.set (i32.const 4) (ref.i31 (i32.const 8))) + (table.set (i32.const 5) (struct.new_default $st)) + (table.set (i32.const 6) (struct.new_default $st)) + (table.set (i32.const 7) (array.new_default $at (i32.const 0))) + (table.set (i32.const 8) (array.new_default $at (i32.const 0))) ) (func (export "eq") (param $i i32) (param $j i32) (result i32) diff --git a/tests/unit/interpreter/CMakeLists.txt b/tests/unit/interpreter/CMakeLists.txt index c99908b2e..f0a1d5e22 100644 --- a/tests/unit/interpreter/CMakeLists.txt +++ b/tests/unit/interpreter/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-interpreter) diff --git a/tests/unit/interpreter/interpreter_test.cc b/tests/unit/interpreter/interpreter_test.cc index e9fa8f9e1..5bceccec8 100644 --- a/tests/unit/interpreter/interpreter_test.cc +++ b/tests/unit/interpreter/interpreter_test.cc @@ -16,7 +16,7 @@ class InterpreterTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() { @@ -45,6 +45,6 @@ TEST_F(InterpreterTest, wasm_runtime_is_built_in_module) bool ret = wasm_runtime_is_built_in_module("env"); ASSERT_TRUE(ret); - ret = ret = wasm_runtime_is_built_in_module("env1"); + ret = wasm_runtime_is_built_in_module("env1"); ASSERT_FALSE(ret); } \ No newline at end of file diff --git a/tests/unit/libc-builtin/CMakeLists.txt b/tests/unit/libc-builtin/CMakeLists.txt index 4d88760e7..f39ed4444 100644 --- a/tests/unit/libc-builtin/CMakeLists.txt +++ b/tests/unit/libc-builtin/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-libc-builtin) diff --git a/tests/unit/libc-builtin/libc_builtin_test.cc b/tests/unit/libc-builtin/libc_builtin_test.cc index 6598f7a8b..444120c1a 100644 --- a/tests/unit/libc-builtin/libc_builtin_test.cc +++ b/tests/unit/libc-builtin/libc_builtin_test.cc @@ -32,7 +32,7 @@ class LibcBuiltinTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() { @@ -88,8 +88,8 @@ TEST_F(LibcBuiltinTest, puts) /* Capture the stdout */ testing::internal::CaptureStdout(); - EXPECT_EQ(CALL_FUNC(puts, "Hello Wrold"), strlen("Hello Wrold\n")); - EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello Wrold\n"); + EXPECT_EQ(CALL_FUNC(puts, "Hello World"), strlen("Hello World\n")); + EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello World\n"); testing::internal::CaptureStdout(); EXPECT_EQ(CALL_FUNC(puts, "c"), strlen("c\n")); @@ -113,9 +113,9 @@ TEST_F(LibcBuiltinTest, printf) /* Capture the stdout */ testing::internal::CaptureStdout(); - EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", empty_va_list.get()), - strlen("Hello Wrold")); - EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello Wrold"); + EXPECT_EQ(CALL_FUNC(printf, "Hello World", empty_va_list.get()), + strlen("Hello World")); + EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello World"); testing::internal::CaptureStdout(); EXPECT_EQ(CALL_FUNC(printf, "c", empty_va_list.get()), strlen("c")); @@ -185,7 +185,7 @@ TEST_F(LibcBuiltinTest, printf) va_list.add(20); //%zd va_list.add(20); //%ld - va_list.add(20L); //%jd + va_list.add(intmax_t(20)); //%jd testing::internal::CaptureStdout(); @@ -290,7 +290,7 @@ TEST_F(LibcBuiltinTest, printf) va_list.add(0x7FFFFFFF); //%ld 2147483647 - sing long va_list.add(0xFFFFFFFF); //%lu 4294967295 -unsigned long va_list.add(0x7FFFFFFFFFFFFFFF); //%lld 9223372036854775807 sing long long - va_list.add(0xFFFFFFFFFFFFFFFF);//%llu 18446744073709551615 unsiged long long + va_list.add(0xFFFFFFFFFFFFFFFF);//%llu 18446744073709551615 unsigned long long testing::internal::CaptureStdout(); @@ -300,17 +300,17 @@ TEST_F(LibcBuiltinTest, printf) /* clang-format on */ } - EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", 0), 0); + EXPECT_EQ(CALL_FUNC(printf, "Hello World", 0), 0); EXPECT_STREQ(dummy_exec_env.get_exception(), "Exception: out of bounds memory access"); dummy_exec_env.clear_exception(); - EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", NULL), 0); + EXPECT_EQ(CALL_FUNC(printf, "Hello World", NULL), 0); EXPECT_STREQ(dummy_exec_env.get_exception(), "Exception: out of bounds memory access"); dummy_exec_env.clear_exception(); - EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", (char *)-1), 0); + EXPECT_EQ(CALL_FUNC(printf, "Hello World", (char *)-1), 0); EXPECT_STREQ(dummy_exec_env.get_exception(), "Exception: out of bounds memory access"); dummy_exec_env.clear_exception(); @@ -323,8 +323,8 @@ TEST_F(LibcBuiltinTest, printf) TEST_F(LibcBuiltinTest, sprintf) { - const char *buf; - const char *str = "Hello Wrold"; + char buf[200] = {0}; + const char *str = "Hello World"; const char *str_sig = "c"; const char *str_f = "20, 3.140000, Hello World"; const char *str_long = "eqwewerwerqwer34were"; // test ok @@ -399,19 +399,19 @@ TEST_F(LibcBuiltinTest, snprintf) WAMRVaList empty_va_list(dummy_exec_env.get()); - EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", 0), + EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", 0), 0); EXPECT_EQ( - CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", NULL), + CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", NULL), 0); - EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", + EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", (char *)-1), 0); - EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", + EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", empty_va_list.get()), - strlen("Hello Wrold")); - EXPECT_EQ(CALL_FUNC(memcmp, buf, "Hello Wrold", strlen("Hello Wrold")), 0); + strlen("Hello World")); + EXPECT_EQ(CALL_FUNC(memcmp, buf, "Hello World", strlen("Hello World")), 0); EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen(very_long_string), very_long_string, empty_va_list.get()), @@ -508,7 +508,7 @@ TEST_F(LibcBuiltinTest, memcmp) TEST_F(LibcBuiltinTest, memcpy) { const char *src = "Hell World"; - char *dest; + char dest[sizeof(src)] = {0}; AppData src_app{ dummy_exec_env.get(), src }; AppData dest_app{ dummy_exec_env.get(), dest }; @@ -535,7 +535,7 @@ TEST_F(LibcBuiltinTest, memcpy) TEST_F(LibcBuiltinTest, memmove) { const char *src = "Hell World"; - char *dest; + char dest[sizeof(src)] = {0}; AppData src_app{ dummy_exec_env.get(), src }; AppData dest_app{ dummy_exec_env.get(), dest }; @@ -673,7 +673,7 @@ TEST_F(LibcBuiltinTest, strncmp) TEST_F(LibcBuiltinTest, strcpy) { char *src = (char *)"Hello World!"; - char *dest; + char dest[sizeof(src)] = {0}; AppData src_app{ dummy_exec_env.get(), src }; AppData dest_app{ dummy_exec_env.get(), dest }; @@ -696,7 +696,7 @@ TEST_F(LibcBuiltinTest, strcpy) TEST_F(LibcBuiltinTest, strncpy) { char *src = (char *)"Hello World!"; - char *dest; + char dest[sizeof(src)] = {0}; AppData src_app{ dummy_exec_env.get(), src }; AppData dest_app{ dummy_exec_env.get(), dest }; @@ -1295,7 +1295,7 @@ TEST_F(LibcBuiltinTest, isalnum) TEST_F(LibcBuiltinTest, emscripten_memcpy_big) { const char *src = "Hell World"; - char *dest; + char dest[sizeof(src)] = {0}; AppData src_app{ dummy_exec_env.get(), src }; AppData dest_app{ dummy_exec_env.get(), dest }; diff --git a/tests/unit/linear-memory-aot/CMakeLists.txt b/tests/unit/linear-memory-aot/CMakeLists.txt index 549b70ad6..02e96c6d1 100644 --- a/tests/unit/linear-memory-aot/CMakeLists.txt +++ b/tests/unit/linear-memory-aot/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-linear-memory-aot) diff --git a/tests/unit/linear-memory-aot/linear_memory_aot_test.cc b/tests/unit/linear-memory-aot/linear_memory_aot_test.cc index dafdbb791..198dfbc91 100644 --- a/tests/unit/linear-memory-aot/linear_memory_aot_test.cc +++ b/tests/unit/linear-memory-aot/linear_memory_aot_test.cc @@ -41,7 +41,7 @@ class TEST_SUITE_NAME : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/linear-memory-wasm/CMakeLists.txt b/tests/unit/linear-memory-wasm/CMakeLists.txt index 03e1616d7..a899b8fbe 100644 --- a/tests/unit/linear-memory-wasm/CMakeLists.txt +++ b/tests/unit/linear-memory-wasm/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-linear-memory-wasm) diff --git a/tests/unit/linear-memory-wasm/linear_memory_wasm_test.cc b/tests/unit/linear-memory-wasm/linear_memory_wasm_test.cc index 77eb53d7e..a5db0e033 100644 --- a/tests/unit/linear-memory-wasm/linear_memory_wasm_test.cc +++ b/tests/unit/linear-memory-wasm/linear_memory_wasm_test.cc @@ -41,7 +41,7 @@ class TEST_SUITE_NAME : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/memory64/memory64_test.cc b/tests/unit/memory64/memory64_test.cc index 67315a594..af36f308c 100644 --- a/tests/unit/memory64/memory64_test.cc +++ b/tests/unit/memory64/memory64_test.cc @@ -73,7 +73,7 @@ class memory64_test_suite : public testing::TestWithParam // TEST_P. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() { diff --git a/tests/unit/running-modes/wasm_running_modes_test.cc b/tests/unit/running-modes/wasm_running_modes_test.cc index 9d6a9379c..e18e64fb1 100644 --- a/tests/unit/running-modes/wasm_running_modes_test.cc +++ b/tests/unit/running-modes/wasm_running_modes_test.cc @@ -193,7 +193,7 @@ class wasm_running_modes_test_suite : public testing::TestWithParam // TEST_P. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() { diff --git a/tests/unit/runtime-common/CMakeLists.txt b/tests/unit/runtime-common/CMakeLists.txt index f73756915..21e5a917f 100644 --- a/tests/unit/runtime-common/CMakeLists.txt +++ b/tests/unit/runtime-common/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project(test-runtime-common) diff --git a/tests/unit/runtime-common/wasm_exec_env_test.cc b/tests/unit/runtime-common/wasm_exec_env_test.cc index 06c162b62..5c5b46499 100644 --- a/tests/unit/runtime-common/wasm_exec_env_test.cc +++ b/tests/unit/runtime-common/wasm_exec_env_test.cc @@ -15,7 +15,7 @@ class wasm_exec_env_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/runtime-common/wasm_runtime_common_test.cc b/tests/unit/runtime-common/wasm_runtime_common_test.cc index 978b54022..15a02673b 100644 --- a/tests/unit/runtime-common/wasm_runtime_common_test.cc +++ b/tests/unit/runtime-common/wasm_runtime_common_test.cc @@ -60,7 +60,7 @@ class wasm_runtime_common_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/runtime-common/wasm_runtime_init_test.cc b/tests/unit/runtime-common/wasm_runtime_init_test.cc index 30e44cea3..f7ff26ae4 100644 --- a/tests/unit/runtime-common/wasm_runtime_init_test.cc +++ b/tests/unit/runtime-common/wasm_runtime_init_test.cc @@ -72,7 +72,7 @@ class wasm_runtime_init_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/CMakeLists.txt b/tests/unit/shared-utils/CMakeLists.txt index c5a43dd0e..47b6b835b 100644 --- a/tests/unit/shared-utils/CMakeLists.txt +++ b/tests/unit/shared-utils/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-shared-utils) diff --git a/tests/unit/shared-utils/bh_assert_test.cc b/tests/unit/shared-utils/bh_assert_test.cc index faa7a807b..bd0861dcf 100644 --- a/tests/unit/shared-utils/bh_assert_test.cc +++ b/tests/unit/shared-utils/bh_assert_test.cc @@ -15,7 +15,7 @@ class bh_assert_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/bh_common_test.cc b/tests/unit/shared-utils/bh_common_test.cc index 1d1cb528d..7f7d574c3 100644 --- a/tests/unit/shared-utils/bh_common_test.cc +++ b/tests/unit/shared-utils/bh_common_test.cc @@ -15,7 +15,7 @@ class bh_common_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/bh_hashmap_test.cc b/tests/unit/shared-utils/bh_hashmap_test.cc index 4b651ef17..496170226 100644 --- a/tests/unit/shared-utils/bh_hashmap_test.cc +++ b/tests/unit/shared-utils/bh_hashmap_test.cc @@ -44,7 +44,7 @@ class bh_hashmap_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/bh_list_test.cc b/tests/unit/shared-utils/bh_list_test.cc index 981c52f25..de8b83505 100644 --- a/tests/unit/shared-utils/bh_list_test.cc +++ b/tests/unit/shared-utils/bh_list_test.cc @@ -15,7 +15,7 @@ class bh_list_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} @@ -70,7 +70,7 @@ TEST_F(bh_list_test_suite, bh_list_remove) bh_list_insert(&list_test, &elem_insert_4); EXPECT_EQ(BH_LIST_SUCCESS, bh_list_remove(&list_test, &elem_insert_1)); - // The elem specified by prameter is not in the list. + // The elem specified by parameter is not in the list. EXPECT_EQ(BH_LIST_ERROR, bh_list_remove(&list_test, &elem_insert_1)); // Illegal parameters. diff --git a/tests/unit/shared-utils/bh_log_test.cc b/tests/unit/shared-utils/bh_log_test.cc index 250fb7926..cb76b89e0 100644 --- a/tests/unit/shared-utils/bh_log_test.cc +++ b/tests/unit/shared-utils/bh_log_test.cc @@ -16,7 +16,7 @@ class bh_log_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/bh_queue_test.cc b/tests/unit/shared-utils/bh_queue_test.cc index c540d8f36..e808aea31 100644 --- a/tests/unit/shared-utils/bh_queue_test.cc +++ b/tests/unit/shared-utils/bh_queue_test.cc @@ -15,7 +15,7 @@ class bh_queue_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/bh_vector_test.cc b/tests/unit/shared-utils/bh_vector_test.cc index 3da9fba5d..fae7c8c48 100644 --- a/tests/unit/shared-utils/bh_vector_test.cc +++ b/tests/unit/shared-utils/bh_vector_test.cc @@ -16,7 +16,7 @@ class bh_vector_test_suite : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/shared-utils/shared_utils_test.cc b/tests/unit/shared-utils/shared_utils_test.cc index 82bedf32f..41fe9f927 100644 --- a/tests/unit/shared-utils/shared_utils_test.cc +++ b/tests/unit/shared-utils/shared_utils_test.cc @@ -16,7 +16,7 @@ class SharedUtilsTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. virtual void SetUp() {} diff --git a/tests/unit/unit_common.cmake b/tests/unit/unit_common.cmake index 90ea2eb7c..66c50b7e8 100644 --- a/tests/unit/unit_common.cmake +++ b/tests/unit/unit_common.cmake @@ -1,6 +1,13 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + if (NOT DEFINED WAMR_BUILD_PLATFORM) set (WAMR_BUILD_PLATFORM "linux") endif () diff --git a/tests/unit/wasm-c-api/CMakeLists.txt b/tests/unit/wasm-c-api/CMakeLists.txt index 3b8884e11..9556c600e 100644 --- a/tests/unit/wasm-c-api/CMakeLists.txt +++ b/tests/unit/wasm-c-api/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.14) project (wasm_c_api_test) ################ runtime settings ################ @@ -13,7 +13,9 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") # WAMR features switch -set(WAMR_BUILD_TARGET "X86_64") +if (NOT DEFINED WAMR_BUILD_TARGET) + set(WAMR_BUILD_TARGET "X86_64") +endif() set(WAMR_BUILD_INTERP 1) set(WAMR_BUILD_AOT 0) set(WAMR_BUILD_JIT 0) @@ -34,6 +36,14 @@ add_library(vmlib STATIC ${WAMR_RUNTIME_LIB_SOURCE}) ################################################ ################ unit test related ################ + +# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update +# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt +# from 3rd parties that we should not alter. Therefore, in addition to +# changing the `cmake_minimum_required()`, we should also add a configuration +# here that is compatible with earlier versions. +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE) + # Add googletest directly to our build. This defines # the gtest and gtest_main targets. diff --git a/tests/unit/wasm-vm/CMakeLists.txt b/tests/unit/wasm-vm/CMakeLists.txt index d13d65aac..6242a48b9 100644 --- a/tests/unit/wasm-vm/CMakeLists.txt +++ b/tests/unit/wasm-vm/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 2.9) +cmake_minimum_required(VERSION 3.14) project (test-wasm-vm) diff --git a/tests/unit/wasm-vm/wasm_vm.cc b/tests/unit/wasm-vm/wasm_vm.cc index f4f5a834d..670fa599b 100644 --- a/tests/unit/wasm-vm/wasm_vm.cc +++ b/tests/unit/wasm-vm/wasm_vm.cc @@ -24,7 +24,7 @@ class WasmVMTest : public testing::Test // accessed from sub-classes. // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. + // should define it if you need to initialize the variables. // Otherwise, this can be skipped. void SetUp() { @@ -65,7 +65,7 @@ class WasmVMTest : public testing::Test TEST_F(WasmVMTest, Test_app1) { - unsigned argv[10]; + uint32 argv[10]; ASSERT_TRUE(app1_wasm != NULL); @@ -151,7 +151,7 @@ TEST_F(WasmVMTest, Test_app1) TEST_F(WasmVMTest, Test_app2) { - unsigned argv[10]; + uint32 argv[10]; /* Load module */ module = wasm_runtime_load(app2_wasm, sizeof(app2_wasm), error_buf, @@ -416,7 +416,7 @@ TEST_F(WasmVMTest, Test_app2) TEST_F(WasmVMTest, Test_app3) { - unsigned argv[10]; + uint32 argv[10]; /* Load module */ module = wasm_runtime_load(app3_wasm, sizeof(app3_wasm), error_buf, @@ -465,7 +465,6 @@ TEST_F(WasmVMTest, Test_app3) ASSERT_TRUE(buf != NULL); ASSERT_EQ(wasm_runtime_addr_native_to_app(module_inst, buf), argv[0]); - int32 buf_offset = argv[0]; /* call my_malloc */ func_inst = wasm_runtime_lookup_function(module_inst, "my_malloc"); @@ -482,7 +481,6 @@ TEST_F(WasmVMTest, Test_app3) ASSERT_TRUE(buf1 != NULL); ASSERT_EQ(wasm_runtime_addr_native_to_app(module_inst, buf1), argv[0]); - int32 buf_offset1 = argv[0]; wasm_runtime_deinstantiate(module_inst); wasm_runtime_unload(module); @@ -526,7 +524,7 @@ TEST_F(WasmVMTest, Test_app4_single) uint8 *buffer = NULL; uint32 buffer_size = 0; bool ret = false; - unsigned argv[10]; + uint32 argv[10]; wasm_runtime_set_module_reader(&module_reader_callback, &module_destroyer_callback); @@ -584,7 +582,7 @@ TEST_F(WasmVMTest, Test_app4_plus_one) uint8 *buffer = NULL; uint32 buffer_size = 0; bool ret = false; - uint32_t argv[10] = { 0 }; + uint32 argv[10] = { 0 }; wasm_runtime_set_module_reader(&module_reader_callback, &module_destroyer_callback); diff --git a/tests/wamr-test-suites/spec-test-script/all.py b/tests/wamr-test-suites/spec-test-script/all.py index fe694124a..2c4725e89 100644 --- a/tests/wamr-test-suites/spec-test-script/all.py +++ b/tests/wamr-test-suites/spec-test-script/all.py @@ -134,6 +134,8 @@ def ignore_the_case( "float_misc", "select", "memory_grow", + # Skip the test case for now, restore it after fixing the issue + "skip-stack-guard-page", ]: return True @@ -247,7 +249,7 @@ def test_case( CMD, bufsize=1, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + stderr=subprocess.STDOUT, universal_newlines=True, ) as p: try: @@ -285,7 +287,9 @@ def test_case( except subprocess.TimeoutExpired: print("failed with TimeoutExpired") raise Exception(case_name) - + except Exception as e: + print(f"An unexpected error occurred: {e}") + raise e def test_suite( target, diff --git a/tests/wamr-test-suites/spec-test-script/runtest.py b/tests/wamr-test-suites/spec-test-script/runtest.py index 6e963bdc7..158d759ed 100755 --- a/tests/wamr-test-suites/spec-test-script/runtest.py +++ b/tests/wamr-test-suites/spec-test-script/runtest.py @@ -7,6 +7,7 @@ import array import atexit import math import os +import pathlib import re import shutil import struct @@ -45,7 +46,8 @@ temp_module_table = {} aot_target_options_map = { "i386": ["--target=i386"], "x86_32": ["--target=i386"], - "x86_64": ["--target=x86_64", "--cpu=skylake"], + # cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3035 + "x86_64": ["--target=x86_64", "--cpu=skylake", "--size-level=0"], "aarch64": ["--target=aarch64", "--target-abi=eabi", "--cpu=cortex-a53"], "aarch64_vfp": ["--target=aarch64", "--target-abi=gnueabihf", "--cpu=cortex-a53"], "armv7": ["--target=armv7", "--target-abi=eabi", "--cpu=cortex-a9", "--cpu-features=-neon"], @@ -81,9 +83,8 @@ def log(data, end='\n'): print(data, end=end) sys.stdout.flush() -def create_tmp_file(suffix: str) -> str: - with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as tmp_file: - return tmp_file.name +def create_tmp_file(prefix: str, suffix: str) -> str: + return tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix, delete=False).name # TODO: do we need to support '\n' too import platform @@ -181,7 +182,16 @@ class Runner(): # queue, so we keep it for non-windows platforms. [outs,_,_] = select([self.stdout], [], [], 1) if self.stdout in outs: - return True, self.stdout.read(1) + try: + stdout_byte = self.stdout.read(1) + except ValueError: + return True, None + except OSError: + return True, None + except Exception as e: + print("Exception: ", e) + return False, None + return True, stdout_byte else: return False, None @@ -212,6 +222,8 @@ class Runner(): buf = self.buf[0:end-len(prompt)] self.buf = self.buf[end:] return buf + + log("left read_to_prompt() because of timeout") return None def writeline(self, str): @@ -249,14 +261,14 @@ def assert_prompt(runner, prompts, timeout, is_need_execute_result): header = runner.read_to_prompt(prompts, timeout=timeout) if not header and is_need_execute_result: log(" ---------- will terminate cause the case needs result while there is none inside of buf. ----------") - sys.exit(1) + raise Exception("get nothing from Runner") if not header == None: if header: log("Started with:\n%s" % header) else: log("Did not one of following prompt(s): %s" % repr(prompts)) log(" Got : %s" % repr(r.buf)) - sys.exit(1) + raise Exception("Did not one of following prompt(s)") ### WebAssembly specific @@ -551,7 +563,7 @@ def parse_assertion_value(val): if not val: return None, "" - splitted = re.split('\s+', val) + splitted = re.split(r'\s+', val) splitted = [s for s in splitted if s] type = splitted[0].split(".")[0] lane_type = splitted[1] if len(splitted) > 2 else "" @@ -790,8 +802,8 @@ def test_assert(r, opts, mode, cmd, expected): return True ## 0x9:i32,-0x1:i32 -> ['0x9:i32', '-0x1:i32'] - expected_list = re.split(',', expected) - out_list = re.split(',', out) + expected_list = re.split(r',', expected) + out_list = re.split(r',', out) if len(expected_list) != len(out_list): raise Exception("Failed:\n Results count incorrect:\n expected: '%s'\n got: '%s'" % (expected, out)) for i in range(len(expected_list)): @@ -806,34 +818,34 @@ def test_assert_return(r, opts, form): n. to search a pattern like (assert_return (invoke $module_name function_name ... ) ...) """ # params, return - m = re.search('^\(assert_return\s+\(invoke\s+"((?:[^"]|\\\")*)"\s+(\(.*\))\s*\)\s*(\(.*\))\s*\)\s*$', form, re.S) + m = re.search(r'^\(assert_return\s+\(invoke\s+"((?:[^"]|\\\")*)"\s+(\(.*\))\s*\)\s*(\(.*\))\s*\)\s*$', form, re.S) # judge if assert_return cmd includes the module name - n = re.search('^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"((?:[^"]|\\\")*)"\s+(\(.*\))\s*\)\s*(\(.*\))\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"((?:[^"]|\\\")*)"\s+(\(.*\))\s*\)\s*(\(.*\))\s*\)\s*$', form, re.S) # print("assert_return with {}".format(form)) if not m: # no params, return - m = re.search('^\(assert_return\s+\(invoke\s+"((?:[^"]|\\\")*)"\s*\)\s+()(\(.*\))\s*\)\s*$', form, re.S) + m = re.search(r'^\(assert_return\s+\(invoke\s+"((?:[^"]|\\\")*)"\s*\)\s+()(\(.*\))\s*\)\s*$', form, re.S) if not m: # params, no return - m = re.search('^\(assert_return\s+\(invoke\s+"([^"]*)"\s+(\(.*\))()\s*\)\s*\)\s*$', form, re.S) + m = re.search(r'^\(assert_return\s+\(invoke\s+"([^"]*)"\s+(\(.*\))()\s*\)\s*\)\s*$', form, re.S) if not m: # no params, no return - m = re.search('^\(assert_return\s+\(invoke\s+"([^"]*)"\s*()()\)\s*\)\s*$', form, re.S) + m = re.search(r'^\(assert_return\s+\(invoke\s+"([^"]*)"\s*()()\)\s*\)\s*$', form, re.S) if not m: # params, return if not n: # no params, return - n = re.search('^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"((?:[^"]|\\\")*)"\s*\)\s+()(\(.*\))\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"((?:[^"]|\\\")*)"\s*\)\s+()(\(.*\))\s*\)\s*$', form, re.S) if not n: # params, no return - n = re.search('^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s+(\(.*\))()\s*\)\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s+(\(.*\))()\s*\)\s*\)\s*$', form, re.S) if not n: # no params, no return - n = re.search('^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"*()()\)\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_return\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"*()()\)\s*\)\s*$', form, re.S) if not m and not n: - if re.search('^\(assert_return\s+\(get.*\).*\)$', form, re.S): + if re.search(r'^\(assert_return\s+\(get.*\).*\)$', form, re.S): log("ignoring assert_return get") return else: @@ -852,7 +864,7 @@ def test_assert_return(r, opts, form): if m.group(2) == '': args = [] else: - #args = [re.split(' +', v)[1].replace('_', "") for v in re.split("\)\s*\(", m.group(2)[1:-1])] + #args = [re.split(r' +', v)[1].replace('_', "") for v in re.split(r"\)\s*\(", m.group(2)[1:-1])] # split arguments with ')spaces(', remove leading and tailing ) and ( args_type_and_value = re.split(r'\)\s+\(', m.group(2)[1:-1]) args_type_and_value = [s.replace('_', '') for s in args_type_and_value] @@ -863,7 +875,7 @@ def test_assert_return(r, opts, form): for arg in args_type_and_value: # remove leading and tailing spaces, it might confuse following assertions arg = arg.strip() - splitted = re.split('\s+', arg) + splitted = re.split(r'\s+', arg) splitted = [s for s in splitted if s] if splitted[0] in ["i32.const", "i64.const"]: @@ -881,7 +893,7 @@ def test_assert_return(r, opts, form): numbers, _ = cast_v128_to_i64x2(splitted[2:], 'v128', splitted[1]) assert(len(numbers) == 2), "has to reform arguments into i64x2" - args.append(f"{numbers[0]:#x}\{numbers[1]:#x}") + args.append(f"{numbers[0]:#x}\\{numbers[1]:#x}") elif "ref.null" == splitted[0]: args.append("null") elif "ref.extern" == splitted[0]: @@ -896,7 +908,7 @@ def test_assert_return(r, opts, form): if m.group(3) == '': returns= [] else: - returns = re.split("\)\s*\(", m.group(3)[1:-1]) + returns = re.split(r"\)\s*\(", m.group(3)[1:-1]) # processed numbers in strings if len(returns) == 1 and returns[0] in ["ref.array", "ref.struct", "ref.i31", "ref.eq", "ref.any", "ref.extern", @@ -921,8 +933,7 @@ def test_assert_return(r, opts, form): except: _, exc, _ = sys.exc_info() log("Run wamrc failed:\n got: '%s'" % r.buf) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 1") r = run_wasm_with_repl(module+".wasm", module+".aot" if test_aot else module, opts, r) # Wait for the initial prompt try: @@ -941,23 +952,23 @@ def test_assert_return(r, opts, form): # convert (ref.null extern/func) into (ref.null null) n1 = n.group(3).replace("(ref.null extern)", "(ref.null null)") n1 = n1.replace("ref.null func)", "(ref.null null)") - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", n1[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", n1[1:-1])] _, expected = parse_assertion_value(n.group(4)[1:-1]) test_assert(r, opts, "return", "%s %s" % (func, " ".join(args)), expected) def test_assert_trap(r, opts, form): # params - m = re.search('^\(assert_trap\s+\(invoke\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form) + m = re.search(r'^\(assert_trap\s+\(invoke\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form) # judge if assert_return cmd includes the module name - n = re.search('^\(assert_trap\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_trap\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form, re.S) if not m: # no params - m = re.search('^\(assert_trap\s+\(invoke\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form) + m = re.search(r'^\(assert_trap\s+\(invoke\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form) if not m: if not n: # no params - n = re.search('^\(assert_trap\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form, re.S) + n = re.search(r'^\(assert_trap\s+\(invoke\s+\$((?:[^\s])*)\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form, re.S) if not m and not n: raise Exception("unparsed assert_trap: '%s'" % form) @@ -969,7 +980,7 @@ def test_assert_trap(r, opts, form): # convert (ref.null extern/func) into (ref.null null) m1 = m.group(2).replace("(ref.null extern)", "(ref.null null)") m1 = m1.replace("ref.null func)", "(ref.null null)") - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", m1[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", m1[1:-1])] expected = "Exception: %s" % m.group(3) test_assert(r, opts, "trap", "%s %s" % (func, " ".join(args)), expected) @@ -987,8 +998,7 @@ def test_assert_trap(r, opts, form): except: _, exc, _ = sys.exc_info() log("Run wamrc failed:\n got: '%s'" % r.buf) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 2") r = run_wasm_with_repl(module+".wasm", module+".aot" if test_aot else module, opts, r) # Wait for the initial prompt try: @@ -1002,23 +1012,23 @@ def test_assert_trap(r, opts, form): if n.group(3) == '': args = [] else: - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", n.group(3)[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", n.group(3)[1:-1])] expected = "Exception: %s" % n.group(4) test_assert(r, opts, "trap", "%s %s" % (func, " ".join(args)), expected) def test_assert_exhaustion(r,opts,form): # params - m = re.search('^\(assert_exhaustion\s+\(invoke\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form) + m = re.search(r'^\(assert_exhaustion\s+\(invoke\s+"([^"]*)"\s+(\(.*\))\s*\)\s*"([^"]+)"\s*\)\s*$', form) if not m: # no params - m = re.search('^\(assert_exhaustion\s+\(invoke\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form) + m = re.search(r'^\(assert_exhaustion\s+\(invoke\s+"([^"]*)"\s*()\)\s*"([^"]+)"\s*\)\s*$', form) if not m: raise Exception("unparsed assert_exhaustion: '%s'" % form) func = m.group(1) if m.group(2) == '': args = [] else: - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", m.group(2)[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", m.group(2)[1:-1])] expected = "Exception: %s\n" % m.group(3) test_assert(r, opts, "exhaustion", "%s %s" % (func, " ".join(args)), expected) @@ -1035,7 +1045,7 @@ def test_assert_wasmexception(r,opts,form): # \)\s* # \)\s* # $ - m = re.search('^\(assert_exception\s+\(invoke\s+"([^"]+)"\s+(\(.*\))\s*\)\s*\)\s*$', form) + m = re.search(r'^\(assert_exception\s+\(invoke\s+"([^"]+)"\s+(\(.*\))\s*\)\s*\)\s*$', form) if not m: # no params @@ -1046,24 +1056,24 @@ def test_assert_wasmexception(r,opts,form): # \)\s* # \)\s* # $ - m = re.search('^\(assert_exception\s+\(invoke\s+"([^"]+)"\s*()\)\s*\)\s*$', form) + m = re.search(r'^\(assert_exception\s+\(invoke\s+"([^"]+)"\s*()\)\s*\)\s*$', form) if not m: raise Exception("unparsed assert_exception: '%s'" % form) func = m.group(1) # function name if m.group(2) == '': # arguments args = [] else: - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", m.group(2)[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", m.group(2)[1:-1])] expected = "Exception: uncaught wasm exception\n" test_assert(r, opts, "wasmexception", "%s %s" % (func, " ".join(args)), expected) def do_invoke(r, opts, form): # params - m = re.search('^\(invoke\s+"([^"]+)"\s+(\(.*\))\s*\)\s*$', form) + m = re.search(r'^\(invoke\s+"([^"]+)"\s+(\(.*\))\s*\)\s*$', form) if not m: # no params - m = re.search('^\(invoke\s+"([^"]+)"\s*()\)\s*$', form) + m = re.search(r'^\(invoke\s+"([^"]+)"\s*()\)\s*$', form) if not m: raise Exception("unparsed invoke: '%s'" % form) func = m.group(1) @@ -1074,7 +1084,7 @@ def do_invoke(r, opts, form): if m.group(2) == '': args = [] else: - args = [re.split(' +', v)[1] for v in re.split("\)\s*\(", m.group(2)[1:-1])] + args = [re.split(r' +', v)[1] for v in re.split(r"\)\s*\(", m.group(2)[1:-1])] log("Invoking %s(%s)" % ( func, ", ".join([str(a) for a in args]))) @@ -1114,8 +1124,8 @@ def compile_wast_to_wasm(form, wast_tempfile, wasm_tempfile, opts): log("Running: %s" % " ".join(cmd)) try: subprocess.check_call(cmd) - except subprocess.CalledProcessError as e: - print(str(e)) + except Exception as e: + print(e) return False return True @@ -1238,13 +1248,17 @@ def run_wasm_with_repl(wasm_tempfile, aot_tempfile, opts, r): return r -def create_tmpfiles(wast_name): +def create_tmpfiles(file_name, test_aot, temp_file_repo): tempfiles = [] - tempfiles.append(create_tmp_file(".wast")) - tempfiles.append(create_tmp_file(".wasm")) + tempfiles.append(create_tmp_file(file_name, ".wast")) + tempfiles.append(create_tmp_file(file_name, ".wasm")) if test_aot: - tempfiles.append(create_tmp_file(".aot")) + tempfiles.append(create_tmp_file(file_name, ".aot")) + else: + tempfiles.append(None) + + assert len(tempfiles) == 3, "tempfiles should have 3 elements" # add these temp file to temporal repo, will be deleted when finishing the test temp_file_repo.extend(tempfiles) @@ -1263,6 +1277,9 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile, if test_aot: r = compile_wasm_to_aot(wasm_tempfile, aot_tempfile, True, opts, r) + if not loadable: + return + try: assert_prompt(r, ['Compile success'], opts.start_fail_timeout, True) except: @@ -1275,8 +1292,7 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile, else: log("Run wamrc failed:\n expected: '%s'\n got: '%s'" % \ (expected, r.buf)) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 3") r = run_wasm_with_repl(wasm_tempfile, aot_tempfile if test_aot else None, opts, r) @@ -1296,6 +1312,20 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile, raise Exception("Failed:\n expected: '%s'\n got: '%s'" % \ (expected, r.buf)) +def recently_added_wasm(temp_file_repo): + for f in reversed(temp_file_repo): + if not f: + continue + + assert os.path.exists(f), f"temp file {f} should exist" + + if os.path.getsize(f) == 0: + continue + + if f.endswith(".wasm"): + return f + + if __name__ == "__main__": opts = parser.parse_args(sys.argv[1:]) # print('Input param :',opts) @@ -1314,16 +1344,10 @@ if __name__ == "__main__": else: SKIP_TESTS = C_SKIP_TESTS - wast_tempfile = create_tmp_file(".wast") - wasm_tempfile = create_tmp_file(".wasm") - if test_aot: - aot_tempfile = create_tmp_file(".aot") - # could be potientially compiled to aot - # with the future following call test_assert_xxx, - # add them to temp_file_repo now even if no actual following file, - # it will be simple ignore during final deletion if not exist - prefix = wasm_tempfile.split(".wasm")[0] - temp_file_repo.append(prefix + ".aot") + case_file = pathlib.Path(opts.test_file.name) + assert(case_file.exists()), f"Test file {case_file} doesn't exist" + + tmpfile_stem = case_file.stem + "_" ret_code = 0 try: @@ -1335,22 +1359,26 @@ if __name__ == "__main__": for form in forms: # log("\n### Current Case is " + form + "\n") + + wast_tempfile, wasm_tempfile, aot_tempfile = create_tmpfiles( + tmpfile_stem, test_aot, temp_file_repo) + if ";;" == form[0:2]: log(form) elif skip_test(form, SKIP_TESTS): log("Skipping test: %s" % form[0:60]) - elif re.match("^\(assert_trap\s+\(module", form): + elif re.match(r"^\(assert_trap\s+\(module", form): test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile if test_aot else None, opts, r) - elif re.match("^\(assert_exhaustion\\b.*", form): + elif re.match(r"^\(assert_exhaustion\b.*", form): test_assert_exhaustion(r, opts, form) - elif re.match("^\(assert_exception\\b.*", form): + elif re.match(r"^\(assert_exception\b.*", form): test_assert_wasmexception(r, opts, form) - elif re.match("^\(assert_unlinkable\\b.*", form): + elif re.match(r"^\(assert_unlinkable\b.*", form): test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile if test_aot else None, opts, r, False) - elif re.match("^\(assert_malformed\\b.*", form): + elif re.match(r"^\(assert_malformed\b.*", form): # remove comments in wast form,n = re.subn(";;.*\n", "", form) - m = re.match("^\(assert_malformed\s*\(module binary\s*(\".*\").*\)\s*\"(.*)\"\s*\)$", form, re.DOTALL) + m = re.match(r"^\(assert_malformed\s*\(module binary\s*(\".*\").*\)\s*\"(.*)\"\s*\)$", form, re.DOTALL) if m: # workaround: spec test changes error message to "malformed" while iwasm still use "invalid" @@ -1359,7 +1387,7 @@ if __name__ == "__main__": with open(wasm_tempfile, 'wb') as f: s = m.group(1) while s: - res = re.match("[^\"]*\"([^\"]*)\"(.*)", s, re.DOTALL) + res = re.match(r"[^\"]*\"([^\"]*)\"(.*)", s, re.DOTALL) if IS_PY_3: context = res.group(1).replace("\\", "\\x").encode("latin1").decode("unicode-escape").encode("latin1") f.write(context) @@ -1414,51 +1442,43 @@ if __name__ == "__main__": else: log("Run wamrc failed:\n expected: '%s'\n got: '%s'" % \ (error_msg, r.buf)) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 4") r = run_wasm_with_repl(wasm_tempfile, aot_tempfile if test_aot else None, opts, r) - elif re.match("^\(assert_malformed\s*\(module quote", form): + elif re.match(r"^\(assert_malformed\s*\(module quote", form): log("ignoring assert_malformed module quote") else: log("unrecognized assert_malformed") - elif re.match("^\(assert_return[_a-z]*_nan\\b.*", form): + elif re.match(r"^\(assert_return[_a-z]*_nan\b.*", form): log("ignoring assert_return_.*_nan") pass - elif re.match(".*\(invoke\s+\$\\b.*", form): + elif re.match(r".*\(invoke\s+\$\b.*", form): # invoke a particular named module's function if form.startswith("(assert_return"): test_assert_return(r,opts,form) elif form.startswith("(assert_trap"): test_assert_trap(r,opts,form) - elif re.match("^\(module\\b.*", form): + elif re.match(r"^\(module\b.*", form): # if the module includes the particular name startswith $ - m = re.search("^\(module\s+\$.\S+", form) + m = re.search(r"^\(module\s+\$.\S+", form) if m: # get module name - module_name = re.split('\$', m.group(0).strip())[1] + module_name = re.split(r'\$', m.group(0).strip())[1] if module_name: # create temporal files - temp_files = create_tmpfiles(module_name) + temp_files = create_tmpfiles(module_name, test_aot, temp_file_repo) if not compile_wast_to_wasm(form, temp_files[0], temp_files[1], opts): raise Exception("compile wast to wasm failed") if test_aot: r = compile_wasm_to_aot(temp_files[1], temp_files[2], True, opts, r) - # could be potientially compiled to aot - # with the future following call test_assert_xxx, - # add them to temp_file_repo now even if no actual following file, - # it will be simple ignore during final deletion if not exist - prefix = temp_files[1].split(".wasm")[0] - temp_file_repo.append(prefix + ".aot") try: assert_prompt(r, ['Compile success'], opts.start_timeout, False) except: _, exc, _ = sys.exc_info() log("Run wamrc failed:\n got: '%s'" % r.buf) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 5") temp_module_table[module_name] = temp_files[1] r = run_wasm_with_repl(temp_files[1], temp_files[2] if test_aot else None, opts, r) else: @@ -1472,8 +1492,7 @@ if __name__ == "__main__": except: _, exc, _ = sys.exc_info() log("Run wamrc failed:\n got: '%s'" % r.buf) - ret_code = 1 - sys.exit(1) + raise Exception("Run wamrc failed 6") r = run_wasm_with_repl(wasm_tempfile, aot_tempfile if test_aot else None, opts, r) @@ -1485,38 +1504,50 @@ if __name__ == "__main__": raise Exception("Failed:\n expected: '%s'\n got: '%s'" % \ (repr(exc), r.buf)) - elif re.match("^\(assert_return\\b.*", form): + elif re.match(r"^\(assert_return\b.*", form): assert(r), "iwasm repl runtime should be not null" test_assert_return(r, opts, form) - elif re.match("^\(assert_trap\\b.*", form): + elif re.match(r"^\(assert_trap\b.*", form): test_assert_trap(r, opts, form) - elif re.match("^\(invoke\\b.*", form): + elif re.match(r"^\(invoke\b.*", form): assert(r), "iwasm repl runtime should be not null" do_invoke(r, opts, form) - elif re.match("^\(assert_invalid\\b.*", form): - test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile if test_aot else None, opts, r) - elif re.match("^\(register\\b.*", form): + elif re.match(r"^\(assert_invalid\b.*", form): + # loading invalid module will raise an error directly, so shell prompt won't show here + test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile if test_aot else None, opts, r, False) + elif re.match(r"^\(register\b.*", form): # get module's new name from the register cmd - name_new =re.split('\"',re.search('\".*\"',form).group(0))[1] - if name_new: - new_module = os.path.join(tempfile.gettempdir(), name_new + ".wasm") - shutil.copyfile(temp_module_table.get(name_new, wasm_tempfile), new_module) - - # add new_module copied from the old into temp_file_repo[] - temp_file_repo.append(new_module) - - if test_aot: - new_module_aot = os.path.join(tempfile.gettempdir(), name_new + ".aot") - r = compile_wasm_to_aot(new_module, new_module_aot, True, opts, r) - try: - assert_prompt(r, ['Compile success'], opts.start_timeout, True) - except: - raise Exception("compile wasm to aot failed") - # add aot module into temp_file_repo[] - temp_file_repo.append(new_module_aot) - else: + name_new =re.split(r'\"',re.search(r'\".*\"',form).group(0))[1] + if not name_new: # there is no name defined in register cmd - raise Exception("can not find module name from the register") + raise Exception(f"Not following register cmd pattern {form}") + + # assumption + # - There exists a module in the form of (module $name). + # - The nearest module in the form of (module), without $name, is the candidate for registration. + recently_wasm = recently_added_wasm(temp_file_repo) + if not name_new in temp_module_table: + print(temp_file_repo) + print(f"Module {name_new} is not found in temp_module_table. use the nearest module {recently_wasm}") + + for_registration = temp_module_table.get(name_new, recently_wasm) + assert os.path.exists(for_registration), f"module {for_registration} is not found" + + new_module = os.path.join(tempfile.gettempdir(), name_new + ".wasm") + # for_registration(tmpfile) --copy-> name_new.wasm + shutil.copyfile(for_registration, new_module) + + # add new_module copied from the old into temp_file_repo[] + temp_file_repo.append(new_module) + + if test_aot: + new_module_aot = os.path.join(tempfile.gettempdir(), name_new + ".aot") + try: + compile_wasm_to_aot(new_module, new_module_aot, None, opts, r) + except Exception as e: + raise Exception(f"compile wasm to aot failed. {e}") + # add aot module into temp_file_repo[] + temp_file_repo.append(new_module_aot) else: raise Exception("unrecognized form '%s...'" % form[0:40]) except Exception as e: @@ -1524,35 +1555,44 @@ if __name__ == "__main__": print("THE FINAL EXCEPTION IS {}".format(e)) ret_code = 101 - shutil.copyfile(wasm_tempfile, os.path.join(opts.log_dir, os.path.basename(wasm_tempfile))) - - if opts.aot or opts.xip: - shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile))) - if "indirect-mode" in str(e): - compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "object") - shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+'.o')) - subprocess.check_call(["llvm-objdump", "-r", aot_tempfile]) - compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "ir") - shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+".ir")) + try: + shutil.copyfile(wasm_tempfile, os.path.join(opts.log_dir, os.path.basename(wasm_tempfile))) + if opts.aot or opts.xip: + shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile))) + if "indirect-mode" in str(e): + compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "object") + shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+'.o')) + subprocess.check_call(["llvm-objdump", "-r", aot_tempfile]) + compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "ir") + shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+".ir")) + except Exception as e: + print("Failed to copy files to log directory: %s" % e) + ret_code = 102 else: ret_code = 0 finally: - if not opts.no_cleanup: - log("Removing tempfiles") - os.remove(wast_tempfile) - os.remove(wasm_tempfile) - if test_aot: - os.remove(aot_tempfile) + try: + if not opts.no_cleanup: + # remove the files under /tempfiles/ and copy of .wasm files + log(f"Removing tmp*") + # log(f"Removing {temp_file_repo}") - # remove the files under /tempfiles/ and copy of .wasm files - if temp_file_repo: for t in temp_file_repo: - if(len(str(t))!=0 and os.path.exists(t)): + # None and empty + if not t: + continue + + if os.path.exists(t): os.remove(t) + else: + log(f"Leaving tmp*") + # log(f"Leaving {temp_file_repo}") + + except Exception as e: + print("Failed to remove tempfiles: %s" % e) + # ignore the exception + ret_code = 0 - log("### End testing %s" % opts.test_file.name) - else: - log("Leaving tempfiles: %s" % ([wast_tempfile, wasm_tempfile])) - + log(f"### End testing {opts.test_file.name} with {ret_code}") sys.exit(ret_code) diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index 31f8b3746..57cef635f 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -39,7 +39,7 @@ function help() echo "-F set the firmware path used by qemu" echo "-C enable code coverage collect" echo "-j set the platform to test" - echo "-T set sanitizer to use in tests(ubsan|tsan|asan)" + echo "-T set sanitizer to use in tests(ubsan|tsan|asan|posan)" echo "-A use the specified wamrc command instead of building it" echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more" echo " subrequirement IDs, if no subrequirement is specificed," @@ -361,7 +361,7 @@ function sightglass_test() function setup_wabt() { - WABT_VERSION=1.0.36 + WABT_VERSION=1.0.37 if [ ${WABT_BINARY_RELEASE} == "YES" ]; then echo "download a binary release and install" local WAT2WASM=${WORK_DIR}/wabt/out/gcc/Release/wat2wasm @@ -448,9 +448,9 @@ function spec_test() # May 31, 2012 [interpreter] implement atomic.wait and atomic.notify (#194) git reset --hard 09f2831349bf409187abb6f7868482a8079f2264 - git apply ../../spec-test-script/thread_proposal_ignore_cases.patch || exit 1 - git apply ../../spec-test-script/thread_proposal_fix_atomic_case.patch || exit 1 - git apply ../../spec-test-script/thread_proposal_remove_memory64_flag_case.patch + git apply --ignore-whitespace ../../spec-test-script/thread_proposal_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/thread_proposal_fix_atomic_case.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/thread_proposal_remove_memory64_flag_case.patch elif [ ${ENABLE_EH} == 1 ]; then echo "checkout exception-handling test cases" @@ -459,7 +459,7 @@ function spec_test() # Jun 6, 2023 Merge branch 'upstream' into merge-upstream git reset --hard 51c721661b671bb7dc4b3a3acb9e079b49778d36 - git apply ../../spec-test-script/exception_handling.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/exception_handling.patch || exit 1 elif [[ ${ENABLE_GC} == 1 ]]; then echo "checkout spec for GC proposal" @@ -469,12 +469,12 @@ function spec_test() # Dec 9, 2024. Merge branch 'funcref' git reset --hard 756060f5816c7e2159f4817fbdee76cf52f9c923 - git apply ../../spec-test-script/gc_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/gc_ignore_cases.patch || exit 1 if [[ ${ENABLE_QEMU} == 1 ]]; then # Decrease the recursive count for tail call cases as nuttx qemu's # native stack size is much smaller - git apply ../../spec-test-script/gc_nuttx_tail_call.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/gc_nuttx_tail_call.patch || exit 1 fi # As of version 1.0.36, wabt is still unable to correctly handle the GC proposal. @@ -497,7 +497,7 @@ function spec_test() git checkout 044d0d2e77bdcbe891f7e0b9dd2ac01d56435f0b -- test/core/elem.wast test/core/data.wast # Patch table64 extension git checkout 940398cd4823522a9b36bec4984be4b153dedb81 -- test/core/call_indirect.wast test/core/table.wast test/core/table_copy.wast test/core/table_copy_mixed.wast test/core/table_fill.wast test/core/table_get.wast test/core/table_grow.wast test/core/table_init.wast test/core/table_set.wast test/core/table_size.wast - git apply ../../spec-test-script/memory64_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/memory64_ignore_cases.patch || exit 1 elif [[ ${ENABLE_MULTI_MEMORY} == 1 ]]; then echo "checkout spec for multi memory proposal" @@ -508,9 +508,9 @@ function spec_test() # Reset to commit: "Merge pull request #48 from backes/specify-memcpy-immediate-order" git reset --hard fbc99efd7a788db300aec3dd62a14577ec404f1b git checkout 044d0d2e77bdcbe891f7e0b9dd2ac01d56435f0b -- test/core/elem.wast - git apply ../../spec-test-script/multi_memory_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/multi_memory_ignore_cases.patch || exit 1 if [[ ${RUNNING_MODE} == "aot" ]]; then - git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1 fi else echo "checkout spec for default proposal" @@ -520,15 +520,15 @@ function spec_test() # Dec 20, 2024. Use WPT version of test harness for HTML core test conversion (#1859) git reset --hard f3a0e06235d2d84bb0f3b5014da4370613886965 - git apply ../../spec-test-script/ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/ignore_cases.patch || exit 1 if [[ ${ENABLE_SIMD} == 1 ]]; then - git apply ../../spec-test-script/simd_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/simd_ignore_cases.patch || exit 1 fi if [[ ${ENABLE_MULTI_MODULE} == 1 ]]; then - git apply ../../spec-test-script/multi_module_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/multi_module_ignore_cases.patch || exit 1 if [[ ${RUNNING_MODE} == "aot" ]]; then - git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1 + git apply --ignore-whitespace ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1 fi fi fi @@ -913,8 +913,8 @@ function do_execute_in_running_mode() fi if [[ ${ENABLE_SIMD} -eq 1 ]]; then - if [[ "${RUNNING_MODE}" != "jit" && "${RUNNING_MODE}" != "aot" ]]; then - echo "support simd in llvm-jit mode and aot mode" + if [[ "${RUNNING_MODE}" != "jit" && "${RUNNING_MODE}" != "aot" && "${RUNNING_MODE}" != "fast-interp" ]]; then + echo "support simd in llvm-jit, aot and fast-interp mode" return 0; fi fi @@ -1035,6 +1035,11 @@ function trigger() EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=tsan" fi + if [[ "$WAMR_BUILD_SANITIZER" == "posan" ]]; then + echo "Setting run with posan" + EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=posan" + fi + # Make sure we're using the builtin WASI libc implementation # if we're running the wasi certification tests. if [[ $TEST_CASE_ARR ]]; then diff --git a/wamr-compiler/CMakeLists.txt b/wamr-compiler/CMakeLists.txt index bc56f4030..0ce647394 100644 --- a/wamr-compiler/CMakeLists.txt +++ b/wamr-compiler/CMakeLists.txt @@ -31,6 +31,13 @@ endif() set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +# Turn on SIMD by default, can be turned off by setting WAMR_BUILD_SIMD to 0 +if (WAMR_BUILD_SIMD EQUAL 0) + add_definitions(-DWASM_ENABLE_SIMD=0) +else() + add_definitions(-DWASM_ENABLE_SIMD=1) +endif() + add_definitions(-DWASM_ENABLE_INTERP=1) add_definitions(-DWASM_ENABLE_WAMR_COMPILER=1) add_definitions(-DWASM_ENABLE_BULK_MEMORY=1) @@ -38,7 +45,6 @@ add_definitions(-DWASM_DISABLE_HW_BOUND_CHECK=1) add_definitions(-DWASM_ENABLE_SHARED_MEMORY=1) add_definitions(-DWASM_ENABLE_THREAD_MGR=1) add_definitions(-DWASM_ENABLE_TAIL_CALL=1) -add_definitions(-DWASM_ENABLE_SIMD=1) add_definitions(-DWASM_ENABLE_REF_TYPES=1) add_definitions(-DWASM_ENABLE_CUSTOM_NAME_SECTION=1) add_definitions(-DWASM_ENABLE_AOT_STACK_FRAME=1) @@ -58,6 +64,7 @@ if (WAMR_BUILD_LLVM_LEGACY_PM EQUAL 1) endif () if (LINUX) + set(WAMR_BUILD_LINUX_PERF 1) add_definitions(-DWASM_ENABLE_LINUX_PERF=1) endif () @@ -131,21 +138,11 @@ endif () message ("-- Build as target ${WAMR_BUILD_TARGET}") -if (CMAKE_SIZEOF_VOID_P EQUAL 8) - if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64" - OR WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR WAMR_BUILD_TARGET MATCHES "RISCV64.*") - if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows") - # Add -fPIC flag if build as 64-bit - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC") - set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC") - endif () - else () - add_definitions (-m32) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32") - endif () +# Add -m32 flag if compiling on 64-bit system for 32-bit x86 target +if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND WAMR_BUILD_TARGET STREQUAL "X86_32") + add_definitions (-m32) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32") endif () if (NOT CMAKE_BUILD_TYPE) @@ -274,6 +271,8 @@ else () message ("-- Lib wasi-threads disabled") endif () +set (WAMR_BUILD_WAMR_COMPILER 1) + include (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake) include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake) include (${SHARED_DIR}/utils/shared_utils.cmake) @@ -284,6 +283,7 @@ include (${IWASM_DIR}/common/gc/iwasm_gc.cmake) include (${IWASM_DIR}/interpreter/iwasm_interp.cmake) include (${IWASM_DIR}/aot/iwasm_aot.cmake) include (${IWASM_DIR}/compilation/iwasm_compl.cmake) +include (${PROJECT_SOURCE_DIR}/../build-scripts/version.cmake) if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) include (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake) @@ -315,6 +315,7 @@ if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1) include (${IWASM_DIR}/libraries/lib-wasi-threads/lib_wasi_threads.cmake) endif () +#TODO: sync up WAMR_BUILD_SANITIZER in config_common.cmake # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" OR MSVC)) @@ -374,7 +375,8 @@ add_library (aotclib ${IWASM_COMPL_SOURCE}) add_executable (wamrc main.c) check_pie_supported() -set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_target_properties (wamrc vmlib aotclib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (wamrc) if (LLVM_LINK_LLVM_DYLIB) set(WAMRC_LINK_LLVM_LIBS LLVM) @@ -395,4 +397,5 @@ else() ${UV_A_LIBS}) endif() -install (TARGETS wamrc DESTINATION bin) +include (GNUInstallDirs) +install (TARGETS wamrc) diff --git a/wamr-compiler/main.c b/wamr-compiler/main.c index 3efe344e6..f74b2fb15 100644 --- a/wamr-compiler/main.c +++ b/wamr-compiler/main.c @@ -116,6 +116,9 @@ print_help() printf(" Default is host arch, e.g. x86_64\n"); printf(" = for ex. on arm or thumb: v5, v6m, v7a, v7m, etc.\n"); printf(" Use --target=help to list supported targets\n"); + printf(" Or, provide a triple in the format of ---.\n"); + printf(" By doing this, --target-abi, --cpu, and --cpu-features will be ignored.\n"); + printf(" The triple will only be normalized without any further verification.\n"); printf(" --target-abi= Set the target ABI, e.g. gnu, eabi, gnueabihf, msvc, etc.\n"); printf(" Default is gnu if target isn't riscv64 or riscv32\n"); printf(" For target riscv64 and riscv32, default is lp64d and ilp32d\n"); @@ -180,6 +183,7 @@ print_help() printf(" Available flags: all, i32.common, i64.common, f32.common, f64.common,\n"); printf(" i32.clz, i32.ctz, etc, refer to doc/xip.md for full list\n"); printf(" Use comma to separate, please refer to doc/xip.md for full list.\n"); + printf(" --disable-llvm-jump-tables Disable the LLVM jump tables similarly to clang's -fno-jump-tables\n"); printf(" --disable-llvm-lto Disable the LLVM link time optimization\n"); printf(" --enable-llvm-pgo Enable LLVM PGO (Profile-Guided Optimization)\n"); printf(" --enable-llvm-passes=\n"); @@ -570,6 +574,9 @@ main(int argc, char *argv[]) PRINT_HELP_AND_EXIT(); option.builtin_intrinsics = argv[0] + 28; } + else if (!strcmp(argv[0], "--disable-llvm-jump-tables")) { + option.disable_llvm_jump_tables = true; + } else if (!strcmp(argv[0], "--disable-llvm-lto")) { option.disable_llvm_lto = true; } @@ -705,7 +712,7 @@ main(int argc, char *argv[]) } if (sgx_mode) { - option.size_level = 1; + option.size_level = 0; option.is_sgx_platform = true; }