Merge branch 'main' into dev/memory64
Some checks failed
compilation on android, ubuntu-22.04 / build_llvm_libraries_on_ubuntu_2204 (push) Has been cancelled
compilation on macos / build_llvm_libraries_on_intel_macos (push) Has been cancelled
compilation on macos / build_llvm_libraries_on_arm_macos (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_AOT) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_CLASSIC) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR_FAST) (push) Has been cancelled
compilation on SGX / build_llvm_libraries (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_DUMP_CALL_STACK=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_DUMP_CALL_STACK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MEMORY_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MEMORY_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MINI_LOADER=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MINI_LOADER=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MINI_LOADER=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MULTI_MODULE=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MULTI_MODULE=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MULTI_MODULE=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_MULTI_MODULE=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_PERF_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_PERF_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_PERF_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_PERF_PROFILING=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_REF_TYPES=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_REF_TYPES=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_REF_TYPES=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_REF_TYPES=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $AOT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Has been cancelled
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Has been cancelled
hadolint dockerfiles / run-hadolint-on-dockerfiles (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_wamrc (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DEBUG_AOT=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DEBUG_AOT=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DEBUG_INTERP=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DEBUG_INTERP=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY64=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY64=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MEMORY=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MEMORY=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $AOT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, android) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_iwasm (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, linux) (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_unit_tests (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-s… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $AOT_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAssembly/wasi-… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $CLASSIC_INTERP_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAss… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAssemb… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAssembly/… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $LLVM_EAGER_JIT_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAss… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $LLVM_LAZY_JIT_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAsse… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, $MULTI_TIER_JIT_BUILD_OPTIONS, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAss… (push) Has been cancelled
compilation on android, ubuntu-22.04 / build_samples_others (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wa… (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $GC_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $MEMORY64_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $MULTI_MODULES_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $WAMR_COMPILER_TEST_OPTIONS) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, aot, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $GC_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $MEMORY64_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $MULTI_MEMORY_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $MULTI_MODULES_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, classic-interp, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-interp, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-interp, $GC_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-interp, $MULTI_MODULES_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-interp, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-interp, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-jit, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, fast-jit, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, jit, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, jit, $GC_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, jit, $SIMD_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, jit, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, jit, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, multi-tier-jit, $DEFAULT_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, multi-tier-jit, $THREADS_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test (${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}, ubuntu-22.04, multi-tier-jit, $WASI_TEST_OPTIONS, 22.04, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz) (push) Has been cancelled
compilation on android, ubuntu-22.04 / test-wamr-ide (push) Has been cancelled
compilation on macos / build_wamrc (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, macos-13) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_CUSTOM_NAME_SECTION=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DEBUG_INTERP=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_DUMP_CALL_STACK=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_PTHREAD=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LIB_WASI_THREADS=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MEMORY_PROFILING=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MINI_LOADER=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_MULTI_MODULE=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_PERF_PROFILING=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_REF_TYPES=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_SIMD=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_BUILD_TAIL_CALL=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $AOT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api ($CLASSIC_INTERP_BUILD_OPTIONS, macos-13, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api ($FAST_INTERP_BUILD_OPTIONS, macos-13, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz) (push) Has been cancelled
compilation on macos / build_samples_others (${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}, macos-14, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-s… (push) Has been cancelled
compilation on macos / build_samples_others (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, macos-13, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz, https://github.com/WebAssembly/wasi-sdk/releases/download/wasi… (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebA… (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://gith… (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.… (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com… (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -P) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -S -P) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -X -P) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, classic-interp, -x -p -s spec -P) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-interp, -x -p -s spec -P) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-jit, -x -p -s spec -P) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Has been cancelled

This commit is contained in:
Wenyong Huang 2024-08-22 11:42:44 +08:00
commit 54f23bdd38
822 changed files with 52793 additions and 4404 deletions

16
.dockerignore Normal file
View File

@ -0,0 +1,16 @@
# 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
.*
core/deps
!core/deps/tensorflow-src
samples
tests

View File

@ -7,7 +7,7 @@
sudo apt update
sudo apt install -y build-essential cmake g++-multilib libgcc-11-dev lib32gcc-11-dev ccache ninja-build ccache
sudo apt install -y build-essential cmake g++-multilib libgcc-12-dev lib32gcc-12-dev ccache ninja-build
WAMR_DIR=${PWD}
@ -264,7 +264,7 @@ fi
# build iwasm with configurable bounds checks enabled
cd ${WAMR_DIR}/product-mini/platforms/linux
rm -rf build && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_CONFIGUABLE_BOUNDS_CHECKS=1
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1
make -j
if [[ $? != 0 ]]; then
echo "Failed to build iwasm with configurable bounds checks enabled!"

10
.github/scripts/install_qemu_xtensa.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#! /bin/sh
set -e
URL=https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
DIR=$(mktemp -d)
cd ${DIR}
curl -fLsS "${URL}" | xzcat | tar -x
ln -s ${DIR}/qemu/bin/qemu-system-xtensa /usr/local/bin/qemu-system-xtensa

View File

@ -11,7 +11,7 @@ on:
required: false
default: x86_64
cwd:
description: workfing directory
description: working directory
type: string
required: true
llvm_cache_key:

View File

@ -14,6 +14,14 @@ on:
container_image:
required: false
type: string
extra_build_llvm_options:
required: false
type: string
default: ""
cache_key_suffix:
required: false
type: string
default: ""
outputs:
cache_key:
description: "A cached key of LLVM libraries"
@ -43,9 +51,9 @@ jobs:
run: /usr/bin/env python3 -m pip install -r requirements.txt --break-system-packages
working-directory: build-scripts
- name: retrive the last commit ID
- name: retrieve the last commit ID
id: get_last_commit
run: echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py --llvm-ver)" >> $GITHUB_OUTPUT
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
@ -54,7 +62,7 @@ jobs:
# suspect.
- name: form the cache key of libraries
id: create_lib_cache_key
run: echo "key=0-llvm-libraries-${{ inputs.os }}-${{ inputs.arch }}-${{ steps.get_last_commit.outputs.last_commit }}" >> $GITHUB_OUTPUT
run: echo "key=0-llvm-libraries-${{ inputs.os }}-${{ inputs.arch }}-${{ steps.get_last_commit.outputs.last_commit }}${{ inputs.cache_key_suffix }}" >> $GITHUB_OUTPUT
- name: Cache LLVM libraries
id: retrieve_llvm_libs
@ -101,5 +109,5 @@ jobs:
- name: Build LLVM libraries
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
run: /usr/bin/env python3 ./build_llvm.py --arch ${{ inputs.arch }}
run: /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --arch ${{ inputs.arch }}
working-directory: build-scripts

View File

@ -20,10 +20,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
- name: set vscode extension to correct version
run: |
@ -33,7 +33,7 @@ jobs:
- name: generate wamr ide vscode extension
run: |
npm install -g vsce
npm install -g @vscode/vsce
rm -rf node_modules
npm install
vsce package

View File

@ -28,7 +28,7 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-13') || 'ubuntu-20.04' }}
runs-on: ${{ (matrix.language == 'swift' && 'macos-13') || 'ubuntu-22.04' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read

View File

@ -19,6 +19,7 @@ on:
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "tests/unit/**"
- "wamr-compiler/**"
- "test-tools/wamr-ide/**"
# will be triggered on push events
@ -36,6 +37,7 @@ on:
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "tests/unit/**"
- "wamr-compiler/**"
- "test-tools/wamr-ide/**"
# allow to be triggered manually
@ -66,6 +68,7 @@ env:
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -S -b -P"
GC_TEST_OPTIONS: "-s spec -G -b -P"
MEMORY64_TEST_OPTIONS: "-s spec -W -b -P"
MULTI_MEMORY_TEST_OPTIONS: "-s spec -E -b -P"
jobs:
build_llvm_libraries_on_ubuntu_2204:
@ -146,12 +149,13 @@ jobs:
"-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_MEMORY64=1",
"-DWAMR_BUILD_MULTI_MEMORY=1",
]
os: [ubuntu-22.04]
platform: [android, linux]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -204,11 +208,9 @@ jobs:
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
# Memory64 only on CLASSIC INTERP mode, and only on 64-bit platform
# Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
platform: android
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
@ -219,6 +221,21 @@ jobs:
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
# Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
platform: android
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
# Fast-JIT and Multi-Tier-JIT mode don't support android
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
platform: android
@ -272,10 +289,73 @@ jobs:
cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/${{ matrix.platform }}
build_unit_tests:
needs:
[
build_llvm_libraries_on_ubuntu_2204,
build_wamrc
]
runs-on: ${{ matrix.os }}
strategy:
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",
]
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: 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: 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: Build wamrc
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler
- name: Build and run unit tests
run: |
mkdir build-unittests && cd build-unittests
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
ctest
working-directory: tests/unit
@ -528,6 +608,7 @@ jobs:
$WASI_TEST_OPTIONS,
$GC_TEST_OPTIONS,
$MEMORY64_TEST_OPTIONS,
$MULTI_MEMORY_TEST_OPTIONS,
]
wasi_sdk_release:
[
@ -542,7 +623,7 @@ jobs:
running_mode: aot
test_option: $WAMR_COMPILER_TEST_OPTIONS
exclude:
# uncompatiable modes and features
# incompatible modes and features
# classic-interp and fast-interp don't support simd
- running_mode: "classic-interp"
test_option: $SIMD_TEST_OPTIONS
@ -566,9 +647,7 @@ jobs:
test_option: $GC_TEST_OPTIONS
- running_mode: "multi-tier-jit"
test_option: $GC_TEST_OPTIONS
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Memory64
- running_mode: "aot"
test_option: $MEMORY64_TEST_OPTIONS
# fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Memory64
- running_mode: "fast-interp"
test_option: $MEMORY64_TEST_OPTIONS
- running_mode: "fast-jit"
@ -577,18 +656,30 @@ 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
- running_mode: "aot"
test_option: $MULTI_MEMORY_TEST_OPTIONS
- running_mode: "fast-interp"
test_option: $MULTI_MEMORY_TEST_OPTIONS
- running_mode: "fast-jit"
test_option: $MULTI_MEMORY_TEST_OPTIONS
- running_mode: "jit"
test_option: $MULTI_MEMORY_TEST_OPTIONS
- running_mode: "multi-tier-jit"
test_option: $MULTI_MEMORY_TEST_OPTIONS
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
uses: ocaml/setup-ocaml@v3
if: matrix.test_option == '$GC_TEST_OPTIONS'
with:
ocaml-compiler: 4.13
- name: Set-up Ocamlbuild
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
if: matrix.test_option == '$GC_TEST_OPTIONS'
run: opam install ocamlbuild dune menhir
- name: download and install wasi-sdk
@ -616,6 +707,7 @@ jobs:
if: >
((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
|| matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
&& matrix.test_option != '$MEMORY64_TEST_OPTIONS'
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
@ -653,13 +745,13 @@ jobs:
- name: run tests
timeout-minutes: 30
if: matrix.test_option != '$GC_TEST_OPTIONS' && matrix.test_option != '$MEMORY64_TEST_OPTIONS'
if: matrix.test_option != '$GC_TEST_OPTIONS'
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
working-directory: ./tests/wamr-test-suites
- name: run gc or memory64 tests
- name: run gc tests
timeout-minutes: 20
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
if: matrix.test_option == '$GC_TEST_OPTIONS'
run: |
eval $(opam env)
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}

View File

@ -134,8 +134,8 @@ jobs:
os: [macos-13]
platform: [darwin]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"

View File

@ -68,32 +68,31 @@ jobs:
# arm64
"boards/arm64/qemu/qemu-armv8a/configs/nsh",
]
wamr_config_option: [
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\n",
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n",
]
wamr_config_option:
- "CONFIG_INTERPRETERS_WAMR_AOT"
- "CONFIG_INTERPRETERS_WAMR_FAST"
- "CONFIG_INTERPRETERS_WAMR_CLASSIC"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
steps:
- name: Checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx
ref: releases/12.4
repository: apache/nuttx
ref: releases/12.6
path: nuttx
- name: Checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx-apps
ref: releases/12.4
repository: apache/nuttx-apps
ref: releases/12.6
path: apps
- name: Checkout WAMR
@ -102,16 +101,22 @@ jobs:
repository: ${{ github.repository }}
path: apps/interpreters/wamr/wamr
- name: Enable WAMR for NuttX
- name: Configure WAMR
working-directory: nuttx
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_EOL_IS_LF=y\n${{ matrix.wamr_config_option }}'
find nuttx/boards/sim -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n'
tools/configure.sh ${{ matrix.nuttx_board_config }}
kconfig-tweak --enable CONFIG_PSEUDOFS_SOFTLINKS
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
kconfig-tweak --enable CONFIG_INTERPRETERS_IWASM_TASK
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_PRIORITY 100
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 8192
for x in ${{ matrix.wamr_config_option }}; do
kconfig-tweak --enable $x
done
- name: Build
run: |
cd nuttx
tools/configure.sh ${{ matrix.nuttx_board_config }}
make -j$(nproc) EXTRAFLAGS=-Werror
working-directory: nuttx
run: make -j$(nproc) EXTRAFLAGS=-Werror
- name: Checkout Bloaty
uses: actions/checkout@v3

View File

@ -99,7 +99,7 @@ jobs:
os: [ubuntu-20.04]
platform: [linux-sgx]
exclude:
# uncompatiable mode and feature
# incompatible mode and feature
# MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
@ -269,23 +269,24 @@ jobs:
strategy:
matrix:
running_mode: ["classic-interp", "fast-interp", "aot", "fast-jit"]
test_option: ["-x -p -s spec -b -P", "-x -p -s spec -S -b -P", "-x -p -s spec -X -b -P"]
# 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 }}"]
exclude:
# classic-interp, fast-interp and fast-jit don't support simd
- running_mode: "classic-interp"
test_option: "-x -p -s spec -S -b -P"
test_option: "-x -p -s spec -S -P"
- running_mode: "fast-interp"
test_option: "-x -p -s spec -S -b -P"
test_option: "-x -p -s spec -S -P"
- running_mode: "fast-jit"
test_option: "-x -p -s spec -S -b -P"
test_option: "-x -p -s spec -S -P"
# classic-interp, fast-interp and fast jit don't support XIP
- running_mode: "classic-interp"
test_option: "-x -p -s spec -X -b -P"
test_option: "-x -p -s spec -X -P"
- running_mode: "fast-interp"
test_option: "-x -p -s spec -X -b -P"
test_option: "-x -p -s spec -X -P"
- running_mode: "fast-jit"
test_option: "-x -p -s spec -X -b -P"
test_option: "-x -p -s spec -X -P"
steps:
- name: checkout
@ -320,6 +321,9 @@ jobs:
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
- name: install for wabt compilation
run: sudo apt update && sudo apt install -y ninja-build
- name: run spec tests
run: |
source /opt/intel/sgxsdk/environment

View File

@ -36,10 +36,11 @@ env:
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"
# For Spec Test
DEFAULT_TEST_OPTIONS: "-s spec -b -P"
MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M -P"
SIMD_TEST_OPTIONS: "-s spec -b -S -P"
THREADS_TEST_OPTIONS: "-s spec -b -p -P"
# FIXME: use binary release(adding -b) instead of building from source after upgrading to 22.04
DEFAULT_TEST_OPTIONS: "-s spec -P"
MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P"
SIMD_TEST_OPTIONS: "-s spec -S -P"
THREADS_TEST_OPTIONS: "-s spec -p -P"
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
WASI_TEST_OPTIONS: "-s wasi_certification -w"
@ -131,12 +132,13 @@ jobs:
"-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_MEMORY64=1",
"-DWAMR_BUILD_MULTI_MEMORY=1",
]
os: [ubuntu-20.04]
platform: [android, linux]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -189,11 +191,9 @@ jobs:
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
# Memory64 only on CLASSIC INTERP mode, and only on 64-bit platform
# Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
platform: android
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
@ -204,6 +204,21 @@ jobs:
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
# Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
platform: android
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
# Fast-JIT and Multi-Tier-JIT mode don't support android
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
platform: android
@ -288,10 +303,11 @@ jobs:
"-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_MEMORY64=1",
"-DWAMR_BUILD_MULTI_MEMORY=1",
]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -321,17 +337,19 @@ jobs:
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
# Memory64 only on CLASSIC INTERP mode
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
steps:
- name: checkout
uses: actions/checkout@v3
- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: apt update && apt install -y make g++-4.8 gcc-4.8 wget git
on_retry_command: sudo rm -r /var/lib/apt/lists/*
run: |
apt update && apt install -y make g++-4.8 gcc-4.8 wget git
- name: checkout
run: |
git clone https://github.com/${{ github.repository }} wamr
- name: Install cmake
run: |
@ -344,7 +362,7 @@ jobs:
mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/linux
working-directory: wamr/product-mini/platforms/linux
build_samples_wasm_c_api:
needs:
@ -619,7 +637,7 @@ jobs:
ubuntu_version: "22.04"
exclude:
# uncompatiable modes and features
# incompatible modes and features
- os: ubuntu-20.04
sanitizer: tsan
# asan works only for aot now
@ -719,6 +737,9 @@ jobs:
if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
run: sudo apt-get update && sudo apt install -y jq
- name: install for wabt compilation
run: sudo apt update && sudo apt install -y ninja-build
- name: Build WASI thread tests
if: matrix.test_option == '$WASI_TEST_OPTIONS'
run: bash build.sh --sysroot "$SYSROOT_PATH"

View File

@ -28,8 +28,6 @@ on:
env:
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
WASI_SDK_PATH: "/opt/wasi-sdk"
WAMR_COMMON_OPTION:
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=327680\\nCONFIG_INTERPRETERS_WAMR_LOG=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\\nCONFIG_EOL_IS_LF=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\nCONFIG_LIBC_FLOATINGPOINT=y\\nCONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE=1024\\n"
jobs:
build_llvm_libraries:
@ -39,9 +37,18 @@ jobs:
arch: "ARM RISCV AArch64"
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
build_llvm_libraries_xtensa:
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-22.04"
arch: "Xtensa"
extra_build_llvm_options: "--platform xtensa"
cache_key_suffix: "-xtensa"
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
spec_test_on_qemu:
runs-on: ubuntu-latest
needs: [build_llvm_libraries]
needs: [build_llvm_libraries, build_llvm_libraries_xtensa]
container:
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
strategy:
@ -67,6 +74,11 @@ jobs:
target: "riscv32",
fpu_type: "none"
},
{
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
target: "riscv32_ilp32f",
fpu_type: "fp"
},
# {
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# target: "riscv32_ilp32d",
@ -77,50 +89,61 @@ jobs:
target: "riscv64",
fpu_type: "none"
},
{
config: "boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug",
target: "xtensa",
fpu_type: "none"
},
]
wamr_test_option: [
{
mode: "-t aot",
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
option: "CONFIG_INTERPRETERS_WAMR_AOT"
},
{
mode: "-t aot -X",
option: "CONFIG_INTERPRETERS_WAMR_AOT"
},
# {
# mode: "-t aot -X",
# option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
# },
# {
# mode: "-t classic-interp",
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC"
# },
# {
# mode: "-t fast-interp",
# option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
# option: "CONFIG_INTERPRETERS_WAMR_FAST"
# },
]
wamr_feature_option:
# Empty option for default
- { option: "", mode: "" }
- { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
- { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
exclude:
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
- target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
wamr_test_option: { mode: "-t aot -X" }
# Our xtensa environment doesn't have enough memory
- target_config: { target: "xtensa" }
wamr_feature_option: { mode: "-G" }
steps:
# Note: we use an unreleased version nuttx for xtensa because
# 12.4 doesn't contain necessary esp32s3 changes.
- name: Checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx
ref: releases/12.4
repository: apache/nuttx
ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || 'releases/12.6' }}
path: nuttx
- name: Checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx-apps
ref: releases/12.4
repository: apache/nuttx-apps
ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || 'releases/12.6' }}
path: apps
- name: Checkout WAMR
@ -140,7 +163,7 @@ jobs:
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
key: ${{ matrix.target_config.target == 'xtensa' && needs.build_llvm_libraries_xtensa.outputs.cache_key || needs.build_llvm_libraries.outputs.cache_key }}
- name: Quit if cache miss
if: contains(matrix.wamr_test_option.mode, 'aot') && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
@ -152,7 +175,12 @@ jobs:
# 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
@ -167,29 +195,6 @@ jobs:
echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
- name: Enable WAMR for NuttX
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
- name: Enable WAMR Interpreter for NuttX
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
- name: Enable WAMR Feature for NuttX
if: matrix.wamr_feature_option.option != ''
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
- name: Disable FPU for NuttX
if: matrix.target_config.fpu_type == 'none'
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
- name: Disable DPFPU for NuttX
if: matrix.target_config.fpu_type == 'fp'
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU is not set\n'
- name: Build wamrc
if: contains(matrix.wamr_test_option.mode, 'aot')
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
@ -197,15 +202,159 @@ jobs:
cmake -Bbuild .
cmake --build build
- name: Build
id: build_firmware
# the nuttx version we use for xtensa requires esptool.py newer than
# what we have in our version of the apache-nuttx-ci-linux image.
- name: Install the latest esptool.py (xtensa)
if: matrix.target_config.target == 'xtensa'
run: |
pip3 install esptool==4.7.0
esptool.py version
- name: Configure NuttX
run: |
tools/configure.sh ${{ matrix.target_config.config }}
working-directory: nuttx
# depending on configurations, the iwasm command line generated
# by spec-test-script can be longer than the default NSH_LINELEN,
# which is 64 or 80.
- name: Enable WAMR for NuttX
run: |
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LOG
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_REF_TYPES
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_SHARED_MEMORY
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_BULK_MEMORY
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE 1024
kconfig-tweak --enable CONFIG_FS_HOSTFS
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
kconfig-tweak --enable CONFIG_LIBC_FLOATINGPOINT
kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
working-directory: nuttx
- name: Set WAMR stack size for NuttX
if: matrix.target_config.target != 'xtensa'
run: |
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 327680
working-directory: nuttx
# because qemu doesn't have a proper emulation of esp32s3 psram,
# we are limited to the internal ram, which is about 400KB.
- name: Set WAMR stack size for NuttX (xtensa)
if: matrix.target_config.target == 'xtensa'
run: |
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 25600
working-directory: nuttx
- name: Enable WAMR interpreter/aot runtime for NuttX
if: matrix.wamr_test_option.option != ''
run: |
for x in ${{ matrix.wamr_test_option.option }}; do
kconfig-tweak --enable $x
done
working-directory: nuttx
- name: Enable WAMR Features for NuttX
if: matrix.wamr_feature_option.option != ''
run: |
for x in ${{ matrix.wamr_feature_option.option }}; do
kconfig-tweak --enable $x
done
working-directory: nuttx
- name: Disable FPU for NuttX
if: matrix.target_config.fpu_type == 'none'
run: |
kconfig-tweak --disable CONFIG_ARCH_FPU
working-directory: nuttx
- name: Disable DPFPU for NuttX
if: matrix.target_config.fpu_type == 'fp'
run: |
kconfig-tweak --disable CONFIG_ARCH_DPFPU
working-directory: nuttx
# Note: while a real hardware would need
# INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=y,
# it doesn't work with xtensa qemu which we use on the CI because it
# doesn't have a proper emulation of I/D separate mappings.
# we work it around by using INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=n.
# this configuration won't work on a real hardware.
- name: Tweak NuttX config (xtensa)
if: matrix.target_config.target == 'xtensa'
run: |
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ
kconfig-tweak --disable CONFIG_INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR
working-directory: nuttx
- name: Build NuttX
run: |
make olddefconfig
make -j$(nproc)
working-directory: nuttx
# for xtensa, build a 8MB firmware image.
# simple boot is assumed. (thus the nuttx.bin offset in the image is 0)
# qemu will infer the flash size from the file size.
- name: Post build processing (xtensa)
if: matrix.target_config.target == 'xtensa'
run: |
cd nuttx
tools/configure.sh ${{ matrix.target_config.config }}
make -j$(nproc)
echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT
dd if=/dev/zero of=flash.img bs=1024 count=8192
dd if=nuttx.bin of=flash.img conv=notrunc
mv flash.img nuttx
- name: Build firmware path
id: build_firmware_path
run: |
echo "firmware=$PWD/nuttx/nuttx" >> $GITHUB_OUTPUT
# for xtensa, use the espressif fork of qemu, which has esp32s3 support.
- name: Install QEMU (xtensa)
if: matrix.target_config.target == 'xtensa'
run: |
apt-get remove -y qemu-system-misc
apt-get update && apt-get install -y libsdl2-2.0-0
./.github/scripts/install_qemu_xtensa.sh
qemu-system-xtensa --version
working-directory: apps/interpreters/wamr/wamr
- name: Test
if: matrix.target_config.target != 'xtensa'
run: |
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
# for xtensa, for some reasons, when running the tests
# with test_wamr.sh -P, nuttx occasionally hangs after
# "total segments stored 6" on the CI.
# i (yamamoto) couldn't reproduce it locally (macOS) even
# with the identical flash image.
# for now, run the tests without -P.
- name: Test
if: matrix.target_config.target == 'xtensa'
run: |
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
- name: pack the log
if: always()
run: |
mkdir log
cp $PWD/nuttx/.config log/dot-config
cp ${{ steps.build_firmware_path.outputs.firmware }} log
tar -C apps/interpreters/wamr/wamr/tests/wamr-test-suites/workspace -cvzf log/report.tgz report
- name: upload the log
if: always()
uses: actions/upload-artifact@v4
with:
name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
path: log

6
.gitignore vendored
View File

@ -5,12 +5,14 @@
.venv
/.idea
**/cmake-build-*/
**/*build/
**/*build*/
!/build-scripts
*.obj
*.a
*.so
.clangd
.DS_Store
*.o
core/deps/**
core/shared/mem-alloc/tlsf
@ -36,4 +38,4 @@ tests/benchmarks/coremark/coremark*
samples/workload/include/**
!samples/workload/include/.gitkeep
# core/iwasm/libraries/wasi-threads
# core/iwasm/libraries/wasi-threads

View File

@ -16,9 +16,9 @@ WAMR project reused some components from other open source project:
- **asmjit**: for the Fast JIT x86-64 codegen implementation
- **zydis**: for the Fast JIT x86-64 codegen implementation
- **NuttX ELF headers**: used in core/iwasm/aot/debug/elf_parser.c
- **Dhrystone**: for the test benchmakr dhrystone
- **Dhrystone**: for the test benchmark dhrystone
The WAMR fast interpreter is a clean room development. We would acknowledge the inspirations by [WASM3](https://github.com/wasm3/wasm3) open source project for the approach of pre-calculated oprand stack location.
The WAMR fast interpreter is a clean room development. We would acknowledge the inspirations by [WASM3](https://github.com/wasm3/wasm3) open source project for the approach of pre-calculated operand stack location.
| third party components | version number | latest release | vendor pages | CVE details |
| --- | --- | --- | --- | --- |
@ -35,7 +35,7 @@ The WAMR fast interpreter is a clean room development. We would acknowledge the
| uvwasi | unspecified | v0.0.12 | https://github.com/nodejs/uvwasi | |
| asmjit | unspecified | unspecified | https://github.com/asmjit/asmjit | |
| zydis | unspecified | e14a07895136182a5b53e181eec3b1c6e0b434de | https://github.com/zyantific/zydis | |
| NuttX ELF headers | 72313301e23f9c2de969fb64b9a0f67bb4c284df | 10.3.0 | https://github.com/apache/incubator-nuttx | |
| NuttX ELF headers | 72313301e23f9c2de969fb64b9a0f67bb4c284df | 10.3.0 | https://github.com/apache/nuttx | |
| Dhrystone | 2.1 | 2.1 | https://fossies.org/linux/privat/old/ | |
## Licenses

View File

@ -16,6 +16,13 @@ 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 "")
@ -114,7 +121,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter -fvisibility=hidden")
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
@ -135,31 +142,38 @@ endif ()
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
# STATIC LIBRARY
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 -lpthread)
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
endif ()
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
# 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 ()
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
endif ()
# SHARED LIBRARY
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 INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_shared INTERFACE boringssl_crypto)
endif ()
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 INTERFACE ${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 (MINGW)
target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32)
endif ()
if (MINGW)
target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32)
endif ()
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
endif ()
# HEADERS
install (FILES

View File

@ -1,3 +1,246 @@
## WAMR-2.1.2
### Breaking Changes
- 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)
### 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)
### 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)
### 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)
---
## WAMR-2.1.1
### Breaking Changes
- 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)
### 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)
### 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)
### 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)
---
## WAMR-2.1.0
### 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)
### 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)
### 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)
### 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)
---
## WAMR-2.0.0
### Breaking Changes

View File

@ -31,9 +31,11 @@ if GetDepend(['WAMR_BUILD_LIBC_BUILTIN']):
if GetDepend(['WAMR_BUILD_LIBC_WASI']):
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-wasi', 'SConscript'))
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'common', 'posix', 'SConscript'))
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'common', 'libc-util', 'SConscript'))
if GetDepend(['WAMR_BUILD_LIB_PTHREAD']):
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-pthread', 'SConscript'))
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'lib-pthread', 'SConscript'))
if GetDepend(['WAMR_BUILD_THREAD_MGR']):
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'thread-mgr', 'SConscript'))
@ -41,6 +43,9 @@ if GetDepend(['WAMR_BUILD_THREAD_MGR']):
if GetDepend(['WAMR_BUILD_LIBC_EMCC']):
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-emmc', 'SConscript'))
if GetDepend(['WAMR_BUILD_LIB_WASI_THREADS']):
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'lib-wasi-threads', 'SConscript'))
objs += SConscript(os.path.join(cwd, 'SConscript_config'));
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'rt-thread', 'SConscript'))

View File

@ -109,7 +109,27 @@ if GetDepend(['WAMR_BUILD_CUSTOM_NAME_SECTION']):
if GetDepend(['WAMR_BUILD_TAIL_CALL']):
CPPDEFINES += ['WASM_ENABLE_TAIL_CALL=1']
print('[WAMR] Tail call enabledd')
print('[WAMR] Tail call enabled')
if GetDepend(['WAMR_BUILD_THREAD_MGR']):
CPPDEFINES += ['WASM_ENABLE_THREAD_MGR=1']
print('[WAMR] Thread manager enabled')
if GetDepend(['WAMR_BUILD_LIBC_WASI']):
CPPDEFINES += ['WASM_ENABLE_LIBC_WASI=1']
CPPDEFINES += ['WASM_ENABLE_MODULE_INST_CONTEXT=1']
print('[WAMR] Libc wasi enabled')
if GetDepend(['WAMR_BUILD_LIB_WASI_THREADS']):
CPPDEFINES += ['WASM_ENABLE_LIB_WASI_THREADS=1']
print('[WAMR] Lib wasi threads enabled')
if GetDepend(['WAMR_BUILD_REF_TYPES']):
CPPDEFINES += ['WASM_ENABLE_REF_TYPES=1']
print('[WAMR] enable ref types')
CPPDEFINES += ['BH_MALLOC=wasm_runtime_malloc']
CPPDEFINES += ['BH_FREE=wasm_runtime_free']
LIBS = ['m']

View File

@ -156,11 +156,15 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
CONFIG_CMD += " -A x64"
else:
CONFIG_CMD += " -G'Ninja'"
print(f"Config command: {CONFIG_CMD}")
subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir)
BUILD_CMD = "cmake --build . --target package" + (
" --config Release" if "windows" == platform else ""
)
if "windows" == platform:
BUILD_CMD += " --parallel " + str(os.cpu_count())
print(f"Build command: {BUILD_CMD}")
subprocess.check_call(shlex.split(BUILD_CMD), cwd=build_dir)
return build_dir
@ -261,7 +265,7 @@ def main():
"xtensa": {
"repo": "https://github.com/espressif/llvm-project.git",
"repo_ssh": "git@github.com:espressif/llvm-project.git",
"branch": "xtensa_release_15.x",
"branch": "xtensa_release_17.0.1",
},
"default": {
"repo": "https://github.com/llvm/llvm-project.git",

View File

@ -39,6 +39,8 @@ elseif (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64")
add_definitions(-DBUILD_TARGET_RISCV64_LP64)
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32" OR WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32D")
add_definitions(-DBUILD_TARGET_RISCV32_ILP32D)
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32F")
add_definitions(-DBUILD_TARGET_RISCV32_ILP32F)
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32")
add_definitions(-DBUILD_TARGET_RISCV32_ILP32)
elseif (WAMR_BUILD_TARGET STREQUAL "ARC")
@ -233,6 +235,10 @@ if (WAMR_BUILD_SPEC_TEST EQUAL 1)
add_definitions (-DWASM_ENABLE_SPEC_TEST=1)
message (" spec test compatible mode is on")
endif ()
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)
@ -259,6 +265,11 @@ if (WAMR_BUILD_MEMORY64 EQUAL 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)
endif ()
if (WAMR_BUILD_THREAD_MGR EQUAL 1)
message (" Thread manager enabled")
endif ()
@ -430,6 +441,20 @@ endif ()
if (WAMR_BUILD_WASI_NN EQUAL 1)
message (" WASI-NN enabled")
add_definitions (-DWASM_ENABLE_WASI_NN=1)
# Variant backends
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
message (FATAL_ERROR " Need to select a backend for WASI-NN")
endif ()
if (WAMR_BUILD_WASI_NN_TFLITE EQUAL 1)
message (" WASI-NN: backend tflite enabled")
add_definitions (-DWASM_ENABLE_WASI_NN_TFLITE)
endif ()
if (WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
message (" WASI-NN: backend openvino enabled")
add_definitions (-DWASM_ENABLE_WASI_NN_OPENVINO)
endif ()
# Variant devices
if (WAMR_BUILD_WASI_NN_ENABLE_GPU EQUAL 1)
message (" WASI-NN: GPU enabled")
add_definitions (-DWASM_ENABLE_WASI_NN_GPU=1)
@ -442,7 +467,7 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
add_definitions (-DWASM_WASI_NN_EXTERNAL_DELEGATE_PATH="${WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH}")
endif ()
if (WAMR_BUILD_WASI_EPHEMERAL_NN EQUAL 1)
message (" WASI-NN: WASI-Ephemeral-NN enabled")
message (" WASI-NN: use 'wasi_ephemeral_nn' instead of 'wasi-nn'")
add_definitions (-DWASM_ENABLE_WASI_EPHEMERAL_NN=1)
endif()
endif ()
@ -516,7 +541,7 @@ if (WAMR_BUILD_TARGET STREQUAL "X86_64"
message (" Write linear memory base addr to x86 GS register enabled")
endif ()
endif ()
if (WAMR_CONFIGUABLE_BOUNDS_CHECKS EQUAL 1)
if (WAMR_CONFIGURABLE_BOUNDS_CHECKS EQUAL 1)
add_definitions (-DWASM_CONFIGURABLE_BOUNDS_CHECKS=1)
message (" Configurable bounds checks enabled")
endif ()

View File

@ -1 +1 @@
requests==2.31.0
requests==2.32.3

View File

@ -14,7 +14,7 @@ docker build \
--cap-add=SYS_PTRACE \
--cpus=".5" \
--memory=4G \
--mount type=bind,src="${ROOT}",dst=/workspace \
--mount type=bind,src="${ROOT}",dst=/workspaces \
--name wamr_build_env \
--security-opt=seccomp=unconfined \
wamr_dev_${VARIANT}:0.1 \

View File

@ -5,7 +5,7 @@
#
import argparse
import re
import pathlib
from pathlib import Path
import re
import shlex
import shutil
@ -46,18 +46,18 @@ def locate_command(command: str) -> bool:
def is_excluded(path: str) -> bool:
path = pathlib.Path(path).resolve()
path = Path(path).resolve()
for exclude_path in EXCLUDE_PATHS:
if path.match(exclude_path):
return True
return False
def pre_flight_check(root: pathlib) -> bool:
def pre_flight_check(root: Path) -> bool:
def check_aspell(root):
return True
def check_clang_foramt(root: pathlib) -> bool:
def check_clang_format(root: Path) -> bool:
if not locate_command(CLANG_FORMAT_CMD):
return False
@ -74,10 +74,10 @@ def pre_flight_check(root: pathlib) -> bool:
def check_git_clang_format() -> bool:
return locate_command(GIT_CLANG_FORMAT_CMD)
return check_aspell(root) and check_clang_foramt(root) and check_git_clang_format()
return check_aspell(root) and check_clang_format(root) and check_git_clang_format()
def run_clang_format(file_path: pathlib, root: pathlib) -> bool:
def run_clang_format(file_path: Path, root: Path) -> bool:
try:
subprocess.check_call(
shlex.split(
@ -91,7 +91,7 @@ def run_clang_format(file_path: pathlib, root: pathlib) -> bool:
return False
def run_clang_format_diff(root: pathlib, commits: str) -> 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
the PR, with a commit range specified. It is required to format the
@ -155,11 +155,11 @@ def run_clang_format_diff(root: pathlib, commits: str) -> bool:
return False
def run_aspell(file_path: pathlib, root: pathlib) -> bool:
def run_aspell(file_path: Path, root: Path) -> bool:
return True
def check_dir_name(path: pathlib, root: pathlib) -> bool:
def check_dir_name(path: Path, root: Path) -> bool:
m = re.search(INVALID_DIR_NAME_SEGMENT, str(path.relative_to(root).parent))
if m:
print(f"--- found a character '_' in {m.groups()} in {path}")
@ -167,7 +167,22 @@ def check_dir_name(path: pathlib, root: pathlib) -> bool:
return not m
def check_file_name(path: pathlib) -> bool:
def check_file_name(path: Path) -> bool:
"""
file names should not contain any character '-'
but some names are well known and use '-' as the separator, e.g.:
- docker-compose
- package-lock
- vite-env.d
"""
if path.stem in [
"docker-compose",
"package-lock",
"vite-env.d",
]:
return True
m = re.search(INVALID_FILE_NAME_SEGMENT, path.stem)
if m:
print(f"--- found a character '-' in {m.groups()} in {path}")
@ -175,7 +190,7 @@ def check_file_name(path: pathlib) -> bool:
return not m
def parse_commits_range(root: pathlib, commits: str) -> list:
def parse_commits_range(root: Path, commits: str) -> list:
GIT_LOG_CMD = f"git log --pretty='%H' {commits}"
try:
ret = subprocess.check_output(
@ -187,7 +202,7 @@ def parse_commits_range(root: pathlib, commits: str) -> list:
return []
def analysis_new_item_name(root: pathlib, commit: str) -> bool:
def analysis_new_item_name(root: Path, commit: str) -> bool:
"""
For any file name in the repo, it is required to use '_' to replace '-'.
@ -216,7 +231,7 @@ def analysis_new_item_name(root: pathlib, commit: str) -> bool:
continue
new_item = match.group(1)
new_item = pathlib.Path(new_item).resolve()
new_item = Path(new_item).resolve()
if new_item.is_file():
if not check_file_name(new_item):
@ -235,7 +250,7 @@ def analysis_new_item_name(root: pathlib, commit: str) -> bool:
return False
def process_entire_pr(root: pathlib, commits: str) -> bool:
def process_entire_pr(root: Path, commits: str) -> bool:
if not commits:
print("Please provide a commits range")
return False
@ -268,7 +283,7 @@ def main() -> int:
)
options = parser.parse_args()
wamr_root = pathlib.Path(__file__).parent.joinpath("..").resolve()
wamr_root = Path(__file__).parent.joinpath("..").resolve()
if not pre_flight_check(wamr_root):
return False
@ -279,23 +294,23 @@ def main() -> int:
# run with python3 -m unitest ci/coding_guidelines_check.py
class TestCheck(unittest.TestCase):
def test_check_dir_name_failed(self):
root = pathlib.Path("/root/Workspace/")
root = Path("/root/Workspace/")
new_file_path = root.joinpath("core/shared/platform/esp_idf/espid_memmap.c")
self.assertFalse(check_dir_name(new_file_path, root))
def test_check_dir_name_pass(self):
root = pathlib.Path("/root/Workspace/")
root = Path("/root/Workspace/")
new_file_path = root.joinpath("core/shared/platform/esp-idf/espid_memmap.c")
self.assertTrue(check_dir_name(new_file_path, root))
def test_check_file_name_failed(self):
new_file_path = pathlib.Path(
new_file_path = Path(
"/root/Workspace/core/shared/platform/esp-idf/espid-memmap.c"
)
self.assertFalse(check_file_name(new_file_path))
def test_check_file_name_pass(self):
new_file_path = pathlib.Path(
new_file_path = Path(
"/root/Workspace/core/shared/platform/esp-idf/espid_memmap.c"
)
self.assertTrue(check_file_name(new_file_path))

View File

@ -20,6 +20,7 @@
&& !defined(BUILD_TARGET_RISCV64_LP64D) \
&& !defined(BUILD_TARGET_RISCV64_LP64) \
&& !defined(BUILD_TARGET_RISCV32_ILP32D) \
&& !defined(BUILD_TARGET_RISCV32_ILP32F) \
&& !defined(BUILD_TARGET_RISCV32_ILP32) \
&& !defined(BUILD_TARGET_ARC)
/* clang-format on */
@ -43,7 +44,11 @@
#define BUILD_TARGET_XTENSA
#elif defined(__riscv) && (__riscv_xlen == 64)
#define BUILD_TARGET_RISCV64_LP64D
#elif defined(__riscv) && (__riscv_xlen == 32)
#elif defined(__riscv) && (__riscv_xlen == 32) && !defined(__riscv_flen)
#define BUILD_TARGET_RISCV32_ILP32
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 32)
#define BUILD_TARGET_RISCV32_ILP32F
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 64)
#define BUILD_TARGET_RISCV32_ILP32D
#elif defined(__arc__)
#define BUILD_TARGET_ARC
@ -304,7 +309,7 @@
#define WASM_DISABLE_STACK_HW_BOUND_CHECK 0
#endif
/* Disable SIMD unless it is manualy enabled somewhere */
/* Disable SIMD unless it is manually enabled somewhere */
#ifndef WASM_ENABLE_SIMD
#define WASM_ENABLE_SIMD 0
#endif
@ -363,37 +368,24 @@
#define WASM_ENABLE_SPEC_TEST 0
#endif
#ifndef WASM_ENABLE_WASI_TEST
#define WASM_ENABLE_WASI_TEST 0
#endif
/* Global heap pool size in bytes */
#ifndef WASM_GLOBAL_HEAP_SIZE
#define WASM_GLOBAL_HEAP_SIZE (10 * 1024 * 1024)
#endif
/* Max app number of all modules */
#define MAX_APP_INSTALLATIONS 3
/* Default timer number in one app */
#define DEFAULT_TIMERS_PER_APP 20
/* Max timer number in one app */
#define MAX_TIMERS_PER_APP 30
/* Max connection number in one app */
#define MAX_CONNECTION_PER_APP 20
/* Max resource registration number in one app */
#define RESOURCE_REGISTRATION_NUM_MAX 16
/* Max length of resource/event url */
#define RESOUCE_EVENT_URL_LEN_MAX 256
/* Default length of queue */
#ifndef DEFAULT_QUEUE_LENGTH
#define DEFAULT_QUEUE_LENGTH 50
/* Default watchdog interval in ms */
#define DEFAULT_WATCHDOG_INTERVAL (3 * 60 * 1000)
#endif
/* The max percentage of global heap that app memory space can grow */
#ifndef APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT
#define APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT 1 / 3
#endif
/* Default min/max heap size of each app */
#ifndef APP_HEAP_SIZE_DEFAULT
@ -445,7 +437,7 @@
#endif
/* Reserved bytes to the native thread stack boundary, throw native
* stack overflow exception if the guard boudary is reached
* stack overflow exception if the guard boundary is reached
*
* WASM_STACK_GUARD_SIZE needs to be large enough for:
*
@ -461,7 +453,7 @@
* - aot runtime functions
* eg. aot_enlarge_memory.
*
* - w/o hw bound check, the intepreter loop
* - w/o hw bound check, the interpreter loop
*
* the stack consumption heavily depends on compiler settings,
* especially for huge functions like the classic interpreter's
@ -470,8 +462,23 @@
* 200 bytes (release build, macOS/amd64)
* 2600 bytes (debug build, macOS/amd64)
*
* libc snprintf (used by eg. wasm_runtime_set_exception) consumes about
* 1600 bytes stack on macOS/amd64, about 2000 bytes on Ubuntu amd64 20.04.
* - platform-provided functions (eg. libc)
*
* the following are examples of the stack consumptions observed for
* host APIs.
*
* snprintf: (used by eg. wasm_runtime_set_exception)
* - about 1600 bytes on macOS/amd64
* - about 2000 bytes on Ubuntu amd64 20.04
*
* gethostbyname:
* - 3KB-6KB on macOS/amd64
* - 10KB on Ubuntu amd64 20.04
*
* getaddrinfo:
* - 4KB-17KB on macOS/amd64
* - 12KB on Ubuntu amd64 20.04
* - 0.3-1.5KB on NuttX/esp32s3
*
* - stack check wrapper functions generated by the aot compiler
* (--stack-bounds-checks=1)
@ -480,6 +487,9 @@
* "precheck functions themselves consume relatively large amount of stack"
* when it detects wrapper functions requiring more than 1KB.
*
* - the ABI-defined red zone. eg. 128 bytes for SYSV x86-64 ABI.
* cf. https://en.wikipedia.org/wiki/Red_zone_(computing)
*
* Note: on platforms with lazy function binding, don't forget to consider
* the symbol resolution overhead on the first call. For example,
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
@ -496,7 +506,7 @@
/*
* Use a larger default for platforms like macOS/Linux.
*
* For example, the classic intepreter loop which ended up with a trap
* For example, the classic interpreter loop which ended up with a trap
* (wasm_runtime_set_exception) would consume about 2KB stack on x86-64
* macOS. On Ubuntu amd64 20.04, it seems to consume a bit more.
*
@ -654,6 +664,11 @@
#define WASM_ENABLE_MEMORY64 0
#endif
/* Disable multi-memory by default */
#ifndef WASM_ENABLE_MULTI_MEMORY
#define WASM_ENABLE_MULTI_MEMORY 0
#endif
#ifndef WASM_TABLE_MAX_SIZE
#define WASM_TABLE_MAX_SIZE 1024
#endif
@ -662,4 +677,15 @@
#define WASM_MEM_ALLOC_WITH_USAGE 0
#endif
#ifndef WASM_ENABLE_FUZZ_TEST
#define WASM_ENABLE_FUZZ_TEST 0
#endif
#if WASM_ENABLE_FUZZ_TEST != 0
#ifndef WASM_MEM_ALLOC_MAX_SIZE
/* In oss-fuzz, the maximum RAM is ~2.5G */
#define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024)
#endif
#endif /* WASM_ENABLE_FUZZ_TEST != 0 */
#endif /* end of _CONFIG_H_ */

View File

@ -685,7 +685,7 @@ add_f64xi64_intrinsics(AOTCompContext *comp_ctx)
}
static void
add_common_float_integer_convertion(AOTCompContext *comp_ctx)
add_common_float_integer_conversion(AOTCompContext *comp_ctx)
{
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_TO_F32);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_U32_TO_F32);
@ -851,7 +851,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
add_f32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_i64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
add_common_float_integer_conversion(comp_ctx);
}
}
else if (!strncmp(comp_ctx->target_arch, "riscv", 5)) {
@ -862,7 +862,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
*/
add_f32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
add_common_float_integer_conversion(comp_ctx);
if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) {
add_i64_common_intrinsics(comp_ctx);
}
@ -876,7 +876,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
add_i32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_i64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(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);

View File

@ -9,6 +9,7 @@
#include "aot_reloc.h"
#include "../common/wasm_runtime_common.h"
#include "../common/wasm_native.h"
#include "../common/wasm_loader_common.h"
#include "../compilation/aot.h"
#if WASM_ENABLE_DEBUG_AOT != 0
@ -94,7 +95,7 @@ check_buf(const uint8 *buf, const uint8 *buf_end, uint32 length,
{
if ((uintptr_t)buf + length < (uintptr_t)buf
|| (uintptr_t)buf + length > (uintptr_t)buf_end) {
set_error_buf(error_buf, error_buf_size, "unexpect end");
set_error_buf(error_buf, error_buf_size, "unexpected end");
return false;
}
return true;
@ -293,6 +294,39 @@ loader_malloc(uint64 size, char *error_buf, uint32 error_buf_size)
return mem;
}
static void *
loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size)
{
int map_prot =
MMAP_PROT_READ | MMAP_PROT_WRITE | (prot_exec ? MMAP_PROT_EXEC : 0);
int map_flags;
void *mem;
#if UINTPTR_MAX == UINT64_MAX
/* The mmapped AOT data and code in 64-bit targets had better be in
range 0 to 2G, or aot loader may fail to apply some relocations,
e.g., R_X86_64_32/R_X86_64_32S/R_X86_64_PC32/R_RISCV_32.
We try to mmap with MMAP_MAP_32BIT flag first, and if fails, mmap
again without the flag. */
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
process address space */
bh_assert((uintptr_t)mem < INT32_MAX);
return mem;
}
#endif
map_flags = MMAP_MAP_NONE;
if (!(mem = os_mmap(NULL, size, map_prot, map_flags,
os_get_invalid_handle()))) {
set_error_buf(error_buf, error_buf_size, "allocate memory failed");
return NULL;
}
return mem;
}
static char *
load_string(uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
bool is_load_from_file_buf,
@ -323,16 +357,20 @@ load_string(uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
#endif
else if (is_load_from_file_buf) {
/* The string is always terminated with '\0', use it directly.
* In this case, the file buffer can be reffered to after loading.
* In this case, the file buffer can be referred to after loading.
*/
bh_assert(p[str_len - 1] == '\0');
if (p[str_len - 1] != '\0')
goto fail;
str = (char *)p;
}
else {
/* Load from sections, the file buffer cannot be reffered to
/* Load from sections, the file buffer cannot be referred to
after loading, we must create another string and insert it
into const string set */
bh_assert(p[str_len - 1] == '\0');
if (p[str_len - 1] != '\0')
goto fail;
if (!(str = aot_const_str_set_insert((uint8 *)p, str_len, module,
#if (WASM_ENABLE_WORD_ALIGN_READ != 0)
is_vram_word_align,
@ -366,6 +404,8 @@ get_aot_file_target(AOTTargetInfo *target_info, char *target_buf,
break;
case E_MACHINE_ARM:
case E_MACHINE_AARCH64:
/* TODO: this will make following `strncmp()` ~L392 unnecessary.
* Use const strings here */
machine_type = target_info->arch;
break;
case E_MACHINE_MIPS:
@ -500,6 +540,11 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end,
read_uint64(p, p_end, target_info.reserved);
read_byte_array(p, p_end, target_info.arch, sizeof(target_info.arch));
if (target_info.arch[sizeof(target_info.arch) - 1] != '\0') {
set_error_buf(error_buf, error_buf_size, "invalid arch string");
return false;
}
if (p != buf_end) {
set_error_buf(error_buf, error_buf_size, "invalid section size");
return false;
@ -560,7 +605,7 @@ get_native_symbol_by_name(const char *name)
sym = get_target_symbol_map(&symnum);
while (symnum--) {
while (symnum && symnum--) {
if (strcmp(sym->symbol_name, name) == 0) {
func = sym->symbol_addr;
break;
@ -579,15 +624,17 @@ str2uint64(const char *buf, uint64 *p_res);
#if WASM_ENABLE_MULTI_MODULE != 0
static void *
aot_loader_resolve_function(const char *module_name, const char *function_name,
aot_loader_resolve_function(const AOTModule *module, const char *function_name,
const AOTFuncType *expected_function_type,
char *error_buf, uint32 error_buf_size)
char *error_buf, uint32 error_buf_size);
static void *
aot_loader_resolve_function_ex(const char *module_name,
const char *function_name,
const AOTFuncType *expected_function_type,
char *error_buf, uint32 error_buf_size)
{
WASMModuleCommon *module_reg;
void *function = NULL;
AOTExport *export = NULL;
AOTModule *module = NULL;
AOTFuncType *target_function_type = NULL;
module_reg = wasm_runtime_find_module_registered(module_name);
if (!module_reg || module_reg->module_type != Wasm_Module_AoT) {
@ -596,10 +643,23 @@ aot_loader_resolve_function(const char *module_name, const char *function_name,
set_error_buf(error_buf, error_buf_size, "unknown import");
return NULL;
}
return aot_loader_resolve_function((AOTModule *)module_reg, function_name,
expected_function_type, error_buf,
error_buf_size);
}
module = (AOTModule *)module_reg;
export = loader_find_export(module_reg, module_name, function_name,
EXPORT_KIND_FUNC, error_buf, error_buf_size);
static void *
aot_loader_resolve_function(const AOTModule *module, const char *function_name,
const AOTFuncType *expected_function_type,
char *error_buf, uint32 error_buf_size)
{
void *function = NULL;
AOTExport *export = NULL;
AOTFuncType *target_function_type = NULL;
export = loader_find_export((WASMModuleCommon *)module, module->name,
function_name, EXPORT_KIND_FUNC, error_buf,
error_buf_size);
if (!export) {
return NULL;
}
@ -621,7 +681,7 @@ aot_loader_resolve_function(const char *module_name, const char *function_name,
if (!wasm_type_equal((WASMType *)expected_function_type,
(WASMType *)target_function_type, module->types,
module->type_count)) {
LOG_DEBUG("%s.%s failed the type check", module_name, function_name);
LOG_DEBUG("%s.%s failed the type check", module->name, function_name);
set_error_buf(error_buf, error_buf_size, "incompatible import type");
return NULL;
}
@ -639,18 +699,27 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
int32 i;
const char *symbol;
if (module->native_symbol_list) {
set_error_buf(error_buf, error_buf_size,
"duplicated native symbol section");
return false;
}
read_uint32(p, p_end, cnt);
if (cnt > 0) {
module->native_symbol_list = wasm_runtime_malloc(cnt * sizeof(void *));
uint64 list_size = cnt * (uint64)sizeof(void *);
module->native_symbol_list =
loader_malloc(list_size, error_buf, error_buf_size);
if (module->native_symbol_list == NULL) {
set_error_buf(error_buf, error_buf_size,
"malloc native symbol list failed");
goto fail;
}
for (i = cnt - 1; i >= 0; i--) {
read_string(p, p_end, symbol);
if (!strlen(symbol))
continue;
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
uint32 u32;
/* Resolve the raw int bits of f32 const */
@ -1032,7 +1101,8 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, module->import_memory_count);
/* We don't support import_memory_count > 0 currently */
bh_assert(module->import_memory_count == 0);
if (module->import_memory_count > 0)
return false;
read_uint32(buf, buf_end, module->memory_count);
total_size = sizeof(AOTMemory) * (uint64)module->memory_count;
@ -1042,10 +1112,16 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
}
for (i = 0; i < module->memory_count; i++) {
read_uint32(buf, buf_end, module->memories[i].memory_flags);
read_uint32(buf, buf_end, module->memories[i].flags);
if (!wasm_memory_check_flags(module->memories[i].flags, error_buf,
error_buf_size, true)) {
return false;
}
read_uint32(buf, buf_end, module->memories[i].num_bytes_per_page);
read_uint32(buf, buf_end, module->memories[i].mem_init_page_count);
read_uint32(buf, buf_end, module->memories[i].mem_max_page_count);
read_uint32(buf, buf_end, module->memories[i].init_page_count);
read_uint32(buf, buf_end, module->memories[i].max_page_count);
}
read_uint32(buf, buf_end, module->mem_init_data_count);
@ -1305,24 +1381,25 @@ load_import_table_list(const uint8 **p_buf, const uint8 *buf_end,
/* keep sync with aot_emit_table_info() aot_emit_aot_file */
for (i = 0; i < module->import_table_count; i++, import_table++) {
read_uint8(buf, buf_end, import_table->elem_type);
read_uint8(buf, buf_end, import_table->table_flags);
read_uint8(buf, buf_end, import_table->possible_grow);
read_uint8(buf, buf_end, import_table->table_type.elem_type);
read_uint8(buf, buf_end, import_table->table_type.flags);
read_uint8(buf, buf_end, import_table->table_type.possible_grow);
#if WASM_ENABLE_GC != 0
if (wasm_is_type_multi_byte_type(import_table->elem_type)) {
if (wasm_is_type_multi_byte_type(import_table->table_type.elem_type)) {
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
}
#endif
read_uint32(buf, buf_end, import_table->table_init_size);
read_uint32(buf, buf_end, import_table->table_max_size);
read_uint32(buf, buf_end, import_table->table_type.init_size);
read_uint32(buf, buf_end, import_table->table_type.max_size);
#if WASM_ENABLE_GC != 0
if (wasm_is_type_multi_byte_type(import_table->elem_type)) {
if (wasm_is_type_multi_byte_type(import_table->table_type.elem_type)) {
read_uint32(buf, buf_end, ref_type.ref_ht_common.heap_type);
ref_type.ref_type = import_table->elem_type;
ref_type.ref_type = import_table->table_type.elem_type;
/* TODO: check ref_type */
if (!(import_table->elem_ref_type = wasm_reftype_set_insert(
module->ref_type_set, &ref_type))) {
if (!(import_table->table_type.elem_ref_type =
wasm_reftype_set_insert(module->ref_type_set,
&ref_type))) {
set_error_buf(error_buf, error_buf_size,
"insert ref type to hash set failed");
return false;
@ -1358,23 +1435,23 @@ load_table_list(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
/* Create each table data segment */
for (i = 0; i < module->table_count; i++, table++) {
read_uint8(buf, buf_end, table->elem_type);
read_uint8(buf, buf_end, table->table_flags);
read_uint8(buf, buf_end, table->possible_grow);
read_uint8(buf, buf_end, table->table_type.elem_type);
read_uint8(buf, buf_end, table->table_type.flags);
read_uint8(buf, buf_end, table->table_type.possible_grow);
#if WASM_ENABLE_GC != 0
if (wasm_is_type_multi_byte_type(table->elem_type)) {
if (wasm_is_type_multi_byte_type(table->table_type.elem_type)) {
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
}
#endif
read_uint32(buf, buf_end, table->table_init_size);
read_uint32(buf, buf_end, table->table_max_size);
read_uint32(buf, buf_end, table->table_type.init_size);
read_uint32(buf, buf_end, table->table_type.max_size);
#if WASM_ENABLE_GC != 0
if (wasm_is_type_multi_byte_type(table->elem_type)) {
if (wasm_is_type_multi_byte_type(table->table_type.elem_type)) {
read_uint32(buf, buf_end, ref_type.ref_ht_common.heap_type);
ref_type.ref_type = table->elem_type;
ref_type.ref_type = table->table_type.elem_type;
/* TODO: check ref_type */
if (!(table->elem_ref_type = wasm_reftype_set_insert(
if (!(table->table_type.elem_ref_type = wasm_reftype_set_insert(
module->ref_type_set, &ref_type))) {
set_error_buf(error_buf, error_buf_size,
"insert ref type to hash set failed");
@ -1665,6 +1742,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_type->ref_type_map_count = ref_type_map_count;
if (!is_valid_func_type(func_type))
goto fail;
param_cell_num = wasm_get_cell_num(func_type->types, param_count);
ret_cell_num =
wasm_get_cell_num(func_type->types + param_count, result_count);
@ -1969,6 +2049,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_types[i]->result_count = (uint16)result_count;
read_byte_array(buf, buf_end, func_types[i]->types, (uint32)size1);
if (!is_valid_func_type(func_types[i]))
goto fail;
param_cell_num = wasm_get_cell_num(func_types[i]->types, param_count);
ret_cell_num =
wasm_get_cell_num(func_types[i]->types + param_count, result_count);
@ -2042,17 +2125,22 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
/* Create each import global */
for (i = 0; i < module->import_global_count; i++) {
buf = (uint8 *)align_ptr(buf, 2);
read_uint8(buf, buf_end, import_globals[i].type);
read_uint8(buf, buf_end, import_globals[i].is_mutable);
read_uint8(buf, buf_end, import_globals[i].type.val_type);
read_uint8(buf, buf_end, import_globals[i].type.is_mutable);
read_string(buf, buf_end, import_globals[i].module_name);
read_string(buf, buf_end, import_globals[i].global_name);
if (!is_valid_value_type(import_globals[i].type.val_type)) {
return false;
}
#if WASM_ENABLE_LIBC_BUILTIN != 0
if (wasm_native_lookup_libc_builtin_global(
import_globals[i].module_name, import_globals[i].global_name,
&tmp_global)) {
if (tmp_global.type != import_globals[i].type
|| tmp_global.is_mutable != import_globals[i].is_mutable) {
if (tmp_global.type.val_type != import_globals[i].type.val_type
|| tmp_global.type.is_mutable
!= import_globals[i].type.is_mutable) {
set_error_buf(error_buf, error_buf_size,
"incompatible import type");
return false;
@ -2065,7 +2153,8 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
import_globals[i].is_linked = false;
#endif
import_globals[i].size = wasm_value_type_size(import_globals[i].type);
import_globals[i].size =
wasm_value_type_size(import_globals[i].type.val_type);
import_globals[i].data_offset = data_offset;
data_offset += import_globals[i].size;
module->global_data_size += import_globals[i].size;
@ -2130,8 +2219,11 @@ load_globals(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
/* Create each global */
for (i = 0; i < module->global_count; i++) {
read_uint8(buf, buf_end, globals[i].type);
read_uint8(buf, buf_end, globals[i].is_mutable);
read_uint8(buf, buf_end, globals[i].type.val_type);
read_uint8(buf, buf_end, globals[i].type.is_mutable);
if (!is_valid_value_type(globals[i].type.val_type))
return false;
buf = align_ptr(buf, 4);
@ -2139,7 +2231,7 @@ load_globals(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
error_buf, error_buf_size))
return false;
globals[i].size = wasm_value_type_size(globals[i].type);
globals[i].size = wasm_value_type_size(globals[i].type.val_type);
globals[i].data_offset = data_offset;
data_offset += globals[i].size;
module->global_data_size += globals[i].size;
@ -2158,6 +2250,9 @@ load_global_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
const uint8 *buf = *p_buf;
read_uint32(buf, buf_end, module->global_count);
if (is_indices_overflow(module->import_global_count, module->global_count,
error_buf, error_buf_size))
return false;
/* load globals */
if (module->global_count > 0
@ -2220,17 +2315,24 @@ load_import_funcs(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
&import_funcs[i].signature, &import_funcs[i].attachment,
&import_funcs[i].call_conv_raw);
if (!linked_func) {
sub_module = NULL;
if (!wasm_runtime_is_built_in_module(module_name)) {
sub_module = (AOTModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)module, module_name, error_buf,
error_buf_size);
if (!sub_module) {
LOG_ERROR("failed to load sub module: %s", error_buf);
return false;
}
}
linked_func = aot_loader_resolve_function(
module_name, field_name, declare_func_type, error_buf,
error_buf_size);
if (!sub_module)
linked_func = aot_loader_resolve_function_ex(
module_name, field_name, declare_func_type, error_buf,
error_buf_size);
else
linked_func = aot_loader_resolve_function(
sub_module, field_name, declare_func_type, error_buf,
error_buf_size);
}
import_funcs[i].func_ptr_linked = linked_func;
import_funcs[i].func_type = declare_func_type;
@ -2309,7 +2411,6 @@ destroy_object_data_sections(AOTObjectDataSection *data_sections,
}
}
#endif
os_munmap(data_section->data, data_section->size);
}
wasm_runtime_free(data_sections);
}
@ -2323,6 +2424,9 @@ load_object_data_sections(const uint8 **p_buf, const uint8 *buf_end,
AOTObjectDataSection *data_sections;
uint64 size;
uint32 i;
uint64 total_size = 0;
uint32 page_size = os_getpagesize();
uint8 *merged_sections = NULL;
/* Allocate memory */
size = sizeof(AOTObjectDataSection) * (uint64)module->data_section_count;
@ -2331,41 +2435,40 @@ load_object_data_sections(const uint8 **p_buf, const uint8 *buf_end,
return false;
}
/* Create each data section */
/* First iteration: read data from buf, and calculate total memory needed */
for (i = 0; i < module->data_section_count; i++) {
int map_prot = MMAP_PROT_READ | MMAP_PROT_WRITE;
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_RISCV64_LP64D) \
|| defined(BUILD_TARGET_RISCV64_LP64)
/* aot code and data in x86_64 must be in range 0 to 2G due to
relocation for R_X86_64_32/32S/PC32 */
int map_flags = MMAP_MAP_32BIT;
#else
int map_flags = MMAP_MAP_NONE;
#endif
read_string(buf, buf_end, data_sections[i].name);
read_uint32(buf, buf_end, data_sections[i].size);
CHECK_BUF(buf, buf_end, data_sections[i].size);
/* Temporary record data ptr for merge, will be replaced after the
merged_data_sections is mmapped */
if (data_sections[i].size > 0)
data_sections[i].data = (uint8 *)buf;
buf += data_sections[i].size;
total_size += align_uint64((uint64)data_sections[i].size, page_size);
}
if (total_size > UINT32_MAX) {
set_error_buf(error_buf, error_buf_size, "data sections too large");
return false;
}
if (total_size > 0) {
/* Allocate memory for data */
if (data_sections[i].size > 0
&& !(data_sections[i].data =
os_mmap(NULL, data_sections[i].size, map_prot, map_flags,
os_get_invalid_handle()))) {
set_error_buf(error_buf, error_buf_size, "allocate memory failed");
merged_sections = module->merged_data_sections =
loader_mmap((uint32)total_size, false, error_buf, error_buf_size);
if (!merged_sections) {
return false;
}
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
#if !defined(BH_PLATFORM_LINUX_SGX) && !defined(BH_PLATFORM_WINDOWS) \
&& !defined(BH_PLATFORM_DARWIN)
/* address must be in the first 2 Gigabytes of
the process address space */
bh_assert((uintptr_t)data_sections[i].data < INT32_MAX);
#endif
#endif
module->merged_data_sections_size = (uint32)total_size;
}
read_byte_array(buf, buf_end, data_sections[i].data,
data_sections[i].size);
/* Second iteration: Create each data section */
for (i = 0; i < module->data_section_count; i++) {
if (data_sections[i].size > 0) {
bh_memcpy_s(merged_sections, data_sections[i].size,
data_sections[i].data, data_sections[i].size);
data_sections[i].data = merged_sections;
merged_sections += align_uint(data_sections[i].size, page_size);
}
}
*p_buf = buf;
@ -2415,6 +2518,10 @@ load_init_data_section(const uint8 *buf, const uint8 *buf_end,
/* load function count and start function index */
read_uint32(p, p_end, module->func_count);
if (is_indices_overflow(module->import_func_count, module->func_count,
error_buf, error_buf_size))
return false;
read_uint32(p, p_end, module->start_func_index);
/* check start function index */
@ -2459,6 +2566,82 @@ fail:
return false;
}
#if !defined(BH_PLATFORM_NUTTX) && !defined(BH_PLATFORM_ESP_IDF)
static bool
try_merge_data_and_text(const uint8 **buf, const uint8 **buf_end,
AOTModule *module, char *error_buf,
uint32 error_buf_size)
{
uint8 *old_buf = (uint8 *)*buf;
uint8 *old_end = (uint8 *)*buf_end;
size_t code_size = (size_t)(old_end - old_buf);
uint32 page_size = os_getpagesize();
uint64 total_size = 0;
uint32 i;
uint8 *sections;
if (code_size == 0) {
return true;
}
/* calculate the total memory needed */
total_size += align_uint64((uint64)code_size, page_size);
for (i = 0; i < module->data_section_count; ++i) {
total_size +=
align_uint64((uint64)module->data_sections[i].size, page_size);
}
/* distance between .data and .text should not be greater than 4GB
for some targets (e.g. arm64 reloc need < 4G distance) */
if (total_size > UINT32_MAX) {
return false;
}
/* code_size was checked and must be larger than 0 here */
bh_assert(total_size > 0);
sections = loader_mmap((uint32)total_size, false, NULL, 0);
if (!sections) {
/* merge failed but may be not critical for some targets */
return false;
}
/* change the code part to be executable */
if (os_mprotect(sections, code_size,
MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC)
!= 0) {
os_munmap(sections, (uint32)total_size);
return false;
}
module->merged_data_text_sections = sections;
module->merged_data_text_sections_size = (uint32)total_size;
/* order not essential just as compiler does: .text section first */
*buf = sections;
*buf_end = sections + code_size;
bh_memcpy_s(sections, code_size, old_buf, code_size);
os_munmap(old_buf, code_size);
sections += align_uint((uint32)code_size, page_size);
/* then migrate .data sections */
for (i = 0; i < module->data_section_count; ++i) {
AOTObjectDataSection *data_section = module->data_sections + i;
uint8 *old_data = data_section->data;
data_section->data = sections;
bh_memcpy_s(data_section->data, data_section->size, old_data,
data_section->size);
sections += align_uint(data_section->size, page_size);
}
/* free the original data sections */
if (module->merged_data_sections) {
os_munmap(module->merged_data_sections,
module->merged_data_sections_size);
module->merged_data_sections = NULL;
module->merged_data_sections_size = 0;
}
return true;
}
#endif /* ! defined(BH_PLATFORM_NUTTX) && !defined(BH_PLATFORM_ESP_IDF) */
static bool
load_text_section(const uint8 *buf, const uint8 *buf_end, AOTModule *module,
char *error_buf, uint32 error_buf_size)
@ -2513,26 +2696,15 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, AOTModule *module,
const uint8 *p = buf, *p_end = buf_end;
uint32 i;
uint64 size, text_offset;
uint32 func_count = module->func_count;
#if defined(BUILD_TARGET_XTENSA)
/*
* For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here.
*/
if (module->is_indirect_mode) {
func_count *= 2;
}
#endif
size = sizeof(void *) * (uint64)func_count;
size = sizeof(void *) * (uint64)module->func_count;
if (size > 0
&& !(module->func_ptrs =
loader_malloc(size, error_buf, error_buf_size))) {
return false;
}
for (i = 0; i < func_count; i++) {
for (i = 0; i < module->func_count; i++) {
if (sizeof(void *) == 8) {
read_uint64(p, p_end, text_offset);
}
@ -2567,14 +2739,14 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, AOTModule *module,
module->start_function = NULL;
}
size = sizeof(uint32) * (uint64)func_count;
size = sizeof(uint32) * (uint64)module->func_count;
if (size > 0
&& !(module->func_type_indexes =
loader_malloc(size, error_buf, error_buf_size))) {
return false;
}
for (i = 0; i < func_count; i++) {
for (i = 0; i < module->func_count; i++) {
read_uint32(p, p_end, module->func_type_indexes[i]);
if (module->func_type_indexes[i] >= module->type_count) {
set_error_buf(error_buf, error_buf_size, "unknown type");
@ -3329,16 +3501,9 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
+ sizeof(uint64) * module->real_plt_count
+ sizeof(uint32) * module->float_plt_count;
if (size > 0) {
map_prot = MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC;
/* aot code and data in x86_64 must be in range 0 to 2G due to
relocation for R_X86_64_32/32S/PC32 */
map_flags = MMAP_MAP_32BIT;
if (size > UINT32_MAX
|| !(module->extra_plt_data =
os_mmap(NULL, (uint32)size, map_prot, map_flags,
os_get_invalid_handle()))) {
set_error_buf(error_buf, error_buf_size, "mmap memory failed");
|| !(module->extra_plt_data = loader_mmap(
(uint32)size, true, error_buf, error_buf_size))) {
goto fail;
}
module->extra_plt_data_size = (uint32)size;
@ -3450,19 +3615,12 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
GOTItem *got_item = module->got_item_list;
uint32 got_item_idx = 0;
map_prot = MMAP_PROT_READ | MMAP_PROT_WRITE;
/* aot code and data in x86_64 must be in range 0 to 2G due to
relocation for R_X86_64_32/32S/PC32 */
map_flags = MMAP_MAP_32BIT;
/* Create the GOT for func_ptrs, note that it is different from
the .got section of a dynamic object file */
size = (uint64)sizeof(void *) * got_item_count;
if (size > UINT32_MAX
|| !(module->got_func_ptrs =
os_mmap(NULL, (uint32)size, map_prot, map_flags,
os_get_invalid_handle()))) {
set_error_buf(error_buf, error_buf_size, "mmap memory failed");
|| !(module->got_func_ptrs = loader_mmap(
(uint32)size, false, error_buf, error_buf_size))) {
goto fail;
}
@ -3632,6 +3790,21 @@ fail:
return ret;
}
#if WASM_ENABLE_MEMORY64 != 0
static bool
has_module_memory64(AOTModule *module)
{
/* TODO: multi-memories for now assuming the memory idx type is consistent
* across multi-memories */
if (module->import_memory_count > 0)
return !!(module->import_memories[0].mem_type.flags & MEMORY64_FLAG);
else if (module->memory_count > 0)
return !!(module->memories[0].flags & MEMORY64_FLAG);
return false;
}
#endif
static bool
load_from_sections(AOTModule *module, AOTSection *sections,
bool is_load_from_file_buf, char *error_buf,
@ -3643,6 +3816,7 @@ load_from_sections(AOTModule *module, AOTSection *sections,
uint32 i, func_index, func_type_index;
AOTFuncType *func_type;
AOTExport *exports;
uint8 malloc_free_io_type = VALUE_TYPE_I32;
while (section) {
buf = section->section_body;
@ -3671,6 +3845,17 @@ load_from_sections(AOTModule *module, AOTSection *sections,
return false;
break;
case AOT_SECTION_TYPE_TEXT:
#if !defined(BH_PLATFORM_NUTTX) && !defined(BH_PLATFORM_ESP_IDF)
/* try to merge .data and .text, with exceptions:
* 1. XIP mode
* 2. pre-mmapped module load from aot_load_from_sections()
* 3. nuttx & esp-idf: have separate region for MMAP_PROT_EXEC
*/
if (!module->is_indirect_mode && is_load_from_file_buf)
if (!try_merge_data_and_text(&buf, &buf_end, module,
error_buf, error_buf_size))
LOG_WARNING("merge .data and .text sections failed");
#endif /* ! defined(BH_PLATFORM_NUTTX) && !defined(BH_PLATFORM_ESP_IDF) */
if (!load_text_section(buf, buf_end, module, error_buf,
error_buf_size))
return false;
@ -3717,7 +3902,10 @@ load_from_sections(AOTModule *module, AOTSection *sections,
module->malloc_func_index = (uint32)-1;
module->free_func_index = (uint32)-1;
module->retain_func_index = (uint32)-1;
#if WASM_ENABLE_MEMORY64 != 0
if (has_module_memory64(module))
malloc_free_io_type = VALUE_TYPE_I64;
#endif
exports = module->exports;
for (i = 0; i < module->export_count; i++) {
if (exports[i].kind == EXPORT_KIND_FUNC
@ -3727,8 +3915,8 @@ load_from_sections(AOTModule *module, AOTSection *sections,
func_type_index = module->func_type_indexes[func_index];
func_type = (AOTFuncType *)module->types[func_type_index];
if (func_type->param_count == 1 && func_type->result_count == 1
&& func_type->types[0] == VALUE_TYPE_I32
&& func_type->types[1] == VALUE_TYPE_I32) {
&& func_type->types[0] == malloc_free_io_type
&& func_type->types[1] == malloc_free_io_type) {
bh_assert(module->malloc_func_index == (uint32)-1);
module->malloc_func_index = func_index;
LOG_VERBOSE("Found malloc function, name: %s, index: %u",
@ -3740,9 +3928,9 @@ load_from_sections(AOTModule *module, AOTSection *sections,
func_type_index = module->func_type_indexes[func_index];
func_type = (AOTFuncType *)module->types[func_type_index];
if (func_type->param_count == 2 && func_type->result_count == 1
&& func_type->types[0] == VALUE_TYPE_I32
&& func_type->types[0] == malloc_free_io_type
&& func_type->types[1] == VALUE_TYPE_I32
&& func_type->types[2] == VALUE_TYPE_I32) {
&& func_type->types[2] == malloc_free_io_type) {
uint32 j;
WASMExport *export_tmp;
@ -3766,8 +3954,8 @@ load_from_sections(AOTModule *module, AOTSection *sections,
(AOTFuncType *)module->types[func_type_index];
if (func_type->param_count == 1
&& func_type->result_count == 1
&& func_type->types[0] == VALUE_TYPE_I32
&& func_type->types[1] == VALUE_TYPE_I32) {
&& func_type->types[0] == malloc_free_io_type
&& func_type->types[1] == malloc_free_io_type) {
bh_assert(module->retain_func_index
== (uint32)-1);
module->retain_func_index = export_tmp->index;
@ -3793,7 +3981,7 @@ load_from_sections(AOTModule *module, AOTSection *sections,
func_type_index = module->func_type_indexes[func_index];
func_type = (AOTFuncType *)module->types[func_type_index];
if (func_type->param_count == 1 && func_type->result_count == 0
&& func_type->types[0] == VALUE_TYPE_I32) {
&& func_type->types[0] == malloc_free_io_type) {
bh_assert(module->free_func_index == (uint32)-1);
module->free_func_index = func_index;
LOG_VERBOSE("Found free function, name: %s, index: %u",
@ -3835,6 +4023,7 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
module->module_type = Wasm_Module_AoT;
module->name = name;
module->is_binary_freeable = false;
#if WASM_ENABLE_MULTI_MODULE != 0
module->import_module_list = &module->import_module_list_head;
@ -3912,7 +4101,7 @@ resolve_execute_mode(const uint8 *buf, uint32 size, bool *p_mode,
p += 8;
while (p < p_end) {
read_uint32(p, p_end, section_type);
if (section_type <= AOT_SECTION_TYPE_SIGANATURE) {
if (section_type <= AOT_SECTION_TYPE_SIGNATURE) {
read_uint32(p, p_end, section_size);
CHECK_BUF(p, p_end, section_size);
if (section_type == AOT_SECTION_TYPE_TARGET_INFO) {
@ -3927,7 +4116,7 @@ resolve_execute_mode(const uint8 *buf, uint32 size, bool *p_mode,
break;
}
}
else { /* section_type > AOT_SECTION_TYPE_SIGANATURE */
else { /* section_type > AOT_SECTION_TYPE_SIGNATURE */
set_error_buf(error_buf, error_buf_size,
"resolve execute mode failed");
break;
@ -3966,7 +4155,7 @@ create_sections(AOTModule *module, const uint8 *buf, uint32 size,
p += 8;
while (p < p_end) {
read_uint32(p, p_end, section_type);
if (section_type < AOT_SECTION_TYPE_SIGANATURE
if (section_type < AOT_SECTION_TYPE_SIGNATURE
|| section_type == AOT_SECTION_TYPE_CUSTOM) {
read_uint32(p, p_end, section_size);
CHECK_BUF(p, p_end, section_size);
@ -3983,37 +4172,16 @@ create_sections(AOTModule *module, const uint8 *buf, uint32 size,
if (section_type == AOT_SECTION_TYPE_TEXT) {
if ((section_size > 0) && !module->is_indirect_mode) {
int map_prot =
MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC;
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_RISCV64_LP64D) \
|| defined(BUILD_TARGET_RISCV64_LP64)
/* aot code and data in x86_64 must be in range 0 to 2G due
to relocation for R_X86_64_32/32S/PC32 */
int map_flags = MMAP_MAP_32BIT;
#else
int map_flags = MMAP_MAP_NONE;
#endif
total_size =
(uint64)section_size + aot_get_plt_table_size();
total_size = (total_size + 3) & ~((uint64)3);
if (total_size >= UINT32_MAX
|| !(aot_text =
os_mmap(NULL, (uint32)total_size, map_prot,
map_flags, os_get_invalid_handle()))) {
loader_mmap((uint32)total_size, true,
error_buf, error_buf_size))) {
wasm_runtime_free(section);
set_error_buf(error_buf, error_buf_size,
"mmap memory failed");
goto fail;
}
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
#if !defined(BH_PLATFORM_LINUX_SGX) && !defined(BH_PLATFORM_WINDOWS) \
&& !defined(BH_PLATFORM_DARWIN)
/* address must be in the first 2 Gigabytes of
the process address space */
bh_assert((uintptr_t)aot_text < INT32_MAX);
#endif
#endif
#if (WASM_MEM_DUAL_BUS_MIRROR != 0)
mirrored_text = os_get_dbus_mirror(aot_text);
@ -4065,8 +4233,8 @@ fail:
}
static bool
load(const uint8 *buf, uint32 size, AOTModule *module, char *error_buf,
uint32 error_buf_size)
load(const uint8 *buf, uint32 size, AOTModule *module,
bool wasm_binary_freeable, char *error_buf, uint32 error_buf_size)
{
const uint8 *buf_end = buf + size;
const uint8 *p = buf, *p_end = buf_end;
@ -4086,16 +4254,22 @@ load(const uint8 *buf, uint32 size, AOTModule *module, char *error_buf,
return false;
}
module->package_version = version;
if (!create_sections(module, buf, size, &section_list, error_buf,
error_buf_size))
return false;
ret = load_from_sections(module, section_list, true, error_buf,
error_buf_size);
ret = load_from_sections(module, section_list, !wasm_binary_freeable,
error_buf, error_buf_size);
if (!ret) {
/* If load_from_sections() fails, then aot text is destroyed
in destroy_sections() */
destroy_sections(section_list, module->is_indirect_mode ? false : true);
destroy_sections(section_list,
module->is_indirect_mode
|| module->merged_data_text_sections
? false
: true);
/* aot_unload() won't destroy aot text again */
module->code = NULL;
}
@ -4135,7 +4309,8 @@ aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args,
return NULL;
os_thread_jit_write_protect_np(false); /* Make memory writable */
if (!load(buf, size, module, error_buf, error_buf_size)) {
if (!load(buf, size, module, args->wasm_binary_freeable, error_buf,
error_buf_size)) {
aot_unload(module);
return NULL;
}
@ -4244,7 +4419,8 @@ aot_unload(AOTModule *module)
}
#endif
if (module->code && !module->is_indirect_mode) {
if (module->code && !module->is_indirect_mode
&& !module->merged_data_text_sections) {
/* The layout is: literal size + literal + code (with plt table) */
uint8 *mmap_addr = module->literal - sizeof(uint32);
uint32 total_size =
@ -4279,6 +4455,14 @@ aot_unload(AOTModule *module)
destroy_object_data_sections(module->data_sections,
module->data_section_count);
if (module->merged_data_sections)
os_munmap(module->merged_data_sections,
module->merged_data_sections_size);
if (module->merged_data_text_sections)
os_munmap(module->merged_data_text_sections,
module->merged_data_text_sections_size);
#if WASM_ENABLE_DEBUG_AOT != 0
jit_code_entry_destroy(module->elf_hdr);
#endif

View File

@ -120,7 +120,6 @@ check_global_init_expr(const AOTModule *module, uint32 global_index,
return false;
}
#if WASM_ENABLE_GC == 0
/**
* Currently, constant expressions occurring as initializers of
* globals are further constrained in that contained global.get
@ -129,24 +128,26 @@ check_global_init_expr(const AOTModule *module, uint32 global_index,
* And initializer expression cannot reference a mutable global.
*/
if (global_index >= module->import_global_count
|| module->import_globals->is_mutable) {
set_error_buf(error_buf, error_buf_size,
"constant expression required");
return false;
}
#else
if (global_index >= module->import_global_count + module->global_count) {
/* make spec test happy */
#if WASM_ENABLE_GC != 0
+ module->global_count
#endif
) {
set_error_buf_v(error_buf, error_buf_size, "unknown global %u",
global_index);
return false;
}
if (global_index < module->import_global_count
&& module->import_globals[global_index].is_mutable) {
if (
/* make spec test happy */
#if WASM_ENABLE_GC != 0
global_index < module->import_global_count &&
#endif
module->import_globals[global_index].type.is_mutable) {
set_error_buf(error_buf, error_buf_size,
"constant expression required");
return false;
}
#endif
return true;
}
@ -389,7 +390,7 @@ global_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
for (i = 0; i < module->import_global_count; i++, import_global++) {
bh_assert(import_global->data_offset
== (uint32)(p - module_inst->global_data));
init_global_data(p, import_global->type,
init_global_data(p, import_global->type.val_type,
&import_global->global_data_linked);
p += import_global->size;
}
@ -410,20 +411,20 @@ global_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
}
#if WASM_ENABLE_GC == 0
init_global_data(
p, global->type,
p, global->type.val_type,
&module->import_globals[init_expr->u.global_index]
.global_data_linked);
#else
if (init_expr->u.global_index < module->import_global_count) {
init_global_data(
p, global->type,
p, global->type.val_type,
&module->import_globals[init_expr->u.global_index]
.global_data_linked);
}
else {
uint32 global_idx =
init_expr->u.global_index - module->import_global_count;
init_global_data(p, global->type,
init_global_data(p, global->type.val_type,
&module->globals[global_idx].init_expr.u);
}
#endif
@ -581,7 +582,7 @@ global_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
#endif /* end of WASM_ENABLE_GC != 0 */
default:
{
init_global_data(p, global->type, &init_expr->u);
init_global_data(p, global->type.val_type, &init_expr->u);
break;
}
}
@ -617,23 +618,23 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
for (i = 0; i != module_inst->table_count; ++i) {
if (i < module->import_table_count) {
AOTImportTable *import_table = module->import_tables + i;
tbl_inst->cur_size = import_table->table_init_size;
tbl_inst->cur_size = import_table->table_type.init_size;
tbl_inst->max_size =
aot_get_imp_tbl_data_slots(import_table, false);
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
#if WASM_ENABLE_GC != 0
tbl_inst->elem_type = module->tables[i].elem_type;
tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].elem_ref_type;
module->tables[i].table_type.elem_ref_type;
#endif
}
else {
AOTTable *table = module->tables + (i - module->import_table_count);
tbl_inst->cur_size = table->table_init_size;
tbl_inst->cur_size = table->table_type.init_size;
tbl_inst->max_size = aot_get_tbl_data_slots(table, false);
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
#if WASM_ENABLE_GC != 0
tbl_inst->elem_type = module->tables[i].elem_type;
tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].elem_ref_type;
module->tables[i].table_type.elem_ref_type;
#endif
}
@ -788,20 +789,21 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
{
void *heap_handle;
uint32 num_bytes_per_page = memory->num_bytes_per_page;
uint32 init_page_count = memory->mem_init_page_count;
uint32 max_page_count =
wasm_runtime_get_max_mem(max_memory_pages, memory->mem_init_page_count,
memory->mem_max_page_count);
uint32 init_page_count = memory->init_page_count;
uint32 max_page_count = wasm_runtime_get_max_mem(
max_memory_pages, memory->init_page_count, memory->max_page_count);
uint32 default_max_pages;
uint32 inc_page_count, global_idx;
uint32 bytes_of_last_page, bytes_to_page_end;
uint64 aux_heap_base,
heap_offset = (uint64)num_bytes_per_page * init_page_count;
uint64 memory_data_size, max_memory_data_size;
uint8 *p = NULL, *global_addr;
bool is_memory64 = memory->flags & MEMORY64_FLAG;
bool is_shared_memory = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
is_shared_memory = memory->memory_flags & 0x02 ? true : false;
is_shared_memory = memory->flags & SHARED_MEMORY_FLAG ? true : false;
/* Shared memory */
if (is_shared_memory && parent != NULL) {
AOTMemoryInstance *shared_memory_instance;
@ -813,6 +815,16 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
}
#endif
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64) {
default_max_pages = DEFAULT_MEM64_MAX_PAGES;
}
else
#endif
{
default_max_pages = DEFAULT_MAX_PAGES;
}
if (heap_size > 0 && module->malloc_func_index != (uint32)-1
&& module->free_func_index != (uint32)-1) {
/* Disable app heap, use malloc/free function exported
@ -893,14 +905,14 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
}
init_page_count += inc_page_count;
max_page_count += inc_page_count;
if (init_page_count > DEFAULT_MAX_PAGES) {
if (init_page_count > default_max_pages) {
set_error_buf(error_buf, error_buf_size,
"failed to insert app heap into linear memory, "
"try using `--heap-size=0` option");
return NULL;
}
if (max_page_count > DEFAULT_MAX_PAGES)
max_page_count = DEFAULT_MAX_PAGES;
if (max_page_count > default_max_pages)
max_page_count = default_max_pages;
}
LOG_VERBOSE("Memory instantiate:");
@ -912,11 +924,11 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
heap_size);
max_memory_data_size = (uint64)num_bytes_per_page * max_page_count;
bh_assert(max_memory_data_size <= MAX_LINEAR_MEMORY_SIZE);
bh_assert(max_memory_data_size <= GET_MAX_LINEAR_MEMORY_SIZE(is_memory64));
(void)max_memory_data_size;
/* TODO: memory64 uses is_memory64 flag */
if (wasm_allocate_linear_memory(&p, is_shared_memory, false,
if (wasm_allocate_linear_memory(&p, is_shared_memory, is_memory64,
num_bytes_per_page, init_page_count,
max_page_count, &memory_data_size)
!= BHT_OK) {
@ -930,6 +942,11 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
memory_inst->cur_page_count = init_page_count;
memory_inst->max_page_count = max_page_count;
memory_inst->memory_data_size = memory_data_size;
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64) {
memory_inst->is_memory64 = 1;
}
#endif
/* Init memory info */
memory_inst->memory_data = p;
@ -993,11 +1010,12 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
uint32 max_memory_pages, char *error_buf,
uint32 error_buf_size)
{
uint32 global_index, global_data_offset, base_offset, length;
uint32 global_index, global_data_offset, length;
uint32 i, memory_count = module->memory_count;
AOTMemoryInstance *memories, *memory_inst;
AOTMemInitData *data_seg;
uint64 total_size;
mem_offset_t base_offset;
module_inst->memory_count = memory_count;
total_size = sizeof(AOTMemoryInstance *) * (uint64)memory_count;
@ -1036,7 +1054,9 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
initialized */
continue;
bh_assert(data_seg->offset.init_expr_type == INIT_EXPR_TYPE_I32_CONST
bh_assert(data_seg->offset.init_expr_type
== (memory_inst->is_memory64 ? INIT_EXPR_TYPE_I64_CONST
: INIT_EXPR_TYPE_I32_CONST)
|| data_seg->offset.init_expr_type
== INIT_EXPR_TYPE_GET_GLOBAL);
@ -1057,11 +1077,28 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
module->globals[global_index - module->import_global_count]
.data_offset;
base_offset =
*(uint32 *)(module_inst->global_data + global_data_offset);
#if WASM_ENABLE_MEMORY64 != 0
if (memory_inst->is_memory64) {
base_offset =
*(uint64 *)(module_inst->global_data + global_data_offset);
}
else
#endif
{
base_offset =
*(uint32 *)(module_inst->global_data + global_data_offset);
}
}
else {
base_offset = (uint32)data_seg->offset.u.i32;
#if WASM_ENABLE_MEMORY64 != 0
if (memory_inst->is_memory64) {
base_offset = data_seg->offset.u.i64;
}
else
#endif
{
base_offset = data_seg->offset.u.u32;
}
}
/* Copy memory data */
@ -1071,7 +1108,8 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
/* Check memory data */
/* check offset since length might negative */
if (base_offset > memory_inst->memory_data_size) {
LOG_DEBUG("base_offset(%d) > memory_data_size(%" PRIu64 ")",
LOG_DEBUG("base_offset(%" PR_MEM_OFFSET
") > memory_data_size(%" PRIu64 ")",
base_offset, memory_inst->memory_data_size);
#if WASM_ENABLE_REF_TYPES != 0
set_error_buf(error_buf, error_buf_size,
@ -1086,8 +1124,8 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
/* check offset + length(could be zero) */
length = data_seg->byte_count;
if (base_offset + length > memory_inst->memory_data_size) {
LOG_DEBUG("base_offset(%d) + length(%d) > memory_data_size(%" PRIu64
")",
LOG_DEBUG("base_offset(%" PR_MEM_OFFSET
") + length(%d) > memory_data_size(%" PRIu64 ")",
base_offset, length, memory_inst->memory_data_size);
#if WASM_ENABLE_REF_TYPES != 0
set_error_buf(error_buf, error_buf_size,
@ -1101,7 +1139,7 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
if (memory_inst->memory_data) {
bh_memcpy_s((uint8 *)memory_inst->memory_data + base_offset,
(uint32)memory_inst->memory_data_size - base_offset,
(uint32)(memory_inst->memory_data_size - base_offset),
data_seg->bytes, length);
}
}
@ -1115,21 +1153,10 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
{
uint32 i;
void **func_ptrs;
uint32 func_count = module->func_count;
#if defined(BUILD_TARGET_XTENSA)
/*
* For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here.
*/
if (module->is_indirect_mode) {
func_count *= 2;
}
#endif
uint64 total_size = ((uint64)module->import_func_count + module->func_count)
* sizeof(void *);
uint64 total_size =
((uint64)module->import_func_count + func_count) * sizeof(void *);
if (module->import_func_count + func_count == 0)
if (module->import_func_count + module->func_count == 0)
return true;
/* Allocate memory */
@ -1151,32 +1178,90 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
}
/* Set defined function pointers */
bh_memcpy_s(func_ptrs, sizeof(void *) * func_count, module->func_ptrs,
sizeof(void *) * func_count);
bh_memcpy_s(func_ptrs, sizeof(void *) * module->func_count,
module->func_ptrs, sizeof(void *) * module->func_count);
return true;
}
AOTFunctionInstance *
aot_get_function_instance(AOTModuleInstance *module_inst, uint32 func_idx)
{
AOTModule *module = (AOTModule *)module_inst->module;
AOTModuleInstanceExtra *extra = (AOTModuleInstanceExtra *)module_inst->e;
AOTFunctionInstance *export_funcs =
(AOTFunctionInstance *)module_inst->export_functions;
uint32 i;
/* export functions are pre-instantiated */
for (i = 0; i < module_inst->export_func_count; i++) {
if (export_funcs[i].func_index == func_idx)
return &export_funcs[i];
}
exception_lock(module_inst);
/* allocate functions array if needed */
if (!extra->functions) {
uint64 func_count =
((uint64)module->import_func_count + module->func_count);
uint64 total_size = func_count * (uint64)sizeof(AOTFunctionInstance *);
if ((func_count == 0)
|| !(extra->functions = runtime_malloc(total_size, NULL, 0))) {
exception_unlock(module_inst);
return NULL;
}
extra->function_count = (uint32)func_count;
}
/* instantiate function if needed */
bh_assert(func_idx < extra->function_count);
if (!extra->functions[func_idx]) {
AOTFunctionInstance *function = (AOTFunctionInstance *)runtime_malloc(
sizeof(AOTFunctionInstance), NULL, 0);
if (!function) {
exception_unlock(module_inst);
return NULL;
}
if (func_idx < module->import_func_count) {
/* instantiate function from import section */
function->is_import_func = true;
function->func_name = module->import_funcs[func_idx].func_name;
function->func_index = func_idx;
function->u.func_import = &module->import_funcs[func_idx];
}
else {
/* instantiate non-import function */
uint32 ftype_index =
module->func_type_indexes[func_idx - module->import_func_count];
function->is_import_func = false;
function->func_index = func_idx;
function->u.func.func_type =
(AOTFuncType *)module->types[ftype_index];
function->u.func.func_ptr =
module->func_ptrs[func_idx - module->import_func_count];
}
extra->functions[func_idx] = function;
}
exception_unlock(module_inst);
return extra->functions[func_idx];
}
static bool
init_func_type_indexes(AOTModuleInstance *module_inst, AOTModule *module,
char *error_buf, uint32 error_buf_size)
{
uint32 i;
uint32 *func_type_index;
uint32 func_count = module->func_count;
#if defined(BUILD_TARGET_XTENSA)
/*
* For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here.
*/
if (module->is_indirect_mode) {
func_count *= 2;
}
#endif
uint64 total_size = ((uint64)module->import_func_count + module->func_count)
* sizeof(uint32);
uint64 total_size =
((uint64)module->import_func_count + func_count) * sizeof(uint32);
if (module->import_func_count + func_count == 0)
if (module->import_func_count + module->func_count == 0)
return true;
/* Allocate memory */
@ -1190,8 +1275,8 @@ init_func_type_indexes(AOTModuleInstance *module_inst, AOTModule *module,
for (i = 0; i < module->import_func_count; i++, func_type_index++)
*func_type_index = module->import_funcs[i].func_type_index;
bh_memcpy_s(func_type_index, sizeof(uint32) * func_count,
module->func_type_indexes, sizeof(uint32) * func_count);
bh_memcpy_s(func_type_index, sizeof(uint32) * module->func_count,
module->func_type_indexes, sizeof(uint32) * module->func_count);
return true;
}
@ -1394,7 +1479,7 @@ execute_post_instantiate_functions(AOTModuleInstance *module_inst,
}
#endif
/* Execute start function for both main insance and sub instance */
/* Execute start function for both main instance and sub instance */
if (module->start_function) {
AOTFunctionInstance start_func = { 0 };
uint32 func_type_idx;
@ -1474,6 +1559,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0
WASMModuleInstanceExtraCommon *common;
#endif
AOTModuleInstanceExtra *extra = NULL;
const uint32 module_inst_struct_size =
offsetof(AOTModuleInstance, global_table_data.bytes);
const uint64 module_inst_mem_inst_size =
@ -1527,14 +1613,13 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
module_inst->module = (void *)module;
module_inst->e =
(WASMModuleInstanceExtra *)((uint8 *)module_inst + extra_info_offset);
extra = (AOTModuleInstanceExtra *)module_inst->e;
#if WASM_ENABLE_GC != 0
/* Initialize gc heap first since it may be used when initializing
globals and others */
if (!is_sub_inst) {
uint32 gc_heap_size = wasm_runtime_get_gc_heap_size_default();
AOTModuleInstanceExtra *extra =
(AOTModuleInstanceExtra *)module_inst->e;
if (gc_heap_size < GC_HEAP_SIZE_MIN)
gc_heap_size = GC_HEAP_SIZE_MIN;
@ -1554,8 +1639,17 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
#endif
#if WASM_ENABLE_MULTI_MODULE != 0
((AOTModuleInstanceExtra *)module_inst->e)->sub_module_inst_list =
&((AOTModuleInstanceExtra *)module_inst->e)->sub_module_inst_list_head;
extra->sub_module_inst_list = &extra->sub_module_inst_list_head;
/* Allocate memory for import_func_module_insts*/
if (module->import_func_count > 0
&& !(extra->import_func_module_insts =
runtime_malloc((uint64)module->import_func_count
* sizeof(WASMModuleInstanceCommon *),
error_buf, error_buf_size))) {
goto fail;
}
ret = wasm_runtime_sub_module_instantiate(
(WASMModuleCommon *)module, (WASMModuleInstanceCommon *)module_inst,
stack_size, heap_size, max_memory_pages, error_buf, error_buf_size);
@ -1571,7 +1665,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
goto fail;
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0
common = &((AOTModuleInstanceExtra *)module_inst->e)->common;
common = &extra->common;
#endif
#if WASM_ENABLE_BULK_MEMORY != 0
if (module->mem_init_data_count > 0) {
@ -1654,24 +1748,15 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
/* Initialize the thread related data */
if (stack_size == 0)
stack_size = DEFAULT_WASM_STACK_SIZE;
#if WASM_ENABLE_SPEC_TEST != 0
#if WASM_ENABLE_TAIL_CALL == 0
if (stack_size < 128 * 1024)
stack_size = 128 * 1024;
#else
/* Some tail-call cases require large operand stack */
if (stack_size < 10 * 1024 * 1024)
stack_size = 10 * 1024 * 1024;
#endif
#endif
module_inst->default_wasm_stack_size = stack_size;
((AOTModuleInstanceExtra *)module_inst->e)->stack_sizes =
extra->stack_sizes =
aot_get_data_section_addr(module, AOT_STACK_SIZES_SECTION_NAME, NULL);
#if WASM_ENABLE_PERF_PROFILING != 0
total_size = (uint64)sizeof(AOTFuncPerfProfInfo)
* (module->import_func_count + module->func_count);
total_size = sizeof(AOTFuncPerfProfInfo)
* ((uint64)module->import_func_count + module->func_count);
if (!(module_inst->func_perf_profilings =
runtime_malloc(total_size, error_buf, error_buf_size))) {
goto fail;
@ -1869,8 +1954,8 @@ destroy_c_api_frames(Vector *frames)
void
aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
{
WASMModuleInstanceExtraCommon *common =
&((AOTModuleInstanceExtra *)module_inst->e)->common;
AOTModuleInstanceExtra *extra = (AOTModuleInstanceExtra *)module_inst->e;
WASMModuleInstanceExtraCommon *common = &extra->common;
if (module_inst->exec_env_singleton) {
/* wasm_exec_env_destroy will call
wasm_cluster_wait_for_all_except_self to wait for other
@ -1896,6 +1981,8 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
#if WASM_ENABLE_MULTI_MODULE != 0
wasm_runtime_sub_module_deinstantiate(
(WASMModuleInstanceCommon *)module_inst);
if (extra->import_func_module_insts)
wasm_runtime_free(extra->import_func_module_insts);
#endif
if (module_inst->tables)
@ -1907,6 +1994,16 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
if (module_inst->export_functions)
wasm_runtime_free(module_inst->export_functions);
if (extra->functions) {
uint32 func_idx;
for (func_idx = 0; func_idx < extra->function_count; ++func_idx) {
if (extra->functions[func_idx]) {
wasm_runtime_free(extra->functions[func_idx]);
}
}
wasm_runtime_free(extra->functions);
}
if (module_inst->func_ptrs)
wasm_runtime_free(module_inst->func_ptrs);
@ -1918,19 +2015,14 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
#if WASM_ENABLE_GC != 0
if (!is_sub_inst) {
AOTModuleInstanceExtra *extra =
(AOTModuleInstanceExtra *)module_inst->e;
if (extra->common.gc_heap_handle)
mem_allocator_destroy(extra->common.gc_heap_handle);
if (extra->common.gc_heap_pool)
wasm_runtime_free(extra->common.gc_heap_pool);
if (common->gc_heap_handle)
mem_allocator_destroy(common->gc_heap_handle);
if (common->gc_heap_pool)
wasm_runtime_free(common->gc_heap_pool);
}
#endif
if (!is_sub_inst) {
#if WASM_ENABLE_WASI_NN != 0
wasi_nn_destroy(module_inst);
#endif
wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst);
}
@ -2008,7 +2100,9 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
void (*invoke_native)(void *func_ptr, void *exec_env, uint32 *argv,
uint32 *argv_ret) =
func_type->quick_aot_entry;
exec_env->attachment = attachment;
invoke_native(func_ptr, exec_env, argv, argv_ret);
exec_env->attachment = NULL;
ret = !aot_copy_exception(module_inst, NULL);
}
else
@ -2086,6 +2180,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
unsigned argc, uint32 argv[])
{
AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst;
AOTModule *module = (AOTModule *)module_inst->module;
AOTFuncType *func_type = function->is_import_func
? function->u.func_import->func_type
: function->u.func.func_type;
@ -2095,6 +2190,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
void *func_ptr = function->is_import_func
? function->u.func_import->func_ptr_linked
: function->u.func.func_ptr;
void *attachment = NULL;
#if WASM_ENABLE_MULTI_MODULE != 0
bh_list *sub_module_list_node = NULL;
const char *sub_inst_name = NULL;
@ -2154,6 +2250,10 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
hw bound check is enabled */
#endif
if (function->func_index < module->import_func_count) {
attachment = function->u.func_import->attachment;
}
/* Set exec env, so it can be later retrieved from instance */
module_inst->cur_exec_env = exec_env;
@ -2204,7 +2304,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#endif
ret = invoke_native_internal(exec_env, function->u.func.func_ptr,
func_type, NULL, NULL, argv1, argc, argv);
func_type, NULL, attachment, argv1, argc,
argv);
if (!ret) {
#ifdef AOT_STACK_FRAME_DEBUG
@ -2221,8 +2322,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#if WASM_ENABLE_AOT_STACK_FRAME != 0
/* Free all frames allocated, note that some frames
may be allocated in AOT code and havent' been
freed if exception occured */
may be allocated in AOT code and haven't been
freed if exception occurred */
while (exec_env->cur_frame != prev_frame)
aot_free_frame(exec_env);
#endif
@ -2273,8 +2374,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
}
#endif
ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL, NULL,
argv, argc, argv);
ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL,
attachment, argv, argc, argv);
if (aot_copy_exception(module_inst, NULL)) {
#ifdef AOT_STACK_FRAME_DEBUG
@ -2291,8 +2392,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#if WASM_ENABLE_AOT_STACK_FRAME != 0
/* Free all frames allocated, note that some frames
may be allocated in AOT code and havent' been
freed if exception occured */
may be allocated in AOT code and haven't been
freed if exception occurred */
while (exec_env->cur_frame != prev_frame)
aot_free_frame(exec_env);
#endif
@ -2334,22 +2435,44 @@ aot_copy_exception(AOTModuleInstance *module_inst, char *exception_buf)
static bool
execute_malloc_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
AOTFunctionInstance *malloc_func,
AOTFunctionInstance *retain_func, uint32 size,
uint32 *p_result)
AOTFunctionInstance *retain_func, uint64 size,
uint64 *p_result)
{
#ifdef OS_ENABLE_HW_BOUND_CHECK
WASMExecEnv *exec_env_tls = wasm_runtime_get_exec_env_tls();
#endif
WASMExecEnv *exec_env_created = NULL;
WASMModuleInstanceCommon *module_inst_old = NULL;
uint32 argv[2], argc;
union {
uint32 u32[3];
uint64 u64;
} argv;
uint32 argc;
bool ret;
argv[0] = size;
argc = 1;
if (retain_func) {
argv[1] = 0;
#if WASM_ENABLE_MEMORY64 != 0
bool is_memory64 = module_inst->memories[0]->is_memory64;
if (is_memory64) {
argc = 2;
PUT_I64_TO_ADDR(&argv.u64, size);
}
else
#endif
{
argc = 1;
argv.u32[0] = (uint32)size;
}
/* if __retain is exported, then this module is compiled by
assemblyscript, the memory should be managed by as's runtime,
in this case we need to call the retain function after malloc
the memory */
if (retain_func) {
/* the malloc function from assemblyscript is:
function __new(size: usize, id: u32)
id = 0 means this is an ArrayBuffer object */
argv.u32[argc] = 0;
argc++;
}
if (exec_env) {
@ -2389,10 +2512,10 @@ execute_malloc_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
}
}
ret = aot_call_function(exec_env, malloc_func, argc, argv);
ret = aot_call_function(exec_env, malloc_func, argc, argv.u32);
if (retain_func && ret)
ret = aot_call_function(exec_env, retain_func, 1, argv);
ret = aot_call_function(exec_env, retain_func, 1, argv.u32);
if (module_inst_old)
/* Restore the existing exec_env's module inst */
@ -2401,24 +2524,46 @@ execute_malloc_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
if (exec_env_created)
wasm_exec_env_destroy(exec_env_created);
if (ret)
*p_result = argv[0];
if (ret) {
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
*p_result = argv.u64;
else
#endif
{
*p_result = argv.u32[0];
}
}
return ret;
}
static bool
execute_free_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
AOTFunctionInstance *free_func, uint32 offset)
AOTFunctionInstance *free_func, uint64 offset)
{
#ifdef OS_ENABLE_HW_BOUND_CHECK
WASMExecEnv *exec_env_tls = wasm_runtime_get_exec_env_tls();
#endif
WASMExecEnv *exec_env_created = NULL;
WASMModuleInstanceCommon *module_inst_old = NULL;
uint32 argv[2];
union {
uint32 u32[2];
uint64 u64;
} argv;
uint32 argc;
bool ret;
argv[0] = offset;
#if WASM_ENABLE_MEMORY64 != 0
if (module_inst->memories[0]->is_memory64) {
PUT_I64_TO_ADDR(&argv.u64, offset);
argc = 2;
}
else
#endif
{
argv.u32[0] = (uint32)offset;
argc = 1;
}
if (exec_env) {
#ifdef OS_ENABLE_HW_BOUND_CHECK
@ -2457,7 +2602,7 @@ execute_free_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
}
}
ret = aot_call_function(exec_env, free_func, 1, argv);
ret = aot_call_function(exec_env, free_func, argc, argv.u32);
if (module_inst_old)
/* Restore the existing exec_env's module inst */
@ -2477,7 +2622,7 @@ aot_module_malloc_internal(AOTModuleInstance *module_inst,
AOTMemoryInstance *memory_inst = aot_get_default_memory(module_inst);
AOTModule *module = (AOTModule *)module_inst->module;
uint8 *addr = NULL;
uint32 offset = 0;
uint64 offset = 0;
/* TODO: Memory64 size check based on memory idx type */
bh_assert(size <= UINT32_MAX);
@ -2509,7 +2654,7 @@ aot_module_malloc_internal(AOTModuleInstance *module_inst,
if (!malloc_func
|| !execute_malloc_function(module_inst, exec_env, malloc_func,
retain_func, (uint32)size, &offset)) {
retain_func, size, &offset)) {
return 0;
}
addr = offset ? (uint8 *)memory_inst->memory_data + offset : NULL;
@ -2620,8 +2765,7 @@ aot_module_free_internal(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
free_func = aot_lookup_function(module_inst, "__unpin");
if (free_func)
execute_free_function(module_inst, exec_env, free_func,
(uint32)ptr);
execute_free_function(module_inst, exec_env, free_func, ptr);
}
}
}
@ -2673,6 +2817,13 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count)
return wasm_enlarge_memory(module_inst, inc_page_count);
}
bool
aot_enlarge_memory_with_idx(AOTModuleInstance *module_inst,
uint32 inc_page_count, uint32 memidx)
{
return wasm_enlarge_memory_with_idx(module_inst, inc_page_count, memidx);
}
bool
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
uint32 *argv)
@ -2694,10 +2845,6 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
void *attachment;
char buf[96];
bool ret = false;
#if WASM_ENABLE_MULTI_MODULE != 0
bh_list *sub_module_list_node = NULL;
const char *sub_inst_name = NULL;
#endif
bh_assert(func_idx < aot_module->import_func_count);
import_func = aot_module->import_funcs + func_idx;
@ -2722,30 +2869,34 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
else if (!import_func->call_conv_raw) {
signature = import_func->signature;
#if WASM_ENABLE_MULTI_MODULE != 0
sub_module_list_node =
((AOTModuleInstanceExtra *)module_inst->e)->sub_module_inst_list;
sub_module_list_node = bh_list_first_elem(sub_module_list_node);
while (sub_module_list_node) {
sub_inst_name =
((AOTSubModInstNode *)sub_module_list_node)->module_name;
if (strcmp(sub_inst_name, import_func->module_name) == 0) {
exec_env = wasm_runtime_get_exec_env_singleton(
(WASMModuleInstanceCommon *)((AOTSubModInstNode *)
sub_module_list_node)
->module_inst);
break;
}
sub_module_list_node = bh_list_elem_next(sub_module_list_node);
WASMModuleInstanceCommon *sub_inst = NULL;
if ((sub_inst = ((AOTModuleInstanceExtra *)module_inst->e)
->import_func_module_insts[func_idx])) {
exec_env = wasm_runtime_get_exec_env_singleton(sub_inst);
}
if (exec_env == NULL) {
wasm_runtime_set_exception((WASMModuleInstanceCommon *)module_inst,
"create singleton exec_env failed");
goto fail;
}
#if WASM_ENABLE_AOT_STACK_FRAME != 0
struct WASMInterpFrame *prev_frame = exec_env->cur_frame;
if (!aot_alloc_frame(exec_env, func_idx)) {
goto fail;
}
#endif
#endif /* WASM_ENABLE_MULTI_MODULE != 0 */
ret =
wasm_runtime_invoke_native(exec_env, func_ptr, func_type, signature,
attachment, argv, argc, argv);
#if WASM_ENABLE_MULTI_MODULE != 0 && 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 (exec_env->cur_frame != prev_frame)
aot_free_frame(exec_env);
#endif
}
else {
signature = import_func->signature;
@ -2832,8 +2983,8 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
/* Call native function */
import_func = aot_module->import_funcs + func_idx;
signature = import_func->signature;
attachment = import_func->attachment;
if (import_func->call_conv_raw) {
attachment = import_func->attachment;
ret = wasm_runtime_invoke_native_raw(exec_env, func_ptr, func_type,
signature, attachment, argv,
argc, argv);
@ -2983,7 +3134,7 @@ aot_sqrtf(float x)
#if WASM_ENABLE_BULK_MEMORY != 0
bool
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
uint32 len, uint32 dst)
uint32 len, size_t dst)
{
AOTMemoryInstance *memory_inst = aot_get_default_memory(module_inst);
AOTModule *aot_module;
@ -3016,7 +3167,7 @@ aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
(WASMModuleInstanceCommon *)module_inst, (uint64)dst);
SHARED_MEMORY_LOCK(memory_inst);
bh_memcpy_s(maddr, (uint32)(memory_inst->memory_data_size - dst),
bh_memcpy_s(maddr, CLAMP_U64_TO_U32(memory_inst->memory_data_size - dst),
data + offset, len);
SHARED_MEMORY_UNLOCK(memory_inst);
return true;
@ -4296,7 +4447,7 @@ aot_dump_pgo_prof_data_to_buf(AOTModuleInstance *module_inst, char *buf,
LLVMProfileData_64 *prof_data_64 = (LLVMProfileData_64 *)buf;
/* Convert LLVMProfileData to LLVMProfileData_64, the pointer width
in the output file is alawys 8 bytes */
in the output file is always 8 bytes */
prof_data = (LLVMProfileData *)module->data_sections[i].data;
prof_data_64->func_md5 = prof_data->func_md5;
prof_data_64->func_hash = prof_data->func_hash;
@ -4549,7 +4700,7 @@ aot_global_traverse_gc_rootset(AOTModuleInstance *module_inst, void *heap)
uint32 i;
for (i = 0; i < module->import_global_count; i++, import_global++) {
if (wasm_is_type_reftype(import_global->type)) {
if (wasm_is_type_reftype(import_global->type.val_type)) {
gc_obj = GET_REF_FROM_ADDR((uint32 *)global_data);
if (wasm_obj_is_created_from_heap(gc_obj)) {
if (0 != mem_allocator_add_root((mem_allocator_t)heap, gc_obj))
@ -4560,7 +4711,7 @@ aot_global_traverse_gc_rootset(AOTModuleInstance *module_inst, void *heap)
}
for (i = 0; i < module->global_count; i++, global++) {
if (wasm_is_type_reftype(global->type)) {
if (wasm_is_type_reftype(global->type.val_type)) {
gc_obj = GET_REF_FROM_ADDR((uint32 *)global_data);
if (wasm_obj_is_created_from_heap(gc_obj)) {
if (0 != mem_allocator_add_root((mem_allocator_t)heap, gc_obj))

View File

@ -14,10 +14,6 @@
#include "gc_export.h"
#endif
#if WASM_ENABLE_WASI_NN != 0
#include "../libraries/wasi-nn/src/wasi_nn_private.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -43,7 +39,7 @@ typedef enum AOTSectionType {
AOT_SECTION_TYPE_FUNCTION = 3,
AOT_SECTION_TYPE_EXPORT = 4,
AOT_SECTION_TYPE_RELOCATION = 5,
AOT_SECTION_TYPE_SIGANATURE = 6,
AOT_SECTION_TYPE_SIGNATURE = 6,
AOT_SECTION_TYPE_CUSTOM = 100,
} AOTSectionType;
@ -108,9 +104,12 @@ typedef struct AOTFunctionInstance {
typedef struct AOTModuleInstanceExtra {
DefPointer(const uint32 *, stack_sizes);
WASMModuleInstanceExtraCommon common;
AOTFunctionInstance **functions;
uint32 function_count;
#if WASM_ENABLE_MULTI_MODULE != 0
bh_list sub_module_inst_list_head;
bh_list *sub_module_inst_list;
WASMModuleInstanceCommon **import_func_module_insts;
#endif
} AOTModuleInstanceExtra;
@ -131,6 +130,9 @@ typedef struct LocalRefFlag {
typedef struct AOTModule {
uint32 module_type;
/* the package version read from the AOT file */
uint32 package_version;
/* import memories */
uint32 import_memory_count;
AOTImportMemory *import_memories;
@ -310,6 +312,16 @@ typedef struct AOTModule {
/* user defined name */
char *name;
/* Whether the underlying wasm binary buffer can be freed */
bool is_binary_freeable;
/* `.data` sections merged into one mmaped to reduce the tlb cache miss */
uint8 *merged_data_sections;
uint32 merged_data_sections_size;
/* `.data` and `.text` sections merged into one large mmaped section */
uint8 *merged_data_text_sections;
uint32 merged_data_text_sections_size;
} AOTModule;
#define AOTMemoryInstance WASMMemoryInstance
@ -420,7 +432,7 @@ typedef struct LLVMProfileData {
uint16 num_value_sites[2];
} LLVMProfileData;
/* The profiling data for writting to the output file, the width of
/* The profiling data for writing to the output file, the width of
pointer is 8 bytes suppose we always use wamrc and llvm-profdata
with 64-bit mode */
typedef struct LLVMProfileData_64 {
@ -508,6 +520,17 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
AOTFunctionInstance *
aot_lookup_function(const AOTModuleInstance *module_inst, const char *name);
/**
* Get a function in the AOT module instance.
*
* @param module_inst the module instance
* @param func_idx the index of the function
*
* @return the function instance found
*/
AOTFunctionInstance *
aot_get_function_instance(AOTModuleInstance *module_inst, uint32_t func_idx);
/**
* Call the given AOT function of a AOT module instance with
* arguments.
@ -589,6 +612,10 @@ aot_module_dup_data(AOTModuleInstance *module_inst, const char *src,
bool
aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
bool
aot_enlarge_memory_with_idx(AOTModuleInstance *module_inst,
uint32 inc_page_count, uint32 memidx);
/**
* Invoke native function from aot code
*/
@ -627,7 +654,7 @@ aot_sqrtf(float x);
#if WASM_ENABLE_BULK_MEMORY != 0
bool
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
uint32 len, uint32 dst);
uint32 len, size_t dst);
bool
aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);

View File

@ -14,33 +14,48 @@
/* clang-format off */
void __adddf3();
void __addsf3();
void __aeabi_d2f();
void __aeabi_d2iz();
void __aeabi_d2lz();
void __aeabi_d2uiz();
void __aeabi_d2ulz();
void __aeabi_dadd();
void __aeabi_dcmpeq();
void __aeabi_dcmpge();
void __aeabi_dcmpgt();
void __aeabi_dcmple();
void __aeabi_dcmplt();
void __aeabi_dcmpun();
void __aeabi_ddiv();
void __aeabi_dmul();
void __aeabi_dsub();
void __aeabi_f2d();
void __aeabi_f2iz();
void __aeabi_f2lz();
void __aeabi_f2ulz();
void __aeabi_fadd();
void __aeabi_fcmpeq();
void __aeabi_fcmpge();
void __aeabi_fcmpgt();
void __aeabi_fcmple();
void __aeabi_fcmplt();
void __aeabi_fcmpun();
void __aeabi_fdiv();
void __aeabi_fmul();
void __aeabi_fsub();
void __aeabi_i2d();
void __aeabi_i2f();
void __aeabi_idiv();
void __aeabi_idivmod();
void __aeabi_l2d();
void __aeabi_l2f();
void __aeabi_ldivmod();
void __aeabi_memclr();
void __aeabi_memcpy();
void __aeabi_memmove();
void __aeabi_memset();
void __aeabi_memclr();
void __aeabi_ui2d();
void __aeabi_ui2f();
void __aeabi_uidiv();
void __aeabi_uidivmod();
void __aeabi_ul2d();
@ -52,6 +67,7 @@ void __divdi3();
void __divsf3();
void __divsi3();
void __eqdf2();
void __eqsf2();
void __extendsfdf2();
void __fixdfdi();
void __fixdfsi();
@ -101,33 +117,48 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__adddf3),
REG_SYM(__addsf3),
/* clang-format on */
REG_SYM(__aeabi_d2f),
REG_SYM(__aeabi_d2iz),
REG_SYM(__aeabi_d2lz),
REG_SYM(__aeabi_d2uiz),
REG_SYM(__aeabi_d2ulz),
REG_SYM(__aeabi_dadd),
REG_SYM(__aeabi_dcmpeq),
REG_SYM(__aeabi_dcmpge),
REG_SYM(__aeabi_dcmpgt),
REG_SYM(__aeabi_dcmple),
REG_SYM(__aeabi_dcmplt),
REG_SYM(__aeabi_dcmpun),
REG_SYM(__aeabi_ddiv),
REG_SYM(__aeabi_dmul),
REG_SYM(__aeabi_dsub),
REG_SYM(__aeabi_f2d),
REG_SYM(__aeabi_f2iz),
REG_SYM(__aeabi_f2lz),
REG_SYM(__aeabi_f2ulz),
REG_SYM(__aeabi_fadd),
REG_SYM(__aeabi_fcmpeq),
REG_SYM(__aeabi_fcmpge),
REG_SYM(__aeabi_fcmpgt),
REG_SYM(__aeabi_fcmple),
REG_SYM(__aeabi_fcmplt),
REG_SYM(__aeabi_fcmpun),
REG_SYM(__aeabi_fdiv),
REG_SYM(__aeabi_fmul),
REG_SYM(__aeabi_fsub),
REG_SYM(__aeabi_i2d),
REG_SYM(__aeabi_i2f),
REG_SYM(__aeabi_idiv),
REG_SYM(__aeabi_idivmod),
REG_SYM(__aeabi_l2d),
REG_SYM(__aeabi_l2f),
REG_SYM(__aeabi_ldivmod),
REG_SYM(__aeabi_memclr),
REG_SYM(__aeabi_memcpy),
REG_SYM(__aeabi_memmove),
REG_SYM(__aeabi_memset),
REG_SYM(__aeabi_memclr),
REG_SYM(__aeabi_ui2d),
REG_SYM(__aeabi_ui2f),
REG_SYM(__aeabi_uidiv),
REG_SYM(__aeabi_uidivmod),
REG_SYM(__aeabi_ul2d),
@ -139,6 +170,7 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__divsf3),
REG_SYM(__divsi3),
REG_SYM(__eqdf2),
REG_SYM(__eqsf2),
REG_SYM(__extendsfdf2),
REG_SYM(__fixdfdi),
REG_SYM(__fixdfsi),
@ -166,7 +198,6 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__moddi3),
REG_SYM(__modsi3),
REG_SYM(__muldf3),
REG_SYM(__muldf3),
REG_SYM(__mulsf3),
REG_SYM(__nedf2),
REG_SYM(__nesf2),

View File

@ -134,6 +134,7 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__eqdf2),
REG_SYM(__extendsfdf2),
REG_SYM(__fixdfdi),
REG_SYM(__fixdfsi),
REG_SYM(__fixunsdfdi),
REG_SYM(__fixunsdfsi),
REG_SYM(__floatdidf),
@ -143,6 +144,7 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__gedf2),
REG_SYM(__gtdf2),
REG_SYM(__ledf2),
REG_SYM(__ltdf2),
REG_SYM(__muldf3),
REG_SYM(__nedf2),
REG_SYM(__negdf2),

View File

@ -16,32 +16,47 @@
/* clang-format off */
void __adddf3();
void __addsf3();
void __aeabi_d2f();
void __aeabi_d2iz();
void __aeabi_d2lz();
void __aeabi_d2uiz();
void __aeabi_d2ulz();
void __aeabi_dadd();
void __aeabi_dcmpeq();
void __aeabi_dcmpge();
void __aeabi_dcmpgt();
void __aeabi_dcmple();
void __aeabi_dcmplt();
void __aeabi_dcmpun();
void __aeabi_ddiv();
void __aeabi_dmul();
void __aeabi_dsub();
void __aeabi_f2d();
void __aeabi_f2iz();
void __aeabi_f2lz();
void __aeabi_f2ulz();
void __aeabi_fadd();
void __aeabi_fcmpeq();
void __aeabi_fcmpge();
void __aeabi_fcmpgt();
void __aeabi_fcmple();
void __aeabi_fcmplt();
void __aeabi_fcmpun();
void __aeabi_fdiv();
void __aeabi_fmul();
void __aeabi_fsub();
void __aeabi_i2d();
void __aeabi_i2f();
void __aeabi_idiv();
void __aeabi_idivmod();
void __aeabi_l2d();
void __aeabi_l2f();
void __aeabi_ldivmod();
void __aeabi_llsl();
void __aeabi_llsr();
void __aeabi_lmul();
void __aeabi_ui2d();
void __aeabi_ui2f();
void __aeabi_uidiv();
void __aeabi_uidivmod();
void __aeabi_ul2d();
@ -120,32 +135,47 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__unordsf2),
#endif
/* clang-format on */
REG_SYM(__aeabi_d2f),
REG_SYM(__aeabi_d2iz),
REG_SYM(__aeabi_d2lz),
REG_SYM(__aeabi_d2uiz),
REG_SYM(__aeabi_d2ulz),
REG_SYM(__aeabi_dadd),
REG_SYM(__aeabi_dcmpeq),
REG_SYM(__aeabi_dcmpge),
REG_SYM(__aeabi_dcmpgt),
REG_SYM(__aeabi_dcmple),
REG_SYM(__aeabi_dcmplt),
REG_SYM(__aeabi_dcmpun),
REG_SYM(__aeabi_ddiv),
REG_SYM(__aeabi_dmul),
REG_SYM(__aeabi_dsub),
REG_SYM(__aeabi_f2d),
REG_SYM(__aeabi_f2iz),
REG_SYM(__aeabi_f2lz),
REG_SYM(__aeabi_f2ulz),
REG_SYM(__aeabi_fadd),
REG_SYM(__aeabi_fcmpeq),
REG_SYM(__aeabi_fcmpge),
REG_SYM(__aeabi_fcmpgt),
REG_SYM(__aeabi_fcmple),
REG_SYM(__aeabi_fcmplt),
REG_SYM(__aeabi_fcmpun),
REG_SYM(__aeabi_fdiv),
REG_SYM(__aeabi_fmul),
REG_SYM(__aeabi_fsub),
REG_SYM(__aeabi_i2d),
REG_SYM(__aeabi_i2f),
REG_SYM(__aeabi_idiv),
REG_SYM(__aeabi_idivmod),
REG_SYM(__aeabi_l2d),
REG_SYM(__aeabi_l2f),
REG_SYM(__aeabi_ldivmod),
REG_SYM(__aeabi_llsl),
REG_SYM(__aeabi_llsr),
REG_SYM(__aeabi_lmul),
REG_SYM(__aeabi_ui2d),
REG_SYM(__aeabi_ui2f),
REG_SYM(__aeabi_uidiv),
REG_SYM(__aeabi_uidivmod),
REG_SYM(__aeabi_ul2d),

View File

@ -6,6 +6,11 @@
#include "../wasm_runtime_common.h"
#include "../wasm_exec_env.h"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#endif
void
invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
{
@ -112,3 +117,7 @@ invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
}
}
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -176,12 +176,6 @@ wasm_defined_type_is_array_type(WASMType *const def_type)
return wasm_type_is_array_type(def_type);
}
uint32
wasm_func_type_get_param_count(WASMFuncType *const func_type)
{
return func_type->param_count;
}
wasm_ref_type_t
wasm_func_type_get_param_type(WASMFuncType *const func_type, uint32 param_idx)
{
@ -202,12 +196,6 @@ wasm_func_type_get_param_type(WASMFuncType *const func_type, uint32 param_idx)
return ref_type;
}
uint32
wasm_func_type_get_result_count(WASMFuncType *const func_type)
{
return (uint32)func_type->result_count;
}
wasm_ref_type_t
wasm_func_type_get_result_type(WASMFuncType *const func_type, uint32 result_idx)
{

View File

@ -13,7 +13,7 @@ extern "C" {
#endif
/**
* Object header of a WASM object, as the adddress of allocated memory
* Object header of a WASM object, as the address of allocated memory
* must be 8-byte aligned, the lowest 3 bits are zero, we use them to
* mark the object:
* bits[0] is 1: the object is an externref object
@ -85,7 +85,7 @@ typedef struct WASMArrayObject {
/* Must be pointer of WASMRttObject of array type */
WASMObjectHeader header;
/* (<array length> << 2) | <array element size>,
* elem_count = lenght >> 2
* elem_count = length >> 2
* elem_size = 2 ^ (length & 0x3)
*/
uint32 length;

View File

@ -846,12 +846,6 @@ wasm_is_reftype_supers_of_func(uint8 type)
return (type == REF_TYPE_FUNCREF) ? true : false;
}
inline static bool
wasm_is_reftype_supers_of_extern(uint8 type)
{
return (type == REF_TYPE_EXTERNREF) ? true : false;
}
#if WASM_ENABLE_STRINGREF != 0
inline static bool
wasm_is_reftype_supers_of_string(uint8 type)

View File

@ -127,7 +127,7 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
#if WASM_ENABLE_THREAD_MGR != 0
if (ret) {
/* On a successful return from the `_start` function,
we terminate other threads by mimicing wasi:proc_exit(0).
we terminate other threads by mimicking wasi:proc_exit(0).
Note:
- A return from the `main` function is an equivalent of
@ -201,9 +201,23 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
if (func_type->param_count) {
for (i = 0; i < argc; i++)
total_argv_size += (uint32)(strlen(argv[i]) + 1);
total_argv_size = align_uint(total_argv_size, 4);
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
total_argv_size = align_uint(total_argv_size, 8);
else
#endif
total_argv_size = align_uint(total_argv_size, 4);
total_size = (uint64)total_argv_size + sizeof(int32) * (uint64)argc;
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
total_size =
(uint64)total_argv_size + sizeof(uint64) * (uint64)argc;
else
#endif
total_size =
(uint64)total_argv_size + sizeof(uint32) * (uint64)argc;
if (total_size >= UINT32_MAX
|| !(argv_buf_offset = wasm_runtime_module_malloc(
@ -219,7 +233,15 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
for (i = 0; i < argc; i++) {
bh_memcpy_s(p, (uint32)(p_end - p), argv[i],
(uint32)(strlen(argv[i]) + 1));
argv_offsets[i] = (uint32)argv_buf_offset + (uint32)(p - argv_buf);
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
((uint64 *)argv_offsets)[i] =
(uint32)argv_buf_offset + (uint32)(p - argv_buf);
else
#endif
argv_offsets[i] =
(uint32)argv_buf_offset + (uint32)(p - argv_buf);
p += strlen(argv[i]) + 1;
}
@ -491,7 +513,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
bh_memcpy_s(&u.val, sizeof(double), &ud.d,
sizeof(double));
}
if (endptr[0] == ':') {
if (endptr && endptr[0] == ':') {
uint64 sig;
union ieee754_double ud;
sig = strtoull(endptr + 1, &endptr, 0);
@ -516,11 +538,11 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
case VALUE_TYPE_V128:
{
/* it likes 0x123\0x234 or 123\234 */
/* retrive first i64 */
/* retrieve first i64 */
*(uint64 *)(argv1 + p) = strtoull(argv[i], &endptr, 0);
/* skip \ */
endptr++;
/* retrive second i64 */
/* retrieve second i64 */
*(uint64 *)(argv1 + p + 2) = strtoull(endptr, &endptr, 0);
p += 4;
break;

View File

@ -42,6 +42,8 @@
typedef struct wasm_module_ex_t {
struct WASMModuleCommon *module_comm_rt;
wasm_byte_vec_t *binary;
/* If true, binary in wasm_module_ex_t contains a copy of the WASM binary */
bool is_binary_cloned;
korp_mutex lock;
uint32 ref_count;
#if WASM_ENABLE_WASM_CACHE != 0
@ -536,7 +538,7 @@ search_thread_local_store_num(Vector *stores_by_tid, korp_tid tid,
#endif
static unsigned
retrive_thread_local_store_num(Vector *stores_by_tid, korp_tid tid)
retrieve_thread_local_store_num(Vector *stores_by_tid, korp_tid tid)
{
#ifndef os_thread_local_attribute
unsigned i = 0;
@ -664,8 +666,8 @@ wasm_store_new(wasm_engine_t *engine)
if (!engine || singleton_engine != engine)
return NULL;
if (!retrive_thread_local_store_num(&engine->stores_by_tid,
os_self_thread())) {
if (!retrieve_thread_local_store_num(&engine->stores_by_tid,
os_self_thread())) {
if (!wasm_runtime_init_thread_env()) {
LOG_ERROR("init thread environment failed");
return NULL;
@ -734,8 +736,8 @@ wasm_store_delete(wasm_store_t *store)
if (decrease_thread_local_store_num(&singleton_engine->stores_by_tid,
os_self_thread())) {
if (!retrive_thread_local_store_num(&singleton_engine->stores_by_tid,
os_self_thread())) {
if (!retrieve_thread_local_store_num(&singleton_engine->stores_by_tid,
os_self_thread())) {
wasm_runtime_destroy_thread_env();
}
}
@ -754,11 +756,12 @@ val_type_rt_2_valkind(uint8 val_type_rt)
WAMR_VAL_TYPE_2_WASM_VAL_KIND(I64)
WAMR_VAL_TYPE_2_WASM_VAL_KIND(F32)
WAMR_VAL_TYPE_2_WASM_VAL_KIND(F64)
WAMR_VAL_TYPE_2_WASM_VAL_KIND(V128)
WAMR_VAL_TYPE_2_WASM_VAL_KIND(FUNCREF)
#undef WAMR_VAL_TYPE_2_WASM_VAL_KIND
default:
return WASM_ANYREF;
return WASM_EXTERNREF;
}
}
@ -773,9 +776,9 @@ wasm_valtype_new(wasm_valkind_t kind)
{
wasm_valtype_t *val_type;
if (kind > WASM_F64 && WASM_FUNCREF != kind
if (kind > WASM_V128 && WASM_FUNCREF != kind
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
&& WASM_ANYREF != kind
&& WASM_EXTERNREF != kind
#endif
) {
return NULL;
@ -807,7 +810,7 @@ wasm_valtype_copy(const wasm_valtype_t *src)
wasm_valkind_t
wasm_valtype_kind(const wasm_valtype_t *val_type)
{
return val_type ? val_type->kind : WASM_ANYREF;
return val_type ? val_type->kind : WASM_EXTERNREF;
}
static wasm_functype_t *
@ -974,7 +977,8 @@ cmp_val_kind_with_val_type(wasm_valkind_t v_k, uint8 v_t)
|| (v_k == WASM_I64 && v_t == VALUE_TYPE_I64)
|| (v_k == WASM_F32 && v_t == VALUE_TYPE_F32)
|| (v_k == WASM_F64 && v_t == VALUE_TYPE_F64)
|| (v_k == WASM_ANYREF && v_t == VALUE_TYPE_EXTERNREF)
|| (v_k == WASM_V128 && v_t == VALUE_TYPE_V128)
|| (v_k == WASM_EXTERNREF && v_t == VALUE_TYPE_EXTERNREF)
|| (v_k == WASM_FUNCREF && v_t == VALUE_TYPE_FUNCREF);
}
@ -1133,7 +1137,7 @@ wasm_tabletype_new(own wasm_valtype_t *val_type, const wasm_limits_t *limits)
if (wasm_valtype_kind(val_type) != WASM_FUNCREF
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
&& wasm_valtype_kind(val_type) != WASM_ANYREF
&& wasm_valtype_kind(val_type) != WASM_EXTERNREF
#endif
) {
return NULL;
@ -1646,9 +1650,12 @@ rt_val_to_wasm_val(const uint8 *data, uint8 val_type_rt, wasm_val_t *out)
out->kind = WASM_F64;
out->of.f64 = *((float64 *)data);
break;
case VALUE_TYPE_V128:
bh_assert(0);
break;
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
case VALUE_TYPE_EXTERNREF:
out->kind = WASM_ANYREF;
out->kind = WASM_EXTERNREF;
if (NULL_REF == *(uint32 *)data) {
out->of.ref = NULL;
}
@ -1687,9 +1694,12 @@ wasm_val_to_rt_val(WASMModuleInstanceCommon *inst_comm_rt, uint8 val_type_rt,
bh_assert(WASM_F64 == v->kind);
*((float64 *)data) = v->of.f64;
break;
case VALUE_TYPE_V128:
bh_assert(0);
break;
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
case VALUE_TYPE_EXTERNREF:
bh_assert(WASM_ANYREF == v->kind);
bh_assert(WASM_EXTERNREF == v->kind);
ret =
wasm_externref_obj2ref(inst_comm_rt, v->of.ref, (uint32 *)data);
break;
@ -2234,8 +2244,7 @@ quit:
#endif /* WASM_ENABLE_WASM_CACHE != 0 */
wasm_module_t *
wasm_module_new_ex(wasm_store_t *store, const wasm_byte_vec_t *binary,
const LoadArgs *args)
wasm_module_new_ex(wasm_store_t *store, wasm_byte_vec_t *binary, LoadArgs *args)
{
char error_buf[128] = { 0 };
wasm_module_ex_t *module_ex = NULL;
@ -2263,7 +2272,7 @@ wasm_module_new_ex(wasm_store_t *store, const wasm_byte_vec_t *binary,
result = result || (pkg_type == Wasm_Module_AoT);
#endif
if (!result) {
LOG_VERBOSE("current building isn't compatiable with the module,"
LOG_VERBOSE("current building isn't compatible with the module,"
"may need recompile");
goto quit;
}
@ -2283,14 +2292,21 @@ wasm_module_new_ex(wasm_store_t *store, const wasm_byte_vec_t *binary,
if (!module_ex)
goto quit;
module_ex->binary = malloc_internal(sizeof(wasm_byte_vec_t));
if (!module_ex->binary)
goto free_module;
module_ex->is_binary_cloned = args->clone_wasm_binary;
if (args->clone_wasm_binary) {
module_ex->binary = malloc_internal(sizeof(wasm_byte_vec_t));
if (!module_ex->binary)
goto free_module;
wasm_byte_vec_copy(module_ex->binary, binary);
if (!module_ex->binary->data)
goto free_binary;
wasm_byte_vec_copy(module_ex->binary, binary);
if (!module_ex->binary->data)
goto free_binary;
}
else {
module_ex->binary = binary;
}
args->wasm_binary_freeable = !args->clone_wasm_binary;
module_ex->module_comm_rt = wasm_runtime_load_ex(
(uint8 *)module_ex->binary->data, (uint32)module_ex->binary->size, args,
error_buf, (uint32)sizeof(error_buf));
@ -2328,9 +2344,11 @@ remove_last:
unload:
wasm_runtime_unload(module_ex->module_comm_rt);
free_vec:
wasm_byte_vec_delete(module_ex->binary);
if (args->clone_wasm_binary)
wasm_byte_vec_delete(module_ex->binary);
free_binary:
wasm_runtime_free(module_ex->binary);
if (args->clone_wasm_binary)
wasm_runtime_free(module_ex->binary);
free_module:
wasm_runtime_free(module_ex);
quit:
@ -2343,7 +2361,8 @@ wasm_module_new(wasm_store_t *store, const wasm_byte_vec_t *binary)
{
LoadArgs args = { 0 };
args.name = "";
return wasm_module_new_ex(store, binary, &args);
args.clone_wasm_binary = true;
return wasm_module_new_ex(store, (wasm_byte_vec_t *)binary, &args);
}
bool
@ -2402,7 +2421,8 @@ wasm_module_delete_internal(wasm_module_t *module)
return;
}
DEINIT_VEC(module_ex->binary, wasm_byte_vec_delete);
if (module_ex->is_binary_cloned)
DEINIT_VEC(module_ex->binary, wasm_byte_vec_delete);
if (module_ex->module_comm_rt) {
wasm_runtime_unload(module_ex->module_comm_rt);
@ -2521,8 +2541,8 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
+ (i - import_func_count);
module_name_rt = import->u.names.module_name;
field_name_rt = import->u.names.field_name;
val_type_rt = import->u.global.type;
mutability_rt = import->u.global.is_mutable;
val_type_rt = import->u.global.type.val_type;
mutability_rt = import->u.global.type.is_mutable;
}
#endif
@ -2532,8 +2552,8 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
+ (i - import_func_count);
module_name_rt = import->module_name;
field_name_rt = import->global_name;
val_type_rt = import->type;
mutability_rt = import->is_mutable;
val_type_rt = import->type.val_type;
mutability_rt = import->type.is_mutable;
}
#endif
@ -2560,8 +2580,8 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
+ (i - import_func_count - import_global_count);
module_name_rt = import->u.names.module_name;
field_name_rt = import->u.names.field_name;
min_page = import->u.memory.init_page_count;
max_page = import->u.memory.max_page_count;
min_page = import->u.memory.mem_type.init_page_count;
max_page = import->u.memory.mem_type.max_page_count;
}
#endif
@ -2572,8 +2592,8 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
+ (i - import_func_count - import_global_count);
module_name_rt = import->module_name;
field_name_rt = import->memory_name;
min_page = import->mem_init_page_count;
max_page = import->mem_max_page_count;
min_page = import->mem_type.init_page_count;
max_page = import->mem_type.max_page_count;
}
#endif
@ -2600,9 +2620,9 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
- import_memory_count);
module_name_rt = import->u.names.module_name;
field_name_rt = import->u.names.field_name;
elem_type_rt = import->u.table.elem_type;
min_size = import->u.table.init_size;
max_size = import->u.table.max_size;
elem_type_rt = import->u.table.table_type.elem_type;
min_size = import->u.table.table_type.init_size;
max_size = import->u.table.table_type.max_size;
}
#endif
@ -2614,9 +2634,9 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
- import_memory_count);
module_name_rt = import->module_name;
field_name_rt = import->table_name;
elem_type_rt = import->elem_type;
min_size = import->table_init_size;
max_size = import->table_max_size;
elem_type_rt = import->table_type.elem_type;
min_size = import->table_type.init_size;
max_size = import->table_type.max_size;
}
#endif
@ -2986,6 +3006,15 @@ wasm_module_get_name(wasm_module_t *module)
return wasm_runtime_get_module_name(module_ex->module_comm_rt);
}
bool
wasm_module_is_underlying_binary_freeable(const wasm_module_t *module)
{
if (((wasm_module_ex_t *)module)->is_binary_cloned)
return true;
return wasm_runtime_is_underlying_binary_freeable(*module);
}
static wasm_func_t *
wasm_func_new_basic(wasm_store_t *store, const wasm_functype_t *type,
wasm_func_callback_t func_callback)
@ -3251,8 +3280,11 @@ params_to_argv(const wasm_val_vec_t *params,
*(int64 *)argv = param->of.i64;
argv += 2;
break;
case WASM_V128:
bh_assert(0);
break;
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
case WASM_ANYREF:
case WASM_EXTERNREF:
*(uintptr_t *)argv = (uintptr_t)param->of.ref;
argv += sizeof(uintptr_t) / sizeof(uint32);
break;
@ -3293,8 +3325,11 @@ argv_to_results(const uint32 *argv, const wasm_valtype_vec_t *result_defs,
result->of.i64 = *(int64 *)argv;
argv += 2;
break;
case WASM_V128:
bh_assert(0);
break;
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
case WASM_ANYREF:
case WASM_EXTERNREF:
result->of.ref = (struct wasm_ref_t *)(*(uintptr_t *)argv);
argv += sizeof(uintptr_t) / sizeof(uint32);
break;
@ -3386,7 +3421,7 @@ wasm_func_call(const wasm_func_t *func, const wasm_val_vec_t *params,
}
}
/* copy parametes */
/* copy parameters */
if (param_count
&& !params_to_argv(params, wasm_functype_params(func->type), argv,
&argc)) {
@ -3634,7 +3669,7 @@ aot_global_set(const AOTModuleInstance *inst_aot, uint16 global_idx_rt,
if (global_idx_rt < module_aot->import_global_count) {
data_offset = module_aot->import_globals[global_idx_rt].data_offset;
val_type_rt = module_aot->import_globals[global_idx_rt].type;
val_type_rt = module_aot->import_globals[global_idx_rt].type.val_type;
}
else {
data_offset =
@ -3642,7 +3677,7 @@ aot_global_set(const AOTModuleInstance *inst_aot, uint16 global_idx_rt,
.data_offset;
val_type_rt =
module_aot->globals[global_idx_rt - module_aot->import_global_count]
.type;
.type.val_type;
}
data = (void *)(inst_aot->global_data + data_offset);
@ -3661,7 +3696,7 @@ aot_global_get(const AOTModuleInstance *inst_aot, uint16 global_idx_rt,
if (global_idx_rt < module_aot->import_global_count) {
data_offset = module_aot->import_globals[global_idx_rt].data_offset;
val_type_rt = module_aot->import_globals[global_idx_rt].type;
val_type_rt = module_aot->import_globals[global_idx_rt].type.val_type;
}
else {
data_offset =
@ -3669,7 +3704,7 @@ aot_global_get(const AOTModuleInstance *inst_aot, uint16 global_idx_rt,
.data_offset;
val_type_rt =
module_aot->globals[global_idx_rt - module_aot->import_global_count]
.type;
.type.val_type;
}
data = inst_aot->global_data + data_offset;
@ -3786,15 +3821,15 @@ wasm_global_new_internal(wasm_store_t *store, uint16 global_idx_rt,
if (global_idx_rt < module_aot->import_global_count) {
AOTImportGlobal *global_import_aot =
module_aot->import_globals + global_idx_rt;
val_type_rt = global_import_aot->type;
is_mutable = global_import_aot->is_mutable;
val_type_rt = global_import_aot->type.val_type;
is_mutable = global_import_aot->type.is_mutable;
}
else {
AOTGlobal *global_aot =
module_aot->globals
+ (global_idx_rt - module_aot->import_global_count);
val_type_rt = global_aot->type;
is_mutable = global_aot->is_mutable;
val_type_rt = global_aot->type.val_type;
is_mutable = global_aot->type.is_mutable;
}
}
#endif
@ -4020,7 +4055,7 @@ wasm_table_get(const wasm_table_t *table, wasm_table_size_t index)
}
#if WASM_ENABLE_REF_TYPES != 0
if (table->type->val_type->kind == WASM_ANYREF) {
if (table->type->val_type->kind == WASM_EXTERNREF) {
void *externref_obj;
if (!wasm_externref_ref2obj(ref_idx, &externref_obj)) {
return NULL;
@ -4050,7 +4085,7 @@ wasm_table_set(wasm_table_t *table, wasm_table_size_t index,
if (ref
#if WASM_ENABLE_REF_TYPES != 0
&& !(WASM_REF_foreign == ref->kind
&& WASM_ANYREF == table->type->val_type->kind)
&& WASM_EXTERNREF == table->type->val_type->kind)
#endif
&& !(WASM_REF_func == ref->kind
&& WASM_FUNCREF == table->type->val_type->kind)) {
@ -4097,7 +4132,7 @@ wasm_table_set(wasm_table_t *table, wasm_table_size_t index,
}
#if WASM_ENABLE_REF_TYPES != 0
if (table->type->val_type->kind == WASM_ANYREF) {
if (table->type->val_type->kind == WASM_EXTERNREF) {
return wasm_externref_obj2ref(table->inst_comm_rt, ref, p_ref_idx);
}
else
@ -4160,13 +4195,13 @@ wasm_table_size(const wasm_table_t *table)
if (table->table_idx_rt < module_aot->import_table_count) {
AOTImportTable *table_aot =
module_aot->import_tables + table->table_idx_rt;
return table_aot->table_init_size;
return table_aot->table_type.init_size;
}
else {
AOTTable *table_aot =
module_aot->tables
+ (table->table_idx_rt - module_aot->import_table_count);
return table_aot->table_init_size;
return table_aot->table_type.init_size;
}
}
#endif
@ -4273,12 +4308,12 @@ wasm_memory_new_internal(wasm_store_t *store, uint16 memory_idx_rt,
AOTModule *module_aot = (AOTModule *)inst_aot->module;
if (memory_idx_rt < module_aot->import_memory_count) {
min_pages = module_aot->import_memories->mem_init_page_count;
max_pages = module_aot->import_memories->mem_max_page_count;
min_pages = module_aot->import_memories->mem_type.init_page_count;
max_pages = module_aot->import_memories->mem_type.max_page_count;
}
else {
min_pages = module_aot->memories->mem_init_page_count;
max_pages = module_aot->memories->mem_max_page_count;
min_pages = module_aot->memories->init_page_count;
max_pages = module_aot->memories->max_page_count;
}
init_flag = true;
}
@ -4511,8 +4546,9 @@ interp_link_global(const WASMModule *module_interp, uint16 global_idx_rt,
return true;
/* type comparison */
if (!cmp_val_kind_with_val_type(wasm_valtype_kind(import->type->val_type),
imported_global_interp->u.global.type))
if (!cmp_val_kind_with_val_type(
wasm_valtype_kind(import->type->val_type),
imported_global_interp->u.global.type.val_type))
return false;
/* set init value */
@ -4685,7 +4721,7 @@ aot_link_global(const AOTModule *module_aot, uint16 global_idx_rt,
bh_assert(val_type);
if (!cmp_val_kind_with_val_type(wasm_valtype_kind(val_type),
import_aot_global->type))
import_aot_global->type.val_type))
return false;
bh_assert(import->init);
@ -5253,7 +5289,7 @@ wasm_externkind_t
wasm_extern_kind(const wasm_extern_t *external)
{
if (!external) {
return WASM_ANYREF;
return WASM_EXTERNREF;
}
return external->kind;
@ -5343,3 +5379,24 @@ wasm_extern_new_empty(wasm_store_t *store, wasm_externkind_t extern_kind)
LOG_ERROR("Don't support linking table and memory for now");
return NULL;
}
double
wasm_instance_sum_wasm_exec_time(const wasm_instance_t *instance)
{
#if WASM_ENABLE_PERF_PROFILING != 0
return wasm_runtime_sum_wasm_exec_time(instance->inst_comm_rt);
#else
return -1.0;
#endif
}
double
wasm_instance_get_wasm_func_exec_time(const wasm_instance_t *instance,
const char *name)
{
#if WASM_ENABLE_PERF_PROFILING != 0
return wasm_runtime_get_wasm_func_exec_time(instance->inst_comm_rt, name);
#else
return -1.0;
#endif
}

View File

@ -71,7 +71,7 @@ struct wasm_memorytype_t {
struct wasm_externtype_t {
uint32 extern_kind;
/* reservered space */
/* reserved space */
uint8 data[1];
};
@ -205,7 +205,7 @@ struct wasm_extern_t {
wasm_name_t *module_name;
wasm_name_t *name;
wasm_externkind_t kind;
/* reservered space */
/* reserved space */
uint8 data[1];
};

View File

@ -202,7 +202,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 overrided by other threads */
the stopped thread will be overriden by other threads */
wasm_cluster_thread_exited(exec_env);
#endif
/* We have waited for other threads, this is the only alive thread, so

View File

@ -0,0 +1,163 @@
/*
* Copyright (C) 2024 Amazon Inc. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "wasm_loader_common.h"
#include "bh_leb128.h"
#include "bh_log.h"
#if WASM_ENABLE_GC != 0
#include "../common/gc/gc_type.h"
#endif
void
wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
const char *string, bool is_aot)
{
if (error_buf != NULL) {
snprintf(error_buf, error_buf_size, "%s module load failed: %s",
is_aot ? "AOT" : "WASM", string);
}
}
bool
wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
uint32 error_buf_size, bool is_aot)
{
/* Check whether certain features indicated by mem_flag are enabled in
* runtime */
if (mem_flag > MAX_PAGE_COUNT_FLAG) {
#if WASM_ENABLE_SHARED_MEMORY == 0
if (mem_flag & SHARED_MEMORY_FLAG) {
LOG_VERBOSE("shared memory flag was found, please enable shared "
"memory, lib-pthread or lib-wasi-threads");
wasm_loader_set_error_buf(error_buf, error_buf_size,
"invalid limits flags", is_aot);
return false;
}
#endif
#if WASM_ENABLE_MEMORY64 == 0
if (mem_flag & MEMORY64_FLAG) {
LOG_VERBOSE("memory64 flag was found, please enable memory64");
wasm_loader_set_error_buf(error_buf, error_buf_size,
"invalid limits flags", is_aot);
return false;
}
#endif
}
if (mem_flag > MAX_PAGE_COUNT_FLAG + SHARED_MEMORY_FLAG + MEMORY64_FLAG) {
wasm_loader_set_error_buf(error_buf, error_buf_size,
"invalid limits flags", is_aot);
return false;
}
else if ((mem_flag & SHARED_MEMORY_FLAG)
&& !(mem_flag & MAX_PAGE_COUNT_FLAG)) {
wasm_loader_set_error_buf(error_buf, error_buf_size,
"shared memory must have maximum", is_aot);
return false;
}
return true;
}
/*
* compare with a bigger type set in `wasm_value_type_size_internal()`,
* this function will only cover global value type, function's param
* value type and function's result value type.
*
* please feel free to add more if there are more requirements
*/
bool
is_valid_value_type(uint8 type)
{
if (/* I32/I64/F32/F64, 0x7C to 0x7F */
(type >= VALUE_TYPE_F64 && type <= VALUE_TYPE_I32)
#if WASM_ENABLE_GC != 0
/* reference types, 0x65 to 0x70 */
|| wasm_is_type_reftype(type)
#elif WASM_ENABLE_REF_TYPES != 0
|| (type == VALUE_TYPE_FUNCREF || type == VALUE_TYPE_EXTERNREF)
#endif
#if WASM_ENABLE_SIMD != 0
|| type == VALUE_TYPE_V128 /* 0x7B */
#endif
)
return true;
return false;
}
bool
is_valid_value_type_for_interpreter(uint8 value_type)
{
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 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.
*/
if (value_type == VALUE_TYPE_V128)
return false;
#endif
return is_valid_value_type(value_type);
}
bool
is_valid_func_type(const WASMFuncType *func_type)
{
unsigned i;
for (i = 0;
i < (unsigned)(func_type->param_count + func_type->result_count);
i++) {
if (!is_valid_value_type(func_type->types[i]))
return false;
}
return true;
}
/*
* Indices are represented as a u32.
*/
bool
is_indices_overflow(uint32 import, uint32 other, char *error_buf,
uint32 error_buf_size)
{
if (import > UINT32_MAX - other) {
snprintf(error_buf, error_buf_size,
"too many items in the index space(%" PRIu32 "+%" PRIu32 ").",
import, other);
return true;
}
return false;
}
bool
read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
uint64 *p_result, char *error_buf, uint32 error_buf_size)
{
size_t offset = 0;
bh_leb_read_status_t status =
bh_leb_read(*p_buf, buf_end, maxbits, sign, p_result, &offset);
switch (status) {
case BH_LEB_READ_SUCCESS:
*p_buf += offset;
return true;
case BH_LEB_READ_TOO_LONG:
wasm_loader_set_error_buf(error_buf, error_buf_size,
"integer representation too long", false);
return false;
case BH_LEB_READ_OVERFLOW:
wasm_loader_set_error_buf(error_buf, error_buf_size,
"integer too large", false);
return false;
case BH_LEB_READ_UNEXPECTED_END:
wasm_loader_set_error_buf(error_buf, error_buf_size,
"unexpected end", false);
return false;
default:
bh_assert(false);
return false;
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2024 Amazon Inc. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef _WASM_LOADER_COMMON_H
#define _WASM_LOADER_COMMON_H
#include "platform_common.h"
#include "../interpreter/wasm.h"
#ifdef __cplusplus
extern "C" {
#endif
bool
wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
uint32 error_buf_size, bool is_aot);
bool
is_valid_value_type(uint8 value_tpye);
bool
is_valid_value_type_for_interpreter(uint8 value_tpye);
bool
is_valid_func_type(const WASMFuncType *func_type);
bool
is_indices_overflow(uint32 import, uint32 other, char *error_buf,
uint32 error_buf_size);
bool
read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
uint64 *p_result, char *error_buf, uint32 error_buf_size);
void
wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
const char *string, bool is_aot);
#ifdef __cplusplus
}
#endif
#endif /* end of _WASM_LOADER_COMMON_H */

View File

@ -189,7 +189,7 @@ wasm_runtime_malloc_internal(unsigned int size)
{
if (memory_mode == MEMORY_MODE_UNKNOWN) {
LOG_WARNING(
"wasm_runtime_malloc failed: memory hasn't been initialize.\n");
"wasm_runtime_malloc failed: memory hasn't been initialized.\n");
return NULL;
}
else if (memory_mode == MEMORY_MODE_POOL) {
@ -215,7 +215,7 @@ wasm_runtime_realloc_internal(void *ptr, unsigned int size)
{
if (memory_mode == MEMORY_MODE_UNKNOWN) {
LOG_WARNING(
"wasm_runtime_realloc failed: memory hasn't been initialize.\n");
"wasm_runtime_realloc failed: memory hasn't been initialized.\n");
return NULL;
}
else if (memory_mode == MEMORY_MODE_POOL) {
@ -284,6 +284,13 @@ wasm_runtime_malloc(unsigned int size)
#endif
}
#if WASM_ENABLE_FUZZ_TEST != 0
if (size >= WASM_MEM_ALLOC_MAX_SIZE) {
LOG_WARNING("warning: wasm_runtime_malloc with too large size\n");
return NULL;
}
#endif
return wasm_runtime_malloc_internal(size);
}
@ -663,6 +670,16 @@ wasm_get_default_memory(WASMModuleInstance *module_inst)
return NULL;
}
WASMMemoryInstance *
wasm_get_memory_with_idx(WASMModuleInstance *module_inst, uint32 index)
{
bh_assert(index < module_inst->memory_count);
if (module_inst->memories)
return module_inst->memories[index];
else
return NULL;
}
void
wasm_runtime_set_mem_bound_check_bytes(WASMMemoryInstance *memory,
uint64 memory_data_size)
@ -740,9 +757,14 @@ wasm_mmap_linear_memory(uint64_t map_size, uint64 commit_size)
}
bool
wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count)
wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count,
uint32 memidx)
{
#if WASM_ENABLE_MULTI_MEMORY != 0
WASMMemoryInstance *memory = wasm_get_memory_with_idx(module, memidx);
#else
WASMMemoryInstance *memory = wasm_get_default_memory(module);
#endif
uint8 *memory_data_old, *memory_data_new, *heap_data_old;
uint32 num_bytes_per_page, heap_size;
uint32 cur_page_count, max_page_count, total_page_count;
@ -876,6 +898,12 @@ wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count)
}
#endif /* end of WASM_MEM_ALLOC_WITH_USAGE */
/*
* AOT compiler assumes at least 8 byte alignment.
* see aot_check_memory_overflow.
*/
bh_assert(((uintptr_t)memory->memory_data & 0x7) == 0);
memory->num_bytes_per_page = num_bytes_per_page;
memory->cur_page_count = total_page_count;
memory->max_page_count = max_page_count;
@ -906,6 +934,30 @@ return_func:
return ret;
}
bool
wasm_runtime_enlarge_memory(WASMModuleInstanceCommon *module_inst,
uint64 inc_page_count)
{
if (inc_page_count > UINT32_MAX) {
return false;
}
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT) {
return aot_enlarge_memory((AOTModuleInstance *)module_inst,
(uint32)inc_page_count);
}
#endif
#if WASM_ENABLE_INTERP != 0
if (module_inst->module_type == Wasm_Module_Bytecode) {
return wasm_enlarge_memory((WASMModuleInstance *)module_inst,
(uint32)inc_page_count);
}
#endif
return false;
}
void
wasm_runtime_set_enlarge_mem_error_callback(
const enlarge_memory_error_callback_t callback, void *user_data)
@ -923,7 +975,7 @@ wasm_enlarge_memory(WASMModuleInstance *module, uint32 inc_page_count)
if (module->memory_count > 0)
shared_memory_lock(module->memories[0]);
#endif
ret = wasm_enlarge_memory_internal(module, inc_page_count);
ret = wasm_enlarge_memory_internal(module, inc_page_count, 0);
#if WASM_ENABLE_SHARED_MEMORY != 0
if (module->memory_count > 0)
shared_memory_unlock(module->memories[0]);
@ -932,6 +984,25 @@ wasm_enlarge_memory(WASMModuleInstance *module, uint32 inc_page_count)
return ret;
}
bool
wasm_enlarge_memory_with_idx(WASMModuleInstance *module, uint32 inc_page_count,
uint32 memidx)
{
bool ret = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
if (memidx < module->memory_count)
shared_memory_lock(module->memories[memidx]);
#endif
ret = wasm_enlarge_memory_internal(module, inc_page_count, memidx);
#if WASM_ENABLE_SHARED_MEMORY != 0
if (memidx < module->memory_count)
shared_memory_unlock(module->memories[memidx]);
#endif
return ret;
}
void
wasm_deallocate_linear_memory(WASMMemoryInstance *memory_inst)
{
@ -1005,15 +1076,7 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
page_size = os_getpagesize();
*memory_data_size = init_page_count * num_bytes_per_page;
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64) {
bh_assert(*memory_data_size <= MAX_LINEAR_MEM64_MEMORY_SIZE);
}
else
#endif
{
bh_assert(*memory_data_size <= MAX_LINEAR_MEMORY_SIZE);
}
bh_assert(*memory_data_size <= GET_MAX_LINEAR_MEMORY_SIZE(is_memory64));
*memory_data_size = align_as_and_cast(*memory_data_size, page_size);
if (map_size > 0) {
@ -1033,5 +1096,11 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
#endif
}
/*
* AOT compiler assumes at least 8 byte alignment.
* see aot_check_memory_overflow.
*/
bh_assert(((uintptr_t)*data & 0x7) == 0);
return BHT_OK;
}

View File

@ -15,6 +15,9 @@
#if WASM_ENABLE_THREAD_MGR != 0
#include "../libraries/thread-mgr/thread_manager.h"
#endif
#if WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
#include "wasi_nn_host.h"
#endif
static NativeSymbolsList g_native_symbols_list = NULL;
@ -33,9 +36,6 @@ get_spectest_export_apis(NativeSymbol **p_libc_builtin_apis);
uint32
get_libc_wasi_export_apis(NativeSymbol **p_libc_wasi_apis);
uint32_t
get_wasi_nn_export_apis(NativeSymbol **p_libc_wasi_apis);
uint32
get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
@ -71,7 +71,7 @@ uint32
get_lib_rats_export_apis(NativeSymbol **p_lib_rats_apis);
static bool
compare_type_with_signautre(uint8 type, const char signature)
compare_type_with_signature(uint8 type, const char signature)
{
const char num_sig_map[] = { 'F', 'f', 'I', 'i' };
@ -122,10 +122,10 @@ check_symbol_signature(const WASMFuncType *type, const char *signature)
sig = *p++;
/* a f64/f32/i64/i32/externref parameter */
if (compare_type_with_signautre(type->types[i], sig))
if (compare_type_with_signature(type->types[i], sig))
continue;
/* a pointer/string paramter */
/* a pointer/string parameter */
if (type->types[i] != VALUE_TYPE_I32)
/* pointer and string must be i32 type */
return false;
@ -156,7 +156,7 @@ check_symbol_signature(const WASMFuncType *type, const char *signature)
return false;
/* result types includes: f64,f32,i64,i32,externref */
if (!compare_type_with_signautre(type->types[i], *p))
if (!compare_type_with_signature(type->types[i], *p))
return false;
p++;
@ -233,7 +233,7 @@ wasm_native_resolve_symbol(const char *module_name, const char *field_name,
#if WASM_ENABLE_WAMR_COMPILER == 0
/* Output warning except running aot compiler */
LOG_WARNING("failed to check signature '%s' and resolve "
"pointer params for import function (%s %s)\n",
"pointer params for import function (%s, %s)\n",
signature, module_name, field_name);
#endif
return NULL;
@ -475,11 +475,12 @@ quick_aot_entry_init();
bool
wasm_native_init()
{
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
NativeSymbol *native_symbols;
uint32 n_native_symbols;
#endif
@ -565,25 +566,30 @@ wasm_native_init()
goto fail;
#endif /* WASM_ENABLE_LIB_RATS */
#if WASM_ENABLE_WASI_NN != 0
n_native_symbols = get_wasi_nn_export_apis(&native_symbols);
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
#define wasi_nn_module_name "wasi_ephemeral_nn"
#else /* WASM_ENABLE_WASI_EPHEMERAL_NN == 0 */
#define wasi_nn_module_name "wasi_nn"
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
if (!wasm_native_register_natives(wasi_nn_module_name, native_symbols,
n_native_symbols))
#if WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (!wasi_nn_initialize())
goto fail;
#endif
n_native_symbols = get_wasi_nn_export_apis(&native_symbols);
if (n_native_symbols > 0
&& !wasm_native_register_natives(
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
"wasi_ephemeral_nn",
#else
"wasi_nn",
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
native_symbols, n_native_symbols))
goto fail;
#endif /* WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
#if WASM_ENABLE_QUICK_AOT_ENTRY != 0
if (!quick_aot_entry_init()) {
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
goto fail;
#else
return false;
@ -592,11 +598,12 @@ wasm_native_init()
#endif
return true;
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
fail:
wasm_native_destroy();
return false;
@ -614,6 +621,7 @@ wasm_native_destroy()
g_wasi_context_key = NULL;
}
#endif
#if WASM_ENABLE_LIB_PTHREAD != 0
lib_pthread_destroy();
#endif
@ -622,6 +630,10 @@ wasm_native_destroy()
lib_wasi_threads_destroy();
#endif
#if WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
wasi_nn_destroy();
#endif
node = g_native_symbols_list;
while (node) {
node_next = node->next;

File diff suppressed because it is too large Load Diff

View File

@ -362,6 +362,9 @@ LOAD_I16(void *addr)
#define SHARED_MEMORY_UNLOCK(memory) (void)0
#endif
#define CLAMP_U64_TO_U32(value) \
((value) > UINT32_MAX ? UINT32_MAX : (uint32)(value))
typedef struct WASMModuleCommon {
/* Module type, for module loaded from WASM bytecode binary,
this field is Wasm_Module_Bytecode, and this structure should
@ -909,7 +912,7 @@ WASMExport *
loader_find_export(const WASMModuleCommon *module, const char *module_name,
const char *field_name, uint8 export_kind, char *error_buf,
uint32 error_buf_size);
#endif /* WASM_ENALBE_MULTI_MODULE */
#endif /* WASM_ENABLE_MULTI_MODULE */
bool
wasm_runtime_is_built_in_module(const char *module_name);
@ -1196,6 +1199,9 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
uint32 requested_size);
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_underlying_binary_freeable(WASMModuleCommon *const module);
#if WASM_ENABLE_LINUX_PERF != 0
bool
wasm_runtime_get_linux_perf(void);

View File

@ -333,7 +333,7 @@ wasm_runtime_atomic_wait(WASMModuleInstanceCommon *module, void *address,
while (1) {
if (timeout < 0) {
/* wait forever until it is notified or terminatied
/* wait forever until it is notified or terminated
here we keep waiting and checking every second */
os_cond_reltimedwait(&wait_node->wait_cond, lock,
(uint64)timeout_1sec);

View File

@ -221,16 +221,16 @@ aot_create_import_globals(const WASMModule *module, bool gc_enabled,
WASMGlobalImport *import_global = &module->import_globals[i].u.global;
import_globals[i].module_name = import_global->module_name;
import_globals[i].global_name = import_global->field_name;
import_globals[i].type = import_global->type;
import_globals[i].is_mutable = import_global->is_mutable;
import_globals[i].type.val_type = import_global->type.val_type;
import_globals[i].type.is_mutable = import_global->type.is_mutable;
import_globals[i].global_data_linked =
import_global->global_data_linked;
import_globals[i].data_offset_64bit = data_offset_64bit;
import_globals[i].data_offset_32bit = data_offset_32bit;
get_value_type_size(import_global->type, gc_enabled, &value_size_64bit,
&value_size_32bit);
get_value_type_size(import_global->type.val_type, gc_enabled,
&value_size_64bit, &value_size_32bit);
import_globals[i].size_64bit = value_size_64bit;
import_globals[i].size_32bit = value_size_32bit;
@ -269,16 +269,16 @@ aot_create_globals(const WASMModule *module, bool gc_enabled,
/* Create each global */
for (i = 0; i < module->global_count; i++) {
WASMGlobal *global = &module->globals[i];
globals[i].type = global->type;
globals[i].is_mutable = global->is_mutable;
globals[i].type.val_type = global->type.val_type;
globals[i].type.is_mutable = global->type.is_mutable;
memcpy(&globals[i].init_expr, &global->init_expr,
sizeof(global->init_expr));
globals[i].data_offset_64bit = data_offset_64bit;
globals[i].data_offset_32bit = data_offset_32bit;
get_value_type_size(global->type, gc_enabled, &value_size_64bit,
&value_size_32bit);
get_value_type_size(global->type.val_type, gc_enabled,
&value_size_64bit, &value_size_32bit);
globals[i].size_64bit = value_size_64bit;
globals[i].size_32bit = value_size_32bit;
@ -540,6 +540,7 @@ aot_create_comp_data(WASMModule *module, const char *target_arch,
/* TODO: create import memories */
/* Allocate memory for memory array, reserve one AOTMemory space at least */
/* TODO: multi-memory */
if (!comp_data->memory_count)
comp_data->memory_count = 1;
@ -558,28 +559,24 @@ aot_create_comp_data(WASMModule *module, const char *target_arch,
/* Set memory page count */
for (i = 0; i < module->import_memory_count + module->memory_count; i++) {
if (i < module->import_memory_count) {
comp_data->memories[i].memory_flags =
module->import_memories[i].u.memory.flags;
comp_data->memories[i].flags =
module->import_memories[i].u.memory.mem_type.flags;
comp_data->memories[i].num_bytes_per_page =
module->import_memories[i].u.memory.num_bytes_per_page;
comp_data->memories[i].mem_init_page_count =
module->import_memories[i].u.memory.init_page_count;
comp_data->memories[i].mem_max_page_count =
module->import_memories[i].u.memory.max_page_count;
comp_data->memories[i].num_bytes_per_page =
module->import_memories[i].u.memory.num_bytes_per_page;
module->import_memories[i].u.memory.mem_type.num_bytes_per_page;
comp_data->memories[i].init_page_count =
module->import_memories[i].u.memory.mem_type.init_page_count;
comp_data->memories[i].max_page_count =
module->import_memories[i].u.memory.mem_type.max_page_count;
}
else {
j = i - module->import_memory_count;
comp_data->memories[i].memory_flags = module->memories[j].flags;
comp_data->memories[i].flags = module->memories[j].flags;
comp_data->memories[i].num_bytes_per_page =
module->memories[j].num_bytes_per_page;
comp_data->memories[i].mem_init_page_count =
comp_data->memories[i].init_page_count =
module->memories[j].init_page_count;
comp_data->memories[i].mem_max_page_count =
comp_data->memories[i].max_page_count =
module->memories[j].max_page_count;
comp_data->memories[i].num_bytes_per_page =
module->memories[j].num_bytes_per_page;
}
}
@ -603,34 +600,36 @@ aot_create_comp_data(WASMModule *module, const char *target_arch,
memset(comp_data->tables, 0, size);
for (i = 0; i < comp_data->table_count; i++) {
if (i < module->import_table_count) {
comp_data->tables[i].elem_type =
module->import_tables[i].u.table.elem_type;
comp_data->tables[i].table_flags =
module->import_tables[i].u.table.flags;
comp_data->tables[i].table_init_size =
module->import_tables[i].u.table.init_size;
comp_data->tables[i].table_max_size =
module->import_tables[i].u.table.max_size;
comp_data->tables[i].table_type.elem_type =
module->import_tables[i].u.table.table_type.elem_type;
comp_data->tables[i].table_type.flags =
module->import_tables[i].u.table.table_type.flags;
comp_data->tables[i].table_type.init_size =
module->import_tables[i].u.table.table_type.init_size;
comp_data->tables[i].table_type.max_size =
module->import_tables[i].u.table.table_type.max_size;
#if WASM_ENABLE_GC != 0
comp_data->tables[i].elem_ref_type =
module->import_tables[i].u.table.elem_ref_type;
comp_data->tables[i].table_type.elem_ref_type =
module->import_tables[i].u.table.table_type.elem_ref_type;
#endif
comp_data->tables[i].possible_grow =
module->import_tables[i].u.table.possible_grow;
comp_data->tables[i].table_type.possible_grow =
module->import_tables[i].u.table.table_type.possible_grow;
}
else {
j = i - module->import_table_count;
comp_data->tables[i].elem_type = module->tables[j].elem_type;
comp_data->tables[i].table_flags = module->tables[j].flags;
comp_data->tables[i].table_init_size =
module->tables[j].init_size;
comp_data->tables[i].table_max_size =
module->tables[j].max_size;
comp_data->tables[i].possible_grow =
module->tables[j].possible_grow;
comp_data->tables[i].table_type.elem_type =
module->tables[j].table_type.elem_type;
comp_data->tables[i].table_type.flags =
module->tables[j].table_type.flags;
comp_data->tables[i].table_type.init_size =
module->tables[j].table_type.init_size;
comp_data->tables[i].table_type.max_size =
module->tables[j].table_type.max_size;
comp_data->tables[i].table_type.possible_grow =
module->tables[j].table_type.possible_grow;
#if WASM_ENABLE_GC != 0
comp_data->tables[j].elem_ref_type =
module->tables[j].elem_ref_type;
comp_data->tables[j].table_type.elem_ref_type =
module->tables[j].table_type.elem_ref_type;
/* Note: if the init_expr contains extra data for struct/array
* initialization information (init_expr.u.data), the pointer is
* copied.

View File

@ -46,6 +46,10 @@ typedef WASMStructType AOTStructType;
typedef WASMArrayType AOTArrayType;
#endif
typedef WASMExport AOTExport;
typedef WASMMemory AOTMemory;
typedef WASMMemoryType AOTMemoryType;
typedef WASMTableType AOTTableType;
typedef WASMTable AOTTable;
#if WASM_ENABLE_DEBUG_AOT != 0
typedef void *dwarf_extractor_handle_t;
@ -81,23 +85,9 @@ typedef enum AOTFloatCond {
typedef struct AOTImportMemory {
char *module_name;
char *memory_name;
uint32 memory_flags;
uint32 num_bytes_per_page;
uint32 mem_init_page_count;
uint32 mem_max_page_count;
AOTMemoryType mem_type;
} AOTImportMemory;
/**
* Memory information
*/
typedef struct AOTMemory {
/* memory info */
uint32 memory_flags;
uint32 num_bytes_per_page;
uint32 mem_init_page_count;
uint32 mem_max_page_count;
} AOTMemory;
/**
* A segment of memory init data
*/
@ -122,32 +112,9 @@ typedef struct AOTMemInitData {
typedef struct AOTImportTable {
char *module_name;
char *table_name;
uint8 elem_type;
uint8 table_flags;
bool possible_grow;
uint32 table_init_size;
uint32 table_max_size;
#if WASM_ENABLE_GC != 0
WASMRefType *elem_ref_type;
#endif
AOTTableType table_type;
} AOTImportTable;
/**
* Table
*/
typedef struct AOTTable {
uint8 elem_type;
uint8 table_flags;
bool possible_grow;
uint32 table_init_size;
uint32 table_max_size;
#if WASM_ENABLE_GC != 0
WASMRefType *elem_ref_type;
/* init expr for the whole table */
InitializerExpression init_expr;
#endif
} AOTTable;
/**
* A segment of table init data
*/
@ -175,9 +142,7 @@ typedef struct AOTTableInitData {
typedef struct AOTImportGlobal {
char *module_name;
char *global_name;
/* VALUE_TYPE_I32/I64/F32/F64 */
uint8 type;
bool is_mutable;
WASMGlobalType type;
uint32 size;
/* The data offset of current global in global data */
uint32 data_offset;
@ -203,9 +168,7 @@ typedef struct AOTImportGlobal {
* Global variable
*/
typedef struct AOTGlobal {
/* VALUE_TYPE_I32/I64/F32/F64 */
uint8 type;
bool is_mutable;
WASMGlobalType type;
uint32 size;
/* The data offset of current global in global data */
uint32 data_offset;
@ -337,7 +300,7 @@ typedef struct AOTCompData {
typedef struct AOTNativeSymbol {
bh_list_link link;
char symbol[32];
char symbol[48];
int32 index;
} AOTNativeSymbol;
@ -375,11 +338,12 @@ aot_get_imp_tbl_data_slots(const AOTImportTable *tbl, bool is_jit_mode)
{
#if WASM_ENABLE_MULTI_MODULE != 0
if (is_jit_mode)
return tbl->table_max_size;
return tbl->table_type.max_size;
#else
(void)is_jit_mode;
#endif
return tbl->possible_grow ? tbl->table_max_size : tbl->table_init_size;
return tbl->table_type.possible_grow ? tbl->table_type.max_size
: tbl->table_type.init_size;
}
static inline uint32
@ -387,11 +351,12 @@ aot_get_tbl_data_slots(const AOTTable *tbl, bool is_jit_mode)
{
#if WASM_ENABLE_MULTI_MODULE != 0
if (is_jit_mode)
return tbl->table_max_size;
return tbl->table_type.max_size;
#else
(void)is_jit_mode;
#endif
return tbl->possible_grow ? tbl->table_max_size : tbl->table_init_size;
return tbl->table_type.possible_grow ? tbl->table_type.max_size
: tbl->table_type.init_size;
}
#ifdef __cplusplus

View File

@ -84,37 +84,46 @@ read_leb(const uint8 *buf, const uint8 *buf_end, uint32 *p_offset,
}
/* NOLINTNEXTLINE */
#define read_leb_uint32(p, p_end, res) \
do { \
uint32 off = 0; \
uint64 res64; \
if (!read_leb(p, p_end, &off, 32, false, &res64)) \
return false; \
p += off; \
res = (uint32)res64; \
#define read_leb_generic(p, p_end, res, res_type, sign) \
do { \
uint32 off = 0; \
uint64 res64; \
if (!read_leb(p, p_end, &off, sizeof(res_type) << 3, sign, &res64)) \
return false; \
p += off; \
res = (res_type)res64; \
} while (0)
/* NOLINTNEXTLINE */
#define read_leb_int32(p, p_end, res) \
do { \
uint32 off = 0; \
uint64 res64; \
if (!read_leb(p, p_end, &off, 32, true, &res64)) \
return false; \
p += off; \
res = (int32)res64; \
} while (0)
#define read_leb_int32(p, p_end, res) \
read_leb_generic(p, p_end, res, int32, true)
/* NOLINTNEXTLINE */
#define read_leb_int64(p, p_end, res) \
do { \
uint32 off = 0; \
uint64 res64; \
if (!read_leb(p, p_end, &off, 64, true, &res64)) \
return false; \
p += off; \
res = (int64)res64; \
#define read_leb_int64(p, p_end, res) \
read_leb_generic(p, p_end, res, int64, true)
/* NOLINTNEXTLINE */
#define read_leb_uint32(p, p_end, res) \
read_leb_generic(p, p_end, res, uint32, false)
/* NOLINTNEXTLINE */
#define read_leb_uint64(p, p_end, res) \
read_leb_generic(p, p_end, res, uint64, false)
/* NOLINTNEXTLINE */
#if WASM_ENABLE_MEMORY64 != 0
#define read_leb_mem_offset(p, p_end, res) \
do { \
if (IS_MEMORY64) { \
read_leb_uint64(p, p_end, res); \
} \
else { \
read_leb_uint32(p, p_end, res); \
} \
} while (0)
#else
#define read_leb_mem_offset read_leb_uint32
#endif
/**
* Since wamrc uses a full feature Wasm loader,
@ -135,6 +144,13 @@ aot_validate_wasm(AOTCompContext *comp_ctx)
}
}
#if WASM_ENABLE_MEMORY64 != 0
if (comp_ctx->pointer_size < sizeof(uint64) && IS_MEMORY64) {
aot_set_last_error("Compiling wasm64 to 32bit platform is not allowed");
return false;
}
#endif
return true;
}
@ -933,7 +949,8 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
uint16 result_count;
uint32 br_depth, *br_depths, br_count;
uint32 func_idx, type_idx, mem_idx, local_idx, global_idx, i;
uint32 bytes = 4, align, offset;
uint32 bytes = 4, align;
mem_offset_t offset;
uint32 type_index;
bool sign = true;
int32 i32_const;
@ -1011,7 +1028,9 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
}
else {
frame_ip--;
read_leb_uint32(frame_ip, frame_ip_end, type_index);
read_leb_int32(frame_ip, frame_ip_end, type_index);
/* type index was checked in wasm loader */
bh_assert(type_index < comp_ctx->comp_data->type_count);
func_type =
(AOTFuncType *)comp_ctx->comp_data->types[type_index];
param_count = func_type->param_count;
@ -1031,7 +1050,9 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case EXT_OP_LOOP:
case EXT_OP_IF:
{
read_leb_uint32(frame_ip, frame_ip_end, type_index);
read_leb_int32(frame_ip, frame_ip_end, type_index);
/* type index was checked in wasm loader */
bh_assert(type_index < comp_ctx->comp_data->type_count);
func_type =
(AOTFuncType *)comp_ctx->comp_data->types[type_index];
param_count = func_type->param_count;
@ -1892,7 +1913,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
sign = (opcode == WASM_OP_I32_LOAD16_S) ? true : false;
op_i32_load:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_i32_load(comp_ctx, func_ctx, align, offset,
bytes, sign, false))
return false;
@ -1918,7 +1939,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
sign = (opcode == WASM_OP_I64_LOAD32_S) ? true : false;
op_i64_load:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_i64_load(comp_ctx, func_ctx, align, offset,
bytes, sign, false))
return false;
@ -1926,14 +1947,14 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case WASM_OP_F32_LOAD:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_f32_load(comp_ctx, func_ctx, align, offset))
return false;
break;
case WASM_OP_F64_LOAD:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_f64_load(comp_ctx, func_ctx, align, offset))
return false;
break;
@ -1948,7 +1969,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
bytes = 2;
op_i32_store:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_i32_store(comp_ctx, func_ctx, align, offset,
bytes, false))
return false;
@ -1967,7 +1988,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
bytes = 4;
op_i64_store:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_i64_store(comp_ctx, func_ctx, align, offset,
bytes, false))
return false;
@ -1975,7 +1996,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case WASM_OP_F32_STORE:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_f32_store(comp_ctx, func_ctx, align,
offset))
return false;
@ -1983,7 +2004,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case WASM_OP_F64_STORE:
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_op_f64_store(comp_ctx, func_ctx, align,
offset))
return false;
@ -2540,7 +2561,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
if (opcode != WASM_OP_ATOMIC_FENCE) {
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
}
switch (opcode) {
case WASM_OP_ATOMIC_WAIT32:
@ -2705,7 +2726,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_load:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_v128_load(comp_ctx, func_ctx,
align, offset))
return false;
@ -2720,7 +2741,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_load32x2_u:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_load_extend(
comp_ctx, func_ctx, opcode, align, offset))
return false;
@ -2733,7 +2754,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_load64_splat:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_load_splat(comp_ctx, func_ctx,
opcode, align, offset))
return false;
@ -2743,7 +2764,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_store:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_v128_store(comp_ctx, func_ctx,
align, offset))
return false;
@ -3006,7 +3027,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_load64_lane:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_load_lane(comp_ctx, func_ctx,
opcode, align, offset,
*frame_ip++))
@ -3020,7 +3041,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_store64_lane:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_store_lane(comp_ctx, func_ctx,
opcode, align, offset,
*frame_ip++))
@ -3032,7 +3053,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
case SIMD_v128_load64_zero:
{
read_leb_uint32(frame_ip, frame_ip_end, align);
read_leb_uint32(frame_ip, frame_ip_end, offset);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
if (!aot_compile_simd_load_zero(comp_ctx, func_ctx,
opcode, align, offset))
return false;
@ -3966,7 +3987,7 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
orc_main_dylib = LLVMOrcLLLazyJITGetMainJITDylib(comp_ctx->orc_jit);
if (!orc_main_dylib) {
aot_set_last_error(
"failed to get orc orc_jit main dynmaic library");
"failed to get orc orc_jit main dynamic library");
return false;
}
@ -4191,7 +4212,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
/*
* move the temporary .su file to the specified location.
*
* Note: the former is automatimally inferred from the output
* Note: the former is automatically inferred from the output
* filename (file_name here) by clang.
*
* Note: the latter might be user-specified.
@ -4247,7 +4268,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
#endif /* end of !(defined(_WIN32) || defined(_WIN32_)) */
if (!strncmp(LLVMGetTargetName(target), "arc", 3))
/* Emit to assmelby file instead for arc target
/* Emit to assembly file instead for arc target
as it cannot emit to object file */
file_type = LLVMAssemblyFile;

View File

@ -519,6 +519,14 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
wasm_runtime_free(aot_value); \
} while (0)
#if WASM_ENABLE_MEMORY64 != 0
#define IS_MEMORY64 (comp_ctx->comp_data->memories[0].flags & MEMORY64_FLAG)
#define MEMORY64_COND_VALUE(VAL_IF_ENABLED, VAL_IF_DISABLED) \
(IS_MEMORY64 ? VAL_IF_ENABLED : VAL_IF_DISABLED)
#else
#define MEMORY64_COND_VALUE(VAL_IF_ENABLED, VAL_IF_DISABLED) (VAL_IF_DISABLED)
#endif
#define POP_I32(v) POP(v, VALUE_TYPE_I32)
#define POP_I64(v) POP(v, VALUE_TYPE_I64)
#define POP_F32(v) POP(v, VALUE_TYPE_F32)
@ -527,6 +535,10 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
#define POP_FUNCREF(v) POP(v, VALUE_TYPE_FUNCREF)
#define POP_EXTERNREF(v) POP(v, VALUE_TYPE_EXTERNREF)
#define POP_GC_REF(v) POP(v, VALUE_TYPE_GC_REF)
#define POP_MEM_OFFSET(v) \
POP(v, MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32))
#define POP_PAGE_COUNT(v) \
POP(v, MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32))
#define POP_COND(llvm_value) \
do { \
@ -590,6 +602,16 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
#define PUSH_FUNCREF(v) PUSH(v, VALUE_TYPE_FUNCREF)
#define PUSH_EXTERNREF(v) PUSH(v, VALUE_TYPE_EXTERNREF)
#define PUSH_GC_REF(v) PUSH(v, VALUE_TYPE_GC_REF)
#define PUSH_PAGE_COUNT(v) \
PUSH(v, MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32))
#define SET_CONST(v) \
do { \
AOTValue *aot_value = \
func_ctx->block_stack.block_list_end->value_stack.value_list_end; \
aot_value->is_const = true; \
aot_value->const_value = (v); \
} while (0)
#define TO_LLVM_TYPE(wasm_type) \
wasm_type_to_llvm_type(comp_ctx, &comp_ctx->basic_types, wasm_type)
@ -603,6 +625,7 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
#define INT8_TYPE comp_ctx->basic_types.int8_type
#define INT16_TYPE comp_ctx->basic_types.int16_type
#define INTPTR_T_TYPE comp_ctx->basic_types.intptr_t_type
#define SIZE_T_TYPE comp_ctx->basic_types.size_t_type
#define MD_TYPE comp_ctx->basic_types.meta_data_type
#define INT8_PTR_TYPE comp_ctx->basic_types.int8_ptr_type
#define INT16_PTR_TYPE comp_ctx->basic_types.int16_ptr_type
@ -767,14 +790,6 @@ aot_compile_wasm(AOTCompContext *comp_ctx);
bool
aot_emit_llvm_file(AOTCompContext *comp_ctx, const char *file_name);
bool
aot_emit_aot_file(AOTCompContext *comp_ctx, AOTCompData *comp_data,
const char *file_name);
uint8 *
aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
uint32 *p_aot_file_size);
bool
aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name);

View File

@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "aot_compiler.h"
#include "aot_emit_aot_file.h"
#include "../aot/aot_runtime.h"
#define PUT_U64_TO_ADDR(addr, value) \
@ -112,16 +112,6 @@ is_little_endian_binary(const AOTObjectData *obj_data)
return obj_data->target_info.bin_type & 1 ? false : true;
}
static bool
need_call_wrapped_indirect(const AOTObjectData *obj_data)
{
const bool need_precheck = obj_data->comp_ctx->enable_stack_bound_check
|| obj_data->comp_ctx->enable_stack_estimation;
return obj_data->comp_ctx->is_indirect_mode && need_precheck
&& !strncmp(obj_data->comp_ctx->target_arch, "xtensa", 6);
}
static bool
str_starts_with(const char *str, const char *prefix)
{
@ -199,7 +189,7 @@ get_import_memory_size(AOTCompData *comp_data)
static uint32
get_memory_size(AOTCompData *comp_data)
{
/* memory_count + count * (memory_flags + num_bytes_per_page +
/* memory_count + count * (flags + num_bytes_per_page +
init_page_count + max_page_count) */
return (uint32)(sizeof(uint32)
+ comp_data->memory_count * sizeof(uint32) * 4);
@ -393,11 +383,11 @@ get_import_table_size(const AOTCompContext *comp_ctx,
* | import_table_count
* ------------------------------
* | | U8 elem_type
* | | U8 table_flags
* | | U8 flags
* | | U8 possible_grow
* | AOTImportTable[N] | U8 elem_ref_type.nullable (for GC only)
* | | U32 table_init_size
* | | U32 table_max_size
* | | U32 init_size
* | | U32 max_size
* | | U32 elem_ref_type.heap_type (for GC only)
* ------------------------------
*/
@ -407,7 +397,8 @@ get_import_table_size(const AOTCompContext *comp_ctx,
for (i = 0; i < comp_data->import_table_count; i++) {
size += sizeof(uint32) * 3;
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc && comp_data->import_tables[i].elem_ref_type)
if (comp_ctx->enable_gc
&& comp_data->import_tables[i].table_type.elem_ref_type)
size += sizeof(uint32);
#endif
}
@ -422,11 +413,11 @@ get_table_size(const AOTCompContext *comp_ctx, const AOTCompData *comp_data)
* | table_count
* ------------------------------
* | | U8 elem_type
* | | U8 table_flags
* | | U8 flags
* | | U8 possible_grow
* | AOTTable[N] | U8 elem_ref_type.nullable (for GC only)
* | | U32 table_init_size
* | | U32 table_max_size
* | | U32 init_size
* | | U32 max_size
* | | U32 elem_ref_type.heap_type (for GC only)
* | | N init_expr (for GC only)
* ------------------------------
@ -438,7 +429,7 @@ get_table_size(const AOTCompContext *comp_ctx, const AOTCompData *comp_data)
size += sizeof(uint32) * 3;
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc) {
if (comp_data->tables[i].elem_ref_type) {
if (comp_data->tables[i].table_type.elem_ref_type) {
size += sizeof(uint32);
}
size += get_init_expr_size(comp_ctx, comp_data,
@ -828,10 +819,6 @@ get_func_section_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
/* function type indexes */
size += (uint32)sizeof(uint32) * comp_data->func_count;
/* aot_func#xxx + aot_func_internal#xxx in XIP mode for xtensa */
if (need_call_wrapped_indirect(obj_data))
size *= 2;
/* max_local_cell_nums */
size += (uint32)sizeof(uint32) * comp_data->func_count;
@ -1203,9 +1190,9 @@ get_string_literal_section_size(AOTCompContext *comp_ctx,
static uint32
get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data);
static uint32
get_aot_file_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data)
uint32
aot_get_aot_file_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data)
{
uint32 size = 0;
uint32 size_custom_section = 0;
@ -1776,10 +1763,10 @@ aot_emit_mem_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
EMIT_U32(comp_data->memory_count);
/* Emit memory items */
for (i = 0; i < comp_data->memory_count; i++) {
EMIT_U32(comp_data->memories[i].memory_flags);
EMIT_U32(comp_data->memories[i].flags);
EMIT_U32(comp_data->memories[i].num_bytes_per_page);
EMIT_U32(comp_data->memories[i].mem_init_page_count);
EMIT_U32(comp_data->memories[i].mem_max_page_count);
EMIT_U32(comp_data->memories[i].init_page_count);
EMIT_U32(comp_data->memories[i].max_page_count);
}
/* Emit mem init data count */
@ -1969,13 +1956,14 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
* EMIT_STR(comp_data->import_tables[i].module_name );
* EMIT_STR(comp_data->import_tables[i].table_name);
*/
EMIT_U8(comp_data->import_tables[i].elem_type);
EMIT_U8(comp_data->import_tables[i].table_flags);
EMIT_U8(comp_data->import_tables[i].possible_grow);
EMIT_U8(comp_data->import_tables[i].table_type.elem_type);
EMIT_U8(comp_data->import_tables[i].table_type.flags);
EMIT_U8(comp_data->import_tables[i].table_type.possible_grow);
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc && comp_data->import_tables[i].elem_ref_type) {
if (comp_ctx->enable_gc
&& comp_data->import_tables[i].table_type.elem_ref_type) {
EMIT_U8(comp_data->import_tables[i]
.elem_ref_type->ref_ht_common.nullable);
.table_type.elem_ref_type->ref_ht_common.nullable);
}
else
#endif
@ -1983,14 +1971,15 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
/* emit one placeholder to keep the same size */
EMIT_U8(0);
}
EMIT_U32(comp_data->import_tables[i].table_init_size);
EMIT_U32(comp_data->import_tables[i].table_max_size);
EMIT_U32(comp_data->import_tables[i].table_type.init_size);
EMIT_U32(comp_data->import_tables[i].table_type.max_size);
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc && comp_data->import_tables[i].elem_ref_type) {
if (comp_ctx->enable_gc
&& comp_data->import_tables[i].table_type.elem_ref_type) {
bh_assert(wasm_is_type_multi_byte_type(
comp_data->import_tables[i].elem_type));
comp_data->import_tables[i].table_type.elem_type));
EMIT_U32(comp_data->import_tables[i]
.elem_ref_type->ref_ht_common.heap_type);
.table_type.elem_ref_type->ref_ht_common.heap_type);
}
#endif
}
@ -1999,12 +1988,14 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
EMIT_U32(comp_data->table_count);
/* Emit table items */
for (i = 0; i < comp_data->table_count; i++) {
EMIT_U8(comp_data->tables[i].elem_type);
EMIT_U8(comp_data->tables[i].table_flags);
EMIT_U8(comp_data->tables[i].possible_grow);
EMIT_U8(comp_data->tables[i].table_type.elem_type);
EMIT_U8(comp_data->tables[i].table_type.flags);
EMIT_U8(comp_data->tables[i].table_type.possible_grow);
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc && comp_data->tables[i].elem_ref_type) {
EMIT_U8(comp_data->tables[i].elem_ref_type->ref_ht_common.nullable);
if (comp_ctx->enable_gc
&& comp_data->tables[i].table_type.elem_ref_type) {
EMIT_U8(comp_data->tables[i]
.table_type.elem_ref_type->ref_ht_common.nullable);
}
else
#endif
@ -2012,15 +2003,16 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
/* emit one placeholder to keep the same size */
EMIT_U8(0);
}
EMIT_U32(comp_data->tables[i].table_init_size);
EMIT_U32(comp_data->tables[i].table_max_size);
EMIT_U32(comp_data->tables[i].table_type.init_size);
EMIT_U32(comp_data->tables[i].table_type.max_size);
#if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc) {
if (comp_data->tables[i].elem_ref_type) {
if (comp_data->tables[i].table_type.elem_ref_type) {
bh_assert(wasm_is_type_multi_byte_type(
comp_data->tables[i].elem_type));
EMIT_U32(comp_data->tables[i]
.elem_ref_type->ref_ht_common.heap_type);
comp_data->tables[i].table_type.elem_type));
EMIT_U32(
comp_data->tables[i]
.table_type.elem_ref_type->ref_ht_common.heap_type);
}
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
&comp_data->tables[i].init_expr)) {
@ -2241,8 +2233,8 @@ aot_emit_import_global_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
for (i = 0; i < comp_data->import_global_count; i++, import_global++) {
offset = align_uint(offset, 2);
EMIT_U8(import_global->type);
EMIT_U8(import_global->is_mutable);
EMIT_U8(import_global->type.val_type);
EMIT_U8(import_global->type.is_mutable);
EMIT_STR(import_global->module_name);
offset = align_uint(offset, 2);
EMIT_STR(import_global->global_name);
@ -2273,8 +2265,8 @@ aot_emit_global_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
for (i = 0; i < comp_data->global_count; i++, global++) {
offset = align_uint(offset, 4);
EMIT_U8(global->type);
EMIT_U8(global->is_mutable);
EMIT_U8(global->type.val_type);
EMIT_U8(global->type.is_mutable);
offset = align_uint(offset, 4);
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
@ -2590,30 +2582,9 @@ aot_emit_func_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
EMIT_U64(func->text_offset);
}
if (need_call_wrapped_indirect(obj_data)) {
/*
* Explicitly emit aot_func_internal#xxx for Xtensa XIP, therefore,
* for aot_func#xxx, func_indexes ranged from 0 ~ func_count,
* for aot_func_internal#xxxx, from func_count + 1 ~ 2 * func_count.
*/
for (i = 0, func = obj_data->funcs; i < obj_data->func_count;
i++, func++) {
if (is_32bit_binary(obj_data))
EMIT_U32(func->text_offset_of_aot_func_internal);
else
EMIT_U64(func->text_offset_of_aot_func_internal);
}
}
for (i = 0; i < comp_data->func_count; i++)
EMIT_U32(funcs[i]->func_type_index);
if (need_call_wrapped_indirect(obj_data)) {
/* func_type_index for aot_func_internal#xxxx */
for (i = 0; i < comp_data->func_count; i++)
EMIT_U32(funcs[i]->func_type_index);
}
for (i = 0; i < comp_data->func_count; i++) {
uint32 max_local_cell_num =
funcs[i]->param_cell_num + funcs[i]->local_cell_num;
@ -3067,15 +3038,18 @@ typedef struct elf64_rela {
elf64_sxword r_addend;
} elf64_rela;
#define SET_TARGET_INFO(f, v, type, little) \
do { \
type tmp = elf_header->v; \
if ((little && !is_little_endian()) \
|| (!little && is_little_endian())) \
exchange_##type((uint8 *)&tmp); \
obj_data->target_info.f = tmp; \
#define SET_TARGET_INFO_VALUE(f, val, type, little) \
do { \
type tmp = val; \
if ((little && !is_little_endian()) \
|| (!little && is_little_endian())) \
exchange_##type((uint8 *)&tmp); \
obj_data->target_info.f = tmp; \
} while (0)
#define SET_TARGET_INFO_FIELD(f, v, type, little) \
SET_TARGET_INFO_VALUE(f, elf_header->v, type, little)
static bool
aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
{
@ -3090,7 +3064,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
&& bin_type != LLVMBinaryTypeMachO32B
&& bin_type != LLVMBinaryTypeMachO64L
&& bin_type != LLVMBinaryTypeMachO64B) {
aot_set_last_error("invaid llvm binary bin_type.");
aot_set_last_error("invalid llvm binary bin_type.");
return false;
}
@ -3125,6 +3099,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
|| bin_type == LLVMBinaryTypeELF32B) {
struct elf32_ehdr *elf_header;
bool is_little_bin = bin_type == LLVMBinaryTypeELF32L;
uint16 e_type;
if (!elf_buf || elf_size < sizeof(struct elf32_ehdr)) {
aot_set_last_error("invalid elf32 buffer.");
@ -3132,20 +3107,22 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
}
elf_header = (struct elf32_ehdr *)elf_buf;
e_type = elf_header->e_type;
/* Emit eXecute In Place file type while in indirect mode */
if (comp_ctx->is_indirect_mode)
elf_header->e_type = E_TYPE_XIP;
e_type = E_TYPE_XIP;
SET_TARGET_INFO(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO(e_flags, e_flags, uint32, is_little_bin);
SET_TARGET_INFO_VALUE(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO_FIELD(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO_FIELD(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO_FIELD(e_flags, e_flags, uint32, is_little_bin);
}
else if (bin_type == LLVMBinaryTypeELF64L
|| bin_type == LLVMBinaryTypeELF64B) {
struct elf64_ehdr *elf_header;
bool is_little_bin = bin_type == LLVMBinaryTypeELF64L;
uint16 e_type;
if (!elf_buf || elf_size < sizeof(struct elf64_ehdr)) {
aot_set_last_error("invalid elf64 buffer.");
@ -3153,26 +3130,27 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
}
elf_header = (struct elf64_ehdr *)elf_buf;
e_type = elf_header->e_type;
/* Emit eXecute In Place file type while in indirect mode */
if (comp_ctx->is_indirect_mode)
elf_header->e_type = E_TYPE_XIP;
e_type = E_TYPE_XIP;
SET_TARGET_INFO(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO(e_flags, e_flags, uint32, is_little_bin);
SET_TARGET_INFO_VALUE(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO_FIELD(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO_FIELD(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO_FIELD(e_flags, e_flags, uint32, is_little_bin);
}
else if (bin_type == LLVMBinaryTypeMachO32L
|| bin_type == LLVMBinaryTypeMachO32B) {
/* TODO: parse file type of Mach-O 32 */
aot_set_last_error("invaid llvm binary bin_type.");
aot_set_last_error("invalid llvm binary bin_type.");
return false;
}
else if (bin_type == LLVMBinaryTypeMachO64L
|| bin_type == LLVMBinaryTypeMachO64B) {
/* TODO: parse file type of Mach-O 64 */
aot_set_last_error("invaid llvm binary bin_type.");
aot_set_last_error("invalid llvm binary bin_type.");
return false;
}
@ -4263,7 +4241,7 @@ destroy_relocation_symbol_list(AOTSymbolList *symbol_list)
}
}
static void
void
aot_obj_data_destroy(AOTObjectData *obj_data)
{
if (obj_data->binary)
@ -4296,7 +4274,7 @@ aot_obj_data_destroy(AOTObjectData *obj_data)
wasm_runtime_free(obj_data);
}
static AOTObjectData *
AOTObjectData *
aot_obj_data_create(AOTCompContext *comp_ctx)
{
char *err = NULL;
@ -4478,25 +4456,48 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
uint32 *p_aot_file_size)
{
AOTObjectData *obj_data = aot_obj_data_create(comp_ctx);
uint8 *aot_file_buf, *buf, *buf_end;
uint32 aot_file_size, offset = 0;
uint8 *aot_file_buf;
uint32 aot_file_size;
if (!obj_data)
return NULL;
aot_file_size = get_aot_file_size(comp_ctx, comp_data, obj_data);
aot_file_size = aot_get_aot_file_size(comp_ctx, comp_data, obj_data);
if (aot_file_size == 0) {
aot_set_last_error("get aot file size failed");
goto fail1;
}
if (!(buf = aot_file_buf = wasm_runtime_malloc(aot_file_size))) {
if (!(aot_file_buf = wasm_runtime_malloc(aot_file_size))) {
aot_set_last_error("allocate memory failed.");
goto fail1;
}
memset(aot_file_buf, 0, aot_file_size);
buf_end = buf + aot_file_size;
if (!aot_emit_aot_file_buf_ex(comp_ctx, comp_data, obj_data, aot_file_buf,
aot_file_size))
goto fail2;
*p_aot_file_size = aot_file_size;
aot_obj_data_destroy(obj_data);
return aot_file_buf;
fail2:
wasm_runtime_free(aot_file_buf);
fail1:
aot_obj_data_destroy(obj_data);
return NULL;
}
bool
aot_emit_aot_file_buf_ex(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data, uint8 *buf,
uint32 aot_file_size)
{
uint8 *buf_end = buf + aot_file_size;
uint32 offset = 0;
if (!aot_emit_file_header(buf, buf_end, &offset, comp_data, obj_data)
|| !aot_emit_target_info_section(buf, buf_end, &offset, comp_data,
@ -4517,7 +4518,7 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
comp_ctx)
#endif
)
goto fail2;
return false;
#if 0
dump_buf(buf, offset, "sections");
@ -4525,20 +4526,10 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
if (offset != aot_file_size) {
aot_set_last_error("emit aot file failed.");
goto fail2;
return false;
}
*p_aot_file_size = aot_file_size;
aot_obj_data_destroy(obj_data);
return aot_file_buf;
fail2:
wasm_runtime_free(aot_file_buf);
fail1:
aot_obj_data_destroy(obj_data);
return NULL;
return true;
}
bool

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef _AOT_EMIT_AOT_FILE_H_
#define _AOT_EMIT_AOT_FILE_H_
#include "aot_compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct AOTObjectData AOTObjectData;
AOTObjectData *
aot_obj_data_create(AOTCompContext *comp_ctx);
void
aot_obj_data_destroy(AOTObjectData *obj_data);
uint32
aot_get_aot_file_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data);
bool
aot_emit_aot_file(AOTCompContext *comp_ctx, AOTCompData *comp_data,
const char *file_name);
uint8 *
aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
uint32 *p_aot_file_size);
bool
aot_emit_aot_file_buf_ex(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data, uint8 *aot_file_buf,
uint32 aot_file_size);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* end of _AOT_EMIT_AOT_FILE_H_ */

View File

@ -28,6 +28,7 @@ aot_compile_op_i32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
PUSH_I32(value);
SET_CONST((uint64)(uint32)i32_const);
return true;
fail:
return false;
@ -55,6 +56,7 @@ aot_compile_op_i64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
PUSH_I64(value);
SET_CONST((uint64)i64_const);
return true;
fail:
return false;
@ -66,23 +68,21 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef alloca, value;
if (!isnan(f32_const)) {
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f32.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f32, &f32_const, sizeof(float32));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F32);
if (!value) {
return false;
}
PUSH_F32(value);
}
else {
value = F32_CONST(f32_const);
CHECK_LLVM_CONST(value);
PUSH_F32(value);
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f32.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f32, &f32_const, sizeof(float32));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F32);
if (!value) {
return false;
}
PUSH_F32(value);
}
else if (!isnan(f32_const)) {
value = F32_CONST(f32_const);
CHECK_LLVM_CONST(value);
PUSH_F32(value);
}
else {
int32 i32_const;
@ -121,23 +121,21 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef alloca, value;
if (!isnan(f64_const)) {
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f64.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f64, &f64_const, sizeof(float64));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F64);
if (!value) {
return false;
}
PUSH_F64(value);
}
else {
value = F64_CONST(f64_const);
CHECK_LLVM_CONST(value);
PUSH_F64(value);
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f64.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f64, &f64_const, sizeof(float64));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F64);
if (!value) {
return false;
}
PUSH_F64(value);
}
else if (!isnan(f64_const)) {
value = F64_CONST(f64_const);
CHECK_LLVM_CONST(value);
PUSH_F64(value);
}
else {
int64 i64_const;

View File

@ -853,7 +853,7 @@ check_suspend_flags(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMBasicBlockRef terminate_block, non_terminate_block;
AOTFuncType *aot_func_type = func_ctx->aot_func->func_type;
bool is_shared_memory =
comp_ctx->comp_data->memories[0].memory_flags & 0x02 ? true : false;
comp_ctx->comp_data->memories[0].flags & 0x02 ? true : false;
/* Only need to check the suspend flags when memory is shared since
shared memory must be enabled for multi-threading */

View File

@ -2125,7 +2125,7 @@ aot_compile_op_call_indirect(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
if (!(table_size_const =
LLVMBuildBitCast(comp_ctx->builder, table_size_const,
INT32_PTR_TYPE, "cur_siuze_i32p"))) {
INT32_PTR_TYPE, "cur_size_i32p"))) {
HANDLE_FAILURE("LLVMBuildBitCast");
goto fail;
}

View File

@ -569,7 +569,7 @@ aot_compile_op_struct_new(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
SET_BUILDER_POS(check_struct_obj_succ);
/* For WASM_OP_STRUCT_NEW, init filed with poped value */
/* For WASM_OP_STRUCT_NEW, init field with poped value */
if (!init_with_default
&& !struct_new_canon_init_fields(comp_ctx, func_ctx, type_index,
struct_obj)) {

View File

@ -38,6 +38,20 @@
#define SET_BUILD_POS(block) LLVMPositionBuilderAtEnd(comp_ctx->builder, block)
static bool
zero_extend_u64(AOTCompContext *comp_ctx, LLVMValueRef *value, const char *name)
{
if (comp_ctx->pointer_size == sizeof(uint64)) {
/* zero extend to uint64 if the target is 64-bit */
*value = LLVMBuildZExt(comp_ctx->builder, *value, I64_TYPE, name);
if (!*value) {
aot_set_last_error("llvm build zero extend failed.");
return false;
}
}
return true;
}
static LLVMValueRef
get_memory_check_bound(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 bytes)
@ -77,34 +91,65 @@ get_memory_check_bound(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return mem_check_bound;
}
#if defined(_WIN32) || defined(_WIN32_)
static inline int
ffs(int n)
{
int pos = 0;
if (n == 0)
return 0;
while (!(n & 1)) {
pos++;
n >>= 1;
}
return pos + 1;
}
#endif
static LLVMValueRef
get_memory_curr_page_count(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
LLVMValueRef
aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 offset, uint32 bytes, bool enable_segue)
mem_offset_t offset, uint32 bytes, bool enable_segue,
unsigned int *alignp)
{
LLVMValueRef offset_const = I32_CONST(offset);
LLVMValueRef offset_const =
MEMORY64_COND_VALUE(I64_CONST(offset), I32_CONST(offset));
LLVMValueRef addr, maddr, offset1, cmp1, cmp2, cmp;
LLVMValueRef mem_base_addr, mem_check_bound;
LLVMBasicBlockRef block_curr = LLVMGetInsertBlock(comp_ctx->builder);
LLVMBasicBlockRef check_succ;
AOTValue *aot_value_top;
uint32 local_idx_of_aot_value = 0;
uint64 const_value;
bool is_target_64bit, is_local_of_aot_value = false;
bool is_const = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
bool is_shared_memory =
comp_ctx->comp_data->memories[0].memory_flags & 0x02;
comp_ctx->comp_data->memories[0].flags & SHARED_MEMORY_FLAG;
#endif
is_target_64bit = (comp_ctx->pointer_size == sizeof(uint64)) ? true : false;
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "i32.const")) {
&& aot_intrinsic_check_capability(
comp_ctx, MEMORY64_COND_VALUE("i64.const", "i32.const"))) {
WASMValue wasm_value;
wasm_value.i32 = offset;
#if WASM_ENABLE_MEMORY64 != 0
if (IS_MEMORY64) {
wasm_value.i64 = offset;
}
else
#endif
{
wasm_value.i32 = (int32)offset;
}
offset_const = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_I32);
comp_ctx, func_ctx->native_symbol, &wasm_value,
MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32));
if (!offset_const) {
return NULL;
}
@ -136,29 +181,57 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* aot_value_top is freed in the following POP_I32(addr),
so save its fields here for further use */
is_local_of_aot_value = aot_value_top->is_local;
is_const = aot_value_top->is_const;
local_idx_of_aot_value = aot_value_top->local_idx;
const_value = aot_value_top->const_value;
}
POP_I32(addr);
POP_MEM_OFFSET(addr);
/*
* 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 */
if (LLVMIsEfficientConstInt(addr)) {
uint64 mem_offset =
(uint64)LLVMConstIntGetZExtValue(addr) + (uint64)offset;
/* return address directly if constant offset and inside memory space */
if (LLVMIsEfficientConstInt(addr) || is_const) {
uint64 value;
if (LLVMIsEfficientConstInt(addr)) {
value = (uint64)LLVMConstIntGetZExtValue(addr);
}
else {
value = const_value;
}
uint64 mem_offset = value + (uint64)offset;
uint32 num_bytes_per_page =
comp_ctx->comp_data->memories[0].num_bytes_per_page;
uint32 init_page_count =
comp_ctx->comp_data->memories[0].mem_init_page_count;
comp_ctx->comp_data->memories[0].init_page_count;
uint64 mem_data_size = (uint64)num_bytes_per_page * init_page_count;
if (alignp != NULL) {
/*
* A note about max_align below:
* the assumption here is the base address of a linear memory
* has the natural alignment. for platforms using mmap, it can
* be even larger. for now, use a conservative value.
*/
const unsigned int max_align = 8;
int shift = ffs((int)(unsigned int)mem_offset);
if (shift == 0) {
*alignp = max_align;
}
else {
unsigned int align = 1 << (shift - 1);
if (align > max_align) {
align = max_align;
}
*alignp = align;
}
}
if (mem_offset + bytes <= mem_data_size) {
/* inside memory space */
if (comp_ctx->pointer_size == sizeof(uint64))
offset1 = I64_CONST((uint32)mem_offset);
offset1 = I64_CONST(mem_offset);
else
offset1 = I32_CONST((uint32)mem_offset);
CHECK_LLVM_CONST(offset1);
@ -180,6 +253,9 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return maddr;
}
}
else if (alignp != NULL) {
*alignp = 1;
}
if (is_target_64bit) {
if (!(offset_const = LLVMBuildZExt(comp_ctx->builder, offset_const,
@ -199,14 +275,15 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
&& aot_checked_addr_list_find(func_ctx, local_idx_of_aot_value,
offset, bytes))) {
uint32 init_page_count =
comp_ctx->comp_data->memories[0].mem_init_page_count;
comp_ctx->comp_data->memories[0].init_page_count;
if (init_page_count == 0) {
LLVMValueRef mem_size;
if (!(mem_size = get_memory_curr_page_count(comp_ctx, func_ctx))) {
goto fail;
}
BUILD_ICMP(LLVMIntEQ, mem_size, I32_ZERO, cmp, "is_zero");
BUILD_ICMP(LLVMIntEQ, mem_size,
MEMORY64_COND_VALUE(I64_ZERO, I32_ZERO), cmp, "is_zero");
ADD_BASIC_BLOCK(check_succ, "check_mem_size_succ");
LLVMMoveBasicBlockAfter(check_succ, block_curr);
if (!aot_emit_exception(comp_ctx, func_ctx,
@ -298,7 +375,7 @@ fail:
aot_set_last_error("llvm build load failed."); \
goto fail; \
} \
LLVMSetAlignment(value, 1); \
LLVMSetAlignment(value, known_align); \
} while (0)
#define BUILD_TRUNC(value, data_type) \
@ -317,7 +394,7 @@ fail:
aot_set_last_error("llvm build store failed."); \
goto fail; \
} \
LLVMSetAlignment(res, 1); \
LLVMSetAlignment(res, known_align); \
} while (0)
#define BUILD_SIGN_EXT(dst_type) \
@ -412,15 +489,16 @@ fail:
bool
aot_compile_op_i32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool sign,
bool atomic)
uint32 align, mem_offset_t offset, uint32 bytes,
bool sign, bool atomic)
{
LLVMValueRef maddr, value = NULL;
LLVMTypeRef data_type;
bool enable_segue = comp_ctx->enable_segue_i32_load;
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, &known_align)))
return false;
switch (bytes) {
@ -482,15 +560,16 @@ fail:
bool
aot_compile_op_i64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool sign,
bool atomic)
uint32 align, mem_offset_t offset, uint32 bytes,
bool sign, bool atomic)
{
LLVMValueRef maddr, value = NULL;
LLVMTypeRef data_type;
bool enable_segue = comp_ctx->enable_segue_i64_load;
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, &known_align)))
return false;
switch (bytes) {
@ -560,13 +639,14 @@ fail:
bool
aot_compile_op_f32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f32_load;
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 4,
enable_segue)))
enable_segue, &known_align)))
return false;
if (!enable_segue)
@ -583,13 +663,14 @@ fail:
bool
aot_compile_op_f64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f64_load;
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 8,
enable_segue)))
enable_segue, &known_align)))
return false;
if (!enable_segue)
@ -606,15 +687,17 @@ fail:
bool
aot_compile_op_i32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool atomic)
uint32 align, mem_offset_t offset, uint32 bytes,
bool atomic)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_i32_store;
POP_I32(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, &known_align)))
return false;
switch (bytes) {
@ -656,15 +739,17 @@ fail:
bool
aot_compile_op_i64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool atomic)
uint32 align, mem_offset_t offset, uint32 bytes,
bool atomic)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_i64_store;
POP_I64(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, &known_align)))
return false;
switch (bytes) {
@ -713,15 +798,16 @@ fail:
bool
aot_compile_op_f32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f32_store;
POP_F32(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 4,
enable_segue)))
enable_segue, &known_align)))
return false;
if (!enable_segue)
@ -736,15 +822,16 @@ fail:
bool
aot_compile_op_f64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f64_store;
POP_F64(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 8,
enable_segue)))
enable_segue, &known_align)))
return false;
if (!enable_segue)
@ -774,7 +861,8 @@ get_memory_curr_page_count(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
}
}
return mem_size;
return LLVMBuildIntCast(comp_ctx->builder, mem_size,
MEMORY64_COND_VALUE(I64_TYPE, I32_TYPE), "");
fail:
return NULL;
}
@ -785,7 +873,7 @@ aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
LLVMValueRef mem_size = get_memory_curr_page_count(comp_ctx, func_ctx);
if (mem_size)
PUSH_I32(mem_size);
PUSH_PAGE_COUNT(mem_size);
return mem_size ? true : false;
fail:
return false;
@ -798,12 +886,16 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
LLVMValueRef delta, param_values[2], ret_value, func, value;
LLVMTypeRef param_types[2], ret_type, func_type, func_ptr_type;
int32 func_index;
#if WASM_ENABLE_MEMORY64 != 0
LLVMValueRef u32_max, u32_cmp_result;
#endif
if (!mem_size)
return false;
POP_I32(delta);
POP_PAGE_COUNT(delta);
/* TODO: multi-memory aot_enlarge_memory_with_idx() */
/* Function type of aot_enlarge_memory() */
param_types[0] = INT8_PTR_TYPE;
param_types[1] = I32_TYPE;
@ -854,7 +946,7 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
/* Call function aot_enlarge_memory() */
param_values[0] = func_ctx->aot_inst;
param_values[1] = delta;
param_values[1] = LLVMBuildTrunc(comp_ctx->builder, delta, I32_TYPE, "");
if (!(ret_value = LLVMBuildCall2(comp_ctx->builder, func_type, func,
param_values, 2, "call"))) {
aot_set_last_error("llvm build call failed.");
@ -862,15 +954,26 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
}
BUILD_ICMP(LLVMIntUGT, ret_value, I8_ZERO, ret_value, "mem_grow_ret");
#if WASM_ENABLE_MEMORY64 != 0
if (IS_MEMORY64) {
if (!(u32_max = I64_CONST(UINT32_MAX))) {
aot_set_last_error("llvm build const failed");
return false;
}
BUILD_ICMP(LLVMIntULE, delta, u32_max, u32_cmp_result, "page_size_cmp");
BUILD_OP(And, ret_value, u32_cmp_result, ret_value, "and");
}
#endif
/* ret_value = ret_value == true ? delta : pre_page_count */
if (!(ret_value = LLVMBuildSelect(comp_ctx->builder, ret_value, mem_size,
I32_NEG_ONE, "mem_grow_ret"))) {
/* ret_value = ret_value == true ? pre_page_count : -1 */
if (!(ret_value = LLVMBuildSelect(
comp_ctx->builder, ret_value, mem_size,
MEMORY64_COND_VALUE(I64_NEG_ONE, I32_NEG_ONE), "mem_grow_ret"))) {
aot_set_last_error("llvm build select failed.");
return false;
}
PUSH_I32(ret_value);
PUSH_PAGE_COUNT(ret_value);
return true;
fail:
return false;
@ -889,8 +992,7 @@ check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* Get memory base address and memory data size */
#if WASM_ENABLE_SHARED_MEMORY != 0
bool is_shared_memory =
comp_ctx->comp_data->memories[0].memory_flags & 0x02;
bool is_shared_memory = comp_ctx->comp_data->memories[0].flags & 0x02;
if (func_ctx->mem_space_unchanged || is_shared_memory) {
#else
@ -918,7 +1020,7 @@ check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 num_bytes_per_page =
comp_ctx->comp_data->memories[0].num_bytes_per_page;
uint32 init_page_count =
comp_ctx->comp_data->memories[0].mem_init_page_count;
comp_ctx->comp_data->memories[0].init_page_count;
uint64 mem_data_size = (uint64)num_bytes_per_page * init_page_count;
if (mem_data_size > 0 && mem_offset + mem_len <= mem_data_size) {
/* inside memory space */
@ -987,13 +1089,17 @@ aot_compile_op_memory_init(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_I32(len);
POP_I32(offset);
POP_I32(dst);
POP_MEM_OFFSET(dst);
if (!zero_extend_u64(comp_ctx, &dst, "dst64")) {
return false;
}
param_types[0] = INT8_PTR_TYPE;
param_types[1] = I32_TYPE;
param_types[2] = I32_TYPE;
param_types[3] = I32_TYPE;
param_types[4] = I32_TYPE;
param_types[4] = SIZE_T_TYPE;
ret_type = INT8_TYPE;
if (comp_ctx->is_jit_mode)
@ -1080,9 +1186,9 @@ aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
LLVMValueRef src, dst, src_addr, dst_addr, len, res;
bool call_aot_memmove = false;
POP_I32(len);
POP_I32(src);
POP_I32(dst);
POP_MEM_OFFSET(len);
POP_MEM_OFFSET(src);
POP_MEM_OFFSET(dst);
if (!(src_addr = check_bulk_memory_overflow(comp_ctx, func_ctx, src, len)))
return false;
@ -1090,6 +1196,10 @@ aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
if (!(dst_addr = check_bulk_memory_overflow(comp_ctx, func_ctx, dst, len)))
return false;
if (!zero_extend_u64(comp_ctx, &len, "len64")) {
return false;
}
call_aot_memmove = comp_ctx->is_indirect_mode || comp_ctx->is_jit_mode;
if (call_aot_memmove) {
LLVMTypeRef param_types[3], ret_type, func_type, func_ptr_type;
@ -1097,7 +1207,7 @@ aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
param_types[0] = INT8_PTR_TYPE;
param_types[1] = INT8_PTR_TYPE;
param_types[2] = I32_TYPE;
param_types[2] = SIZE_T_TYPE;
ret_type = INT8_PTR_TYPE;
if (!(func_type = LLVMFunctionType(ret_type, param_types, 3, false))) {
@ -1165,16 +1275,20 @@ aot_compile_op_memory_fill(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
LLVMTypeRef param_types[3], ret_type, func_type, func_ptr_type;
LLVMValueRef func, params[3];
POP_I32(len);
POP_MEM_OFFSET(len);
POP_I32(val);
POP_I32(dst);
POP_MEM_OFFSET(dst);
if (!(dst_addr = check_bulk_memory_overflow(comp_ctx, func_ctx, dst, len)))
return false;
if (!zero_extend_u64(comp_ctx, &len, "len64")) {
return false;
}
param_types[0] = INT8_PTR_TYPE;
param_types[1] = I32_TYPE;
param_types[2] = I32_TYPE;
param_types[2] = SIZE_T_TYPE;
ret_type = INT8_PTR_TYPE;
if (!(func_type = LLVMFunctionType(ret_type, param_types, 3, false))) {
@ -1233,7 +1347,7 @@ fail:
bool
aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 atomic_op, uint8 op_type, uint32 align,
uint32 offset, uint32 bytes)
mem_offset_t offset, uint32 bytes)
{
LLVMValueRef maddr, value, result;
bool enable_segue = (op_type == VALUE_TYPE_I32)
@ -1248,7 +1362,7 @@ aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_I64(value);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, NULL)))
return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1319,7 +1433,7 @@ fail:
bool
aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, uint8 op_type,
uint32 align, uint32 offset, uint32 bytes)
uint32 align, mem_offset_t offset, uint32 bytes)
{
LLVMValueRef maddr, value, expect, result;
bool enable_segue = (op_type == VALUE_TYPE_I32)
@ -1338,7 +1452,7 @@ aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
}
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue)))
enable_segue, NULL)))
return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1392,7 +1506,7 @@ aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
LLVMSetVolatile(result, true);
/* CmpXchg return {i32, i1} structure,
we need to extrack the previous_value from the structure */
we need to extract the previous_value from the structure */
if (!(result = LLVMBuildExtractValue(comp_ctx->builder, result, 0,
"previous_value"))) {
goto fail;
@ -1424,7 +1538,7 @@ fail:
bool
aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 op_type, uint32 align, uint32 offset,
uint8 op_type, uint32 align, mem_offset_t offset,
uint32 bytes)
{
LLVMValueRef maddr, value, timeout, expect, cmp;
@ -1451,7 +1565,7 @@ aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
CHECK_LLVM_CONST(is_wait64);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
false)))
false, NULL)))
return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1516,7 +1630,7 @@ fail:
bool
aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, uint32 align,
uint32 offset, uint32 bytes)
mem_offset_t offset, uint32 bytes)
{
LLVMValueRef maddr, value, count;
LLVMValueRef param_values[3], ret_value, func;
@ -1525,7 +1639,7 @@ aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
POP_I32(count);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
false)))
false, NULL)))
return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))

View File

@ -17,43 +17,44 @@ extern "C" {
bool
aot_compile_op_i32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool sign,
bool atomic);
uint32 align, mem_offset_t offset, uint32 bytes,
bool sign, bool atomic);
bool
aot_compile_op_i64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes, bool sign,
bool atomic);
uint32 align, mem_offset_t offset, uint32 bytes,
bool sign, bool atomic);
bool
aot_compile_op_f32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
bool
aot_compile_op_f64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
bool
aot_compile_op_i32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes,
uint32 align, mem_offset_t offset, uint32 bytes,
bool atomic);
bool
aot_compile_op_i64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset, uint32 bytes,
uint32 align, mem_offset_t offset, uint32 bytes,
bool atomic);
bool
aot_compile_op_f32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
bool
aot_compile_op_f64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
LLVMValueRef
aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 offset, uint32 bytes, bool enable_segue);
mem_offset_t offset, uint32 bytes, bool enable_segue,
unsigned int *alignp);
bool
aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
@ -89,22 +90,22 @@ aot_compile_op_memory_fill(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
bool
aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 atomic_op, uint8 op_type, uint32 align,
uint32 offset, uint32 bytes);
mem_offset_t offset, uint32 bytes);
bool
aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, uint8 op_type,
uint32 align, uint32 offset, uint32 bytes);
uint32 align, mem_offset_t offset, uint32 bytes);
bool
aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 op_type, uint32 align, uint32 offset,
uint8 op_type, uint32 align, mem_offset_t offset,
uint32 bytes);
bool
aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, uint32 align,
uint32 offset, uint32 bytes);
mem_offset_t offset, uint32 bytes);
bool
aot_compiler_op_atomic_fence(AOTCompContext *comp_ctx,

View File

@ -228,6 +228,7 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
bool is_f32, LLVMValueRef left, LLVMValueRef right,
bool is_min)
{
LLVMTypeRef float_param_types[2];
LLVMTypeRef param_types[2], ret_type = is_f32 ? F32_TYPE : F64_TYPE,
int_type = is_f32 ? I32_TYPE : I64_TYPE;
LLVMValueRef cmp, is_eq, is_nan, ret, left_int, right_int, tmp,
@ -236,7 +237,9 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
: (is_f32 ? "llvm.maxnum.f32" : "llvm.maxnum.f64");
CHECK_LLVM_CONST(nan);
param_types[0] = param_types[1] = ret_type;
/* Note: param_types is used by LLVM_BUILD_OP_OR_INTRINSIC */
param_types[0] = param_types[1] = int_type;
float_param_types[0] = float_param_types[1] = ret_type;
if (comp_ctx->disable_llvm_intrinsics
&& aot_intrinsic_check_capability(comp_ctx,
@ -304,7 +307,7 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
if (!(cmp = aot_call_llvm_intrinsic(comp_ctx, func_ctx, intrinsic, ret_type,
param_types, 2, left, right)))
float_param_types, 2, left, right)))
return NULL;
/* The result of XIP intrinsic is 0 or 1, should return it directly */
@ -554,7 +557,7 @@ compile_int_div(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
}
else {
/* Check divied by zero */
/* Check divided by zero */
LLVM_BUILD_ICMP(LLVMIntEQ, right, is_i32 ? I32_ZERO : I64_ZERO,
cmp_div_zero, "cmp_div_zero");
ADD_BASIC_BLOCK(check_div_zero_succ, "check_div_zero_success");

View File

@ -147,7 +147,7 @@ aot_check_table_access(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
if (!(tbl_sz = LLVMBuildBitCast(comp_ctx->builder, tbl_sz, INT32_PTR_TYPE,
"cur_siuze_i32p"))) {
"cur_size_i32p"))) {
HANDLE_FAILURE("LLVMBuildBitCast");
goto fail;
}

View File

@ -174,7 +174,7 @@ compile_global(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
+ (comp_ctx->pointer_size == sizeof(uint64)
? comp_data->import_globals[global_idx].data_offset_64bit
: comp_data->import_globals[global_idx].data_offset_32bit);
global_type = comp_data->import_globals[global_idx].type;
global_type = comp_data->import_globals[global_idx].type.val_type;
}
else {
global_offset =
@ -185,7 +185,8 @@ compile_global(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
.data_offset_64bit
: comp_data->globals[global_idx - import_global_count]
.data_offset_32bit);
global_type = comp_data->globals[global_idx - import_global_count].type;
global_type =
comp_data->globals[global_idx - import_global_count].type.val_type;
}
if (comp_ctx->enable_gc && aot_is_type_gc_reftype(global_type))

View File

@ -24,8 +24,6 @@ create_native_stack_bound(const AOTCompContext *comp_ctx,
static bool
create_native_stack_top_min(const AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx);
static bool
create_func_ptrs(const AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
LLVMTypeRef
wasm_type_to_llvm_type(const AOTCompContext *comp_ctx,
@ -539,51 +537,8 @@ aot_build_precheck_function(AOTCompContext *comp_ctx, LLVMModuleRef module,
if (ret_type == VOID_TYPE) {
name = "";
}
LLVMValueRef retval;
if (comp_ctx->is_indirect_mode
&& !strncmp(comp_ctx->target_arch, "xtensa", 6)) {
/* call wrapped_func indirectly */
if (!create_func_ptrs(comp_ctx, func_ctx)) {
goto fail;
}
LLVMTypeRef func_ptr_type;
LLVMValueRef wrapped_func_indirect;
uint32 import_func_count = comp_ctx->comp_data->import_func_count;
uint32 func_count = comp_ctx->func_ctx_count;
/* Check function index */
if (func_index >= import_func_count + func_count) {
aot_set_last_error("Function index out of range.");
goto fail;
}
/* Get function type */
if (!(func_ptr_type = LLVMPointerType(func_type, 0))) {
aot_set_last_error("create LLVM function type failed.");
goto fail;
}
/*
* func_index layout :
* aot_func#xxx, range from 0 ~ func_conut - 1;
* aot_func#internal#xxx, range from func_conut ~ 2 * func_conut - 1;
*/
if (!(wrapped_func_indirect = aot_get_func_from_table(
comp_ctx, func_ctx->func_ptrs, func_ptr_type,
func_index + func_count + import_func_count))) {
goto fail;
}
/* Call the function indirectly */
retval = LLVMBuildCall2(b, func_type, wrapped_func_indirect, params,
param_count, name);
}
else
retval = LLVMBuildCall2(b, func_type, wrapped_func, params, param_count,
name);
LLVMValueRef retval =
LLVMBuildCall2(b, func_type, wrapped_func, params, param_count, name);
if (!retval) {
goto fail;
}
@ -780,9 +735,7 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
}
if (need_precheck) {
if (!comp_ctx->is_jit_mode
&& !(comp_ctx->is_indirect_mode
&& !strncmp(comp_ctx->target_arch, "xtensa", 6)))
if (!comp_ctx->is_jit_mode)
LLVMSetLinkage(func, LLVMInternalLinkage);
unsigned int kind =
LLVMGetEnumAttributeKindForName("noinline", strlen("noinline"));
@ -790,7 +743,17 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
LLVMCreateEnumAttribute(comp_ctx->context, kind, 0);
LLVMAddAttributeAtIndex(func, LLVMAttributeFunctionIndex,
attr_noinline);
if (!strcmp(comp_ctx->target_arch, "xtensa")) {
/* Because "func" is only called by "precheck_func", short-call
* should be ok. We prefer short-call because it's smaller
* and more importantly doesn't involve relocations.
*/
LLVMAttributeRef attr_short_call = LLVMCreateStringAttribute(
comp_ctx->context, "short-call", (unsigned)strlen("short-call"),
"", 0);
LLVMAddAttributeAtIndex(func, LLVMAttributeFunctionIndex,
attr_short_call);
}
if (!aot_build_precheck_function(comp_ctx, module, precheck_func,
func_index, func_type, func))
goto fail;
@ -1242,7 +1205,7 @@ create_memory_info(const AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
func_ctx->mem_space_unchanged = mem_space_unchanged;
memory_count = module->memory_count + module->import_memory_count;
/* If the module dosen't have memory, reserve
/* If the module doesn't have memory, reserve
one mem_info space with empty content */
if (memory_count == 0)
memory_count = 1;
@ -1257,7 +1220,7 @@ create_memory_info(const AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* Load memory base address */
#if WASM_ENABLE_SHARED_MEMORY != 0
is_shared_memory =
comp_ctx->comp_data->memories[0].memory_flags & 0x02 ? true : false;
comp_ctx->comp_data->memories[0].flags & 0x02 ? true : false;
if (is_shared_memory) {
LLVMValueRef shared_mem_addr;
offset = I32_CONST(offsetof(AOTModuleInstance, memories));
@ -1727,7 +1690,15 @@ aot_create_stack_sizes(const AOTCompData *comp_data, AOTCompContext *comp_ctx)
* avoid creating extra relocations in the precheck functions.
*/
LLVMSetLinkage(stack_sizes, LLVMInternalLinkage);
LLVMSetSection(stack_sizes, aot_stack_sizes_section_name);
/*
* for AOT, place it into a dedicated section for the convenience
* of the AOT file generation and symbol resolutions.
*
* for JIT, it doesn't matter.
*/
if (!comp_ctx->is_jit_mode) {
LLVMSetSection(stack_sizes, aot_stack_sizes_section_name);
}
comp_ctx->stack_sizes_type = stack_sizes_type;
comp_ctx->stack_sizes = stack_sizes;
return true;
@ -1973,10 +1944,12 @@ aot_set_llvm_basic_types(AOTLLVMTypes *basic_types, LLVMContextRef context,
if (pointer_size == 4) {
basic_types->intptr_t_type = basic_types->int32_type;
basic_types->intptr_t_ptr_type = basic_types->int32_ptr_type;
basic_types->size_t_type = basic_types->int32_type;
}
else {
basic_types->intptr_t_type = basic_types->int64_type;
basic_types->intptr_t_ptr_type = basic_types->int64_ptr_type;
basic_types->size_t_type = basic_types->int64_type;
}
basic_types->gc_ref_type = basic_types->int8_ptr_type;
@ -2416,7 +2389,7 @@ orc_jit_create(AOTCompContext *comp_ctx)
}
if (comp_ctx->enable_stack_bound_check || comp_ctx->enable_stack_estimation)
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
builder, jit_stack_size_callback, comp_ctx);
err = LLVMOrcJITTargetMachineBuilderDetectHost(&jtmb);
@ -3143,6 +3116,16 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
goto fail;
}
/* Return error if ref-types and GC are disabled by command line but
ref-types instructions are used */
if (!option->enable_ref_types && !option->enable_gc
&& wasm_module->is_ref_types_used) {
aot_set_last_error("ref-types instruction was found, "
"try removing --disable-ref-types option "
"or adding --enable-gc option.");
goto fail;
}
/* Disable features when they are not actually used */
if (!wasm_module->is_simd_used) {
option->enable_simd = comp_ctx->enable_simd = false;
@ -3156,7 +3139,8 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
#endif
if (option->enable_simd && strcmp(comp_ctx->target_arch, "x86_64") != 0
&& strncmp(comp_ctx->target_arch, "aarch64", 7) != 0) {
&& strncmp(comp_ctx->target_arch, "aarch64", 7) != 0
&& strcmp(comp_ctx->target_arch, "arc") != 0) {
/* Disable simd if it isn't supported by target arch */
option->enable_simd = false;
}
@ -3312,6 +3296,7 @@ static bool
insert_native_symbol(AOTCompContext *comp_ctx, const char *symbol, int32 idx)
{
AOTNativeSymbol *sym = wasm_runtime_malloc(sizeof(AOTNativeSymbol));
int ret;
if (!sym) {
aot_set_last_error("alloc native symbol failed.");
@ -3320,7 +3305,12 @@ insert_native_symbol(AOTCompContext *comp_ctx, const char *symbol, int32 idx)
memset(sym, 0, sizeof(AOTNativeSymbol));
bh_assert(strlen(symbol) <= sizeof(sym->symbol));
snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol);
ret = snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol);
if (ret < 0 || ret + 1 > (int)sizeof(sym->symbol)) {
wasm_runtime_free(sym);
aot_set_last_error_v("symbol name too long: %s", symbol);
return false;
}
sym->index = idx;
if (BH_LIST_ERROR == bh_list_insert(&comp_ctx->native_symbols, sym)) {
@ -3565,7 +3555,7 @@ aot_block_destroy(AOTCompContext *comp_ctx, AOTBlock *block)
bool
aot_checked_addr_list_add(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes)
uint64 offset, uint32 bytes)
{
AOTCheckedAddr *node = func_ctx->checked_addr_list;
@ -3609,7 +3599,7 @@ aot_checked_addr_list_del(AOTFuncContext *func_ctx, uint32 local_idx)
bool
aot_checked_addr_list_find(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes)
uint64 offset, uint32 bytes)
{
AOTCheckedAddr *node = func_ctx->checked_addr_list;

View File

@ -75,10 +75,12 @@ typedef struct AOTValue {
struct AOTValue *next;
struct AOTValue *prev;
LLVMValueRef value;
uint64 const_value; /* valid if is_const is true */
uint32 local_idx;
/* VALUE_TYPE_I32/I64/F32/F64/VOID */
uint8 type;
bool is_local;
uint32 local_idx;
bool is_const;
} AOTValue;
/**
@ -195,7 +197,7 @@ typedef struct AOTBlockStack {
typedef struct AOTCheckedAddr {
struct AOTCheckedAddr *next;
uint32 local_idx;
uint32 offset;
uint64 offset;
uint32 bytes;
} AOTCheckedAddr, *AOTCheckedAddrList;
@ -262,6 +264,7 @@ typedef struct AOTLLVMTypes {
LLVMTypeRef int32_type;
LLVMTypeRef int64_type;
LLVMTypeRef intptr_t_type;
LLVMTypeRef size_t_type;
LLVMTypeRef float32_type;
LLVMTypeRef float64_type;
LLVMTypeRef void_type;
@ -373,7 +376,7 @@ typedef struct AOTCompContext {
char target_arch[16];
unsigned pointer_size;
/* Hardware intrinsic compability flags */
/* Hardware intrinsic compatibility flags */
uint64 flags[8];
/* required by JIT */
@ -440,7 +443,7 @@ typedef struct AOTCompContext {
/* Use profile file collected by LLVM PGO */
char *use_prof_file;
/* Enable to use segument register as the base addr
/* Enable to use segment register as the base addr
of linear memory for load/store operations */
bool enable_segue_i32_load;
bool enable_segue_i64_load;
@ -571,14 +574,14 @@ wasm_type_to_llvm_type(const AOTCompContext *comp_ctx,
bool
aot_checked_addr_list_add(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes);
uint64 offset, uint32 bytes);
void
aot_checked_addr_list_del(AOTFuncContext *func_ctx, uint32 local_idx);
bool
aot_checked_addr_list_find(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes);
uint64 offset, uint32 bytes);
void
aot_checked_addr_list_destroy(AOTFuncContext *func_ctx);
@ -610,12 +613,6 @@ aot_load_const_from_table(AOTCompContext *comp_ctx, LLVMValueRef base,
bool
aot_check_simd_compatibility(const char *arch_c_str, const char *cpu_c_str);
void
aot_add_expand_memory_op_pass(LLVMPassManagerRef pass);
void
aot_add_simple_loop_unswitch_pass(LLVMPassManagerRef pass);
void
aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module);

View File

@ -41,6 +41,9 @@
#include <llvm/Target/CodeGenCWrappers.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetOptions.h>
#if LLVM_VERSION_MAJOR >= 17
#include <llvm/TargetParser/Triple.h>
#endif
#include <llvm/Transforms/Utils/LowerMemIntrinsics.h>
#include <llvm/Transforms/Vectorize/LoopVectorize.h>
#include <llvm/Transforms/Vectorize/LoadStoreVectorizer.h>
@ -76,12 +79,6 @@ LLVM_C_EXTERN_C_BEGIN
bool
aot_check_simd_compatibility(const char *arch_c_str, const char *cpu_c_str);
void
aot_add_expand_memory_op_pass(LLVMPassManagerRef pass);
void
aot_add_simple_loop_unswitch_pass(LLVMPassManagerRef pass);
void
aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module);
@ -179,6 +176,9 @@ aot_check_simd_compatibility(const char *arch_c_str, const char *cpu_c_str)
else if (targetArch == llvm::Triple::aarch64) {
return subTargetInfo->checkFeatures("+neon");
}
else if (targetArch == llvm::Triple::arc) {
return true;
}
else {
return false;
}
@ -417,7 +417,7 @@ aot_compress_aot_func_names(AOTCompContext *comp_ctx, uint32 *p_size)
return NULL;
}
compressed_str_len = Result.size();
compressed_str_len = (uint32)Result.size();
if (!(compressed_str = (char *)wasm_runtime_malloc(compressed_str_len))) {
aot_set_last_error("allocate memory failed");
return NULL;

View File

@ -189,7 +189,7 @@ PartitionFunction(GlobalValueSet Requested)
auto GVName = GV->getName(); /* get the function name */
const char *gvname = GVName.begin(); /* C function name */
const char *wrapper;
uint32 prefix_len = strlen(AOT_FUNC_PREFIX);
uint32 prefix_len = (uint32)strlen(AOT_FUNC_PREFIX);
LOG_DEBUG("requested func %s", gvname);
/* Convert "aot_func#n_wrapper" to "aot_func#n" */
@ -203,7 +203,7 @@ PartitionFunction(GlobalValueSet Requested)
* if the jit wrapper (which has "_wrapper" suffix in
* the name) is requested, compile others in the group too.
* otherwise, only compile the requested one.
* (and possibly the correspondig wrapped function,
* (and possibly the corresponding wrapped function,
* which has AOT_FUNC_INTERNAL_PREFIX.)
*/
wrapper = strstr(gvname + prefix_len, "_wrapper");

View File

@ -72,7 +72,7 @@ LLVMOrcObjectTransformLayerRef
LLVMOrcLLLazyJITGetObjTransformLayer(LLVMOrcLLLazyJITRef J);
void
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
LLVMOrcLLLazyJITBuilderRef Builder,
void (*cb)(void *, const char *, size_t, size_t), void *cb_data);

View File

@ -130,7 +130,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(llvm::orc::LLLazyJITBuilder,
LLVMOrcLLLazyJITBuilderRef)
void
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
LLVMOrcLLLazyJITBuilderRef Builder,
void (*cb)(void *, const char *, size_t, size_t), void *cb_data)
{

View File

@ -37,8 +37,9 @@ typedef struct dwarf_extractor {
#define TO_HANDLE(extractor) (dwarf_extractor_handle_t)(extractor)
#define TO_EXTACTOR(handle) (dwarf_extractor *)(handle)
#define TO_EXTRACTOR(handle) (dwarf_extractor *)(handle)
static const char *compiler_name = "WAMR AoT compiler";
static bool is_debugger_initialized;
dwarf_extractor_handle_t
@ -103,7 +104,7 @@ fail3:
void
destroy_dwarf_extractor(dwarf_extractor_handle_t handle)
{
dwarf_extractor *extractor = TO_EXTACTOR(handle);
dwarf_extractor *extractor = TO_EXTRACTOR(handle);
if (!extractor)
return;
extractor->debugger.DeleteTarget(extractor->target);
@ -122,7 +123,7 @@ dwarf_gen_file_info(const AOTCompContext *comp_ctx)
const char *file_name;
const char *dir_name;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
units_number = extractor->module.GetNumCompileUnits();
@ -198,7 +199,7 @@ dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx)
int units_number;
LLVMMetadataRef comp_unit = NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
units_number = extractor->module.GetNumCompileUnits();
@ -209,8 +210,8 @@ dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx)
comp_unit = LLVMDIBuilderCreateCompileUnit(
comp_ctx->debug_builder, LLDB_TO_LLVM_LANG_TYPE(lang_type),
comp_ctx->debug_file, "WAMR AoT compiler", 12, 0, NULL, 0, 1, NULL,
0, LLVMDWARFEmissionFull, 0, 0, 0, "/", 1, "", 0);
comp_ctx->debug_file, compiler_name, strlen(compiler_name), 0, NULL,
0, 1, NULL, 0, LLVMDWARFEmissionFull, 0, 0, 0, "/", 1, "", 0);
}
return comp_unit;
}
@ -289,7 +290,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
{
SBFunction function(sc.GetFunction());
const char *function_name = function.GetName();
const char *link_name = function.GetName();
const char *link_name = function.GetMangledName();
SBTypeList function_args = function.GetType().GetFunctionArgumentTypes();
SBType return_type = function.GetType().GetFunctionReturnType();
const size_t num_function_args = function_args.GetSize();
@ -304,6 +305,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
* https://github.com/bytecodealliance/wasm-micro-runtime/issues/3163
*/
LanguageType language_type = function.GetLanguage();
bool cplusplus = false;
switch (language_type) {
case eLanguageTypeC89:
case eLanguageTypeC:
@ -311,41 +313,53 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
case eLanguageTypeC11:
case eLanguageTypeC17:
break;
case eLanguageTypeC_plus_plus:
case eLanguageTypeC_plus_plus_03:
case eLanguageTypeC_plus_plus_11:
case eLanguageTypeC_plus_plus_14:
case eLanguageTypeC_plus_plus_17:
case eLanguageTypeC_plus_plus_20:
cplusplus = true;
break;
default:
LOG_WARNING("func %s has unsuppoted language_type 0x%x",
LOG_WARNING("func %s has unsupported language_type 0x%x",
function_name, (int)language_type);
return NULL;
}
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
LLVMDIBuilderRef DIB = comp_ctx->debug_builder;
LLVMMetadataRef File = comp_ctx->debug_file; /* a fallback */
LLVMMetadataRef ParamTypes[num_function_args + 1];
size_t num_param_types = 0;
ParamTypes[0] = lldb_type_to_type_dbi(comp_ctx, return_type);
if (!cplusplus) {
num_param_types = num_function_args + 1;
ParamTypes[0] = lldb_type_to_type_dbi(comp_ctx, return_type);
for (uint32_t function_arg_idx = 0; function_arg_idx < num_function_args;
++function_arg_idx) {
SBType function_arg_type =
function_args.GetTypeAtIndex(function_arg_idx);
for (uint32_t function_arg_idx = 0;
function_arg_idx < num_function_args; ++function_arg_idx) {
SBType function_arg_type =
function_args.GetTypeAtIndex(function_arg_idx);
if (function_arg_type.IsValid()) {
ParamTypes[function_arg_idx + 1] =
lldb_type_to_type_dbi(comp_ctx, function_arg_type);
if (ParamTypes[function_arg_idx + 1] == NULL) {
LOG_WARNING(
"func %s arg %" PRIu32
" has a type not implemented by lldb_type_to_type_dbi",
function_name, function_arg_idx);
}
}
else {
LOG_WARNING("func %s arg %" PRIu32 ": GetTypeAtIndex failed",
if (function_arg_type.IsValid()) {
ParamTypes[function_arg_idx + 1] =
lldb_type_to_type_dbi(comp_ctx, function_arg_type);
if (ParamTypes[function_arg_idx + 1] == NULL) {
LOG_WARNING(
"func %s arg %" PRIu32
" has a type not implemented by lldb_type_to_type_dbi",
function_name, function_arg_idx);
ParamTypes[function_arg_idx + 1] = NULL;
}
}
else {
LOG_WARNING("func %s arg %" PRIu32 ": GetTypeAtIndex failed",
function_name, function_arg_idx);
ParamTypes[function_arg_idx + 1] = NULL;
}
}
}
@ -365,7 +379,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
}
LLVMMetadataRef FunctionTy = LLVMDIBuilderCreateSubroutineType(
DIB, File, ParamTypes, num_function_args + 1, LLVMDIFlagZero);
DIB, File, ParamTypes, num_param_types, LLVMDIFlagZero);
auto line_entry = sc.GetLineEntry();
LLVMMetadataRef ReplaceableFunctionMetadata =
@ -375,8 +389,8 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMMetadataRef FunctionMetadata = LLVMDIBuilderCreateFunction(
DIB, File, function_name, strlen(function_name), link_name,
strlen(link_name), File, line_entry.GetLine(), FunctionTy, true, true,
line_entry.GetLine(), LLVMDIFlagZero, false);
link_name != NULL ? strlen(link_name) : 0, File, line_entry.GetLine(),
FunctionTy, true, true, line_entry.GetLine(), LLVMDIFlagZero, false);
LLVMMetadataReplaceAllUsesWith(ReplaceableFunctionMetadata,
FunctionMetadata);
@ -385,13 +399,6 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMMetadataRef ParamExpression =
LLVMDIBuilderCreateExpression(DIB, NULL, 0);
auto variable_list =
function.GetBlock().GetVariables(extractor->target, true, false, false);
if (num_function_args != variable_list.GetSize()) {
LOG_ERROR(
"function args number dismatch!:value number=%d, function args=%d",
variable_list.GetSize(), num_function_args);
}
LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation(
comp_ctx->context, line_entry.GetLine(), 0, FunctionMetadata, NULL);
@ -399,39 +406,63 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
// TODO:change to void * or WasmExenv *
LLVMMetadataRef voidtype =
LLVMDIBuilderCreateBasicType(DIB, "void", 4, 0, 0, LLVMDIFlagZero);
LLVMMetadataRef voidpionter =
LLVMMetadataRef voidpointer =
LLVMDIBuilderCreatePointerType(DIB, voidtype, 64, 0, 0, "void *", 6);
LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable(
DIB, FunctionMetadata, "exenv", 5, 1,
File, // starts form 1, and 1 is exenv,
line_entry.GetLine(), voidpionter, true, LLVMDIFlagZero);
line_entry.GetLine(), voidpointer, true, LLVMDIFlagZero);
LLVMValueRef Param = LLVMGetParam(func_ctx->func, 0);
LLVMBasicBlockRef block_curr = LLVMGetEntryBasicBlock(func_ctx->func);
LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar, ParamExpression,
ParamLocation, block_curr);
for (uint32_t function_arg_idx = 0;
function_arg_idx < variable_list.GetSize(); ++function_arg_idx) {
SBValue variable(variable_list.GetValueAtIndex(function_arg_idx));
if (variable.IsValid() && ParamTypes[function_arg_idx + 1] != NULL) {
SBDeclaration dec(variable.GetDeclaration());
auto valtype = variable.GetType();
LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation(
comp_ctx->context, dec.GetLine(), dec.GetColumn(),
FunctionMetadata, NULL);
const char *varname = variable.GetName();
LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable(
DIB, FunctionMetadata, varname, varname ? strlen(varname) : 0,
function_arg_idx + 1 + 1,
File, // starts form 1, and 1 is exenv,
dec.GetLine(), ParamTypes[function_arg_idx + 1], true,
LLVMDIFlagZero);
LLVMValueRef Param =
LLVMGetParam(func_ctx->func, function_arg_idx + 1);
LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar,
ParamExpression, ParamLocation,
block_curr);
if (num_function_args != func_ctx->aot_func->func_type->param_count) {
// for C, this happens when the compiler optimized out some of
// function parameters.
//
// for C++, this mismatch is normal because of the "this" pointer.
if (!cplusplus) {
LOG_WARNING("function args number mismatch! num_function_args: %d, "
"wasm func params: %d, func: %s",
num_function_args,
func_ctx->aot_func->func_type->param_count,
function_name);
}
}
else if (!cplusplus) {
auto variable_list = function.GetBlock().GetVariables(
extractor->target, true, false, false);
if (num_function_args != variable_list.GetSize()) {
LOG_ERROR("function args number mismatch!:value number=%d, "
"function args=%d",
variable_list.GetSize(), num_function_args);
}
for (uint32_t function_arg_idx = 0;
function_arg_idx < variable_list.GetSize(); ++function_arg_idx) {
SBValue variable(variable_list.GetValueAtIndex(function_arg_idx));
if (variable.IsValid()
&& ParamTypes[function_arg_idx + 1] != NULL) {
SBDeclaration dec(variable.GetDeclaration());
auto valtype = variable.GetType();
LLVMMetadataRef ParamLocation =
LLVMDIBuilderCreateDebugLocation(
comp_ctx->context, dec.GetLine(), dec.GetColumn(),
FunctionMetadata, NULL);
const char *varname = variable.GetName();
LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable(
DIB, FunctionMetadata, varname,
varname ? strlen(varname) : 0, function_arg_idx + 1 + 1,
File, // starts form 1, and 1 is exenv,
dec.GetLine(), ParamTypes[function_arg_idx + 1], true,
LLVMDIFlagZero);
LLVMValueRef Param =
LLVMGetParam(func_ctx->func, function_arg_idx + 1);
LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar,
ParamExpression, ParamLocation,
block_curr);
}
}
}
@ -447,13 +478,13 @@ dwarf_gen_func_info(const AOTCompContext *comp_ctx,
uint64_t vm_offset;
AOTFunc *func = func_ctx->aot_func;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = func->code - comp_ctx->comp_data->wasm_module->buf_code;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -479,13 +510,13 @@ dwarf_get_func_name(const AOTCompContext *comp_ctx,
name[0] = '\0';
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = func->code - comp_ctx->comp_data->wasm_module->buf_code;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -509,7 +540,7 @@ dwarf_gen_location(const AOTCompContext *comp_ctx,
if (func_ctx->debug_func == NULL)
return NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -550,13 +581,13 @@ dwarf_gen_func_ret_location(const AOTCompContext *comp_ctx,
AOTFunc *func = func_ctx->aot_func;
LLVMMetadataRef location_info = NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = (func->code + func->code_size - 1)
- comp_ctx->comp_data->wasm_module->buf_code;
location_info = dwarf_gen_location(comp_ctx, func_ctx, vm_offset);

View File

@ -85,7 +85,7 @@ aot_compile_simd_swizzle_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
if (!(condition = LLVMBuildICmp(comp_ctx->builder, LLVMIntUGE, mask,
max_lanes, "compare_with_16"))) {
HANDLE_FAILURE("LLVMBuldICmp");
HANDLE_FAILURE("LLVMBuildICmp");
goto fail;
}
@ -363,7 +363,7 @@ aot_compile_simd_replace(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
goto fail;
}
return simd_bitcast_and_push_v128(comp_ctx, func_ctx, result, "reesult");
return simd_bitcast_and_push_v128(comp_ctx, func_ctx, result, "result");
fail:
return false;

View File

@ -45,7 +45,7 @@ simd_build_bitmask(const AOTCompContext *comp_ctx,
goto fail;
}
/* fill every bit in a lange with its sign bit */
/* fill every bit in a lane with its sign bit */
if (!(ashr_distance = simd_build_splat_const_integer_vector(
comp_ctx, element_type[itype], lane_bits[itype] - 1,
lanes[itype]))) {

View File

@ -86,8 +86,8 @@ fail:
}
static bool
interger_vector_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
IntCond cond, LLVMTypeRef vector_type)
integer_vector_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
IntCond cond, LLVMTypeRef vector_type)
{
LLVMValueRef vec1, vec2, result;
LLVMIntPredicate int_pred;
@ -138,28 +138,28 @@ bool
aot_compile_simd_i8x16_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i8x16_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i8x16_TYPE);
}
bool
aot_compile_simd_i16x8_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i16x8_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i16x8_TYPE);
}
bool
aot_compile_simd_i32x4_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i32x4_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i32x4_TYPE);
}
bool
aot_compile_simd_i64x2_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i64x2_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i64x2_TYPE);
}
static bool

View File

@ -12,7 +12,7 @@
static bool
simd_integer_narrow_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMTypeRef in_vector_type, LLVMTypeRef out_vector_type,
const char *instrinsic)
const char *intrinsic)
{
LLVMValueRef vector1, vector2, result;
LLVMTypeRef param_types[2] = { in_vector_type, in_vector_type };
@ -24,7 +24,7 @@ simd_integer_narrow_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false;
}
if (!(result = aot_call_llvm_intrinsic(comp_ctx, func_ctx, instrinsic,
if (!(result = aot_call_llvm_intrinsic(comp_ctx, func_ctx, intrinsic,
out_vector_type, param_types, 2,
vector1, vector2))) {
HANDLE_FAILURE("LLVMBuildCall");
@ -261,7 +261,7 @@ simd_integer_extension(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false;
}
/* retrive the low or high half */
/* retrieve the low or high half */
if (!(sub_vector = LLVMBuildShuffleVector(comp_ctx->builder, vector,
undef[itype], mask, "half"))) {
HANDLE_FAILURE("LLVMBuildShuffleVector");
@ -659,7 +659,7 @@ aot_compile_simd_i16x8_q15mulr_sat(AOTCompContext *comp_ctx,
if (!(result = LLVMBuildTrunc(comp_ctx->builder, result, V128_i16x8_TYPE,
"down_to_v8i16"))) {
HANDLE_FAILURE("LLVMBuidlTrunc");
HANDLE_FAILURE("LLVMBuildTrunc");
return false;
}

View File

@ -13,13 +13,13 @@
/* data_length in bytes */
static LLVMValueRef
simd_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align,
uint32 offset, uint32 data_length, LLVMTypeRef ptr_type,
mem_offset_t offset, uint32 data_length, LLVMTypeRef ptr_type,
LLVMTypeRef data_type, bool enable_segue)
{
LLVMValueRef maddr, data;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset,
data_length, enable_segue))) {
data_length, enable_segue, NULL))) {
HANDLE_FAILURE("aot_check_memory_overflow");
return NULL;
}
@ -42,7 +42,7 @@ simd_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align,
bool
aot_compile_simd_v128_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
bool enable_segue = comp_ctx->enable_segue_v128_load;
LLVMTypeRef v128_ptr_type = enable_segue ? V128_PTR_TYPE_GS : V128_PTR_TYPE;
@ -62,7 +62,7 @@ fail:
bool
aot_compile_simd_load_extend(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset)
uint8 opcode, uint32 align, mem_offset_t offset)
{
LLVMValueRef sub_vector, result;
uint32 opcode_index = opcode - SIMD_v128_load8x8_s;
@ -117,7 +117,7 @@ aot_compile_simd_load_extend(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
bool
aot_compile_simd_load_splat(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset)
uint8 opcode, uint32 align, mem_offset_t offset)
{
uint32 opcode_index = opcode - SIMD_v128_load8_splat;
LLVMValueRef element, result;
@ -173,7 +173,7 @@ aot_compile_simd_load_splat(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
bool
aot_compile_simd_load_lane(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset,
uint8 opcode, uint32 align, mem_offset_t offset,
uint8 lane_id)
{
LLVMValueRef element, vector;
@ -218,7 +218,7 @@ aot_compile_simd_load_lane(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
bool
aot_compile_simd_load_zero(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset)
uint8 opcode, uint32 align, mem_offset_t offset)
{
LLVMValueRef element, result, mask;
uint32 opcode_index = opcode - SIMD_v128_load32_zero;
@ -281,13 +281,13 @@ aot_compile_simd_load_zero(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* data_length in bytes */
static bool
simd_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align,
uint32 offset, uint32 data_length, LLVMValueRef value,
mem_offset_t offset, uint32 data_length, LLVMValueRef value,
LLVMTypeRef value_ptr_type, bool enable_segue)
{
LLVMValueRef maddr, result;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset,
data_length, enable_segue)))
data_length, enable_segue, NULL)))
return false;
if (!(maddr = LLVMBuildBitCast(comp_ctx->builder, maddr, value_ptr_type,
@ -308,7 +308,7 @@ simd_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align,
bool
aot_compile_simd_v128_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset)
uint32 align, mem_offset_t offset)
{
bool enable_segue = comp_ctx->enable_segue_v128_store;
LLVMTypeRef v128_ptr_type = enable_segue ? V128_PTR_TYPE_GS : V128_PTR_TYPE;
@ -324,7 +324,7 @@ fail:
bool
aot_compile_simd_store_lane(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset,
uint8 opcode, uint32 align, mem_offset_t offset,
uint8 lane_id)
{
LLVMValueRef element, vector;

View File

@ -14,32 +14,32 @@ extern "C" {
bool
aot_compile_simd_v128_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
bool
aot_compile_simd_load_extend(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset);
uint8 opcode, uint32 align, mem_offset_t offset);
bool
aot_compile_simd_load_splat(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset);
uint8 opcode, uint32 align, mem_offset_t offset);
bool
aot_compile_simd_load_lane(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset,
uint8 opcode, uint32 align, mem_offset_t offset,
uint8 lane_id);
bool
aot_compile_simd_load_zero(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset);
uint8 opcode, uint32 align, mem_offset_t offset);
bool
aot_compile_simd_v128_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint32 align, uint32 offset);
uint32 align, mem_offset_t offset);
bool
aot_compile_simd_store_lane(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
uint8 opcode, uint32 align, uint32 offset,
uint8 opcode, uint32 align, mem_offset_t offset,
uint8 lane_id);
#ifdef __cplusplus

View File

@ -1,36 +1,36 @@
# Wasm Function
# Wasm Function
## Internal data structure
![](./images/wasm_function.svg)
## Module level data (function)
**WASMModule**: Data structure created for loading a module.
**WASMModule**: Data structure created for loading a module.
- `WASMImport *import_functions`: initialized from the Wasm file function section
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMImport**: represent a imported Wasm function which can be a solved as a native function or another Wasm module exported function.
## Instance level data (function)
**WASMModuleInstance**: Data structure created for instantiating a module
- `WASMModuleInstanceExtra::functions`: combined the imported and internal functions into single array of structure `WASMFunctionInstance`
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialzed with the module level solved imports, but may points to different native function later due to c-api calls.
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialized with the module level solved imports, but may points to different native function later due to c-api calls.
## Execution paths
**Interpreter**:
- Execute internal bytecode function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
-> WASMFunction::code
```
- Execute imported function from other module:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(WASMFunctionInstance flag indicates an import)
-> WASMFunctionInstance::import_func_inst
-> WASMModuleInstance(second)::func
@ -39,9 +39,9 @@
- Execute imported native function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(flag indicates imported native)
WASMModuleInstance::import_func_ptrs[..]
-> native function
```
```

View File

@ -602,6 +602,7 @@ jit_compile_op_memory_grow(JitCompContext *cc, uint32 mem_idx)
args[0] = get_module_inst_reg(cc->jit_frame);
args[1] = inc_page_count;
/* TODO: multi-memory wasm_enlarge_memory_with_idx() */
if (!jit_emit_callnative(cc, wasm_enlarge_memory, grow_res, args, 2)) {
goto fail;
}

View File

@ -168,12 +168,12 @@ get_global_type(const WASMModule *module, uint32 global_idx)
if (global_idx < module->import_global_count) {
const WASMGlobalImport *import_global =
&((module->import_globals + global_idx)->u.global);
return import_global->type;
return import_global->type.val_type;
}
else {
const WASMGlobal *global =
module->globals + (global_idx - module->import_global_count);
return global->type;
return global->type.val_type;
}
}

View File

@ -76,11 +76,12 @@ jit_frontend_get_table_inst_offset(const WASMModule *module, uint32 tbl_idx)
offset += (uint32)offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0
offset += (uint32)sizeof(uint32) * import_table->max_size;
offset += (uint32)sizeof(uint32) * import_table->table_type.max_size;
#else
offset += (uint32)sizeof(uint32)
* (import_table->possible_grow ? import_table->max_size
: import_table->init_size);
* (import_table->table_type.possible_grow
? import_table->table_type.max_size
: import_table->table_type.init_size);
#endif
i++;
@ -97,10 +98,13 @@ jit_frontend_get_table_inst_offset(const WASMModule *module, uint32 tbl_idx)
offset += (uint32)offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0
offset += (uint32)sizeof(table_elem_type_t) * table->max_size;
offset +=
(uint32)sizeof(table_elem_type_t) * table->table_type.max_size;
#else
offset += (uint32)sizeof(table_elem_type_t)
* (table->possible_grow ? table->max_size : table->init_size);
offset +=
(uint32)sizeof(table_elem_type_t)
* (table->table_type.possible_grow ? table->table_type.max_size
: table->table_type.init_size);
#endif
i++;
@ -234,7 +238,7 @@ is_shared_memory(WASMModule *module, uint32 mem_idx)
if (mem_idx < module->import_memory_count) {
memory_import = &(module->import_memories[mem_idx].u.memory);
is_shared = memory_import->flags & 0x02 ? true : false;
is_shared = memory_import->mem_type.flags & 0x02 ? true : false;
}
else {
memory = &module->memories[mem_idx - module->import_memory_count];
@ -1243,6 +1247,21 @@ init_func_translation(JitCompContext *cc)
NEW_CONST(I32, local_off));
}
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
/* externref/funcref should be NULL_REF rather than 0 */
local_off = (uint32)offsetof(WASMInterpFrame, lp)
+ cur_wasm_func->param_cell_num * 4;
for (i = 0; i < cur_wasm_func->local_count; i++) {
if (cur_wasm_func->local_types[i] == VALUE_TYPE_EXTERNREF
|| cur_wasm_func->local_types[i] == VALUE_TYPE_FUNCREF) {
GEN_INSN(STI32, NEW_CONST(I32, NULL_REF), cc->fp_reg,
NEW_CONST(I32, local_off));
}
local_off +=
4 * wasm_value_type_cell_num(cur_wasm_func->local_types[i]);
}
#endif
return jit_frame;
}
@ -1495,7 +1514,9 @@ jit_compile_func(JitCompContext *cc)
case EXT_OP_LOOP:
case EXT_OP_IF:
{
read_leb_uint32(frame_ip, frame_ip_end, type_idx);
read_leb_int32(frame_ip, frame_ip_end, type_idx);
/* type index was checked in wasm loader */
bh_assert(type_idx < cc->cur_wasm_module->type_count);
func_type = cc->cur_wasm_module->types[type_idx];
param_count = func_type->param_count;
param_types = func_type->types;

View File

@ -27,6 +27,9 @@ typedef struct AOTCompData *aot_comp_data_t;
struct AOTCompContext;
typedef struct AOTCompContext *aot_comp_context_t;
struct AOTObjectData;
typedef struct AOTObjectData *aot_obj_data_t;
aot_comp_data_t
aot_create_comp_data(void *wasm_module, const char *target_arch,
bool gc_enabled);
@ -62,6 +65,25 @@ aot_destroy_comp_context(aot_comp_context_t comp_ctx);
bool
aot_compile_wasm(aot_comp_context_t comp_ctx);
aot_obj_data_t
aot_obj_data_create(aot_comp_context_t comp_ctx);
void
aot_obj_data_destroy(aot_obj_data_t obj_data);
uint32_t
aot_get_aot_file_size(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
aot_obj_data_t obj_data);
uint8_t *
aot_emit_aot_file_buf(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
uint32_t *p_aot_file_size);
bool
aot_emit_aot_file_buf_ex(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
aot_obj_data_t obj_data, uint8_t *aot_file_buf,
uint32_t aot_file_size);
bool
aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);

View File

@ -71,7 +71,7 @@ typedef struct WASMObject *wasm_obj_t;
typedef union V128 {
int8_t i8x16[16];
int16_t i16x8[8];
int32_t i32x8[4];
int32_t i32x4[4];
int64_t i64x2[2];
float f32x4[4];
double f64x2[2];
@ -230,16 +230,6 @@ wasm_defined_type_is_struct_type(const wasm_defined_type_t def_type);
WASM_RUNTIME_API_EXTERN bool
wasm_defined_type_is_array_type(const wasm_defined_type_t def_type);
/**
* Get parameter count of a function type
*
* @param func_type the specified function type
*
* @return the param count of the specified function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_param_count(const wasm_func_type_t func_type);
/**
* Get type of a specified parameter of a function type
*
@ -253,16 +243,6 @@ WASM_RUNTIME_API_EXTERN wasm_ref_type_t
wasm_func_type_get_param_type(const wasm_func_type_t func_type,
uint32_t param_idx);
/**
* Get result count of a function type
*
* @param func_type the specified function type
*
* @return the result count of the specified function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_result_count(const wasm_func_type_t func_type);
/**
* Get type of a specified result of a function type
*
@ -727,7 +707,7 @@ wasm_externref_obj_to_internal_obj(const wasm_externref_obj_t externref_obj);
* @param exec_env the execution environment
* @param internal_obj the internal object
*
* @return wasm_externref_obj_t if create success, NULL othersise
* @return wasm_externref_obj_t if create success, NULL otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_externref_obj_t
wasm_internal_obj_to_externref_obj(wasm_exec_env_t exec_env,
@ -777,7 +757,7 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_unpin_object(wasm_exec_env_t exec_env, wasm_obj_t obj);
/**
* Check whether an object is a struct objectc
* Check whether an object is a struct object
*
* @param obj the object to check
*

View File

@ -96,7 +96,7 @@ typedef double float64_t;
// Vectors
// size: capacity
// num_elems: current number of elements
// size_of_elem: size of one elemen
// size_of_elem: size of one element
#define WASM_DECLARE_VEC(name, ptr_or_none) \
typedef struct wasm_##name##_vec_t { \
size_t size; \
@ -183,7 +183,7 @@ typedef union MemAllocOption {
} MemAllocOption;
#endif /* MEM_ALLOC_OPTION_DEFINED */
/* Runtime configration */
/* Runtime configuration */
struct wasm_config_t {
mem_alloc_type_t mem_alloc_type;
MemAllocOption mem_alloc_option;
@ -297,7 +297,8 @@ enum wasm_valkind_enum {
WASM_I64,
WASM_F32,
WASM_F64,
WASM_ANYREF = 128,
WASM_V128,
WASM_EXTERNREF = 128,
WASM_FUNCREF,
};
#endif
@ -307,10 +308,10 @@ WASM_API_EXTERN own wasm_valtype_t* wasm_valtype_new(wasm_valkind_t);
WASM_API_EXTERN wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t*);
static inline bool wasm_valkind_is_num(wasm_valkind_t k) {
return k < WASM_ANYREF;
return k < WASM_EXTERNREF;
}
static inline bool wasm_valkind_is_ref(wasm_valkind_t k) {
return k >= WASM_ANYREF;
return k >= WASM_EXTERNREF;
}
static inline bool wasm_valtype_is_num(const wasm_valtype_t* t) {
@ -433,7 +434,7 @@ struct wasm_ref_t;
typedef struct wasm_val_t {
wasm_valkind_t kind;
uint8_t __paddings[7];
uint8_t _paddings[7];
union {
int32_t i32;
int64_t i64;
@ -527,6 +528,12 @@ typedef struct WASMModuleCommon *wasm_module_t;
#define LOAD_ARGS_OPTION_DEFINED
typedef struct LoadArgs {
char *name;
/* True by default, used by wasm-c-api only.
If false, the wasm input buffer (wasm_byte_vec_t) is referenced by the
module instead of being cloned. Hence, it can be freed after module loading. */
bool clone_wasm_binary;
/* This option is only used by the AOT/wasm loader (see wasm_export.h) */
bool wasm_binary_freeable;
/* TODO: more fields? */
} LoadArgs;
#endif /* LOAD_ARGS_OPTION_DEFINED */
@ -536,7 +543,7 @@ WASM_API_EXTERN own wasm_module_t* wasm_module_new(
// please refer to wasm_runtime_load_ex(...) in core/iwasm/include/wasm_export.h
WASM_API_EXTERN own wasm_module_t* wasm_module_new_ex(
wasm_store_t*, const wasm_byte_vec_t* binary, const LoadArgs *args);
wasm_store_t*, wasm_byte_vec_t* binary, LoadArgs *args);
WASM_API_EXTERN void wasm_module_delete(own wasm_module_t*);
@ -556,6 +563,8 @@ WASM_API_EXTERN void wasm_shared_module_delete(own wasm_shared_module_t*);
WASM_API_EXTERN bool wasm_module_set_name(wasm_module_t*, const char* name);
WASM_API_EXTERN const char *wasm_module_get_name(wasm_module_t*);
WASM_API_EXTERN bool wasm_module_is_underlying_binary_freeable(const wasm_module_t *module);
// Function Instances
@ -682,6 +691,11 @@ WASM_API_EXTERN own wasm_instance_t* wasm_instance_new_with_args_ex(
WASM_API_EXTERN void wasm_instance_exports(const wasm_instance_t*, own wasm_extern_vec_t* out);
// Return total wasm functions' execution time in ms
WASM_API_EXTERN double wasm_instance_sum_wasm_exec_time(const wasm_instance_t*);
// Return execution time in ms of a given wasm function with
// func_name. If the function is not found, return 0.
WASM_API_EXTERN double wasm_instance_get_wasm_func_exec_time(const wasm_instance_t*, const char *);
///////////////////////////////////////////////////////////////////////////////
// Convenience
@ -706,9 +720,12 @@ static inline own wasm_valtype_t* wasm_valtype_new_f32(void) {
static inline own wasm_valtype_t* wasm_valtype_new_f64(void) {
return wasm_valtype_new(WASM_F64);
}
static inline own wasm_valtype_t* wasm_valtype_new_v128(void) {
return wasm_valtype_new(WASM_V128);
}
static inline own wasm_valtype_t* wasm_valtype_new_anyref(void) {
return wasm_valtype_new(WASM_ANYREF);
return wasm_valtype_new(WASM_EXTERNREF);
}
static inline own wasm_valtype_t* wasm_valtype_new_funcref(void) {
return wasm_valtype_new(WASM_FUNCREF);
@ -864,12 +881,12 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
#endif
}
#define WASM_I32_VAL(i) {.kind = WASM_I32, .__paddings = {0}, .of = {.i32 = i}}
#define WASM_I64_VAL(i) {.kind = WASM_I64, .__paddings = {0}, .of = {.i64 = i}}
#define WASM_F32_VAL(z) {.kind = WASM_F32, .__paddings = {0}, .of = {.f32 = z}}
#define WASM_F64_VAL(z) {.kind = WASM_F64, .__paddings = {0}, .of = {.f64 = z}}
#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .__paddings = {0}, .of = {.ref = r}}
#define WASM_INIT_VAL {.kind = WASM_ANYREF, .__paddings = {0}, .of = {.ref = NULL}}
#define WASM_I32_VAL(i) {.kind = WASM_I32, ._paddings = {0}, .of = {.i32 = i}}
#define WASM_I64_VAL(i) {.kind = WASM_I64, ._paddings = {0}, .of = {.i64 = i}}
#define WASM_F32_VAL(z) {.kind = WASM_F32, ._paddings = {0}, .of = {.f32 = z}}
#define WASM_F64_VAL(z) {.kind = WASM_F64, ._paddings = {0}, .of = {.f64 = z}}
#define WASM_REF_VAL(r) {.kind = WASM_EXTERNREF, ._paddings = {0}, .of = {.ref = r}}
#define WASM_INIT_VAL {.kind = WASM_EXTERNREF, ._paddings = {0}, .of = {.ref = NULL}}
#define KILOBYTE(n) ((n) * 1024)

View File

@ -72,17 +72,45 @@ typedef enum {
WASM_IMPORT_EXPORT_KIND_GLOBAL
} wasm_import_export_kind_t;
typedef struct wasm_import_type {
struct WASMFuncType;
typedef struct WASMFuncType *wasm_func_type_t;
struct WASMTableType;
typedef struct WASMTableType *wasm_table_type_t;
struct WASMGlobalType;
typedef struct WASMGlobalType *wasm_global_type_t;
#ifndef WASM_MEMORY_T_DEFINED
#define WASM_MEMORY_T_DEFINED
struct WASMMemory;
typedef struct WASMMemory WASMMemoryType;
#endif
typedef WASMMemoryType *wasm_memory_type_t;
typedef struct wasm_import_t {
const char *module_name;
const char *name;
wasm_import_export_kind_t kind;
bool linked;
} wasm_import_type;
union {
wasm_func_type_t func_type;
wasm_table_type_t table_type;
wasm_global_type_t global_type;
wasm_memory_type_t memory_type;
} u;
} wasm_import_t;
typedef struct wasm_export_type {
typedef struct wasm_export_t {
const char *name;
wasm_import_export_kind_t kind;
} wasm_export_type;
union {
wasm_func_type_t func_type;
wasm_table_type_t table_type;
wasm_global_type_t global_type;
wasm_memory_type_t memory_type;
} u;
} wasm_export_t;
/* Instantiated WASM module */
struct WASMModuleInstanceCommon;
@ -213,6 +241,13 @@ typedef struct RuntimeInitArgs {
#define LOAD_ARGS_OPTION_DEFINED
typedef struct LoadArgs {
char *name;
/* This option is only used by the Wasm C API (see wasm_c_api.h) */
bool clone_wasm_binary;
/* False by default, used by AOT/wasm loader only.
If true, the AOT/wasm loader creates a copy of some module fields (e.g.
const strings), making it possible to free the wasm binary buffer after
loading. */
bool wasm_binary_freeable;
/* TODO: more fields? */
} LoadArgs;
#endif /* LOAD_ARGS_OPTION_DEFINED */
@ -235,7 +270,8 @@ enum wasm_valkind_enum {
WASM_I64,
WASM_F32,
WASM_F64,
WASM_ANYREF = 128,
WASM_V128,
WASM_EXTERNREF = 128,
WASM_FUNCREF,
};
#endif
@ -246,7 +282,7 @@ struct wasm_ref_t;
typedef struct wasm_val_t {
wasm_valkind_t kind;
uint8_t __paddings[7];
uint8_t _paddings[7];
union {
/* also represent a function index */
int32_t i32;
@ -260,6 +296,22 @@ typedef struct wasm_val_t {
} wasm_val_t;
#endif
/* Global instance*/
typedef struct wasm_global_inst_t {
wasm_valkind_t kind;
bool is_mutable;
void *global_data;
} wasm_global_inst_t;
/* Table instance*/
typedef struct wasm_table_inst_t {
wasm_valkind_t elem_kind;
uint32_t cur_size;
uint32_t max_size;
/* represents the elements of the table, for internal use only */
void *elems;
} wasm_table_inst_t;
typedef enum {
WASM_LOG_LEVEL_FATAL = 0,
WASM_LOG_LEVEL_ERROR = 1,
@ -370,6 +422,59 @@ wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
WASM_RUNTIME_API_EXTERN package_type_t
get_package_type(const uint8_t *buf, uint32_t size);
/**
* Get the package type of a buffer (same as get_package_type).
*
* @param buf the package buffer
* @param size the package buffer size
*
* @return the package type, return Package_Type_Unknown if the type is unknown
*/
WASM_RUNTIME_API_EXTERN package_type_t
wasm_runtime_get_file_package_type(const uint8_t *buf, uint32_t size);
/**
* Get the package type of a module.
*
* @param module the module
*
* @return the package type, return Package_Type_Unknown if the type is
* unknown
*/
WASM_RUNTIME_API_EXTERN package_type_t
wasm_runtime_get_module_package_type(const wasm_module_t module);
/**
* Get the package version of a buffer.
*
* @param buf the package buffer
* @param size the package buffer size
*
* @return the package version, return zero if the version is unknown
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_runtime_get_file_package_version(const uint8_t *buf, uint32_t size);
/**
* Get the package version of a module
*
* @param module the module
*
* @return the package version, or zero if version is unknown
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_runtime_get_module_package_version(const wasm_module_t module);
/**
* Get the currently supported version of the package type
*
* @param package_type the package type
*
* @return the currently supported version, or zero if package type is unknown
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_runtime_get_current_package_version(package_type_t package_type);
/**
* Check whether a file is an AOT XIP (Execution In Place) file
*
@ -419,7 +524,7 @@ wasm_runtime_register_module(const char *module_name, wasm_module_t module,
/**
* Check if there is already a loaded module named module_name in the
* runtime. Repeately loading a module with the same name is not allowed.
* runtime. Repeatedly loading a module with the same name is not allowed.
*
* @param module_name indicate a name
*
@ -442,7 +547,7 @@ wasm_runtime_find_module_registered(const char *module_name);
* @param buf the byte buffer which contains the WASM/AOT binary data,
* note that the byte buffer must be writable since runtime may
* change its content for footprint and performance purpose, and
* it must be referencable until wasm_runtime_unload is called
* it must be referenceable until wasm_runtime_unload is called
* @param size the size of the buffer
* @param error_buf output of the exception info
* @param error_buf_size the size of the exception string
@ -663,7 +768,7 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
* @return the function instance found, NULL if not found
*/
WASM_RUNTIME_API_EXTERN wasm_function_inst_t
wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
const char *name);
/**
@ -675,8 +780,8 @@ wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
* @return the parameter count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_param_count(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst);
wasm_func_get_param_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
/**
* Get result count of the function instance
@ -687,8 +792,8 @@ wasm_func_get_param_count(wasm_function_inst_t const func_inst,
* @return the result count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_result_count(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst);
wasm_func_get_result_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
/**
* Get parameter types of the function instance
@ -698,8 +803,8 @@ wasm_func_get_result_count(wasm_function_inst_t const func_inst,
* @param param_types the parameter types returned
*/
WASM_RUNTIME_API_EXTERN void
wasm_func_get_param_types(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst,
wasm_func_get_param_types(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst,
wasm_valkind_t *param_types);
/**
@ -710,8 +815,8 @@ wasm_func_get_param_types(wasm_function_inst_t const func_inst,
* @param result_types the result types returned
*/
WASM_RUNTIME_API_EXTERN void
wasm_func_get_result_types(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst,
wasm_func_get_result_types(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst,
wasm_valkind_t *result_types);
/**
@ -912,7 +1017,7 @@ wasm_runtime_call_wasm_v(wasm_exec_env_t exec_env,
* @param exec_env the execution environment to call the function
* which must be created from wasm_create_exec_env()
* @param element_index the function reference index, usually
* prvovided by the caller of a registed native function
* provided by the caller of a registered native function
* @param argc the number of arguments
* @param argv the arguments. If the function method has return value,
* the first (or first two in case 64-bit return value) element of
@ -1153,14 +1258,14 @@ wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
void *native_ptr, uint64_t size);
/**
* Convert app address(relative address) to native address(absolute address)
* Convert app address (relative address) to native address (absolute address)
*
* Note that native addresses to module instance memory can be invalidated
* on a memory growth. (Except shared memory, whose native addresses are
* stable.)
*
* @param module_inst the WASM module instance
* @param app_offset the app adress
* @param app_offset the app address
*
* @return the native address converted
*/
@ -1169,7 +1274,7 @@ wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
uint64_t app_offset);
/**
* Convert native address(absolute address) to app address(relative address)
* Convert native address (absolute address) to app address (relative address)
*
* @param module_inst the WASM module instance
* @param native_ptr the native address
@ -1234,7 +1339,7 @@ wasm_runtime_get_import_count(const wasm_module_t module);
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_get_import_type(const wasm_module_t module, int32_t import_index,
wasm_import_type *import_type);
wasm_import_t *import_type);
/**
* Get the number of export items for a WASM module
@ -1255,7 +1360,141 @@ wasm_runtime_get_export_count(const wasm_module_t module);
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_get_export_type(const wasm_module_t module, int32_t export_index,
wasm_export_type *export_type);
wasm_export_t *export_type);
/**
* Get the number of parameters for a function type
*
* @param func_type the function type
*
* @return the number of parameters for the function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_param_count(const wasm_func_type_t func_type);
/**
* Get the kind of a parameter for a function type
*
* @param func_type the function type
* @param param_index the index of the parameter to get
*
* @return the kind of the parameter if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
uint32_t param_index);
/**
* Get the number of results for a function type
*
* @param func_type the function type
*
* @return the number of results for the function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_result_count(const wasm_func_type_t func_type);
/**
* Get the kind of a result for a function type
*
* @param func_type the function type
* @param result_index the index of the result to get
*
* @return the kind of the result if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_result_valkind(const wasm_func_type_t func_type,
uint32_t result_index);
/**
* Get the kind for a global type
*
* @param global_type the global type
*
* @return the kind of the global
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_global_type_get_valkind(const wasm_global_type_t global_type);
/**
* Get the mutability for a global type
*
* @param global_type the global type
*
* @return true if mutable, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_global_type_get_mutable(const wasm_global_type_t global_type);
/**
* Get the shared setting for a memory type
*
* @param memory_type the memory type
*
* @return true if shared, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_memory_type_get_shared(const wasm_memory_type_t memory_type);
/**
* Get the initial page count for a memory type
*
* @param memory_type the memory type
*
* @return the initial memory page count
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_memory_type_get_init_page_count(const wasm_memory_type_t memory_type);
/**
* Get the maximum page count for a memory type
*
* @param memory_type the memory type
*
* @return the maximum memory page count
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_memory_type_get_max_page_count(const wasm_memory_type_t memory_type);
/**
* Get the element kind for a table type
*
* @param table_type the table type
*
* @return the element kind
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_table_type_get_elem_kind(const wasm_table_type_t table_type);
/**
* Get the sharing setting for a table type
*
* @param table_type the table type
*
* @return true if shared, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_table_type_get_shared(const wasm_table_type_t table_type);
/**
* Get the initial size for a table type
*
* @param table_type the table type
*
* @return the initial table size
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_table_type_get_init_size(const wasm_table_type_t table_type);
/**
* Get the maximum size for a table type
*
* @param table_type the table type
*
* @return the maximum table size
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_table_type_get_max_size(const wasm_table_type_t table_type);
/**
* Register native functions with same module name
@ -1328,6 +1567,49 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_unregister_natives(const char *module_name,
NativeSymbol *native_symbols);
/**
* Get an export global instance
*
* @param module_inst the module instance
* @param name the export global name
* @param global_inst location to store the global instance
*
* @return true if success, false otherwise
*
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_get_export_global_inst(const wasm_module_inst_t module_inst,
const char *name,
wasm_global_inst_t *global_inst);
/**
* Get an export table instance
*
* @param module_inst the module instance
* @param name the export table name
* @param table_inst location to store the table instance
*
* @return true if success, false otherwise
*
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_get_export_table_inst(const wasm_module_inst_t module_inst,
const char *name,
wasm_table_inst_t *table_inst);
/**
* Get a function instance from a table.
*
* @param module_inst the module instance
* @param table_inst the table instance
* @param idx the index in the table
*
* @return the function instance if successful, NULL otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_function_inst_t
wasm_table_get_func_inst(const wasm_module_inst_t module_inst,
const wasm_table_inst_t *table_inst, uint32_t idx);
/**
* Get attachment of native function from execution environment
*
@ -1386,7 +1668,7 @@ WASM_RUNTIME_API_EXTERN double
wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst);
/**
* Return execution time in ms of a given wasm funciton with
* Return execution time in ms of a given wasm function with
* func_name. If the function is not found, return 0.
*
* @param module_inst the WASM module instance to profile
@ -1591,7 +1873,7 @@ wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
* and name string) if found, NULL otherwise
*/
WASM_RUNTIME_API_EXTERN const uint8_t *
wasm_runtime_get_custom_section(wasm_module_t const module_comm,
wasm_runtime_get_custom_section(const wasm_module_t module_comm,
const char *name, uint32_t *len);
/**
@ -1602,7 +1884,7 @@ wasm_runtime_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch);
/**
* Check whether an import func `(import <module_name> <func_name> (func ...))`
* is linked or not with runtime registered natvie functions
* is linked or not with runtime registered native functions
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_import_func_linked(const char *module_name,
@ -1610,12 +1892,24 @@ wasm_runtime_is_import_func_linked(const char *module_name,
/**
* Check whether an import global `(import <module_name> <global_name>
* (global ...))` is linked or not with runtime registered natvie globals
* (global ...))` is linked or not with runtime registered native globals
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_import_global_linked(const char *module_name,
const char *global_name);
/**
* Enlarge the memory region for a module instance
*
* @param module_inst the module instance
* @param inc_page_count the number of pages to add
*
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_enlarge_memory(wasm_module_inst_t module_inst,
uint64_t inc_page_count);
typedef enum {
INTERNAL_ERROR,
MAX_SIZE_REACHED,
@ -1653,7 +1947,7 @@ wasm_runtime_set_enlarge_mem_error_callback(
* to all threads in the cluster.
* It's an undefined behavior if multiple threads in a cluster call
* wasm_runtime_set_context_spread on the same key
* simultaneously. It's a caller's resposibility to perform necessary
* simultaneously. It's a caller's responsibility to perform necessary
* serialization if necessary. For example:
*
* if (wasm_runtime_get_context(inst, key) == NULL) {
@ -1673,7 +1967,7 @@ wasm_runtime_set_enlarge_mem_error_callback(
*
* Note: dynamic key create/destroy while instances are live is not
* implemented as of writing this.
* it's caller's resposibility to ensure destorying all module instances
* it's caller's responsibility to ensure destroying all module instances
* before calling wasm_runtime_create_context_key or
* wasm_runtime_destroy_context_key.
* otherwise, it's an undefined behavior.
@ -1734,7 +2028,7 @@ wasm_runtime_get_context(wasm_module_inst_t inst, void *key);
*
* The actual wake up mechanism used by `os_wakeup_blocking_op` is
* platform-dependent. It might impose some platform-dependent restrictions
* on the implementation of the blocking opearation.
* on the implementation of the blocking operation.
*
* For example, on POSIX-like platforms, a signal (by default SIGUSR1) is
* used. The signal delivery configurations (eg. signal handler, signal mask,
@ -1807,6 +2101,15 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_detect_native_stack_overflow_size(wasm_exec_env_t exec_env,
uint32_t required_size);
/**
* Query whether the wasm binary buffer used to create the module can be freed
*
* @param module the target module
* @return true if the wasm binary buffer can be freed
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_underlying_binary_freeable(const wasm_module_t module);
#ifdef __cplusplus
}
#endif

View File

@ -85,8 +85,8 @@ extern "C" {
/**
* Used by wamr compiler to represent object ref types,
* including func object ref, externref object ref,
* internal object ref, eq obect ref, i31 object ref,
* struct object ref, array obect ref
* internal object ref, eq object ref, i31 object ref,
* struct object ref, array object ref
*/
#define VALUE_TYPE_GC_REF 0x43
@ -94,6 +94,14 @@ extern "C" {
#define SHARED_MEMORY_FLAG 0x02
#define MEMORY64_FLAG 0x04
/**
* In the multi-memory proposal, the memarg in loads and stores are
* reinterpreted as a bitfield, bit 6 serves as a flag indicating the presence
* of the optional memory index, if it is set, then an i32 memory index follows
* after the alignment bitfield
*/
#define OPT_MEMIDX_FLAG 0x40
#define DEFAULT_NUM_BYTES_PER_PAGE 65536
#define DEFAULT_MAX_PAGES 65536
#define DEFAULT_MEM64_MAX_PAGES UINT32_MAX
@ -213,10 +221,11 @@ typedef struct WASMTag WASMTag;
#ifndef WASM_VALUE_DEFINED
#define WASM_VALUE_DEFINED
typedef union V128 {
int8 i8x16[16];
int16 i16x8[8];
int32 i32x8[4];
int32 i32x4[4];
int64 i64x2[2];
float32 f32x4[4];
float64 f64x2[2];
@ -249,13 +258,13 @@ typedef union WASMValue {
#endif /* end of WASM_VALUE_DEFINED */
typedef struct WASMStructNewInitValues {
uint8 type_idx;
uint32 type_idx;
uint32 count;
WASMValue fields[1];
} WASMStructNewInitValues;
typedef struct WASMArrayNewInitValues {
uint8 type_idx;
uint32 type_idx;
uint32 length;
WASMValue elem_data[1];
} WASMArrayNewInitValues;
@ -479,11 +488,11 @@ typedef void *WASMString;
#endif /* end of WASM_ENABLE_STRINGREF != 0 */
#endif /* end of WASM_ENABLE_GC != 0 */
typedef struct WASMTable {
typedef struct WASMTableType {
uint8 elem_type;
/**
* 0: no max size and not shared
* 1: hax max size
* 1: has max size
* 2: shared
*/
uint8 flags;
@ -493,6 +502,12 @@ typedef struct WASMTable {
uint32 max_size;
#if WASM_ENABLE_GC != 0
WASMRefType *elem_ref_type;
#endif
} WASMTableType;
typedef struct WASMTable {
WASMTableType table_type;
#if WASM_ENABLE_GC != 0
/* init expr for the whole table */
InitializerExpression init_expr;
#endif
@ -500,8 +515,10 @@ typedef struct WASMTable {
#if WASM_ENABLE_MEMORY64 != 0
typedef uint64 mem_offset_t;
#define PR_MEM_OFFSET PRIu64
#else
typedef uint32 mem_offset_t;
#define PR_MEM_OFFSET PRIu32
#endif
typedef struct WASMMemory {
@ -510,20 +527,15 @@ typedef struct WASMMemory {
uint32 init_page_count;
uint32 max_page_count;
} WASMMemory;
#ifndef WASM_MEMORY_T_DEFINED
#define WASM_MEMORY_T_DEFINED
typedef struct WASMMemory WASMMemoryType;
#endif
typedef struct WASMTableImport {
char *module_name;
char *field_name;
/* 0: no max size, 1: has max size */
uint8 elem_type;
uint8 flags;
bool possible_grow;
uint32 init_size;
/* specified if (flags & 1), else it is 0x10000 */
uint32 max_size;
#if WASM_ENABLE_GC != 0
WASMRefType *elem_ref_type;
#endif
WASMTableType table_type;
#if WASM_ENABLE_MULTI_MODULE != 0
WASMModule *import_module;
WASMTable *import_table_linked;
@ -533,10 +545,7 @@ typedef struct WASMTableImport {
typedef struct WASMMemoryImport {
char *module_name;
char *field_name;
uint32 flags;
uint32 num_bytes_per_page;
uint32 init_page_count;
uint32 max_page_count;
WASMMemoryType mem_type;
#if WASM_ENABLE_MULTI_MODULE != 0
WASMModule *import_module;
WASMMemory *import_memory_linked;
@ -572,7 +581,7 @@ typedef struct WASMTagImport {
char *field_name;
uint8 attribute; /* the type of the tag (numerical) */
uint32 type; /* the type of the catch function (numerical)*/
WASMType *tag_type;
WASMFuncType *tag_type;
void *tag_ptr_linked;
#if WASM_ENABLE_MULTI_MODULE != 0
@ -584,11 +593,15 @@ typedef struct WASMTagImport {
} WASMTagImport;
#endif
typedef struct WASMGlobalType {
uint8 val_type;
bool is_mutable;
} WASMGlobalType;
typedef struct WASMGlobalImport {
char *module_name;
char *field_name;
uint8 type;
bool is_mutable;
WASMGlobalType type;
bool is_linked;
/* global data after linked */
WASMValue global_data_linked;
@ -700,13 +713,12 @@ struct WASMFunction {
struct WASMTag {
uint8 attribute; /* the attribute property of the tag (expected to be 0) */
uint32 type; /* the type of the tag (expected valid inden in type table) */
WASMType *tag_type;
WASMFuncType *tag_type;
};
#endif
struct WASMGlobal {
uint8 type;
bool is_mutable;
WASMGlobalType type;
#if WASM_ENABLE_GC != 0
WASMRefType *ref_type;
#endif
@ -746,6 +758,7 @@ typedef struct WASMDataSeg {
bool is_passive;
#endif
uint8 *data;
bool is_data_cloned;
} WASMDataSeg;
typedef struct BlockAddr {
@ -762,7 +775,7 @@ typedef struct WASIArguments {
uint32 map_dir_count;
const char **env;
uint32 env_count;
/* in CIDR noation */
/* in CIDR notation */
const char **addr_pool;
uint32 addr_count;
const char **ns_lookup_pool;
@ -831,6 +844,9 @@ struct WASMModule {
AOTModule structure. */
uint32 module_type;
/* the package version read from the WASM file */
uint32 package_version;
uint32 type_count;
uint32 import_count;
uint32 function_count;
@ -1021,7 +1037,7 @@ struct WASMModule {
/**
* func pointers of LLVM JITed (un-imported) functions
* for non Multi-Tier JIT mode:
* each pointer is set to the lookuped llvm jit func ptr, note that it
* each pointer is set to the looked up llvm jit func ptr, note that it
* is a stub and will trigger the actual compilation when it is called
* for Multi-Tier JIT mode:
* each pointer is inited as call_to_fast_jit code block, when the llvm
@ -1071,6 +1087,9 @@ struct WASMModule {
/* user defined name */
char *name;
/* Whether the underlying wasm binary buffer can be freed */
bool is_binary_freeable;
};
typedef struct BlockType {

View File

@ -495,6 +495,12 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
} while (0)
#endif
#if UINTPTR_MAX == UINT64_MAX
#define PUSH_PTR(value) PUSH_I64(value)
#else
#define PUSH_PTR(value) PUSH_I32(value)
#endif
/* in exception handling, label_type needs to be stored to lookup exception
* handlers */
@ -691,6 +697,44 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
#define read_leb_mem_offset(p, p_end, res) read_leb_uint32(p, p_end, res)
#endif
#if WASM_ENABLE_MULTI_MEMORY != 0
/* If the current memidx differs than the last cached one,
* update memory related information */
#define read_leb_memidx(p, p_end, res) \
do { \
read_leb_uint32(p, p_end, res); \
if (res != memidx_cached) { \
memory = wasm_get_memory_with_idx(module, res); \
linear_mem_size = GET_LINEAR_MEMORY_SIZE(memory); \
memidx_cached = res; \
} \
} while (0)
/* First read the alignment, then if it has flag indicating following memidx,
* read and update memory related information, if it differs than the
* last(cached) one. If it doesn't have flag reset the
* memory instance to the default memories[0] */
#define read_leb_memarg(p, p_end, res) \
do { \
read_leb_uint32(p, p_end, res); \
if (!(res & OPT_MEMIDX_FLAG)) \
memidx = 0; \
else \
read_leb_uint32(p, p_end, memidx); \
if (memidx != memidx_cached) { \
memory = wasm_get_memory_with_idx(module, memidx); \
linear_mem_size = GET_LINEAR_MEMORY_SIZE(memory); \
memidx_cached = memidx; \
} \
} while (0)
#else
#define read_leb_memarg(p, p_end, res) \
do { \
read_leb_uint32(p, p_end, res); \
(void)res; \
} while (0)
#define read_leb_memidx(p, p_end, res) read_leb_memarg(p, p_end, res)
#endif
#if WASM_ENABLE_LABELS_AS_VALUES == 0
#define RECOVER_FRAME_IP_END() frame_ip_end = wasm_get_func_code_end(cur_func)
#else
@ -1393,26 +1437,48 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
#endif /* WASM_ENABLE_DEBUG_INTERP */
#endif /* WASM_ENABLE_THREAD_MGR */
#if WASM_ENABLE_THREAD_MGR != 0 && WASM_ENABLE_DEBUG_INTERP != 0
#if BH_ATOMIC_32_IS_ATOMIC != 0
#define GET_SIGNAL_FLAG() \
do { \
signal_flag = \
BH_ATOMIC_32_LOAD(exec_env->current_status->signal_flag); \
} while (0)
#else
#define GET_SIGNAL_FLAG() \
do { \
os_mutex_lock(&exec_env->wait_lock); \
signal_flag = exec_env->current_status->signal_flag; \
os_mutex_unlock(&exec_env->wait_lock); \
} while (0)
#endif
#endif
#if WASM_ENABLE_LABELS_AS_VALUES != 0
#define HANDLE_OP(opcode) HANDLE_##opcode:
#define FETCH_OPCODE_AND_DISPATCH() goto *handle_table[*frame_ip++]
#if WASM_ENABLE_THREAD_MGR != 0 && WASM_ENABLE_DEBUG_INTERP != 0
#define HANDLE_OP_END() \
do { \
/* Record the current frame_ip, so when exception occurs, \
debugger can know the exact opcode who caused the exception */ \
frame_ip_orig = frame_ip; \
os_mutex_lock(&exec_env->wait_lock); \
while (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \
&& exec_env->current_status->step_count++ == 1) { \
exec_env->current_status->step_count = 0; \
SYNC_ALL_TO_FRAME(); \
wasm_cluster_thread_waiting_run(exec_env); \
} \
os_mutex_unlock(&exec_env->wait_lock); \
goto *handle_table[*frame_ip++]; \
#define HANDLE_OP_END() \
do { \
/* Record the current frame_ip, so when exception occurs, \
debugger can know the exact opcode who caused the exception */ \
frame_ip_orig = frame_ip; \
/* Atomic load the exec_env's signal_flag first, and then handle \
more with lock if it is WAMR_SIG_SINGSTEP */ \
GET_SIGNAL_FLAG(); \
if (signal_flag == WAMR_SIG_SINGSTEP) { \
os_mutex_lock(&exec_env->wait_lock); \
while (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \
&& exec_env->current_status->step_count++ == 1) { \
exec_env->current_status->step_count = 0; \
SYNC_ALL_TO_FRAME(); \
wasm_cluster_thread_waiting_run(exec_env); \
} \
os_mutex_unlock(&exec_env->wait_lock); \
} \
goto *handle_table[*frame_ip++]; \
} while (0)
#else
#define HANDLE_OP_END() FETCH_OPCODE_AND_DISPATCH()
@ -1421,16 +1487,24 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
#else /* else of WASM_ENABLE_LABELS_AS_VALUES */
#define HANDLE_OP(opcode) case opcode:
#if WASM_ENABLE_THREAD_MGR != 0 && WASM_ENABLE_DEBUG_INTERP != 0
#define HANDLE_OP_END() \
os_mutex_lock(&exec_env->wait_lock); \
if (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \
&& exec_env->current_status->step_count++ == 2) { \
exec_env->current_status->step_count = 0; \
SYNC_ALL_TO_FRAME(); \
wasm_cluster_thread_waiting_run(exec_env); \
} \
os_mutex_unlock(&exec_env->wait_lock); \
continue
#define HANDLE_OP_END() \
/* Record the current frame_ip, so when exception occurs, \
debugger can know the exact opcode who caused the exception */ \
frame_ip_orig = frame_ip; \
/* Atomic load the exec_env's signal_flag first, and then handle \
more with lock if it is WAMR_SIG_SINGSTEP */ \
GET_SIGNAL_FLAG(); \
if (signal_flag == WAMR_SIG_SINGSTEP) { \
os_mutex_lock(&exec_env->wait_lock); \
while (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \
&& exec_env->current_status->step_count++ == 1) { \
exec_env->current_status->step_count = 0; \
SYNC_ALL_TO_FRAME(); \
wasm_cluster_thread_waiting_run(exec_env); \
} \
os_mutex_unlock(&exec_env->wait_lock); \
} \
continue;
#else
#define HANDLE_OP_END() continue
#endif
@ -1531,6 +1605,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
if (memory)
is_memory64 = memory->is_memory64;
#endif
#if WASM_ENABLE_MULTI_MEMORY != 0
uint32 memidx = 0;
uint32 memidx_cached = (uint32)-1;
#endif
#if WASM_ENABLE_DEBUG_INTERP != 0
uint8 *frame_ip_orig = NULL;
@ -1539,6 +1617,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
debug_instance ? &debug_instance->watch_point_list_read : NULL;
bh_list *watch_point_list_write =
debug_instance ? &debug_instance->watch_point_list_write : NULL;
#if WASM_ENABLE_THREAD_MGR != 0
uint32 signal_flag;
#endif
#endif
#if WASM_ENABLE_LABELS_AS_VALUES != 0
@ -1584,7 +1665,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 *tgtframe_sp = tgtframe->frame_sp;
/* frame sp of tgtframe points to catched exception */
/* frame sp of tgtframe points to caught exception */
exception_tag_index = *((uint32 *)tgtframe_sp);
tgtframe_sp++;
@ -1612,7 +1693,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
/* landing pad for the rethrow ? */
find_a_catch_handler:
{
WASMType *tag_type = NULL;
WASMFuncType *tag_type = NULL;
uint32 cell_num_to_copy = 0;
if (IS_INVALID_TAGINDEX(exception_tag_index)) {
/*
@ -1655,7 +1736,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
* BLOCK, IF and LOOP do not contain handlers and
* cannot catch exceptions.
* blocks marked as CATCH or
* CATCH_ALL did already caugth an exception and can
* CATCH_ALL did already caught an exception and can
* only be a target for RETHROW, but cannot catch an
* exception again
*/
@ -1787,7 +1868,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
}
handler_number++;
}
/* exception not catched in this frame */
/* exception not caught in this frame */
break;
}
case LABEL_TYPE_FUNCTION:
@ -1892,19 +1973,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
switch (handler_opcode) {
case WASM_OP_CATCH:
skip_leb(lookup_cursor); /* skip tag_index */
PUSH_I64(end_addr);
PUSH_PTR(end_addr);
break;
case WASM_OP_CATCH_ALL:
PUSH_I64(end_addr);
PUSH_PTR(end_addr);
break;
case WASM_OP_DELEGATE:
skip_leb(lookup_cursor); /* skip depth */
PUSH_I64(end_addr);
PUSH_PTR(end_addr);
/* patch target_addr */
(frame_csp - 1)->target_addr = lookup_cursor;
break;
case WASM_OP_END:
PUSH_I64(0);
PUSH_PTR(0);
/* patch target_addr */
(frame_csp - 1)->target_addr = end_addr;
break;
@ -2242,8 +2323,15 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
bh_assert(tidx < module->module->type_count);
cur_type = wasm_types[tidx];
/* clang-format off */
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
read_leb_uint32(frame_ip, frame_ip_end, tbl_idx);
#else
frame_ip++;
tbl_idx = 0;
#endif
bh_assert(tbl_idx < module->table_count);
/* clang-format on */
tbl_inst = wasm_get_table_inst(module, tbl_idx);
@ -4246,13 +4334,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(4);
PUSH_I32(LOAD_I32(maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4262,13 +4349,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(8);
PUSH_I64(LOAD_I64(maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4277,13 +4363,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(1);
PUSH_I32(sign_ext_8_32(*(int8 *)maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4292,13 +4377,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(1);
PUSH_I32((uint32)(*(uint8 *)maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4307,13 +4391,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(2);
PUSH_I32(sign_ext_16_32(LOAD_I16(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4322,13 +4405,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(2);
PUSH_I32((uint32)(LOAD_U16(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4337,13 +4419,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(1);
PUSH_I64(sign_ext_8_64(*(int8 *)maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4352,13 +4433,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(1);
PUSH_I64((uint64)(*(uint8 *)maddr));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4367,13 +4447,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(2);
PUSH_I64(sign_ext_16_64(LOAD_I16(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4382,13 +4461,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(2);
PUSH_I64((uint64)(LOAD_U16(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4397,14 +4475,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
opcode = *(frame_ip - 1);
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(4);
PUSH_I64(sign_ext_32_64(LOAD_I32(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4413,13 +4489,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
addr = POP_MEM_OFFSET();
CHECK_MEMORY_OVERFLOW(4);
PUSH_I64((uint64)(LOAD_U32(maddr)));
CHECK_READ_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4430,7 +4505,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
frame_sp--;
addr = POP_MEM_OFFSET();
@ -4445,7 +4520,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
STORE_U32(maddr, frame_sp[1]);
}
CHECK_WRITE_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4455,7 +4529,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 flags;
mem_offset_t offset, addr;
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
frame_sp -= 2;
addr = POP_MEM_OFFSET();
@ -4473,7 +4547,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
GET_I64_FROM_ADDR(frame_sp + 1));
}
CHECK_WRITE_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4485,7 +4558,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 sval;
opcode = *(frame_ip - 1);
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
sval = (uint32)POP_I32();
addr = POP_MEM_OFFSET();
@ -4499,7 +4572,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
STORE_U16(maddr, (uint16)sval);
}
CHECK_WRITE_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
@ -4512,7 +4584,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint64 sval;
opcode = *(frame_ip - 1);
read_leb_uint32(frame_ip, frame_ip_end, flags);
read_leb_memarg(frame_ip, frame_ip_end, flags);
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
sval = (uint64)POP_I64();
addr = POP_MEM_OFFSET();
@ -4530,29 +4602,27 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
STORE_U32(maddr, (uint32)sval);
}
CHECK_WRITE_WATCHPOINT(addr, offset);
(void)flags;
HANDLE_OP_END();
}
/* memory size and memory grow instructions */
HANDLE_OP(WASM_OP_MEMORY_SIZE)
{
uint32 reserved;
read_leb_uint32(frame_ip, frame_ip_end, reserved);
uint32 mem_idx;
read_leb_memidx(frame_ip, frame_ip_end, mem_idx);
PUSH_PAGE_COUNT(memory->cur_page_count);
(void)reserved;
HANDLE_OP_END();
}
HANDLE_OP(WASM_OP_MEMORY_GROW)
{
uint32 reserved, delta,
prev_page_count = memory->cur_page_count;
uint32 mem_idx, delta, prev_page_count;
read_leb_uint32(frame_ip, frame_ip_end, reserved);
read_leb_memidx(frame_ip, frame_ip_end, mem_idx);
prev_page_count = memory->cur_page_count;
delta = (uint32)POP_PAGE_COUNT();
if (!wasm_enlarge_memory(module, delta)) {
if (!wasm_enlarge_memory_with_idx(module, delta, mem_idx)) {
/* failed to memory.grow, return -1 */
PUSH_PAGE_COUNT(-1);
}
@ -4568,7 +4638,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
#endif
}
(void)reserved;
HANDLE_OP_END();
}
@ -5564,8 +5633,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint8 *data;
read_leb_uint32(frame_ip, frame_ip_end, segment);
#if WASM_ENABLE_MULTI_MEMORY != 0
read_leb_memidx(frame_ip, frame_ip_end, memidx);
#else
/* skip memory index */
frame_ip++;
#endif
bytes = (uint64)(uint32)POP_I32();
offset = (uint64)(uint32)POP_I32();
@ -5614,39 +5687,72 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
{
mem_offset_t dst, src, len;
uint8 *mdst, *msrc;
uint64 dlen;
frame_ip += 2;
len = POP_MEM_OFFSET();
src = POP_MEM_OFFSET();
dst = POP_MEM_OFFSET();
#if WASM_ENABLE_MULTI_MEMORY != 0
/* dst memidx */
read_leb_memidx(frame_ip, frame_ip_end, memidx);
#else
/* skip dst memidx */
frame_ip += 1;
#endif
#if WASM_ENABLE_THREAD_MGR != 0
linear_mem_size = get_linear_mem_size();
#endif
/* dst boundary check */
#ifndef OS_ENABLE_HW_BOUND_CHECK
CHECK_BULK_MEMORY_OVERFLOW(src, len, msrc);
CHECK_BULK_MEMORY_OVERFLOW(dst, len, mdst);
#else
if ((uint64)(uint32)src + len > linear_mem_size)
if ((uint64)dst + len > linear_mem_size)
goto out_of_bounds;
msrc = memory->memory_data + (uint32)src;
mdst = memory->memory_data + dst;
#endif
dlen = linear_mem_size - dst;
if ((uint64)(uint32)dst + len > linear_mem_size)
#if WASM_ENABLE_MULTI_MEMORY != 0
/* src memidx */
read_leb_memidx(frame_ip, frame_ip_end, memidx);
#else
/* skip src memidx */
frame_ip += 1;
#endif
#if WASM_ENABLE_THREAD_MGR != 0
linear_mem_size = get_linear_mem_size();
#endif
/* src boundary check */
#ifndef OS_ENABLE_HW_BOUND_CHECK
CHECK_BULK_MEMORY_OVERFLOW(src, len, msrc);
#else
if ((uint64)src + len > linear_mem_size)
goto out_of_bounds;
mdst = memory->memory_data + (uint32)dst;
msrc = memory->memory_data + src;
#endif
#if WASM_ENABLE_MEMORY64 == 0
/* allowing the destination and source to overlap */
bh_memmove_s(mdst, (uint32)(linear_mem_size - dst),
msrc, len);
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);
#endif
break;
}
case WASM_OP_MEMORY_FILL:
{
mem_offset_t dst, len;
uint8 fill_val, *mdst;
#if WASM_ENABLE_MULTI_MEMORY != 0
read_leb_memidx(frame_ip, frame_ip_end, memidx);
#else
/* skip memory index */
frame_ip++;
#endif
len = POP_MEM_OFFSET();
fill_val = POP_I32();
@ -6411,7 +6517,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
}
}
/*
* excange the thrown exception (index valid in submodule)
* exchange the thrown exception (index valid in submodule)
* with the imported exception index (valid in this module)
* if the module did not import the exception,
* that results in a "INVALID_TAGINDEX", that triggers
@ -6468,7 +6574,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
goto find_a_catch_handler;
}
/* when throw hits the end of a function it signalles with a
/* when throw hits the end of a function it signals with a
* "uncaught wasm exception" trap */
if (has_exception
&& strstr(uncaught_exception, "uncaught wasm exception")) {
@ -6487,6 +6593,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
WASMFuncType *func_type = cur_wasm_func->func_type;
uint32 max_stack_cell_num = cur_wasm_func->max_stack_cell_num;
uint32 cell_num_of_local_stack;
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
uint32 local_cell_idx;
#endif
#if WASM_ENABLE_EXCE_HANDLING != 0
/* account for exception handlers, bundle them here */
@ -6546,6 +6655,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
memset(frame_lp + cur_func->param_cell_num, 0,
(uint32)(cur_func->local_cell_num * 4));
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
/* externref/funcref should be NULL_REF rather than 0 */
local_cell_idx = cur_func->param_cell_num;
for (i = 0; i < cur_wasm_func->local_count; i++) {
if (cur_wasm_func->local_types[i] == VALUE_TYPE_EXTERNREF
|| cur_wasm_func->local_types[i] == VALUE_TYPE_FUNCREF) {
*(frame_lp + local_cell_idx) = NULL_REF;
}
local_cell_idx +=
wasm_value_type_cell_num(cur_wasm_func->local_types[i]);
}
#endif
/* Push function block as first block */
cell_num = func_type->ret_cell_num;
PUSH_CSP(LABEL_TYPE_FUNCTION, 0, cell_num, frame_ip_end - 1);

View File

@ -973,9 +973,9 @@ fail:
} \
} \
else if (cells[0] == 2) { \
frame_lp[dst_offsets[0]] = frame_lp[src_offsets[0]]; \
frame_lp[dst_offsets[0] + 1] = \
frame_lp[src_offsets[0] + 1]; \
PUT_I64_TO_ADDR( \
frame_lp + dst_offsets[0], \
GET_I64_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]); \
@ -1020,9 +1020,9 @@ fail:
if (cells[0] == 1) \
frame_lp[dst_offsets[0]] = frame_lp[src_offsets[0]]; \
else if (cells[0] == 2) { \
frame_lp[dst_offsets[0]] = frame_lp[src_offsets[0]]; \
frame_lp[dst_offsets[0] + 1] = \
frame_lp[src_offsets[0] + 1]; \
PUT_I64_TO_ADDR( \
frame_lp + dst_offsets[0], \
GET_I64_FROM_ADDR(frame_lp + src_offsets[0])); \
} \
} \
else { \
@ -3446,10 +3446,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
{
/* clang-format off */
#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
local_offset = *frame_ip++;
local_offset = *frame_ip++;
#else
local_offset = *frame_ip;
frame_ip += 2;
local_offset = *frame_ip;
frame_ip += 2;
#endif
/* clang-format on */
*(uint32 *)(frame_lp + local_offset) =
@ -3463,10 +3463,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
{
/* clang-format off */
#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
local_offset = *frame_ip++;
local_offset = *frame_ip++;
#else
local_offset = *frame_ip;
frame_ip += 2;
local_offset = *frame_ip;
frame_ip += 2;
#endif
/* clang-format on */
PUT_I64_TO_ADDR((uint32 *)(frame_lp + local_offset),
@ -3837,6 +3837,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
addr_ret = GET_OFFSET();
delta = (uint32)frame_lp[addr1];
/* TODO: multi-memory wasm_enlarge_memory_with_idx() */
if (!wasm_enlarge_memory(module, delta)) {
/* failed to memory.grow, return -1 */
frame_lp[addr_ret] = -1;
@ -4868,8 +4869,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
GET_LOCAL_INDEX_TYPE_AND_OFFSET();
addr1 = GET_OFFSET();
if (local_type == VALUE_TYPE_I32
|| local_type == VALUE_TYPE_F32) {
if (local_type == VALUE_TYPE_I32 || local_type == VALUE_TYPE_F32
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
|| local_type == VALUE_TYPE_FUNCREF
|| local_type == VALUE_TYPE_EXTERNREF
#endif
) {
*(int32 *)(frame_lp + local_offset) = frame_lp[addr1];
}
else if (local_type == VALUE_TYPE_I64
@ -5905,6 +5910,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
else {
WASMFunction *cur_wasm_func = cur_func->u.func;
uint32 cell_num_of_local_stack;
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
uint32 i, local_cell_idx;
#endif
cell_num_of_local_stack = cur_func->param_cell_num
+ cur_func->local_cell_num
@ -5947,6 +5955,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
memset(frame_lp + cur_func->param_cell_num, 0,
(uint32)(cur_func->local_cell_num * 4));
#if WASM_ENABLE_REF_TYPES != 0 && WASM_ENABLE_GC == 0
/* externref/funcref should be NULL_REF rather than 0 */
local_cell_idx = cur_func->param_cell_num;
for (i = 0; i < cur_wasm_func->local_count; i++) {
if (cur_wasm_func->local_types[i] == VALUE_TYPE_EXTERNREF
|| cur_wasm_func->local_types[i] == VALUE_TYPE_FUNCREF) {
*(frame_lp + local_cell_idx) = NULL_REF;
}
local_cell_idx +=
wasm_value_type_cell_num(cur_wasm_func->local_types[i]);
}
#endif
#if WASM_ENABLE_GC != 0
/* frame->ip is used during GC root set enumeration, so we must
* initialized this field here */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ typedef enum WASMOpcode {
WASM_OP_I32_STORE8 = 0x3a, /* i32.store8 */
WASM_OP_I32_STORE16 = 0x3b, /* i32.store16 */
WASM_OP_I64_STORE8 = 0x3c, /* i64.store8 */
WASM_OP_I64_STORE16 = 0x3d, /* i64.sotre16 */
WASM_OP_I64_STORE16 = 0x3d, /* i64.store16 */
WASM_OP_I64_STORE32 = 0x3e, /* i64.store32 */
WASM_OP_MEMORY_SIZE = 0x3f, /* memory.size */
WASM_OP_MEMORY_GROW = 0x40, /* memory.grow */
@ -325,7 +325,7 @@ typedef enum WASMGCEXTOpcode {
WASM_OP_I31_GET_S = 0x1D, /* i31.get_s */
WASM_OP_I31_GET_U = 0x1E, /* i31.get_u */
/* stringref related opcoded */
/* stringref related opcodes */
WASM_OP_STRING_NEW_UTF8 = 0x80, /* string.new_utf8 */
WASM_OP_STRING_NEW_WTF16 = 0x81, /* string.new_wtf16 */
WASM_OP_STRING_CONST = 0x82, /* string.const */

File diff suppressed because it is too large Load Diff

View File

@ -13,10 +13,6 @@
#include "../common/wasm_runtime_common.h"
#include "../common/wasm_exec_env.h"
#if WASM_ENABLE_WASI_NN != 0
#include "../libraries/wasi-nn/src/wasi_nn_private.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -112,7 +108,7 @@ struct WASMMemoryInstance {
/* Four-byte paddings to ensure the layout of WASMMemoryInstance is the same
* in both 64-bit and 32-bit */
uint8 __paddings[4];
uint8 _paddings[4];
/* Number bytes per page */
uint32 num_bytes_per_page;
@ -624,9 +620,16 @@ wasm_check_app_addr_and_convert(WASMModuleInstance *module_inst, bool is_str,
WASMMemoryInstance *
wasm_get_default_memory(WASMModuleInstance *module_inst);
WASMMemoryInstance *
wasm_get_memory_with_idx(WASMModuleInstance *module_inst, uint32 index);
bool
wasm_enlarge_memory(WASMModuleInstance *module_inst, uint32 inc_page_count);
bool
wasm_enlarge_memory_with_idx(WASMModuleInstance *module_inst,
uint32 inc_page_count, uint32 memidx);
bool
wasm_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
uint32 argc, uint32 argv[]);
@ -760,7 +763,7 @@ llvm_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
#if WASM_ENABLE_BULK_MEMORY != 0
bool
llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
uint32 offset, uint32 len, uint32 dst);
uint32 offset, uint32 len, size_t dst);
bool
llvm_jit_data_drop(WASMModuleInstance *module_inst, uint32 seg_index);

View File

@ -9,12 +9,12 @@ from building import *
cwd = GetCurrentDir()
src = Split('''
libc_pthread_wrapper.c
lib_pthread_wrapper.c
''')
CPPPATH = [cwd]
group = DefineGroup('iwasm_libc_pthread', src, depend = [''], CPPPATH = CPPPATH)
group = DefineGroup('iwasm_lib_pthread', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,15 @@
#
# Copyright 2024 Sony Semiconductor Solutions Corporation.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('iwasm_lib_wasi_threads', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -16,7 +16,7 @@
void
wasm_runtime_set_exception(wasm_module_inst_t module, const char *exception);
uint32
uint64
wasm_runtime_module_realloc(wasm_module_inst_t module, uint64 ptr, uint64 size,
void **p_native_addr);
@ -321,10 +321,22 @@ fail:
return false;
}
#ifndef BUILTIN_LIBC_BUFFERED_PRINTF
#define BUILTIN_LIBC_BUFFERED_PRINTF 0
#endif
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_SIZE
#define BUILTIN_LIBC_BUFFERED_PRINT_SIZE 128
#endif
struct str_context {
char *str;
uint32 max;
uint32 count;
#if BUILTIN_LIBC_BUFFERED_PRINTF != 0
char print_buf[BUILTIN_LIBC_BUFFERED_PRINT_SIZE];
uint32 print_buf_size;
#endif
};
static int
@ -345,41 +357,23 @@ sprintf_out(int c, struct str_context *ctx)
return c;
}
#ifndef BUILTIN_LIBC_BUFFERED_PRINTF
#define BUILTIN_LIBC_BUFFERED_PRINTF 0
#endif
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_SIZE
#define BUILTIN_LIBC_BUFFERED_PRINT_SIZE 128
#endif
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
#define BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
#endif
#if BUILTIN_LIBC_BUFFERED_PRINTF != 0
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
static char print_buf[BUILTIN_LIBC_BUFFERED_PRINT_SIZE] = { 0 };
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
static int print_buf_size = 0;
static int
printf_out(int c, struct str_context *ctx)
{
if (c == '\n') {
print_buf[print_buf_size] = '\0';
os_printf("%s\n", print_buf);
print_buf_size = 0;
ctx->print_buf[ctx->print_buf_size] = '\0';
os_printf("%s\n", ctx->print_buf);
ctx->print_buf_size = 0;
}
else if (print_buf_size >= sizeof(print_buf) - 2) {
print_buf[print_buf_size++] = (char)c;
print_buf[print_buf_size] = '\0';
os_printf("%s\n", print_buf);
print_buf_size = 0;
else if (ctx->print_buf_size >= sizeof(ctx->print_buf) - 2) {
ctx->print_buf[ctx->print_buf_size++] = (char)c;
ctx->print_buf[ctx->print_buf_size] = '\0';
os_printf("%s\n", ctx->print_buf);
ctx->print_buf_size = 0;
}
else {
print_buf[print_buf_size++] = (char)c;
ctx->print_buf[ctx->print_buf_size++] = (char)c;
}
ctx->count++;
return c;
@ -398,7 +392,9 @@ static int
printf_wrapper(wasm_exec_env_t exec_env, const char *format, _va_list va_args)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
struct str_context ctx = { NULL, 0, 0 };
struct str_context ctx = { 0 };
memset(&ctx, 0, sizeof(ctx));
/* format has been checked by runtime */
if (!validate_native_addr(va_args, (uint64)sizeof(int32)))
@ -408,6 +404,11 @@ printf_wrapper(wasm_exec_env_t exec_env, const char *format, _va_list va_args)
module_inst))
return 0;
#if BUILTIN_LIBC_BUFFERED_PRINTF != 0
if (ctx.print_buf_size > 0)
os_printf("%s", ctx.print_buf);
#endif
return (int)ctx.count;
}
@ -682,9 +683,12 @@ calloc_wrapper(wasm_exec_env_t exec_env, uint32 nmemb, uint32 size)
static uint32
realloc_wrapper(wasm_exec_env_t exec_env, uint32 ptr, uint32 new_size)
{
uint64 ret_offset = 0;
wasm_module_inst_t module_inst = get_module_inst(exec_env);
return wasm_runtime_module_realloc(module_inst, ptr, new_size, NULL);
ret_offset = wasm_runtime_module_realloc(module_inst, ptr, new_size, NULL);
bh_assert(ret_offset < UINT32_MAX);
return (uint32)ret_offset;
}
static void
@ -1001,6 +1005,12 @@ print_i32_wrapper(wasm_exec_env_t exec_env, int32 i32)
os_printf("in specttest.print_i32(%" PRId32 ")\n", i32);
}
static void
print_i64_wrapper(wasm_exec_env_t exec_env, int64 i64)
{
os_printf("in specttest.print_i64(%" PRId64 ")\n", i64);
}
static void
print_i32_f32_wrapper(wasm_exec_env_t exec_env, int32 i32, float f32)
{
@ -1091,6 +1101,7 @@ static NativeSymbol native_symbols_libc_builtin[] = {
static NativeSymbol native_symbols_spectest[] = {
REG_NATIVE_FUNC(print, "()"),
REG_NATIVE_FUNC(print_i32, "(i)"),
REG_NATIVE_FUNC(print_i64, "(I)"),
REG_NATIVE_FUNC(print_i32_f32, "(if)"),
REG_NATIVE_FUNC(print_f64_f64, "(FF)"),
REG_NATIVE_FUNC(print_f32, "(f)"),
@ -1136,6 +1147,7 @@ static WASMNativeGlobalDef native_global_defs[] = {
{ "test", "global-f32", VALUE_TYPE_F32, false, .value.f32 = 0 },
{ "test", "global-mut-i32", VALUE_TYPE_I32, true, .value.i32 = 0 },
{ "test", "global-mut-i64", VALUE_TYPE_I64, true, .value.i64 = 0 },
{ "test", "g", VALUE_TYPE_I32, true, .value.i32 = 0 },
#if WASM_ENABLE_GC != 0
{ "G", "g", VALUE_TYPE_I32, false, .value.i32 = 4 },
{ "M", "g", REF_TYPE_HT_NON_NULLABLE, false, .value.gc_obj = 0 },
@ -1161,8 +1173,8 @@ wasm_native_lookup_libc_builtin_global(const char *module_name,
while (global_def < global_def_end) {
if (!strcmp(global_def->module_name, module_name)
&& !strcmp(global_def->global_name, global_name)) {
global->type = global_def->type;
global->is_mutable = global_def->is_mutable;
global->type.val_type = global_def->type;
global->type.is_mutable = global_def->is_mutable;
global->global_data_linked = global_def->value;
return true;
}

View File

@ -495,6 +495,24 @@ emscripten_notify_memory_growth_wrapper(wasm_exec_env_t exec_env, int i)
(void)i;
}
static void
emscripten_sleep_wrapper(wasm_exec_env_t exec_env, int timeout_ms)
{
unsigned int sec;
useconds_t us;
if (timeout_ms <= 0)
return;
sec = timeout_ms / 1000;
us = (timeout_ms % 1000) * 1000;
if (sec > 0)
sleep(sec);
if (us > 0)
usleep(us);
}
static void
emscripten_thread_sleep_wrapper(wasm_exec_env_t exec_env, double timeout_ms)
{
@ -544,6 +562,7 @@ static NativeSymbol native_symbols_libc_emcc[] = {
REG_NATIVE_FUNC(__sys_getcwd, "(*~)i"),
REG_NATIVE_FUNC(__sys_uname, "(*)i"),
REG_NATIVE_FUNC(emscripten_notify_memory_growth, "(i)"),
REG_NATIVE_FUNC(emscripten_sleep, "(i)"),
REG_NATIVE_FUNC(emscripten_thread_sleep, "(F)"),
#endif /* end of BH_PLATFORM_LINUX_SGX */
};

View File

@ -459,8 +459,27 @@ fd_determine_type_rights(os_file_handle fd, __wasi_filetype_t *type,
__wasi_rights_t *rights_inheriting)
{
struct __wasi_filestat_t buf;
__wasi_errno_t error = os_fstat(fd, &buf);
__wasi_errno_t error;
if (os_is_stdin_handle(fd)) {
*rights_base = RIGHTS_STDIN;
*rights_inheriting = RIGHTS_STDIN;
return __WASI_ESUCCESS;
}
if (os_is_stdout_handle(fd)) {
*rights_base = RIGHTS_STDOUT;
*rights_inheriting = RIGHTS_STDOUT;
return __WASI_ESUCCESS;
}
if (os_is_stderr_handle(fd)) {
*rights_base = RIGHTS_STDERR;
*rights_inheriting = RIGHTS_STDERR;
return __WASI_ESUCCESS;
}
error = os_fstat(fd, &buf);
if (error != __WASI_ESUCCESS)
return error;
@ -650,8 +669,10 @@ fd_table_insert(wasm_exec_env_t exec_env, struct fd_table *ft,
__wasi_errno_t error = fd_table_unused(ft, out);
if (error != __WASI_ESUCCESS)
if (error != __WASI_ESUCCESS) {
rwlock_unlock(&ft->lock);
return error;
}
fd_table_attach(ft, *out, fo, rights_base, rights_inheriting);
rwlock_unlock(&ft->lock);

View File

@ -47,6 +47,19 @@
#define RIGHTS_CHARACTER_DEVICE_BASE RIGHTS_ALL
#define RIGHTS_CHARACTER_DEVICE_INHERITING RIGHTS_ALL
#define RIGHTS_STDIN \
(__WASI_RIGHT_FD_ADVISE | __WASI_RIGHT_FD_FILESTAT_GET | \
__WASI_RIGHT_FD_READ | __WASI_RIGHT_FD_WRITE | \
__WASI_RIGHT_POLL_FD_READWRITE)
#define RIGHTS_STDOUT \
(__WASI_RIGHT_FD_ADVISE | __WASI_RIGHT_FD_DATASYNC | \
__WASI_RIGHT_FD_FILESTAT_GET | __WASI_RIGHT_FD_SYNC | \
__WASI_RIGHT_FD_READ | __WASI_RIGHT_FD_WRITE | \
__WASI_RIGHT_POLL_FD_READWRITE)
#define RIGHTS_STDERR RIGHTS_STDOUT
// Only allow directory operations on directories. Directories can only
// yield file descriptors to other directories and files.
#define RIGHTS_DIRECTORY_BASE \

View File

@ -18,7 +18,7 @@
#include "gnuc.h"
#if defined(__FreeBSD__) || defined(__APPLE__) \
|| (defined(ANDROID) && __ANDROID_API__ < 28)
|| ((defined(ANDROID) || defined(__ANDROID__)) && (__ANDROID_API__ < 28))
#define CONFIG_HAS_ARC4RANDOM_BUF 1
#else
#define CONFIG_HAS_ARC4RANDOM_BUF 0
@ -26,9 +26,17 @@
// On Linux, prefer to use getrandom, though it isn't available in
// GLIBC before 2.25.
#if (defined(__linux__) || defined(ESP_PLATFORM) || defined(__COSMOPOLITAN__)) \
&& (!defined(__GLIBC__) || __GLIBC__ > 2 \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))
//
// NuttX has arc4random_buf, getrandom, and /dev/urandom.
// We prefer getrandom here because it has the best chance to be usable.
// - Our /dev/urandom usage (keep the open descriptor in a global variable)
// is not compatible with NuttX flat memory model.
// - arc4random_buf is only available with CONFIG_CRYPTO_RANDOM_POOL=y.
#if defined(__NuttX__) \
|| ((defined(__linux__) || defined(ESP_PLATFORM) \
|| defined(__COSMOPOLITAN__)) \
&& (!defined(__GLIBC__) || __GLIBC__ > 2 \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25)))
#define CONFIG_HAS_GETRANDOM 1
#else
#define CONFIG_HAS_GETRANDOM 0

View File

@ -1194,7 +1194,7 @@ wait_for_thread_visitor(void *node, void *user_data)
}
void
wams_cluster_wait_for_all(WASMCluster *cluster)
wasm_cluster_wait_for_all(WASMCluster *cluster)
{
os_mutex_lock(&cluster->lock);
cluster->processing = true;

View File

@ -45,7 +45,7 @@ struct WASMCluster {
* requests. This is a short-lived state, must be cleared immediately once
* the processing finished.
* This is used to avoid dead lock when one thread waiting another thread
* with lock, see wams_cluster_wait_for_all and wasm_cluster_terminate_all
* with lock, see wasm_cluster_wait_for_all and wasm_cluster_terminate_all
*/
bool processing;
#if WASM_ENABLE_DEBUG_INTERP != 0
@ -135,7 +135,7 @@ wasm_cluster_terminate_all_except_self(WASMCluster *cluster,
WASMExecEnv *exec_env);
void
wams_cluster_wait_for_all(WASMCluster *cluster);
wasm_cluster_wait_for_all(WASMCluster *cluster);
void
wasm_cluster_wait_for_all_except_self(WASMCluster *cluster,
@ -184,9 +184,9 @@ wasm_cluster_is_thread_terminated(WASMExecEnv *exec_env);
((signo) == WAMR_SIG_STOP || (signo) == WAMR_SIG_TRAP)
struct WASMCurrentEnvStatus {
uint64 signal_flag : 32;
uint64 step_count : 16;
uint64 running_status : 16;
uint32 signal_flag;
uint16 step_count;
uint16 running_status;
};
WASMCurrentEnvStatus *

Some files were not shown because too many files have changed in this diff Show More