Merge pull request #3629 from bytecodealliance/main
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=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/rp2040/raspberrypi-pico/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm/stm32h7/nucleo-h743zi/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/arm64/qemu/qemu-armv8a/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/risc-v/qemu-rv/rv-virt/configs/nsh64, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\n) (push) Has been cancelled
compilation on nuttx / build_iwasm_on_nuttx (boards/sim/sim/sim/configs/nsh, CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\n) (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, $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_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_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

Merge branch main into dev/checkpoint_and_restore
This commit is contained in:
Wenyong Huang 2024-07-16 12:42:52 +08:00 committed by GitHub
commit d51fdccfb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
214 changed files with 6574 additions and 1163 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

@ -645,7 +645,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set-up OCaml - name: Set-up OCaml
uses: ocaml/setup-ocaml@v2 uses: ocaml/setup-ocaml@v3
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS' if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
with: with:
ocaml-compiler: 4.13 ocaml-compiler: 4.13

View File

@ -18,7 +18,7 @@ WAMR project reused some components from other open source project:
- **NuttX ELF headers**: used in core/iwasm/aot/debug/elf_parser.c - **NuttX ELF headers**: used in core/iwasm/aot/debug/elf_parser.c
- **Dhrystone**: for the test benchmakr dhrystone - **Dhrystone**: for the test benchmakr 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 | | third party components | version number | latest release | vendor pages | CVE details |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |

View File

@ -142,12 +142,15 @@ endif ()
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# STATIC LIBRARY # STATIC LIBRARY
if (WAMR_BUILD_STATIC) if (WAMR_BUILD_STATIC)
add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib)
target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) 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) 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) if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_static INTERFACE boringssl_crypto) target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
endif () endif ()
@ -160,7 +163,7 @@ if (WAMR_BUILD_SHARED)
add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm)
target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) 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) 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) if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) target_link_libraries(iwasm_shared INTERFACE boringssl_crypto)
endif () endif ()

View File

@ -1,3 +1,74 @@
## 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 ## WAMR-2.1.0
### Breaking Changes ### Breaking Changes

View File

@ -156,11 +156,15 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
CONFIG_CMD += " -A x64" CONFIG_CMD += " -A x64"
else: else:
CONFIG_CMD += " -G'Ninja'" CONFIG_CMD += " -G'Ninja'"
print(f"Config command: {CONFIG_CMD}")
subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir) subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir)
BUILD_CMD = "cmake --build . --target package" + ( BUILD_CMD = "cmake --build . --target package" + (
" --config Release" if "windows" == platform else "" " --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) subprocess.check_call(shlex.split(BUILD_CMD), cwd=build_dir)
return build_dir return build_dir

View File

@ -233,6 +233,10 @@ if (WAMR_BUILD_SPEC_TEST EQUAL 1)
add_definitions (-DWASM_ENABLE_SPEC_TEST=1) add_definitions (-DWASM_ENABLE_SPEC_TEST=1)
message (" spec test compatible mode is on") message (" spec test compatible mode is on")
endif () 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) if (NOT DEFINED WAMR_BUILD_BULK_MEMORY)
# Enable bulk memory by default # Enable bulk memory by default
set (WAMR_BUILD_BULK_MEMORY 1) set (WAMR_BUILD_BULK_MEMORY 1)

View File

@ -363,6 +363,10 @@
#define WASM_ENABLE_SPEC_TEST 0 #define WASM_ENABLE_SPEC_TEST 0
#endif #endif
#ifndef WASM_ENABLE_WASI_TEST
#define WASM_ENABLE_WASI_TEST 0
#endif
/* Global heap pool size in bytes */ /* Global heap pool size in bytes */
#ifndef WASM_GLOBAL_HEAP_SIZE #ifndef WASM_GLOBAL_HEAP_SIZE
#define WASM_GLOBAL_HEAP_SIZE (10 * 1024 * 1024) #define WASM_GLOBAL_HEAP_SIZE (10 * 1024 * 1024)
@ -667,13 +671,11 @@
#define WASM_ENABLE_FUZZ_TEST 0 #define WASM_ENABLE_FUZZ_TEST 0
#endif #endif
#ifndef WASM_MEM_ALLOC_MAX_SIZE
#if WASM_ENABLE_FUZZ_TEST != 0 #if WASM_ENABLE_FUZZ_TEST != 0
#ifndef WASM_MEM_ALLOC_MAX_SIZE
/* In oss-fuzz, the maximum RAM is ~2.5G */ /* In oss-fuzz, the maximum RAM is ~2.5G */
#define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024) #define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024)
#else
#define WASM_MEM_ALLOC_MAX_SIZE UINT32_MAX
#endif
#endif #endif
#endif /* WASM_ENABLE_FUZZ_TEST != 0 */
#endif /* end of _CONFIG_H_ */ #endif /* end of _CONFIG_H_ */

View File

@ -326,14 +326,18 @@ load_string(uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
/* The string is always terminated with '\0', use it directly. /* The string is always terminated with '\0', use it directly.
* In this case, the file buffer can be referred 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; str = (char *)p;
} }
else { else {
/* Load from sections, the file buffer cannot be referred to /* Load from sections, the file buffer cannot be referred to
after loading, we must create another string and insert it after loading, we must create another string and insert it
into const string set */ 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 (!(str = aot_const_str_set_insert((uint8 *)p, str_len, module,
#if (WASM_ENABLE_WORD_ALIGN_READ != 0) #if (WASM_ENABLE_WORD_ALIGN_READ != 0)
is_vram_word_align, is_vram_word_align,
@ -367,6 +371,8 @@ get_aot_file_target(AOTTargetInfo *target_info, char *target_buf,
break; break;
case E_MACHINE_ARM: case E_MACHINE_ARM:
case E_MACHINE_AARCH64: case E_MACHINE_AARCH64:
/* TODO: this will make following `strncmp()` ~L392 unnecessary.
* Use const strings here */
machine_type = target_info->arch; machine_type = target_info->arch;
break; break;
case E_MACHINE_MIPS: case E_MACHINE_MIPS:
@ -501,6 +507,11 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end,
read_uint64(p, p_end, target_info.reserved); read_uint64(p, p_end, target_info.reserved);
read_byte_array(p, p_end, target_info.arch, sizeof(target_info.arch)); 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) { if (p != buf_end) {
set_error_buf(error_buf, error_buf_size, "invalid section size"); set_error_buf(error_buf, error_buf_size, "invalid section size");
return false; return false;
@ -561,7 +572,7 @@ get_native_symbol_by_name(const char *name)
sym = get_target_symbol_map(&symnum); sym = get_target_symbol_map(&symnum);
while (symnum--) { while (symnum && symnum--) {
if (strcmp(sym->symbol_name, name) == 0) { if (strcmp(sym->symbol_name, name) == 0) {
func = sym->symbol_addr; func = sym->symbol_addr;
break; break;
@ -580,15 +591,17 @@ str2uint64(const char *buf, uint64 *p_res);
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
static void * 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);
static void *
aot_loader_resolve_function_ex(const char *module_name,
const char *function_name,
const AOTFuncType *expected_function_type, const AOTFuncType *expected_function_type,
char *error_buf, uint32 error_buf_size) char *error_buf, uint32 error_buf_size)
{ {
WASMModuleCommon *module_reg; 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); module_reg = wasm_runtime_find_module_registered(module_name);
if (!module_reg || module_reg->module_type != Wasm_Module_AoT) { if (!module_reg || module_reg->module_type != Wasm_Module_AoT) {
@ -597,10 +610,23 @@ aot_loader_resolve_function(const char *module_name, const char *function_name,
set_error_buf(error_buf, error_buf_size, "unknown import"); set_error_buf(error_buf, error_buf_size, "unknown import");
return NULL; return NULL;
} }
return aot_loader_resolve_function((AOTModule *)module_reg, function_name,
expected_function_type, error_buf,
error_buf_size);
}
module = (AOTModule *)module_reg; static void *
export = loader_find_export(module_reg, module_name, function_name, aot_loader_resolve_function(const AOTModule *module, const char *function_name,
EXPORT_KIND_FUNC, error_buf, error_buf_size); 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) { if (!export) {
return NULL; return NULL;
} }
@ -622,7 +648,7 @@ aot_loader_resolve_function(const char *module_name, const char *function_name,
if (!wasm_type_equal((WASMType *)expected_function_type, if (!wasm_type_equal((WASMType *)expected_function_type,
(WASMType *)target_function_type, module->types, (WASMType *)target_function_type, module->types,
module->type_count)) { 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"); set_error_buf(error_buf, error_buf_size, "incompatible import type");
return NULL; return NULL;
} }
@ -640,18 +666,27 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
int32 i; int32 i;
const char *symbol; 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); read_uint32(p, p_end, cnt);
if (cnt > 0) { 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) { if (module->native_symbol_list == NULL) {
set_error_buf(error_buf, error_buf_size,
"malloc native symbol list failed");
goto fail; goto fail;
} }
for (i = cnt - 1; i >= 0; i--) { for (i = cnt - 1; i >= 0; i--) {
read_string(p, p_end, symbol); read_string(p, p_end, symbol);
if (!strlen(symbol))
continue;
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) { if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
uint32 u32; uint32 u32;
/* Resolve the raw int bits of f32 const */ /* Resolve the raw int bits of f32 const */
@ -1033,7 +1068,8 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, module->import_memory_count); read_uint32(buf, buf_end, module->import_memory_count);
/* We don't support import_memory_count > 0 currently */ /* 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); read_uint32(buf, buf_end, module->memory_count);
total_size = sizeof(AOTMemory) * (uint64)module->memory_count; total_size = sizeof(AOTMemory) * (uint64)module->memory_count;
@ -1312,24 +1348,25 @@ load_import_table_list(const uint8 **p_buf, const uint8 *buf_end,
/* keep sync with aot_emit_table_info() aot_emit_aot_file */ /* keep sync with aot_emit_table_info() aot_emit_aot_file */
for (i = 0; i < module->import_table_count; i++, import_table++) { 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_type.elem_type);
read_uint8(buf, buf_end, import_table->table_flags); read_uint8(buf, buf_end, import_table->table_type.flags);
read_uint8(buf, buf_end, import_table->possible_grow); read_uint8(buf, buf_end, import_table->table_type.possible_grow);
#if WASM_ENABLE_GC != 0 #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); read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
} }
#endif #endif
read_uint32(buf, buf_end, import_table->table_init_size); read_uint32(buf, buf_end, import_table->table_type.init_size);
read_uint32(buf, buf_end, import_table->table_max_size); read_uint32(buf, buf_end, import_table->table_type.max_size);
#if WASM_ENABLE_GC != 0 #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); 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 */ /* TODO: check ref_type */
if (!(import_table->elem_ref_type = wasm_reftype_set_insert( if (!(import_table->table_type.elem_ref_type =
module->ref_type_set, &ref_type))) { wasm_reftype_set_insert(module->ref_type_set,
&ref_type))) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"insert ref type to hash set failed"); "insert ref type to hash set failed");
return false; return false;
@ -1365,23 +1402,23 @@ load_table_list(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
/* Create each table data segment */ /* Create each table data segment */
for (i = 0; i < module->table_count; i++, table++) { for (i = 0; i < module->table_count; i++, table++) {
read_uint8(buf, buf_end, table->elem_type); read_uint8(buf, buf_end, table->table_type.elem_type);
read_uint8(buf, buf_end, table->table_flags); read_uint8(buf, buf_end, table->table_type.flags);
read_uint8(buf, buf_end, table->possible_grow); read_uint8(buf, buf_end, table->table_type.possible_grow);
#if WASM_ENABLE_GC != 0 #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); read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
} }
#endif #endif
read_uint32(buf, buf_end, table->table_init_size); read_uint32(buf, buf_end, table->table_type.init_size);
read_uint32(buf, buf_end, table->table_max_size); read_uint32(buf, buf_end, table->table_type.max_size);
#if WASM_ENABLE_GC != 0 #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); 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 */ /* 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))) { module->ref_type_set, &ref_type))) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"insert ref type to hash set failed"); "insert ref type to hash set failed");
@ -1672,6 +1709,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_type->ref_type_map_count = ref_type_map_count; 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); param_cell_num = wasm_get_cell_num(func_type->types, param_count);
ret_cell_num = ret_cell_num =
wasm_get_cell_num(func_type->types + param_count, result_count); wasm_get_cell_num(func_type->types + param_count, result_count);
@ -1976,6 +2016,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_types[i]->result_count = (uint16)result_count; func_types[i]->result_count = (uint16)result_count;
read_byte_array(buf, buf_end, func_types[i]->types, (uint32)size1); 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); param_cell_num = wasm_get_cell_num(func_types[i]->types, param_count);
ret_cell_num = ret_cell_num =
wasm_get_cell_num(func_types[i]->types + param_count, result_count); wasm_get_cell_num(func_types[i]->types + param_count, result_count);
@ -2054,6 +2097,10 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
read_string(buf, buf_end, import_globals[i].module_name); read_string(buf, buf_end, import_globals[i].module_name);
read_string(buf, buf_end, import_globals[i].global_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_ENABLE_LIBC_BUILTIN != 0
if (wasm_native_lookup_libc_builtin_global( if (wasm_native_lookup_libc_builtin_global(
import_globals[i].module_name, import_globals[i].global_name, import_globals[i].module_name, import_globals[i].global_name,
@ -2142,6 +2189,9 @@ load_globals(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint8(buf, buf_end, globals[i].type.val_type); read_uint8(buf, buf_end, globals[i].type.val_type);
read_uint8(buf, buf_end, globals[i].type.is_mutable); 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); buf = align_ptr(buf, 4);
if (!load_init_expr(&buf, buf_end, module, &globals[i].init_expr, if (!load_init_expr(&buf, buf_end, module, &globals[i].init_expr,
@ -2167,6 +2217,9 @@ load_global_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
const uint8 *buf = *p_buf; const uint8 *buf = *p_buf;
read_uint32(buf, buf_end, module->global_count); 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 */ /* load globals */
if (module->global_count > 0 if (module->global_count > 0
@ -2229,17 +2282,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].signature, &import_funcs[i].attachment,
&import_funcs[i].call_conv_raw); &import_funcs[i].call_conv_raw);
if (!linked_func) { if (!linked_func) {
sub_module = NULL;
if (!wasm_runtime_is_built_in_module(module_name)) { if (!wasm_runtime_is_built_in_module(module_name)) {
sub_module = (AOTModule *)wasm_runtime_load_depended_module( sub_module = (AOTModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)module, module_name, error_buf, (WASMModuleCommon *)module, module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) { if (!sub_module) {
LOG_ERROR("failed to load sub module: %s", error_buf);
return false; return false;
} }
} }
linked_func = aot_loader_resolve_function( if (!sub_module)
linked_func = aot_loader_resolve_function_ex(
module_name, field_name, declare_func_type, error_buf, module_name, field_name, declare_func_type, error_buf,
error_buf_size); 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_ptr_linked = linked_func;
import_funcs[i].func_type = declare_func_type; import_funcs[i].func_type = declare_func_type;
@ -2424,6 +2484,10 @@ load_init_data_section(const uint8 *buf, const uint8 *buf_end,
/* load function count and start function index */ /* load function count and start function index */
read_uint32(p, p_end, module->func_count); 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); read_uint32(p, p_end, module->start_func_index);
/* check start function index */ /* check start function index */
@ -4104,6 +4168,8 @@ load(const uint8 *buf, uint32 size, AOTModule *module,
return false; return false;
} }
module->package_version = version;
if (!create_sections(module, buf, size, &section_list, error_buf, if (!create_sections(module, buf, size, &section_list, error_buf,
error_buf_size)) error_buf_size))
return false; return false;

View File

@ -618,23 +618,23 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
for (i = 0; i != module_inst->table_count; ++i) { for (i = 0; i != module_inst->table_count; ++i) {
if (i < module->import_table_count) { if (i < module->import_table_count) {
AOTImportTable *import_table = module->import_tables + i; 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 = tbl_inst->max_size =
aot_get_imp_tbl_data_slots(import_table, false); 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 #if WASM_ENABLE_GC != 0
tbl_inst->elem_type = module->tables[i].elem_type;
tbl_inst->elem_ref_type.elem_ref_type = tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].elem_ref_type; module->tables[i].table_type.elem_ref_type;
#endif #endif
} }
else { else {
AOTTable *table = module->tables + (i - module->import_table_count); 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->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 #if WASM_ENABLE_GC != 0
tbl_inst->elem_type = module->tables[i].elem_type;
tbl_inst->elem_ref_type.elem_ref_type = tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].elem_ref_type; module->tables[i].table_type.elem_ref_type;
#endif #endif
} }
@ -1139,7 +1139,7 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
if (memory_inst->memory_data) { if (memory_inst->memory_data) {
bh_memcpy_s((uint8 *)memory_inst->memory_data + base_offset, 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); data_seg->bytes, length);
} }
} }
@ -1183,6 +1183,75 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
return true; 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 static bool
init_func_type_indexes(AOTModuleInstance *module_inst, AOTModule *module, init_func_type_indexes(AOTModuleInstance *module_inst, AOTModule *module,
char *error_buf, uint32 error_buf_size) char *error_buf, uint32 error_buf_size)
@ -1490,6 +1559,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0 #if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0
WASMModuleInstanceExtraCommon *common; WASMModuleInstanceExtraCommon *common;
#endif #endif
AOTModuleInstanceExtra *extra = NULL;
const uint32 module_inst_struct_size = const uint32 module_inst_struct_size =
offsetof(AOTModuleInstance, global_table_data.bytes); offsetof(AOTModuleInstance, global_table_data.bytes);
const uint64 module_inst_mem_inst_size = const uint64 module_inst_mem_inst_size =
@ -1543,14 +1613,13 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
module_inst->module = (void *)module; module_inst->module = (void *)module;
module_inst->e = module_inst->e =
(WASMModuleInstanceExtra *)((uint8 *)module_inst + extra_info_offset); (WASMModuleInstanceExtra *)((uint8 *)module_inst + extra_info_offset);
extra = (AOTModuleInstanceExtra *)module_inst->e;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
/* Initialize gc heap first since it may be used when initializing /* Initialize gc heap first since it may be used when initializing
globals and others */ globals and others */
if (!is_sub_inst) { if (!is_sub_inst) {
uint32 gc_heap_size = wasm_runtime_get_gc_heap_size_default(); 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) if (gc_heap_size < GC_HEAP_SIZE_MIN)
gc_heap_size = GC_HEAP_SIZE_MIN; gc_heap_size = GC_HEAP_SIZE_MIN;
@ -1570,8 +1639,17 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
#endif #endif
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
((AOTModuleInstanceExtra *)module_inst->e)->sub_module_inst_list = extra->sub_module_inst_list = &extra->sub_module_inst_list_head;
&((AOTModuleInstanceExtra *)module_inst->e)->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( ret = wasm_runtime_sub_module_instantiate(
(WASMModuleCommon *)module, (WASMModuleInstanceCommon *)module_inst, (WASMModuleCommon *)module, (WASMModuleInstanceCommon *)module_inst,
stack_size, heap_size, max_memory_pages, error_buf, error_buf_size); stack_size, heap_size, max_memory_pages, error_buf, error_buf_size);
@ -1587,7 +1665,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
goto fail; goto fail;
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0 #if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_REF_TYPES != 0
common = &((AOTModuleInstanceExtra *)module_inst->e)->common; common = &extra->common;
#endif #endif
#if WASM_ENABLE_BULK_MEMORY != 0 #if WASM_ENABLE_BULK_MEMORY != 0
if (module->mem_init_data_count > 0) { if (module->mem_init_data_count > 0) {
@ -1682,12 +1760,12 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
#endif #endif
module_inst->default_wasm_stack_size = stack_size; 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); aot_get_data_section_addr(module, AOT_STACK_SIZES_SECTION_NAME, NULL);
#if WASM_ENABLE_PERF_PROFILING != 0 #if WASM_ENABLE_PERF_PROFILING != 0
total_size = (uint64)sizeof(AOTFuncPerfProfInfo) total_size = sizeof(AOTFuncPerfProfInfo)
* (module->import_func_count + module->func_count); * ((uint64)module->import_func_count + module->func_count);
if (!(module_inst->func_perf_profilings = if (!(module_inst->func_perf_profilings =
runtime_malloc(total_size, error_buf, error_buf_size))) { runtime_malloc(total_size, error_buf, error_buf_size))) {
goto fail; goto fail;
@ -1885,8 +1963,8 @@ destroy_c_api_frames(Vector *frames)
void void
aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst) aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
{ {
WASMModuleInstanceExtraCommon *common = AOTModuleInstanceExtra *extra = (AOTModuleInstanceExtra *)module_inst->e;
&((AOTModuleInstanceExtra *)module_inst->e)->common; WASMModuleInstanceExtraCommon *common = &extra->common;
if (module_inst->exec_env_singleton) { if (module_inst->exec_env_singleton) {
/* wasm_exec_env_destroy will call /* wasm_exec_env_destroy will call
wasm_cluster_wait_for_all_except_self to wait for other wasm_cluster_wait_for_all_except_self to wait for other
@ -1912,6 +1990,8 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
wasm_runtime_sub_module_deinstantiate( wasm_runtime_sub_module_deinstantiate(
(WASMModuleInstanceCommon *)module_inst); (WASMModuleInstanceCommon *)module_inst);
if (extra->import_func_module_insts)
wasm_runtime_free(extra->import_func_module_insts);
#endif #endif
if (module_inst->tables) if (module_inst->tables)
@ -1923,6 +2003,16 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
if (module_inst->export_functions) if (module_inst->export_functions)
wasm_runtime_free(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) if (module_inst->func_ptrs)
wasm_runtime_free(module_inst->func_ptrs); wasm_runtime_free(module_inst->func_ptrs);
@ -1934,19 +2024,14 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (!is_sub_inst) { if (!is_sub_inst) {
AOTModuleInstanceExtra *extra = if (common->gc_heap_handle)
(AOTModuleInstanceExtra *)module_inst->e; mem_allocator_destroy(common->gc_heap_handle);
if (extra->common.gc_heap_handle) if (common->gc_heap_pool)
mem_allocator_destroy(extra->common.gc_heap_handle); wasm_runtime_free(common->gc_heap_pool);
if (extra->common.gc_heap_pool)
wasm_runtime_free(extra->common.gc_heap_pool);
} }
#endif #endif
if (!is_sub_inst) { if (!is_sub_inst) {
#if WASM_ENABLE_WASI_NN != 0
wasi_nn_destroy((WASMModuleInstanceCommon *)module_inst);
#endif
wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst); wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst);
} }
@ -2024,7 +2109,9 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
void (*invoke_native)(void *func_ptr, void *exec_env, uint32 *argv, void (*invoke_native)(void *func_ptr, void *exec_env, uint32 *argv,
uint32 *argv_ret) = uint32 *argv_ret) =
func_type->quick_aot_entry; func_type->quick_aot_entry;
exec_env->attachment = attachment;
invoke_native(func_ptr, exec_env, argv, argv_ret); invoke_native(func_ptr, exec_env, argv, argv_ret);
exec_env->attachment = NULL;
ret = !aot_copy_exception(module_inst, NULL); ret = !aot_copy_exception(module_inst, NULL);
} }
else else
@ -2102,6 +2189,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
unsigned argc, uint32 argv[]) unsigned argc, uint32 argv[])
{ {
AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst; AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst;
AOTModule *module = (AOTModule *)module_inst->module;
AOTFuncType *func_type = function->is_import_func AOTFuncType *func_type = function->is_import_func
? function->u.func_import->func_type ? function->u.func_import->func_type
: function->u.func.func_type; : function->u.func.func_type;
@ -2111,6 +2199,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
void *func_ptr = function->is_import_func void *func_ptr = function->is_import_func
? function->u.func_import->func_ptr_linked ? function->u.func_import->func_ptr_linked
: function->u.func.func_ptr; : function->u.func.func_ptr;
void *attachment = NULL;
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
bh_list *sub_module_list_node = NULL; bh_list *sub_module_list_node = NULL;
const char *sub_inst_name = NULL; const char *sub_inst_name = NULL;
@ -2170,6 +2259,10 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
hw bound check is enabled */ hw bound check is enabled */
#endif #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 */ /* Set exec env, so it can be later retrieved from instance */
module_inst->cur_exec_env = exec_env; module_inst->cur_exec_env = exec_env;
@ -2220,7 +2313,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#endif #endif
ret = invoke_native_internal(exec_env, function->u.func.func_ptr, 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) { if (!ret) {
#ifdef AOT_STACK_FRAME_DEBUG #ifdef AOT_STACK_FRAME_DEBUG
@ -2289,8 +2383,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
} }
#endif #endif
ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL, NULL, ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL,
argv, argc, argv); attachment, argv, argc, argv);
if (aot_copy_exception(module_inst, NULL)) { if (aot_copy_exception(module_inst, NULL)) {
#ifdef AOT_STACK_FRAME_DEBUG #ifdef AOT_STACK_FRAME_DEBUG
@ -2442,7 +2536,7 @@ execute_malloc_function(AOTModuleInstance *module_inst, WASMExecEnv *exec_env,
if (ret) { if (ret) {
#if WASM_ENABLE_MEMORY64 != 0 #if WASM_ENABLE_MEMORY64 != 0
if (is_memory64) if (is_memory64)
*p_result = GET_I64_FROM_ADDR(&argv.u64); *p_result = argv.u64;
else else
#endif #endif
{ {
@ -2753,10 +2847,6 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
void *attachment; void *attachment;
char buf[96]; char buf[96];
bool ret = false; 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); bh_assert(func_idx < aot_module->import_func_count);
import_func = aot_module->import_funcs + func_idx; import_func = aot_module->import_funcs + func_idx;
@ -2781,30 +2871,34 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
else if (!import_func->call_conv_raw) { else if (!import_func->call_conv_raw) {
signature = import_func->signature; signature = import_func->signature;
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
sub_module_list_node = WASMModuleInstanceCommon *sub_inst = NULL;
((AOTModuleInstanceExtra *)module_inst->e)->sub_module_inst_list; if ((sub_inst = ((AOTModuleInstanceExtra *)module_inst->e)
sub_module_list_node = bh_list_first_elem(sub_module_list_node); ->import_func_module_insts[func_idx])) {
while (sub_module_list_node) { exec_env = wasm_runtime_get_exec_env_singleton(sub_inst);
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);
} }
if (exec_env == NULL) { if (exec_env == NULL) {
wasm_runtime_set_exception((WASMModuleInstanceCommon *)module_inst, wasm_runtime_set_exception((WASMModuleInstanceCommon *)module_inst,
"create singleton exec_env failed"); "create singleton exec_env failed");
goto fail; 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
#endif /* WASM_ENABLE_MULTI_MODULE != 0 */
ret = ret =
wasm_runtime_invoke_native(exec_env, func_ptr, func_type, signature, wasm_runtime_invoke_native(exec_env, func_ptr, func_type, signature,
attachment, argv, argc, argv); 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 { else {
signature = import_func->signature; signature = import_func->signature;
@ -2891,8 +2985,8 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
/* Call native function */ /* Call native function */
import_func = aot_module->import_funcs + func_idx; import_func = aot_module->import_funcs + func_idx;
signature = import_func->signature; signature = import_func->signature;
if (import_func->call_conv_raw) {
attachment = import_func->attachment; attachment = import_func->attachment;
if (import_func->call_conv_raw) {
ret = wasm_runtime_invoke_native_raw(exec_env, func_ptr, func_type, ret = wasm_runtime_invoke_native_raw(exec_env, func_ptr, func_type,
signature, attachment, argv, signature, attachment, argv,
argc, argv); argc, argv);

View File

@ -14,10 +14,6 @@
#include "gc_export.h" #include "gc_export.h"
#endif #endif
#if WASM_ENABLE_WASI_NN != 0
#include "../libraries/wasi-nn/src/wasi_nn_private.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -108,9 +104,12 @@ typedef struct AOTFunctionInstance {
typedef struct AOTModuleInstanceExtra { typedef struct AOTModuleInstanceExtra {
DefPointer(const uint32 *, stack_sizes); DefPointer(const uint32 *, stack_sizes);
WASMModuleInstanceExtraCommon common; WASMModuleInstanceExtraCommon common;
AOTFunctionInstance **functions;
uint32 function_count;
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
bh_list sub_module_inst_list_head; bh_list sub_module_inst_list_head;
bh_list *sub_module_inst_list; bh_list *sub_module_inst_list;
WASMModuleInstanceCommon **import_func_module_insts;
#endif #endif
} AOTModuleInstanceExtra; } AOTModuleInstanceExtra;
@ -131,6 +130,9 @@ typedef struct LocalRefFlag {
typedef struct AOTModule { typedef struct AOTModule {
uint32 module_type; uint32 module_type;
/* the package version read from the AOT file */
uint32 package_version;
/* import memories */ /* import memories */
uint32 import_memory_count; uint32 import_memory_count;
AOTImportMemory *import_memories; AOTImportMemory *import_memories;
@ -511,6 +513,17 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
AOTFunctionInstance * AOTFunctionInstance *
aot_lookup_function(const AOTModuleInstance *module_inst, const char *name); 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 * Call the given AOT function of a AOT module instance with
* arguments. * arguments.

View File

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

View File

@ -513,7 +513,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
bh_memcpy_s(&u.val, sizeof(double), &ud.d, bh_memcpy_s(&u.val, sizeof(double), &ud.d,
sizeof(double)); sizeof(double));
} }
if (endptr[0] == ':') { if (endptr && endptr[0] == ':') {
uint64 sig; uint64 sig;
union ieee754_double ud; union ieee754_double ud;
sig = strtoull(endptr + 1, &endptr, 0); sig = strtoull(endptr + 1, &endptr, 0);

View File

@ -2620,9 +2620,9 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
- import_memory_count); - import_memory_count);
module_name_rt = import->u.names.module_name; module_name_rt = import->u.names.module_name;
field_name_rt = import->u.names.field_name; field_name_rt = import->u.names.field_name;
elem_type_rt = import->u.table.elem_type; elem_type_rt = import->u.table.table_type.elem_type;
min_size = import->u.table.init_size; min_size = import->u.table.table_type.init_size;
max_size = import->u.table.max_size; max_size = import->u.table.table_type.max_size;
} }
#endif #endif
@ -2634,9 +2634,9 @@ wasm_module_imports(const wasm_module_t *module, own wasm_importtype_vec_t *out)
- import_memory_count); - import_memory_count);
module_name_rt = import->module_name; module_name_rt = import->module_name;
field_name_rt = import->table_name; field_name_rt = import->table_name;
elem_type_rt = import->elem_type; elem_type_rt = import->table_type.elem_type;
min_size = import->table_init_size; min_size = import->table_type.init_size;
max_size = import->table_max_size; max_size = import->table_type.max_size;
} }
#endif #endif
@ -4195,13 +4195,13 @@ wasm_table_size(const wasm_table_t *table)
if (table->table_idx_rt < module_aot->import_table_count) { if (table->table_idx_rt < module_aot->import_table_count) {
AOTImportTable *table_aot = AOTImportTable *table_aot =
module_aot->import_tables + table->table_idx_rt; module_aot->import_tables + table->table_idx_rt;
return table_aot->table_init_size; return table_aot->table_type.init_size;
} }
else { else {
AOTTable *table_aot = AOTTable *table_aot =
module_aot->tables module_aot->tables
+ (table->table_idx_rt - module_aot->import_table_count); + (table->table_idx_rt - module_aot->import_table_count);
return table_aot->table_init_size; return table_aot->table_type.init_size;
} }
} }
#endif #endif

View File

@ -4,7 +4,9 @@
*/ */
#include "wasm_loader_common.h" #include "wasm_loader_common.h"
#include "bh_log.h" #include "bh_log.h"
#include "../interpreter/wasm.h" #if WASM_ENABLE_GC != 0
#include "../common/gc/gc_type.h"
#endif
static void static void
set_error_buf(char *error_buf, uint32 error_buf_size, const char *string, set_error_buf(char *error_buf, uint32 error_buf_size, const char *string,
@ -56,3 +58,75 @@ wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
return true; 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;
}

View File

@ -7,6 +7,7 @@
#define _WASM_LOADER_COMMON_H #define _WASM_LOADER_COMMON_H
#include "platform_common.h" #include "platform_common.h"
#include "../interpreter/wasm.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -16,6 +17,19 @@ bool
wasm_memory_check_flags(const uint8 mem_flag, char *error_buf, wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
uint32 error_buf_size, bool is_aot); 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);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -189,7 +189,7 @@ wasm_runtime_malloc_internal(unsigned int size)
{ {
if (memory_mode == MEMORY_MODE_UNKNOWN) { if (memory_mode == MEMORY_MODE_UNKNOWN) {
LOG_WARNING( LOG_WARNING(
"wasm_runtime_malloc failed: memory hasn't been initialize.\n"); "wasm_runtime_malloc failed: memory hasn't been initialized.\n");
return NULL; return NULL;
} }
else if (memory_mode == MEMORY_MODE_POOL) { 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) { if (memory_mode == MEMORY_MODE_UNKNOWN) {
LOG_WARNING( LOG_WARNING(
"wasm_runtime_realloc failed: memory hasn't been initialize.\n"); "wasm_runtime_realloc failed: memory hasn't been initialized.\n");
return NULL; return NULL;
} }
else if (memory_mode == MEMORY_MODE_POOL) { else if (memory_mode == MEMORY_MODE_POOL) {
@ -284,6 +284,13 @@ wasm_runtime_malloc(unsigned int size)
#endif #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); return wasm_runtime_malloc_internal(size);
} }
@ -876,6 +883,12 @@ wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count)
} }
#endif /* end of WASM_MEM_ALLOC_WITH_USAGE */ #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->num_bytes_per_page = num_bytes_per_page;
memory->cur_page_count = total_page_count; memory->cur_page_count = total_page_count;
memory->max_page_count = max_page_count; memory->max_page_count = max_page_count;
@ -906,6 +919,30 @@ return_func:
return ret; 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 void
wasm_runtime_set_enlarge_mem_error_callback( wasm_runtime_set_enlarge_mem_error_callback(
const enlarge_memory_error_callback_t callback, void *user_data) const enlarge_memory_error_callback_t callback, void *user_data)
@ -1025,5 +1062,11 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
#endif #endif
} }
/*
* AOT compiler assumes at least 8 byte alignment.
* see aot_check_memory_overflow.
*/
bh_assert(((uintptr_t)*data & 0x7) == 0);
return BHT_OK; return BHT_OK;
} }

View File

@ -33,9 +33,6 @@ get_spectest_export_apis(NativeSymbol **p_libc_builtin_apis);
uint32 uint32
get_libc_wasi_export_apis(NativeSymbol **p_libc_wasi_apis); get_libc_wasi_export_apis(NativeSymbol **p_libc_wasi_apis);
uint32_t
get_wasi_nn_export_apis(NativeSymbol **p_libc_wasi_apis);
uint32 uint32
get_base_lib_export_apis(NativeSymbol **p_base_lib_apis); get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
@ -565,18 +562,6 @@ wasm_native_init()
goto fail; goto fail;
#endif /* WASM_ENABLE_LIB_RATS */ #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))
goto fail;
#endif
#if WASM_ENABLE_QUICK_AOT_ENTRY != 0 #if WASM_ENABLE_QUICK_AOT_ENTRY != 0
if (!quick_aot_entry_init()) { if (!quick_aot_entry_init()) {
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \ #if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \

View File

@ -858,11 +858,11 @@ wasm_runtime_set_default_running_mode(RunningMode running_mode)
PackageType PackageType
get_package_type(const uint8 *buf, uint32 size) get_package_type(const uint8 *buf, uint32 size)
{ {
if (buf && size >= 4) {
#if (WASM_ENABLE_WORD_ALIGN_READ != 0) #if (WASM_ENABLE_WORD_ALIGN_READ != 0)
uint32 buf32 = *(uint32 *)buf; uint32 buf32 = *(uint32 *)buf;
buf = (const uint8 *)&buf32; buf = (const uint8 *)&buf32;
#endif #endif
if (buf && size >= 4) {
if (buf[0] == '\0' && buf[1] == 'a' && buf[2] == 's' && buf[3] == 'm') if (buf[0] == '\0' && buf[1] == 'a' && buf[2] == 's' && buf[3] == 'm')
return Wasm_Module_Bytecode; return Wasm_Module_Bytecode;
if (buf[0] == '\0' && buf[1] == 'a' && buf[2] == 'o' && buf[3] == 't') if (buf[0] == '\0' && buf[1] == 'a' && buf[2] == 'o' && buf[3] == 't')
@ -871,6 +871,78 @@ get_package_type(const uint8 *buf, uint32 size)
return Package_Type_Unknown; return Package_Type_Unknown;
} }
PackageType
wasm_runtime_get_file_package_type(const uint8 *buf, uint32 size)
{
return get_package_type(buf, size);
}
PackageType
wasm_runtime_get_module_package_type(WASMModuleCommon *const module)
{
if (!module) {
return Package_Type_Unknown;
}
return module->module_type;
}
uint32
wasm_runtime_get_file_package_version(const uint8 *buf, uint32 size)
{
if (buf && size >= 8) {
uint32 version;
#if (WASM_ENABLE_WORD_ALIGN_READ != 0)
uint32 buf32 = *(uint32 *)(buf + sizeof(uint32));
buf = (const uint8 *)&buf32;
version = buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
#else
version = buf[4] | buf[5] << 8 | buf[6] << 16 | buf[7] << 24;
#endif
return version;
}
return 0;
}
uint32
wasm_runtime_get_module_package_version(WASMModuleCommon *const module)
{
if (!module) {
return 0;
}
#if WASM_ENABLE_INTERP != 0
if (module->module_type == Wasm_Module_Bytecode) {
WASMModule *wasm_module = (WASMModule *)module;
return wasm_module->package_version;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module->module_type == Wasm_Module_AoT) {
AOTModule *aot_module = (AOTModule *)module;
return aot_module->package_version;
}
#endif
return 0;
}
uint32
wasm_runtime_get_current_package_version(package_type_t package_type)
{
switch (package_type) {
case Wasm_Module_Bytecode:
return WASM_CURRENT_VERSION;
case Wasm_Module_AoT:
return AOT_CURRENT_VERSION;
case Package_Type_Unknown:
default:
return 0;
}
}
#if WASM_ENABLE_AOT != 0 #if WASM_ENABLE_AOT != 0
static uint8 * static uint8 *
align_ptr(const uint8 *p, uint32 b) align_ptr(const uint8 *p, uint32 b)
@ -1267,6 +1339,9 @@ wasm_runtime_is_built_in_module(const char *module_name)
|| !strcmp("wasi_snapshot_preview1", module_name) || !strcmp("wasi_snapshot_preview1", module_name)
#if WASM_ENABLE_SPEC_TEST != 0 #if WASM_ENABLE_SPEC_TEST != 0
|| !strcmp("spectest", module_name) || !strcmp("spectest", module_name)
#endif
#if WASM_ENABLE_WASI_TEST != 0
|| !strcmp("foo", module_name)
#endif #endif
|| !strcmp("", module_name)); || !strcmp("", module_name));
} }
@ -1966,6 +2041,118 @@ wasm_runtime_get_export_global_inst(WASMModuleInstanceCommon *const module_inst,
return false; return false;
} }
bool
wasm_runtime_get_export_table_inst(WASMModuleInstanceCommon *const module_inst,
char const *name,
wasm_table_inst_t *table_inst)
{
#if WASM_ENABLE_INTERP != 0
if (module_inst->module_type == Wasm_Module_Bytecode) {
const WASMModuleInstance *wasm_module_inst =
(const WASMModuleInstance *)module_inst;
const WASMModule *wasm_module = wasm_module_inst->module;
uint32 i;
for (i = 0; i < wasm_module->export_count; i++) {
const WASMExport *wasm_export = &wasm_module->exports[i];
if ((wasm_export->kind == WASM_IMPORT_EXPORT_KIND_TABLE)
&& !strcmp(wasm_export->name, name)) {
const WASMTableInstance *wasm_table_inst =
wasm_module_inst->tables[wasm_export->index];
table_inst->elem_kind =
val_type_to_val_kind(wasm_table_inst->elem_type);
table_inst->cur_size = wasm_table_inst->cur_size;
table_inst->max_size = wasm_table_inst->max_size;
table_inst->elems = (void *)wasm_table_inst->elems;
return true;
}
}
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT) {
const AOTModuleInstance *aot_module_inst =
(AOTModuleInstance *)module_inst;
const AOTModule *aot_module = (AOTModule *)aot_module_inst->module;
uint32 i;
for (i = 0; i < aot_module->export_count; i++) {
const AOTExport *aot_export = &aot_module->exports[i];
if ((aot_export->kind == WASM_IMPORT_EXPORT_KIND_TABLE)
&& !strcmp(aot_export->name, name)) {
const AOTTableInstance *aot_table_inst =
aot_module_inst->tables[aot_export->index];
table_inst->elem_kind =
val_type_to_val_kind(aot_table_inst->elem_type);
table_inst->cur_size = aot_table_inst->cur_size;
table_inst->max_size = aot_table_inst->max_size;
table_inst->elems = (void *)aot_table_inst->elems;
return true;
}
}
}
#endif
return false;
}
WASMFunctionInstanceCommon *
wasm_table_get_func_inst(struct WASMModuleInstanceCommon *const module_inst,
const wasm_table_inst_t *table_inst, uint32_t idx)
{
if (!table_inst) {
bh_assert(0);
return NULL;
}
if (idx >= table_inst->cur_size) {
bh_assert(0);
return NULL;
}
#if WASM_ENABLE_INTERP != 0
if (module_inst->module_type == Wasm_Module_Bytecode) {
const WASMModuleInstance *wasm_module_inst =
(const WASMModuleInstance *)module_inst;
table_elem_type_t tbl_elem_val =
((table_elem_type_t *)table_inst->elems)[idx];
if (tbl_elem_val == NULL_REF) {
return NULL;
}
#if WASM_ENABLE_GC == 0
uint32 func_idx = (uint32)tbl_elem_val;
#else
uint32 func_idx =
wasm_func_obj_get_func_idx_bound((WASMFuncObjectRef)tbl_elem_val);
#endif
bh_assert(func_idx < wasm_module_inst->e->function_count);
return wasm_module_inst->e->functions + func_idx;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT) {
AOTModuleInstance *aot_module_inst = (AOTModuleInstance *)module_inst;
uint32 func_idx;
table_elem_type_t tbl_elem_val =
((table_elem_type_t *)table_inst->elems)[idx];
if (tbl_elem_val == NULL_REF) {
return NULL;
}
#if WASM_ENABLE_GC == 0
func_idx = (uint32)tbl_elem_val;
#else
func_idx =
wasm_func_obj_get_func_idx_bound((WASMFuncObjectRef)tbl_elem_val);
#endif
return aot_get_function_instance(aot_module_inst, func_idx);
}
#endif
return NULL;
}
void * void *
wasm_runtime_get_function_attachment(WASMExecEnv *exec_env) wasm_runtime_get_function_attachment(WASMExecEnv *exec_env)
{ {
@ -3898,7 +4085,9 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_table->module_name; import_type->module_name = aot_import_table->module_name;
import_type->name = aot_import_table->table_name; import_type->name = aot_import_table->table_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_TABLE; import_type->kind = WASM_IMPORT_EXPORT_KIND_TABLE;
import_type->linked = false; import_type->linked = false; /* not supported */
import_type->u.table_type =
(WASMTableType *)&aot_import_table->table_type;
return; return;
} }
@ -3909,7 +4098,7 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_memory->module_name; import_type->module_name = aot_import_memory->module_name;
import_type->name = aot_import_memory->memory_name; import_type->name = aot_import_memory->memory_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY; import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY;
import_type->linked = false; import_type->linked = false; /* not supported */
import_type->u.memory_type = import_type->u.memory_type =
(WASMMemoryType *)&aot_import_memory->mem_type; (WASMMemoryType *)&aot_import_memory->mem_type;
return; return;
@ -3946,6 +4135,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
break; break;
case WASM_IMPORT_EXPORT_KIND_TABLE: case WASM_IMPORT_EXPORT_KIND_TABLE:
import_type->linked = false; /* not supported */ import_type->linked = false; /* not supported */
import_type->u.table_type =
(WASMTableType *)&wasm_import->u.table.table_type;
break; break;
case WASM_IMPORT_EXPORT_KIND_MEMORY: case WASM_IMPORT_EXPORT_KIND_MEMORY:
import_type->linked = false; /* not supported */ import_type->linked = false; /* not supported */
@ -4030,6 +4221,11 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
.type; .type;
break; break;
case WASM_IMPORT_EXPORT_KIND_TABLE: case WASM_IMPORT_EXPORT_KIND_TABLE:
export_type->u.table_type =
&aot_module
->tables[aot_export->index
- aot_module->import_table_count]
.table_type;
break; break;
case WASM_IMPORT_EXPORT_KIND_MEMORY: case WASM_IMPORT_EXPORT_KIND_MEMORY:
export_type->u.memory_type = export_type->u.memory_type =
@ -4071,6 +4267,11 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
.type; .type;
break; break;
case WASM_IMPORT_EXPORT_KIND_TABLE: case WASM_IMPORT_EXPORT_KIND_TABLE:
export_type->u.table_type =
&wasm_module
->tables[wasm_export->index
- wasm_module->import_table_count]
.table_type;
break; break;
case WASM_IMPORT_EXPORT_KIND_MEMORY: case WASM_IMPORT_EXPORT_KIND_MEMORY:
export_type->u.memory_type = export_type->u.memory_type =
@ -4212,6 +4413,38 @@ wasm_memory_type_get_max_page_count(WASMMemoryType *const memory_type)
return memory_type->max_page_count; return memory_type->max_page_count;
} }
wasm_valkind_t
wasm_table_type_get_elem_kind(WASMTableType *const table_type)
{
bh_assert(table_type);
return val_type_to_val_kind(table_type->elem_type);
}
bool
wasm_table_type_get_shared(WASMTableType *const table_type)
{
bh_assert(table_type);
return (table_type->flags & 2) ? true : false;
}
uint32
wasm_table_type_get_init_size(WASMTableType *const table_type)
{
bh_assert(table_type);
return table_type->init_size;
}
uint32
wasm_table_type_get_max_size(WASMTableType *const table_type)
{
bh_assert(table_type);
return table_type->max_size;
}
bool bool
wasm_runtime_register_natives(const char *module_name, wasm_runtime_register_natives(const char *module_name,
NativeSymbol *native_symbols, NativeSymbol *native_symbols,
@ -6178,7 +6411,7 @@ aot_mark_all_externrefs(AOTModuleInstance *module_inst)
for (i = 0; i < module->table_count; i++) { for (i = 0; i < module->table_count; i++) {
table_inst = module_inst->tables[i]; table_inst = module_inst->tables[i];
if ((table + i)->elem_type == VALUE_TYPE_EXTERNREF) { if ((table + i)->table_type.elem_type == VALUE_TYPE_EXTERNREF) {
while (j < table_inst->cur_size) { while (j < table_inst->cur_size) {
mark_externref(table_inst->elems[j++]); mark_externref(table_inst->elems[j++]);
} }
@ -6374,22 +6607,22 @@ wasm_runtime_get_table_elem_type(const WASMModuleCommon *module_comm,
if (table_idx < module->import_table_count) { if (table_idx < module->import_table_count) {
WASMTableImport *import_table = WASMTableImport *import_table =
&((module->import_tables + table_idx)->u.table); &((module->import_tables + table_idx)->u.table);
*out_elem_type = import_table->elem_type; *out_elem_type = import_table->table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
*out_ref_type = import_table->elem_ref_type; *out_ref_type = import_table->table_type.elem_ref_type;
#endif #endif
*out_min_size = import_table->init_size; *out_min_size = import_table->table_type.init_size;
*out_max_size = import_table->max_size; *out_max_size = import_table->table_type.max_size;
} }
else { else {
WASMTable *table = WASMTable *table =
module->tables + (table_idx - module->import_table_count); module->tables + (table_idx - module->import_table_count);
*out_elem_type = table->elem_type; *out_elem_type = table->table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
*out_ref_type = table->elem_ref_type; *out_ref_type = table->table_type.elem_ref_type;
#endif #endif
*out_min_size = table->init_size; *out_min_size = table->table_type.init_size;
*out_max_size = table->max_size; *out_max_size = table->table_type.max_size;
} }
return true; return true;
} }
@ -6401,22 +6634,22 @@ wasm_runtime_get_table_elem_type(const WASMModuleCommon *module_comm,
if (table_idx < module->import_table_count) { if (table_idx < module->import_table_count) {
AOTImportTable *import_table = module->import_tables + table_idx; AOTImportTable *import_table = module->import_tables + table_idx;
*out_elem_type = import_table->elem_type; *out_elem_type = import_table->table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
*out_ref_type = NULL; /* TODO */ *out_ref_type = NULL; /* TODO */
#endif #endif
*out_min_size = import_table->table_init_size; *out_min_size = import_table->table_type.init_size;
*out_max_size = import_table->table_max_size; *out_max_size = import_table->table_type.max_size;
} }
else { else {
AOTTable *table = AOTTable *table =
module->tables + (table_idx - module->import_table_count); module->tables + (table_idx - module->import_table_count);
*out_elem_type = table->elem_type; *out_elem_type = table->table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
*out_ref_type = NULL; /* TODO */ *out_ref_type = NULL; /* TODO */
#endif #endif
*out_min_size = table->table_init_size; *out_min_size = table->table_type.init_size;
*out_max_size = table->table_max_size; *out_max_size = table->table_type.max_size;
} }
return true; return true;
} }
@ -7164,6 +7397,32 @@ wasm_runtime_sub_module_instantiate(WASMModuleCommon *module,
(WASMModuleInstance *)sub_module_inst; (WASMModuleInstance *)sub_module_inst;
sub_module_inst_list_node->module_name = sub_module_inst_list_node->module_name =
sub_module_list_node->module_name; sub_module_list_node->module_name;
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT) {
AOTModuleInstance *aot_module_inst =
(AOTModuleInstance *)module_inst;
AOTModule *aot_module = (AOTModule *)module;
AOTModuleInstanceExtra *aot_extra =
(AOTModuleInstanceExtra *)aot_module_inst->e;
uint32 i;
AOTImportFunc *import_func;
for (i = 0; i < aot_module->import_func_count; i++) {
if (aot_extra->import_func_module_insts[i])
continue;
import_func = &aot_module->import_funcs[i];
if (strcmp(sub_module_inst_list_node->module_name,
import_func->module_name)
== 0) {
aot_extra->import_func_module_insts[i] =
(WASMModuleInstanceCommon *)
sub_module_inst_list_node->module_inst;
}
}
}
#endif
bh_list_status ret = bh_list_status ret =
bh_list_insert(sub_module_inst_list, sub_module_inst_list_node); bh_list_insert(sub_module_inst_list, sub_module_inst_list_node);
bh_assert(BH_LIST_SUCCESS == ret); bh_assert(BH_LIST_SUCCESS == ret);

View File

@ -599,34 +599,36 @@ aot_create_comp_data(WASMModule *module, const char *target_arch,
memset(comp_data->tables, 0, size); memset(comp_data->tables, 0, size);
for (i = 0; i < comp_data->table_count; i++) { for (i = 0; i < comp_data->table_count; i++) {
if (i < module->import_table_count) { if (i < module->import_table_count) {
comp_data->tables[i].elem_type = comp_data->tables[i].table_type.elem_type =
module->import_tables[i].u.table.elem_type; module->import_tables[i].u.table.table_type.elem_type;
comp_data->tables[i].table_flags = comp_data->tables[i].table_type.flags =
module->import_tables[i].u.table.flags; module->import_tables[i].u.table.table_type.flags;
comp_data->tables[i].table_init_size = comp_data->tables[i].table_type.init_size =
module->import_tables[i].u.table.init_size; module->import_tables[i].u.table.table_type.init_size;
comp_data->tables[i].table_max_size = comp_data->tables[i].table_type.max_size =
module->import_tables[i].u.table.max_size; module->import_tables[i].u.table.table_type.max_size;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
comp_data->tables[i].elem_ref_type = comp_data->tables[i].table_type.elem_ref_type =
module->import_tables[i].u.table.elem_ref_type; module->import_tables[i].u.table.table_type.elem_ref_type;
#endif #endif
comp_data->tables[i].possible_grow = comp_data->tables[i].table_type.possible_grow =
module->import_tables[i].u.table.possible_grow; module->import_tables[i].u.table.table_type.possible_grow;
} }
else { else {
j = i - module->import_table_count; j = i - module->import_table_count;
comp_data->tables[i].elem_type = module->tables[j].elem_type; comp_data->tables[i].table_type.elem_type =
comp_data->tables[i].table_flags = module->tables[j].flags; module->tables[j].table_type.elem_type;
comp_data->tables[i].table_init_size = comp_data->tables[i].table_type.flags =
module->tables[j].init_size; module->tables[j].table_type.flags;
comp_data->tables[i].table_max_size = comp_data->tables[i].table_type.init_size =
module->tables[j].max_size; module->tables[j].table_type.init_size;
comp_data->tables[i].possible_grow = comp_data->tables[i].table_type.max_size =
module->tables[j].possible_grow; 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 #if WASM_ENABLE_GC != 0
comp_data->tables[j].elem_ref_type = comp_data->tables[j].table_type.elem_ref_type =
module->tables[j].elem_ref_type; module->tables[j].table_type.elem_ref_type;
/* Note: if the init_expr contains extra data for struct/array /* Note: if the init_expr contains extra data for struct/array
* initialization information (init_expr.u.data), the pointer is * initialization information (init_expr.u.data), the pointer is
* copied. * copied.

View File

@ -48,6 +48,8 @@ typedef WASMArrayType AOTArrayType;
typedef WASMExport AOTExport; typedef WASMExport AOTExport;
typedef WASMMemory AOTMemory; typedef WASMMemory AOTMemory;
typedef WASMMemoryType AOTMemoryType; typedef WASMMemoryType AOTMemoryType;
typedef WASMTableType AOTTableType;
typedef WASMTable AOTTable;
#if WASM_ENABLE_DEBUG_AOT != 0 #if WASM_ENABLE_DEBUG_AOT != 0
typedef void *dwarf_extractor_handle_t; typedef void *dwarf_extractor_handle_t;
@ -110,32 +112,9 @@ typedef struct AOTMemInitData {
typedef struct AOTImportTable { typedef struct AOTImportTable {
char *module_name; char *module_name;
char *table_name; char *table_name;
uint8 elem_type; AOTTableType table_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
} AOTImportTable; } 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 * A segment of table init data
*/ */
@ -359,11 +338,12 @@ aot_get_imp_tbl_data_slots(const AOTImportTable *tbl, bool is_jit_mode)
{ {
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
if (is_jit_mode) if (is_jit_mode)
return tbl->table_max_size; return tbl->table_type.max_size;
#else #else
(void)is_jit_mode; (void)is_jit_mode;
#endif #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 static inline uint32
@ -371,11 +351,12 @@ aot_get_tbl_data_slots(const AOTTable *tbl, bool is_jit_mode)
{ {
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
if (is_jit_mode) if (is_jit_mode)
return tbl->table_max_size; return tbl->table_type.max_size;
#else #else
(void)is_jit_mode; (void)is_jit_mode;
#endif #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 #ifdef __cplusplus

View File

@ -605,6 +605,14 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
#define PUSH_PAGE_COUNT(v) \ #define PUSH_PAGE_COUNT(v) \
PUSH(v, MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32)) 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) \ #define TO_LLVM_TYPE(wasm_type) \
wasm_type_to_llvm_type(comp_ctx, &comp_ctx->basic_types, wasm_type) wasm_type_to_llvm_type(comp_ctx, &comp_ctx->basic_types, wasm_type)
@ -782,14 +790,6 @@ aot_compile_wasm(AOTCompContext *comp_ctx);
bool bool
aot_emit_llvm_file(AOTCompContext *comp_ctx, const char *file_name); 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 bool
aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name); 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 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/ */
#include "aot_compiler.h" #include "aot_emit_aot_file.h"
#include "../aot/aot_runtime.h" #include "../aot/aot_runtime.h"
#define PUT_U64_TO_ADDR(addr, value) \ #define PUT_U64_TO_ADDR(addr, value) \
@ -383,11 +383,11 @@ get_import_table_size(const AOTCompContext *comp_ctx,
* | import_table_count * | import_table_count
* ------------------------------ * ------------------------------
* | | U8 elem_type * | | U8 elem_type
* | | U8 table_flags * | | U8 flags
* | | U8 possible_grow * | | U8 possible_grow
* | AOTImportTable[N] | U8 elem_ref_type.nullable (for GC only) * | AOTImportTable[N] | U8 elem_ref_type.nullable (for GC only)
* | | U32 table_init_size * | | U32 init_size
* | | U32 table_max_size * | | U32 max_size
* | | U32 elem_ref_type.heap_type (for GC only) * | | U32 elem_ref_type.heap_type (for GC only)
* ------------------------------ * ------------------------------
*/ */
@ -397,7 +397,8 @@ get_import_table_size(const AOTCompContext *comp_ctx,
for (i = 0; i < comp_data->import_table_count; i++) { for (i = 0; i < comp_data->import_table_count; i++) {
size += sizeof(uint32) * 3; size += sizeof(uint32) * 3;
#if WASM_ENABLE_GC != 0 #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); size += sizeof(uint32);
#endif #endif
} }
@ -412,11 +413,11 @@ get_table_size(const AOTCompContext *comp_ctx, const AOTCompData *comp_data)
* | table_count * | table_count
* ------------------------------ * ------------------------------
* | | U8 elem_type * | | U8 elem_type
* | | U8 table_flags * | | U8 flags
* | | U8 possible_grow * | | U8 possible_grow
* | AOTTable[N] | U8 elem_ref_type.nullable (for GC only) * | AOTTable[N] | U8 elem_ref_type.nullable (for GC only)
* | | U32 table_init_size * | | U32 init_size
* | | U32 table_max_size * | | U32 max_size
* | | U32 elem_ref_type.heap_type (for GC only) * | | U32 elem_ref_type.heap_type (for GC only)
* | | N init_expr (for GC only) * | | N init_expr (for GC only)
* ------------------------------ * ------------------------------
@ -428,7 +429,7 @@ get_table_size(const AOTCompContext *comp_ctx, const AOTCompData *comp_data)
size += sizeof(uint32) * 3; size += sizeof(uint32) * 3;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc) { 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 += sizeof(uint32);
} }
size += get_init_expr_size(comp_ctx, comp_data, size += get_init_expr_size(comp_ctx, comp_data,
@ -1189,8 +1190,8 @@ get_string_literal_section_size(AOTCompContext *comp_ctx,
static uint32 static uint32
get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data); get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data);
static uint32 uint32
get_aot_file_size(AOTCompContext *comp_ctx, AOTCompData *comp_data, aot_get_aot_file_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
AOTObjectData *obj_data) AOTObjectData *obj_data)
{ {
uint32 size = 0; uint32 size = 0;
@ -1955,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].module_name );
* EMIT_STR(comp_data->import_tables[i].table_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_type.elem_type);
EMIT_U8(comp_data->import_tables[i].table_flags); EMIT_U8(comp_data->import_tables[i].table_type.flags);
EMIT_U8(comp_data->import_tables[i].possible_grow); EMIT_U8(comp_data->import_tables[i].table_type.possible_grow);
#if WASM_ENABLE_GC != 0 #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] EMIT_U8(comp_data->import_tables[i]
.elem_ref_type->ref_ht_common.nullable); .table_type.elem_ref_type->ref_ht_common.nullable);
} }
else else
#endif #endif
@ -1969,14 +1971,15 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
/* emit one placeholder to keep the same size */ /* emit one placeholder to keep the same size */
EMIT_U8(0); EMIT_U8(0);
} }
EMIT_U32(comp_data->import_tables[i].table_init_size); EMIT_U32(comp_data->import_tables[i].table_type.init_size);
EMIT_U32(comp_data->import_tables[i].table_max_size); EMIT_U32(comp_data->import_tables[i].table_type.max_size);
#if WASM_ENABLE_GC != 0 #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( 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] 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 #endif
} }
@ -1985,12 +1988,14 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
EMIT_U32(comp_data->table_count); EMIT_U32(comp_data->table_count);
/* Emit table items */ /* Emit table items */
for (i = 0; i < comp_data->table_count; i++) { for (i = 0; i < comp_data->table_count; i++) {
EMIT_U8(comp_data->tables[i].elem_type); EMIT_U8(comp_data->tables[i].table_type.elem_type);
EMIT_U8(comp_data->tables[i].table_flags); EMIT_U8(comp_data->tables[i].table_type.flags);
EMIT_U8(comp_data->tables[i].possible_grow); EMIT_U8(comp_data->tables[i].table_type.possible_grow);
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc && comp_data->tables[i].elem_ref_type) { if (comp_ctx->enable_gc
EMIT_U8(comp_data->tables[i].elem_ref_type->ref_ht_common.nullable); && 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 else
#endif #endif
@ -1998,15 +2003,16 @@ aot_emit_table_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
/* emit one placeholder to keep the same size */ /* emit one placeholder to keep the same size */
EMIT_U8(0); EMIT_U8(0);
} }
EMIT_U32(comp_data->tables[i].table_init_size); EMIT_U32(comp_data->tables[i].table_type.init_size);
EMIT_U32(comp_data->tables[i].table_max_size); EMIT_U32(comp_data->tables[i].table_type.max_size);
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (comp_ctx->enable_gc) { 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( bh_assert(wasm_is_type_multi_byte_type(
comp_data->tables[i].elem_type)); comp_data->tables[i].table_type.elem_type));
EMIT_U32(comp_data->tables[i] EMIT_U32(
.elem_ref_type->ref_ht_common.heap_type); 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, if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
&comp_data->tables[i].init_expr)) { &comp_data->tables[i].init_expr)) {
@ -3032,15 +3038,18 @@ typedef struct elf64_rela {
elf64_sxword r_addend; elf64_sxword r_addend;
} elf64_rela; } elf64_rela;
#define SET_TARGET_INFO(f, v, type, little) \ #define SET_TARGET_INFO_VALUE(f, val, type, little) \
do { \ do { \
type tmp = elf_header->v; \ type tmp = val; \
if ((little && !is_little_endian()) \ if ((little && !is_little_endian()) \
|| (!little && is_little_endian())) \ || (!little && is_little_endian())) \
exchange_##type((uint8 *)&tmp); \ exchange_##type((uint8 *)&tmp); \
obj_data->target_info.f = tmp; \ obj_data->target_info.f = tmp; \
} while (0) } while (0)
#define SET_TARGET_INFO_FIELD(f, v, type, little) \
SET_TARGET_INFO_VALUE(f, elf_header->v, type, little)
static bool static bool
aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data) aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
{ {
@ -3090,6 +3099,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
|| bin_type == LLVMBinaryTypeELF32B) { || bin_type == LLVMBinaryTypeELF32B) {
struct elf32_ehdr *elf_header; struct elf32_ehdr *elf_header;
bool is_little_bin = bin_type == LLVMBinaryTypeELF32L; bool is_little_bin = bin_type == LLVMBinaryTypeELF32L;
uint16 e_type;
if (!elf_buf || elf_size < sizeof(struct elf32_ehdr)) { if (!elf_buf || elf_size < sizeof(struct elf32_ehdr)) {
aot_set_last_error("invalid elf32 buffer."); aot_set_last_error("invalid elf32 buffer.");
@ -3097,20 +3107,22 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
} }
elf_header = (struct elf32_ehdr *)elf_buf; elf_header = (struct elf32_ehdr *)elf_buf;
e_type = elf_header->e_type;
/* Emit eXecute In Place file type while in indirect mode */ /* Emit eXecute In Place file type while in indirect mode */
if (comp_ctx->is_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_VALUE(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO(e_machine, e_machine, uint16, is_little_bin); SET_TARGET_INFO_FIELD(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO(e_version, e_version, uint32, is_little_bin); SET_TARGET_INFO_FIELD(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO(e_flags, e_flags, uint32, is_little_bin); SET_TARGET_INFO_FIELD(e_flags, e_flags, uint32, is_little_bin);
} }
else if (bin_type == LLVMBinaryTypeELF64L else if (bin_type == LLVMBinaryTypeELF64L
|| bin_type == LLVMBinaryTypeELF64B) { || bin_type == LLVMBinaryTypeELF64B) {
struct elf64_ehdr *elf_header; struct elf64_ehdr *elf_header;
bool is_little_bin = bin_type == LLVMBinaryTypeELF64L; bool is_little_bin = bin_type == LLVMBinaryTypeELF64L;
uint16 e_type;
if (!elf_buf || elf_size < sizeof(struct elf64_ehdr)) { if (!elf_buf || elf_size < sizeof(struct elf64_ehdr)) {
aot_set_last_error("invalid elf64 buffer."); aot_set_last_error("invalid elf64 buffer.");
@ -3118,15 +3130,16 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
} }
elf_header = (struct elf64_ehdr *)elf_buf; elf_header = (struct elf64_ehdr *)elf_buf;
e_type = elf_header->e_type;
/* Emit eXecute In Place file type while in indirect mode */ /* Emit eXecute In Place file type while in indirect mode */
if (comp_ctx->is_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_VALUE(e_type, e_type, uint16, is_little_bin);
SET_TARGET_INFO(e_machine, e_machine, uint16, is_little_bin); SET_TARGET_INFO_FIELD(e_machine, e_machine, uint16, is_little_bin);
SET_TARGET_INFO(e_version, e_version, uint32, is_little_bin); SET_TARGET_INFO_FIELD(e_version, e_version, uint32, is_little_bin);
SET_TARGET_INFO(e_flags, e_flags, uint32, is_little_bin); SET_TARGET_INFO_FIELD(e_flags, e_flags, uint32, is_little_bin);
} }
else if (bin_type == LLVMBinaryTypeMachO32L else if (bin_type == LLVMBinaryTypeMachO32L
|| bin_type == LLVMBinaryTypeMachO32B) { || bin_type == LLVMBinaryTypeMachO32B) {
@ -4228,7 +4241,7 @@ destroy_relocation_symbol_list(AOTSymbolList *symbol_list)
} }
} }
static void void
aot_obj_data_destroy(AOTObjectData *obj_data) aot_obj_data_destroy(AOTObjectData *obj_data)
{ {
if (obj_data->binary) if (obj_data->binary)
@ -4261,7 +4274,7 @@ aot_obj_data_destroy(AOTObjectData *obj_data)
wasm_runtime_free(obj_data); wasm_runtime_free(obj_data);
} }
static AOTObjectData * AOTObjectData *
aot_obj_data_create(AOTCompContext *comp_ctx) aot_obj_data_create(AOTCompContext *comp_ctx)
{ {
char *err = NULL; char *err = NULL;
@ -4443,25 +4456,48 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
uint32 *p_aot_file_size) uint32 *p_aot_file_size)
{ {
AOTObjectData *obj_data = aot_obj_data_create(comp_ctx); AOTObjectData *obj_data = aot_obj_data_create(comp_ctx);
uint8 *aot_file_buf, *buf, *buf_end; uint8 *aot_file_buf;
uint32 aot_file_size, offset = 0; uint32 aot_file_size;
if (!obj_data) if (!obj_data)
return NULL; 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) { if (aot_file_size == 0) {
aot_set_last_error("get aot file size failed"); aot_set_last_error("get aot file size failed");
goto fail1; 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."); aot_set_last_error("allocate memory failed.");
goto fail1; goto fail1;
} }
memset(aot_file_buf, 0, aot_file_size); 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) if (!aot_emit_file_header(buf, buf_end, &offset, comp_data, obj_data)
|| !aot_emit_target_info_section(buf, buf_end, &offset, comp_data, || !aot_emit_target_info_section(buf, buf_end, &offset, comp_data,
@ -4482,7 +4518,7 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
comp_ctx) comp_ctx)
#endif #endif
) )
goto fail2; return false;
#if 0 #if 0
dump_buf(buf, offset, "sections"); dump_buf(buf, offset, "sections");
@ -4490,20 +4526,10 @@ aot_emit_aot_file_buf(AOTCompContext *comp_ctx, AOTCompData *comp_data,
if (offset != aot_file_size) { if (offset != aot_file_size) {
aot_set_last_error("emit aot file failed."); aot_set_last_error("emit aot file failed.");
goto fail2; return false;
} }
*p_aot_file_size = aot_file_size; return true;
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 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); PUSH_I32(value);
SET_CONST((uint64)(uint32)i32_const);
return true; return true;
fail: fail:
return false; return false;
@ -55,6 +56,7 @@ aot_compile_op_i64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
} }
PUSH_I64(value); PUSH_I64(value);
SET_CONST((uint64)i64_const);
return true; return true;
fail: fail:
return false; return false;

View File

@ -91,12 +91,30 @@ get_memory_check_bound(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return mem_check_bound; 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 static LLVMValueRef
get_memory_curr_page_count(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx); get_memory_curr_page_count(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
LLVMValueRef LLVMValueRef
aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
mem_offset_t offset, uint32 bytes, bool enable_segue) mem_offset_t offset, uint32 bytes, bool enable_segue,
unsigned int *alignp)
{ {
LLVMValueRef offset_const = LLVMValueRef offset_const =
MEMORY64_COND_VALUE(I64_CONST(offset), I32_CONST(offset)); MEMORY64_COND_VALUE(I64_CONST(offset), I32_CONST(offset));
@ -106,7 +124,9 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMBasicBlockRef check_succ; LLVMBasicBlockRef check_succ;
AOTValue *aot_value_top; AOTValue *aot_value_top;
uint32 local_idx_of_aot_value = 0; uint32 local_idx_of_aot_value = 0;
uint64 const_value;
bool is_target_64bit, is_local_of_aot_value = false; bool is_target_64bit, is_local_of_aot_value = false;
bool is_const = false;
#if WASM_ENABLE_SHARED_MEMORY != 0 #if WASM_ENABLE_SHARED_MEMORY != 0
bool is_shared_memory = bool is_shared_memory =
comp_ctx->comp_data->memories[0].flags & SHARED_MEMORY_FLAG; comp_ctx->comp_data->memories[0].flags & SHARED_MEMORY_FLAG;
@ -161,7 +181,9 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* aot_value_top is freed in the following POP_I32(addr), /* aot_value_top is freed in the following POP_I32(addr),
so save its fields here for further use */ so save its fields here for further use */
is_local_of_aot_value = aot_value_top->is_local; 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; local_idx_of_aot_value = aot_value_top->local_idx;
const_value = aot_value_top->const_value;
} }
POP_MEM_OFFSET(addr); POP_MEM_OFFSET(addr);
@ -171,15 +193,41 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
* have been thrown when converting float to integer before * have been thrown when converting float to integer before
*/ */
/* return address directly if constant offset and inside memory space */ /* return address directly if constant offset and inside memory space */
if (LLVMIsEfficientConstInt(addr) || is_const) {
uint64 value;
if (LLVMIsEfficientConstInt(addr)) { if (LLVMIsEfficientConstInt(addr)) {
uint64 mem_offset = value = (uint64)LLVMConstIntGetZExtValue(addr);
(uint64)LLVMConstIntGetZExtValue(addr) + (uint64)offset; }
else {
value = const_value;
}
uint64 mem_offset = value + (uint64)offset;
uint32 num_bytes_per_page = uint32 num_bytes_per_page =
comp_ctx->comp_data->memories[0].num_bytes_per_page; comp_ctx->comp_data->memories[0].num_bytes_per_page;
uint32 init_page_count = uint32 init_page_count =
comp_ctx->comp_data->memories[0].init_page_count; comp_ctx->comp_data->memories[0].init_page_count;
uint64 mem_data_size = (uint64)num_bytes_per_page * 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) { if (mem_offset + bytes <= mem_data_size) {
/* inside memory space */ /* inside memory space */
if (comp_ctx->pointer_size == sizeof(uint64)) if (comp_ctx->pointer_size == sizeof(uint64))
@ -205,6 +253,9 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return maddr; return maddr;
} }
} }
else if (alignp != NULL) {
*alignp = 1;
}
if (is_target_64bit) { if (is_target_64bit) {
if (!(offset_const = LLVMBuildZExt(comp_ctx->builder, offset_const, if (!(offset_const = LLVMBuildZExt(comp_ctx->builder, offset_const,
@ -324,7 +375,7 @@ fail:
aot_set_last_error("llvm build load failed."); \ aot_set_last_error("llvm build load failed."); \
goto fail; \ goto fail; \
} \ } \
LLVMSetAlignment(value, 1); \ LLVMSetAlignment(value, known_align); \
} while (0) } while (0)
#define BUILD_TRUNC(value, data_type) \ #define BUILD_TRUNC(value, data_type) \
@ -343,7 +394,7 @@ fail:
aot_set_last_error("llvm build store failed."); \ aot_set_last_error("llvm build store failed."); \
goto fail; \ goto fail; \
} \ } \
LLVMSetAlignment(res, 1); \ LLVMSetAlignment(res, known_align); \
} while (0) } while (0)
#define BUILD_SIGN_EXT(dst_type) \ #define BUILD_SIGN_EXT(dst_type) \
@ -445,8 +496,9 @@ aot_compile_op_i32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMTypeRef data_type; LLVMTypeRef data_type;
bool enable_segue = comp_ctx->enable_segue_i32_load; 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, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, &known_align)))
return false; return false;
switch (bytes) { switch (bytes) {
@ -515,8 +567,9 @@ aot_compile_op_i64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMTypeRef data_type; LLVMTypeRef data_type;
bool enable_segue = comp_ctx->enable_segue_i64_load; 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, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, &known_align)))
return false; return false;
switch (bytes) { switch (bytes) {
@ -591,8 +644,9 @@ aot_compile_op_f32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef maddr, value; LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f32_load; 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, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 4,
enable_segue))) enable_segue, &known_align)))
return false; return false;
if (!enable_segue) if (!enable_segue)
@ -614,8 +668,9 @@ aot_compile_op_f64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef maddr, value; LLVMValueRef maddr, value;
bool enable_segue = comp_ctx->enable_segue_f64_load; 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, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 8,
enable_segue))) enable_segue, &known_align)))
return false; return false;
if (!enable_segue) if (!enable_segue)
@ -640,8 +695,9 @@ aot_compile_op_i32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_I32(value); POP_I32(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, &known_align)))
return false; return false;
switch (bytes) { switch (bytes) {
@ -691,8 +747,9 @@ aot_compile_op_i64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_I64(value); POP_I64(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, &known_align)))
return false; return false;
switch (bytes) { switch (bytes) {
@ -748,8 +805,9 @@ aot_compile_op_f32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F32(value); POP_F32(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 4, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 4,
enable_segue))) enable_segue, &known_align)))
return false; return false;
if (!enable_segue) if (!enable_segue)
@ -771,8 +829,9 @@ aot_compile_op_f64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F64(value); POP_F64(value);
unsigned int known_align;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 8, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 8,
enable_segue))) enable_segue, &known_align)))
return false; return false;
if (!enable_segue) if (!enable_segue)
@ -1302,7 +1361,7 @@ aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_I64(value); POP_I64(value);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, NULL)))
return false; return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align)) if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1392,7 +1451,7 @@ aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
} }
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
enable_segue))) enable_segue, NULL)))
return false; return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align)) if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1505,7 +1564,7 @@ aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
CHECK_LLVM_CONST(is_wait64); CHECK_LLVM_CONST(is_wait64);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
false))) false, NULL)))
return false; return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align)) if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))
@ -1579,7 +1638,7 @@ aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
POP_I32(count); POP_I32(count);
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, bytes,
false))) false, NULL)))
return false; return false;
if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align)) if (!check_memory_alignment(comp_ctx, func_ctx, maddr, align))

View File

@ -53,7 +53,8 @@ aot_compile_op_f64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef LLVMValueRef
aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
mem_offset_t offset, uint32 bytes, bool enable_segue); mem_offset_t offset, uint32 bytes, bool enable_segue,
unsigned int *alignp);
bool bool
aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx); aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);

View File

@ -749,7 +749,8 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
* and more importantly doesn't involve relocations. * and more importantly doesn't involve relocations.
*/ */
LLVMAttributeRef attr_short_call = LLVMCreateStringAttribute( LLVMAttributeRef attr_short_call = LLVMCreateStringAttribute(
comp_ctx->context, "short-call", strlen("short-call"), "", 0); comp_ctx->context, "short-call", (unsigned)strlen("short-call"),
"", 0);
LLVMAddAttributeAtIndex(func, LLVMAttributeFunctionIndex, LLVMAddAttributeAtIndex(func, LLVMAttributeFunctionIndex,
attr_short_call); attr_short_call);
} }
@ -3529,7 +3530,7 @@ aot_block_destroy(AOTCompContext *comp_ctx, AOTBlock *block)
bool bool
aot_checked_addr_list_add(AOTFuncContext *func_ctx, uint32 local_idx, 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; AOTCheckedAddr *node = func_ctx->checked_addr_list;
@ -3573,7 +3574,7 @@ aot_checked_addr_list_del(AOTFuncContext *func_ctx, uint32 local_idx)
bool bool
aot_checked_addr_list_find(AOTFuncContext *func_ctx, uint32 local_idx, 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; AOTCheckedAddr *node = func_ctx->checked_addr_list;

View File

@ -75,10 +75,12 @@ typedef struct AOTValue {
struct AOTValue *next; struct AOTValue *next;
struct AOTValue *prev; struct AOTValue *prev;
LLVMValueRef value; LLVMValueRef value;
uint64 const_value; /* valid if is_const is true */
uint32 local_idx;
/* VALUE_TYPE_I32/I64/F32/F64/VOID */ /* VALUE_TYPE_I32/I64/F32/F64/VOID */
uint8 type; uint8 type;
bool is_local; bool is_local;
uint32 local_idx; bool is_const;
} AOTValue; } AOTValue;
/** /**
@ -195,7 +197,7 @@ typedef struct AOTBlockStack {
typedef struct AOTCheckedAddr { typedef struct AOTCheckedAddr {
struct AOTCheckedAddr *next; struct AOTCheckedAddr *next;
uint32 local_idx; uint32 local_idx;
uint32 offset; uint64 offset;
uint32 bytes; uint32 bytes;
} AOTCheckedAddr, *AOTCheckedAddrList; } AOTCheckedAddr, *AOTCheckedAddrList;
@ -572,14 +574,14 @@ wasm_type_to_llvm_type(const AOTCompContext *comp_ctx,
bool bool
aot_checked_addr_list_add(AOTFuncContext *func_ctx, uint32 local_idx, aot_checked_addr_list_add(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes); uint64 offset, uint32 bytes);
void void
aot_checked_addr_list_del(AOTFuncContext *func_ctx, uint32 local_idx); aot_checked_addr_list_del(AOTFuncContext *func_ctx, uint32 local_idx);
bool bool
aot_checked_addr_list_find(AOTFuncContext *func_ctx, uint32 local_idx, aot_checked_addr_list_find(AOTFuncContext *func_ctx, uint32 local_idx,
uint32 offset, uint32 bytes); uint64 offset, uint32 bytes);
void void
aot_checked_addr_list_destroy(AOTFuncContext *func_ctx); aot_checked_addr_list_destroy(AOTFuncContext *func_ctx);

View File

@ -411,7 +411,7 @@ aot_compress_aot_func_names(AOTCompContext *comp_ctx, uint32 *p_size)
return NULL; return NULL;
} }
compressed_str_len = Result.size(); compressed_str_len = (uint32)Result.size();
if (!(compressed_str = (char *)wasm_runtime_malloc(compressed_str_len))) { if (!(compressed_str = (char *)wasm_runtime_malloc(compressed_str_len))) {
aot_set_last_error("allocate memory failed"); aot_set_last_error("allocate memory failed");
return NULL; return NULL;

View File

@ -189,7 +189,7 @@ PartitionFunction(GlobalValueSet Requested)
auto GVName = GV->getName(); /* get the function name */ auto GVName = GV->getName(); /* get the function name */
const char *gvname = GVName.begin(); /* C function name */ const char *gvname = GVName.begin(); /* C function name */
const char *wrapper; const char *wrapper;
uint32 prefix_len = strlen(AOT_FUNC_PREFIX); uint32 prefix_len = (uint32)strlen(AOT_FUNC_PREFIX);
LOG_DEBUG("requested func %s", gvname); LOG_DEBUG("requested func %s", gvname);
/* Convert "aot_func#n_wrapper" to "aot_func#n" */ /* Convert "aot_func#n_wrapper" to "aot_func#n" */

View File

@ -39,6 +39,7 @@ typedef struct dwarf_extractor {
#define TO_EXTRACTOR(handle) (dwarf_extractor *)(handle) #define TO_EXTRACTOR(handle) (dwarf_extractor *)(handle)
static const char *compiler_name = "WAMR AoT compiler";
static bool is_debugger_initialized; static bool is_debugger_initialized;
dwarf_extractor_handle_t dwarf_extractor_handle_t
@ -209,8 +210,8 @@ dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx)
comp_unit = LLVMDIBuilderCreateCompileUnit( comp_unit = LLVMDIBuilderCreateCompileUnit(
comp_ctx->debug_builder, LLDB_TO_LLVM_LANG_TYPE(lang_type), comp_ctx->debug_builder, LLDB_TO_LLVM_LANG_TYPE(lang_type),
comp_ctx->debug_file, "WAMR AoT compiler", 12, 0, NULL, 0, 1, NULL, comp_ctx->debug_file, compiler_name, strlen(compiler_name), 0, NULL,
0, LLVMDWARFEmissionFull, 0, 0, 0, "/", 1, "", 0); 0, 1, NULL, 0, LLVMDWARFEmissionFull, 0, 0, 0, "/", 1, "", 0);
} }
return comp_unit; return comp_unit;
} }
@ -289,7 +290,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
{ {
SBFunction function(sc.GetFunction()); SBFunction function(sc.GetFunction());
const char *function_name = function.GetName(); const char *function_name = function.GetName();
const char *link_name = function.GetName(); const char *link_name = function.GetMangledName();
SBTypeList function_args = function.GetType().GetFunctionArgumentTypes(); SBTypeList function_args = function.GetType().GetFunctionArgumentTypes();
SBType return_type = function.GetType().GetFunctionReturnType(); SBType return_type = function.GetType().GetFunctionReturnType();
const size_t num_function_args = function_args.GetSize(); 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 * https://github.com/bytecodealliance/wasm-micro-runtime/issues/3163
*/ */
LanguageType language_type = function.GetLanguage(); LanguageType language_type = function.GetLanguage();
bool cplusplus = false;
switch (language_type) { switch (language_type) {
case eLanguageTypeC89: case eLanguageTypeC89:
case eLanguageTypeC: case eLanguageTypeC:
@ -311,6 +313,14 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
case eLanguageTypeC11: case eLanguageTypeC11:
case eLanguageTypeC17: case eLanguageTypeC17:
break; 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: default:
LOG_WARNING("func %s has unsupported language_type 0x%x", LOG_WARNING("func %s has unsupported language_type 0x%x",
function_name, (int)language_type); function_name, (int)language_type);
@ -324,11 +334,14 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMMetadataRef File = comp_ctx->debug_file; /* a fallback */ LLVMMetadataRef File = comp_ctx->debug_file; /* a fallback */
LLVMMetadataRef ParamTypes[num_function_args + 1]; LLVMMetadataRef ParamTypes[num_function_args + 1];
size_t num_param_types = 0;
if (!cplusplus) {
num_param_types = num_function_args + 1;
ParamTypes[0] = lldb_type_to_type_dbi(comp_ctx, return_type); ParamTypes[0] = lldb_type_to_type_dbi(comp_ctx, return_type);
for (uint32_t function_arg_idx = 0; function_arg_idx < num_function_args; for (uint32_t function_arg_idx = 0;
++function_arg_idx) { function_arg_idx < num_function_args; ++function_arg_idx) {
SBType function_arg_type = SBType function_arg_type =
function_args.GetTypeAtIndex(function_arg_idx); function_args.GetTypeAtIndex(function_arg_idx);
@ -348,6 +361,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
ParamTypes[function_arg_idx + 1] = NULL; ParamTypes[function_arg_idx + 1] = NULL;
} }
} }
}
auto compile_unit = sc.GetCompileUnit(); auto compile_unit = sc.GetCompileUnit();
auto file_spec = compile_unit.GetFileSpec(); auto file_spec = compile_unit.GetFileSpec();
@ -365,7 +379,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
} }
LLVMMetadataRef FunctionTy = LLVMDIBuilderCreateSubroutineType( LLVMMetadataRef FunctionTy = LLVMDIBuilderCreateSubroutineType(
DIB, File, ParamTypes, num_function_args + 1, LLVMDIFlagZero); DIB, File, ParamTypes, num_param_types, LLVMDIFlagZero);
auto line_entry = sc.GetLineEntry(); auto line_entry = sc.GetLineEntry();
LLVMMetadataRef ReplaceableFunctionMetadata = LLVMMetadataRef ReplaceableFunctionMetadata =
@ -375,8 +389,8 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMMetadataRef FunctionMetadata = LLVMDIBuilderCreateFunction( LLVMMetadataRef FunctionMetadata = LLVMDIBuilderCreateFunction(
DIB, File, function_name, strlen(function_name), link_name, DIB, File, function_name, strlen(function_name), link_name,
strlen(link_name), File, line_entry.GetLine(), FunctionTy, true, true, link_name != NULL ? strlen(link_name) : 0, File, line_entry.GetLine(),
line_entry.GetLine(), LLVMDIFlagZero, false); FunctionTy, true, true, line_entry.GetLine(), LLVMDIFlagZero, false);
LLVMMetadataReplaceAllUsesWith(ReplaceableFunctionMetadata, LLVMMetadataReplaceAllUsesWith(ReplaceableFunctionMetadata,
FunctionMetadata); FunctionMetadata);
@ -385,13 +399,6 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMMetadataRef ParamExpression = LLVMMetadataRef ParamExpression =
LLVMDIBuilderCreateExpression(DIB, NULL, 0); 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 mismatch!:value number=%d, function args=%d",
variable_list.GetSize(), num_function_args);
}
LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation( LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation(
comp_ctx->context, line_entry.GetLine(), 0, FunctionMetadata, NULL); comp_ctx->context, line_entry.GetLine(), 0, FunctionMetadata, NULL);
@ -411,19 +418,42 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar, ParamExpression, LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar, ParamExpression,
ParamLocation, block_curr); 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; for (uint32_t function_arg_idx = 0;
function_arg_idx < variable_list.GetSize(); ++function_arg_idx) { function_arg_idx < variable_list.GetSize(); ++function_arg_idx) {
SBValue variable(variable_list.GetValueAtIndex(function_arg_idx)); SBValue variable(variable_list.GetValueAtIndex(function_arg_idx));
if (variable.IsValid() && ParamTypes[function_arg_idx + 1] != NULL) { if (variable.IsValid()
&& ParamTypes[function_arg_idx + 1] != NULL) {
SBDeclaration dec(variable.GetDeclaration()); SBDeclaration dec(variable.GetDeclaration());
auto valtype = variable.GetType(); auto valtype = variable.GetType();
LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation( LLVMMetadataRef ParamLocation =
LLVMDIBuilderCreateDebugLocation(
comp_ctx->context, dec.GetLine(), dec.GetColumn(), comp_ctx->context, dec.GetLine(), dec.GetColumn(),
FunctionMetadata, NULL); FunctionMetadata, NULL);
const char *varname = variable.GetName(); const char *varname = variable.GetName();
LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable( LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable(
DIB, FunctionMetadata, varname, varname ? strlen(varname) : 0, DIB, FunctionMetadata, varname,
function_arg_idx + 1 + 1, varname ? strlen(varname) : 0, function_arg_idx + 1 + 1,
File, // starts form 1, and 1 is exenv, File, // starts form 1, and 1 is exenv,
dec.GetLine(), ParamTypes[function_arg_idx + 1], true, dec.GetLine(), ParamTypes[function_arg_idx + 1], true,
LLVMDIFlagZero); LLVMDIFlagZero);
@ -434,6 +464,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
block_curr); block_curr);
} }
} }
}
return FunctionMetadata; return FunctionMetadata;
} }

View File

@ -19,7 +19,7 @@ simd_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align,
LLVMValueRef maddr, data; LLVMValueRef maddr, data;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, 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"); HANDLE_FAILURE("aot_check_memory_overflow");
return NULL; return NULL;
} }
@ -281,13 +281,13 @@ aot_compile_simd_load_zero(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
/* data_length in bytes */ /* data_length in bytes */
static bool static bool
simd_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, uint32 align, 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) LLVMTypeRef value_ptr_type, bool enable_segue)
{ {
LLVMValueRef maddr, result; LLVMValueRef maddr, result;
if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset, if (!(maddr = aot_check_memory_overflow(comp_ctx, func_ctx, offset,
data_length, enable_segue))) data_length, enable_segue, NULL)))
return false; return false;
if (!(maddr = LLVMBuildBitCast(comp_ctx->builder, maddr, value_ptr_type, if (!(maddr = LLVMBuildBitCast(comp_ctx->builder, maddr, value_ptr_type,

View File

@ -76,11 +76,12 @@ jit_frontend_get_table_inst_offset(const WASMModule *module, uint32 tbl_idx)
offset += (uint32)offsetof(WASMTableInstance, elems); offset += (uint32)offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0 #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 #else
offset += (uint32)sizeof(uint32) offset += (uint32)sizeof(uint32)
* (import_table->possible_grow ? import_table->max_size * (import_table->table_type.possible_grow
: import_table->init_size); ? import_table->table_type.max_size
: import_table->table_type.init_size);
#endif #endif
i++; i++;
@ -97,10 +98,13 @@ jit_frontend_get_table_inst_offset(const WASMModule *module, uint32 tbl_idx)
offset += (uint32)offsetof(WASMTableInstance, elems); offset += (uint32)offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0 #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 #else
offset += (uint32)sizeof(table_elem_type_t) offset +=
* (table->possible_grow ? table->max_size : table->init_size); (uint32)sizeof(table_elem_type_t)
* (table->table_type.possible_grow ? table->table_type.max_size
: table->table_type.init_size);
#endif #endif
i++; i++;

View File

@ -27,6 +27,9 @@ typedef struct AOTCompData *aot_comp_data_t;
struct AOTCompContext; struct AOTCompContext;
typedef struct AOTCompContext *aot_comp_context_t; typedef struct AOTCompContext *aot_comp_context_t;
struct AOTObjectData;
typedef struct AOTObjectData *aot_obj_data_t;
aot_comp_data_t aot_comp_data_t
aot_create_comp_data(void *wasm_module, const char *target_arch, aot_create_comp_data(void *wasm_module, const char *target_arch,
bool gc_enabled); bool gc_enabled);
@ -62,6 +65,25 @@ aot_destroy_comp_context(aot_comp_context_t comp_ctx);
bool bool
aot_compile_wasm(aot_comp_context_t comp_ctx); 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 bool
aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name); aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);

View File

@ -75,11 +75,17 @@ typedef enum {
struct WASMFuncType; struct WASMFuncType;
typedef struct WASMFuncType *wasm_func_type_t; typedef struct WASMFuncType *wasm_func_type_t;
struct WASMTableType;
typedef struct WASMTableType *wasm_table_type_t;
struct WASMGlobalType; struct WASMGlobalType;
typedef struct WASMGlobalType *wasm_global_type_t; typedef struct WASMGlobalType *wasm_global_type_t;
#ifndef WASM_MEMORY_T_DEFINED
#define WASM_MEMORY_T_DEFINED
struct WASMMemory; struct WASMMemory;
typedef struct WASMMemory WASMMemoryType; typedef struct WASMMemory WASMMemoryType;
#endif
typedef WASMMemoryType *wasm_memory_type_t; typedef WASMMemoryType *wasm_memory_type_t;
typedef struct wasm_import_t { typedef struct wasm_import_t {
@ -89,6 +95,7 @@ typedef struct wasm_import_t {
bool linked; bool linked;
union { union {
wasm_func_type_t func_type; wasm_func_type_t func_type;
wasm_table_type_t table_type;
wasm_global_type_t global_type; wasm_global_type_t global_type;
wasm_memory_type_t memory_type; wasm_memory_type_t memory_type;
} u; } u;
@ -99,6 +106,7 @@ typedef struct wasm_export_t {
wasm_import_export_kind_t kind; wasm_import_export_kind_t kind;
union { union {
wasm_func_type_t func_type; wasm_func_type_t func_type;
wasm_table_type_t table_type;
wasm_global_type_t global_type; wasm_global_type_t global_type;
wasm_memory_type_t memory_type; wasm_memory_type_t memory_type;
} u; } u;
@ -295,6 +303,15 @@ typedef struct wasm_global_inst_t {
void *global_data; void *global_data;
} wasm_global_inst_t; } 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 { typedef enum {
WASM_LOG_LEVEL_FATAL = 0, WASM_LOG_LEVEL_FATAL = 0,
WASM_LOG_LEVEL_ERROR = 1, WASM_LOG_LEVEL_ERROR = 1,
@ -405,6 +422,59 @@ wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
WASM_RUNTIME_API_EXTERN package_type_t WASM_RUNTIME_API_EXTERN package_type_t
get_package_type(const uint8_t *buf, uint32_t size); 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 * Check whether a file is an AOT XIP (Execution In Place) file
* *
@ -698,7 +768,7 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
* @return the function instance found, NULL if not found * @return the function instance found, NULL if not found
*/ */
WASM_RUNTIME_API_EXTERN wasm_function_inst_t 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); const char *name);
/** /**
@ -710,8 +780,8 @@ wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
* @return the parameter count of the function instance * @return the parameter count of the function instance
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_param_count(wasm_function_inst_t const func_inst, wasm_func_get_param_count(const wasm_function_inst_t func_inst,
wasm_module_inst_t const module_inst); const wasm_module_inst_t module_inst);
/** /**
* Get result count of the function instance * Get result count of the function instance
@ -722,8 +792,8 @@ wasm_func_get_param_count(wasm_function_inst_t const func_inst,
* @return the result count of the function instance * @return the result count of the function instance
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_result_count(wasm_function_inst_t const func_inst, wasm_func_get_result_count(const wasm_function_inst_t func_inst,
wasm_module_inst_t const module_inst); const wasm_module_inst_t module_inst);
/** /**
* Get parameter types of the function instance * Get parameter types of the function instance
@ -733,8 +803,8 @@ wasm_func_get_result_count(wasm_function_inst_t const func_inst,
* @param param_types the parameter types returned * @param param_types the parameter types returned
*/ */
WASM_RUNTIME_API_EXTERN void WASM_RUNTIME_API_EXTERN void
wasm_func_get_param_types(wasm_function_inst_t const func_inst, wasm_func_get_param_types(const wasm_function_inst_t func_inst,
wasm_module_inst_t const module_inst, const wasm_module_inst_t module_inst,
wasm_valkind_t *param_types); wasm_valkind_t *param_types);
/** /**
@ -745,8 +815,8 @@ wasm_func_get_param_types(wasm_function_inst_t const func_inst,
* @param result_types the result types returned * @param result_types the result types returned
*/ */
WASM_RUNTIME_API_EXTERN void WASM_RUNTIME_API_EXTERN void
wasm_func_get_result_types(wasm_function_inst_t const func_inst, wasm_func_get_result_types(const wasm_function_inst_t func_inst,
wasm_module_inst_t const module_inst, const wasm_module_inst_t module_inst,
wasm_valkind_t *result_types); wasm_valkind_t *result_types);
/** /**
@ -1188,7 +1258,7 @@ wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
void *native_ptr, uint64_t size); 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 * Note that native addresses to module instance memory can be invalidated
* on a memory growth. (Except shared memory, whose native addresses are * on a memory growth. (Except shared memory, whose native addresses are
@ -1204,7 +1274,7 @@ wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
uint64_t app_offset); 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 module_inst the WASM module instance
* @param native_ptr the native address * @param native_ptr the native address
@ -1300,7 +1370,7 @@ wasm_runtime_get_export_type(const wasm_module_t module, int32_t export_index,
* @return the number of parameters for the function type * @return the number of parameters for the function type
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_param_count(wasm_func_type_t const func_type); wasm_func_type_get_param_count(const wasm_func_type_t func_type);
/** /**
* Get the kind of a parameter for a function type * Get the kind of a parameter for a function type
@ -1311,7 +1381,7 @@ wasm_func_type_get_param_count(wasm_func_type_t const func_type);
* @return the kind of the parameter if successful, -1 otherwise * @return the kind of the parameter if successful, -1 otherwise
*/ */
WASM_RUNTIME_API_EXTERN wasm_valkind_t WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_param_valkind(wasm_func_type_t const func_type, wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
uint32_t param_index); uint32_t param_index);
/** /**
@ -1322,7 +1392,7 @@ wasm_func_type_get_param_valkind(wasm_func_type_t const func_type,
* @return the number of results for the function type * @return the number of results for the function type
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_result_count(wasm_func_type_t const func_type); wasm_func_type_get_result_count(const wasm_func_type_t func_type);
/** /**
* Get the kind of a result for a function type * Get the kind of a result for a function type
@ -1333,7 +1403,7 @@ wasm_func_type_get_result_count(wasm_func_type_t const func_type);
* @return the kind of the result if successful, -1 otherwise * @return the kind of the result if successful, -1 otherwise
*/ */
WASM_RUNTIME_API_EXTERN wasm_valkind_t WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_result_valkind(wasm_func_type_t const func_type, wasm_func_type_get_result_valkind(const wasm_func_type_t func_type,
uint32_t result_index); uint32_t result_index);
/** /**
@ -1386,6 +1456,46 @@ wasm_memory_type_get_init_page_count(const wasm_memory_type_t memory_type);
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_memory_type_get_max_page_count(const wasm_memory_type_t memory_type); 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 * Register native functions with same module name
* *
@ -1472,6 +1582,34 @@ wasm_runtime_get_export_global_inst(const wasm_module_inst_t module_inst,
const char *name, const char *name,
wasm_global_inst_t *global_inst); 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 * Get attachment of native function from execution environment
* *
@ -1735,7 +1873,7 @@ wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
* and name string) if found, NULL otherwise * and name string) if found, NULL otherwise
*/ */
WASM_RUNTIME_API_EXTERN const uint8_t * 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); const char *name, uint32_t *len);
/** /**
@ -1760,6 +1898,18 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_import_global_linked(const char *module_name, wasm_runtime_is_import_global_linked(const char *module_name,
const char *global_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 { typedef enum {
INTERNAL_ERROR, INTERNAL_ERROR,
MAX_SIZE_REACHED, MAX_SIZE_REACHED,

View File

@ -480,11 +480,11 @@ typedef void *WASMString;
#endif /* end of WASM_ENABLE_STRINGREF != 0 */ #endif /* end of WASM_ENABLE_STRINGREF != 0 */
#endif /* end of WASM_ENABLE_GC != 0 */ #endif /* end of WASM_ENABLE_GC != 0 */
typedef struct WASMTable { typedef struct WASMTableType {
uint8 elem_type; uint8 elem_type;
/** /**
* 0: no max size and not shared * 0: no max size and not shared
* 1: hax max size * 1: has max size
* 2: shared * 2: shared
*/ */
uint8 flags; uint8 flags;
@ -494,6 +494,12 @@ typedef struct WASMTable {
uint32 max_size; uint32 max_size;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
WASMRefType *elem_ref_type; WASMRefType *elem_ref_type;
#endif
} WASMTableType;
typedef struct WASMTable {
WASMTableType table_type;
#if WASM_ENABLE_GC != 0
/* init expr for the whole table */ /* init expr for the whole table */
InitializerExpression init_expr; InitializerExpression init_expr;
#endif #endif
@ -512,21 +518,16 @@ typedef struct WASMMemory {
uint32 num_bytes_per_page; uint32 num_bytes_per_page;
uint32 init_page_count; uint32 init_page_count;
uint32 max_page_count; uint32 max_page_count;
} WASMMemory, WASMMemoryType; } WASMMemory;
#ifndef WASM_MEMORY_T_DEFINED
#define WASM_MEMORY_T_DEFINED
typedef struct WASMMemory WASMMemoryType;
#endif
typedef struct WASMTableImport { typedef struct WASMTableImport {
char *module_name; char *module_name;
char *field_name; char *field_name;
/* 0: no max size, 1: has max size */ WASMTableType table_type;
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
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
WASMModule *import_module; WASMModule *import_module;
WASMTable *import_table_linked; WASMTable *import_table_linked;
@ -835,6 +836,9 @@ struct WASMModule {
AOTModule structure. */ AOTModule structure. */
uint32 module_type; uint32 module_type;
/* the package version read from the WASM file */
uint32 package_version;
uint32 type_count; uint32 type_count;
uint32 import_count; uint32 import_count;
uint32 function_count; uint32 function_count;

View File

@ -495,6 +495,12 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
} while (0) } while (0)
#endif #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 /* in exception handling, label_type needs to be stored to lookup exception
* handlers */ * handlers */
@ -1424,7 +1430,7 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
#define HANDLE_OP_END() \ #define HANDLE_OP_END() \
os_mutex_lock(&exec_env->wait_lock); \ os_mutex_lock(&exec_env->wait_lock); \
if (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \ if (exec_env->current_status->signal_flag == WAMR_SIG_SINGSTEP \
&& exec_env->current_status->step_count++ == 2) { \ && exec_env->current_status->step_count++ == 1) { \
exec_env->current_status->step_count = 0; \ exec_env->current_status->step_count = 0; \
SYNC_ALL_TO_FRAME(); \ SYNC_ALL_TO_FRAME(); \
wasm_cluster_thread_waiting_run(exec_env); \ wasm_cluster_thread_waiting_run(exec_env); \
@ -1892,19 +1898,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
switch (handler_opcode) { switch (handler_opcode) {
case WASM_OP_CATCH: case WASM_OP_CATCH:
skip_leb(lookup_cursor); /* skip tag_index */ skip_leb(lookup_cursor); /* skip tag_index */
PUSH_I64(end_addr); PUSH_PTR(end_addr);
break; break;
case WASM_OP_CATCH_ALL: case WASM_OP_CATCH_ALL:
PUSH_I64(end_addr); PUSH_PTR(end_addr);
break; break;
case WASM_OP_DELEGATE: case WASM_OP_DELEGATE:
skip_leb(lookup_cursor); /* skip depth */ skip_leb(lookup_cursor); /* skip depth */
PUSH_I64(end_addr); PUSH_PTR(end_addr);
/* patch target_addr */ /* patch target_addr */
(frame_csp - 1)->target_addr = lookup_cursor; (frame_csp - 1)->target_addr = lookup_cursor;
break; break;
case WASM_OP_END: case WASM_OP_END:
PUSH_I64(0); PUSH_PTR(0);
/* patch target_addr */ /* patch target_addr */
(frame_csp - 1)->target_addr = end_addr; (frame_csp - 1)->target_addr = end_addr;
break; break;
@ -5638,8 +5644,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
#endif #endif
/* allowing the destination and source to overlap */ /* allowing the destination and source to overlap */
#if WASM_ENABLE_MEMORY64 == 0
bh_memmove_s(mdst, (uint32)(linear_mem_size - dst), bh_memmove_s(mdst, (uint32)(linear_mem_size - dst),
msrc, len); msrc, (uint32)len);
#else
/* use memmove when memory64 is enabled since len
may be larger than UINT32_MAX */
memmove(mdst, msrc, len);
#endif
break; break;
} }
case WASM_OP_MEMORY_FILL: case WASM_OP_MEMORY_FILL:

View File

@ -323,27 +323,6 @@ is_64bit_type(uint8 type)
return false; return false;
} }
static bool
is_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
#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
|| type == VALUE_TYPE_V128 /* 0x7B */
#endif
#endif
)
return true;
return false;
}
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
static bool static bool
is_packed_type(uint8 type) is_packed_type(uint8 type)
@ -355,7 +334,10 @@ is_packed_type(uint8 type)
static bool static bool
is_byte_a_type(uint8 type) is_byte_a_type(uint8 type)
{ {
return (is_value_type(type) || (type == VALUE_TYPE_VOID)) ? true : false; return (is_valid_value_type_for_interpreter(type)
|| (type == VALUE_TYPE_VOID))
? true
: false;
} }
#if WASM_ENABLE_SIMD != 0 #if WASM_ENABLE_SIMD != 0
@ -380,8 +362,7 @@ loader_malloc(uint64 size, char *error_buf, uint32 error_buf_size)
{ {
void *mem; void *mem;
if (size >= WASM_MEM_ALLOC_MAX_SIZE if (size >= UINT32_MAX || !(mem = wasm_runtime_malloc((uint32)size))) {
|| !(mem = wasm_runtime_malloc((uint32)size))) {
set_error_buf(error_buf, error_buf_size, "allocate memory failed"); set_error_buf(error_buf, error_buf_size, "allocate memory failed");
return NULL; return NULL;
} }
@ -1060,6 +1041,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
} }
cur_value.type_index = type_idx; cur_value.type_index = type_idx;
cur_value.data = NULL;
wasm_set_refheaptype_typeidx( wasm_set_refheaptype_typeidx(
&cur_ref_type.ref_ht_typeidx, false, type_idx); &cur_ref_type.ref_ht_typeidx, false, type_idx);
if (!push_const_expr_stack( if (!push_const_expr_stack(
@ -1463,7 +1445,7 @@ resolve_value_type(const uint8 **p_buf, const uint8 *buf_end,
} }
else { else {
/* type which can be represented by one byte */ /* type which can be represented by one byte */
if (!is_value_type(type) if (!is_valid_value_type_for_interpreter(type)
&& !(allow_packed_type && is_packed_type(type))) { && !(allow_packed_type && is_packed_type(type))) {
set_error_buf(error_buf, error_buf_size, "type mismatch"); set_error_buf(error_buf, error_buf_size, "type mismatch");
return false; return false;
@ -1973,7 +1955,7 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
type->types[param_count + j] = read_uint8(p); type->types[param_count + j] = read_uint8(p);
} }
for (j = 0; j < param_count + result_count; j++) { for (j = 0; j < param_count + result_count; j++) {
if (!is_value_type(type->types[j])) { if (!is_valid_value_type_for_interpreter(type->types[j])) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown value type"); "unknown value type");
return false; return false;
@ -2255,9 +2237,15 @@ fail:
static void static void
adjust_table_max_size(uint32 init_size, uint32 max_size_flag, uint32 *max_size) adjust_table_max_size(uint32 init_size, uint32 max_size_flag, uint32 *max_size)
{ {
uint32 default_max_size = init_size * 2 > WASM_TABLE_MAX_SIZE uint32 default_max_size;
? init_size * 2
: WASM_TABLE_MAX_SIZE; if (UINT32_MAX / 2 > init_size)
default_max_size = init_size * 2;
else
default_max_size = UINT32_MAX;
if (default_max_size < WASM_TABLE_MAX_SIZE)
default_max_size = WASM_TABLE_MAX_SIZE;
if (max_size_flag) { if (max_size_flag) {
/* module defines the table limitation */ /* module defines the table limitation */
@ -2379,10 +2367,11 @@ wasm_loader_resolve_table(const char *module_name, const char *table_name,
else { else {
table = &(module->tables[export->index - module->import_table_count]); table = &(module->tables[export->index - module->import_table_count]);
} }
if (table->init_size < init_size || table->max_size > max_size) { if (table->table_type.init_size < init_size
|| table->table_type.max_size > max_size) {
LOG_DEBUG("%s,%s failed type check(%d-%d), expected(%d-%d)", LOG_DEBUG("%s,%s failed type check(%d-%d), expected(%d-%d)",
module_name, table_name, table->init_size, table->max_size, module_name, table_name, table->table_type.init_size,
init_size, max_size); table->table_type.max_size, init_size, max_size);
set_error_buf(error_buf, error_buf_size, "incompatible import type"); set_error_buf(error_buf, error_buf_size, "incompatible import type");
return NULL; return NULL;
} }
@ -2547,6 +2536,7 @@ load_function_import(const uint8 **p_buf, const uint8 *buf_end,
WASMFunction *linked_func = NULL; WASMFunction *linked_func = NULL;
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
WASMModule *sub_module = NULL; WASMModule *sub_module = NULL;
bool is_built_in_module = false;
#endif #endif
const char *linked_signature = NULL; const char *linked_signature = NULL;
void *linked_attachment = NULL; void *linked_attachment = NULL;
@ -2582,14 +2572,13 @@ load_function_import(const uint8 **p_buf, const uint8 *buf_end,
} }
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
else { else {
if (!wasm_runtime_is_built_in_module(sub_module_name)) { if (!(is_built_in_module =
wasm_runtime_is_built_in_module(sub_module_name))) {
sub_module = (WASMModule *)wasm_runtime_load_depended_module( sub_module = (WASMModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)parent_module, sub_module_name, error_buf, (WASMModuleCommon *)parent_module, sub_module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) {
return false;
}
} }
if (is_built_in_module || sub_module)
linked_func = wasm_loader_resolve_function( linked_func = wasm_loader_resolve_function(
sub_module_name, function_name, declare_func_type, error_buf, sub_module_name, function_name, declare_func_type, error_buf,
error_buf_size); error_buf_size);
@ -2667,7 +2656,7 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
} }
declare_elem_type = ref_type.ref_type; declare_elem_type = ref_type.ref_type;
if (need_ref_type_map) { if (need_ref_type_map) {
if (!(table->elem_ref_type = if (!(table->table_type.elem_ref_type =
reftype_set_insert(parent_module->ref_type_set, &ref_type, reftype_set_insert(parent_module->ref_type_set, &ref_type,
error_buf, error_buf_size))) { error_buf, error_buf_size))) {
return false; return false;
@ -2675,7 +2664,7 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
} }
#if TRACE_WASM_LOADER != 0 #if TRACE_WASM_LOADER != 0
os_printf("import table type: "); os_printf("import table type: ");
wasm_dump_value_type(declare_elem_type, table->elem_ref_type); wasm_dump_value_type(declare_elem_type, table->table_type.elem_ref_type);
os_printf("\n"); os_printf("\n");
#endif #endif
#endif /* end of WASM_ENABLE_GC == 0 */ #endif /* end of WASM_ENABLE_GC == 0 */
@ -2705,25 +2694,21 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
sub_module = (WASMModule *)wasm_runtime_load_depended_module( sub_module = (WASMModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)parent_module, sub_module_name, error_buf, (WASMModuleCommon *)parent_module, sub_module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) { if (sub_module) {
return false;
}
linked_table = wasm_loader_resolve_table( linked_table = wasm_loader_resolve_table(
sub_module_name, table_name, declare_init_size, declare_max_size, sub_module_name, table_name, declare_init_size,
error_buf, error_buf_size); declare_max_size, error_buf, error_buf_size);
if (!linked_table) { if (linked_table) {
return false;
}
/* reset with linked table limit */ /* reset with linked table limit */
declare_elem_type = linked_table->elem_type; declare_elem_type = linked_table->table_type.elem_type;
declare_init_size = linked_table->init_size; declare_init_size = linked_table->table_type.init_size;
declare_max_size = linked_table->max_size; declare_max_size = linked_table->table_type.max_size;
declare_max_size_flag = linked_table->flags; declare_max_size_flag = linked_table->table_type.flags;
table->import_table_linked = linked_table; table->import_table_linked = linked_table;
table->import_module = sub_module; table->import_module = sub_module;
} }
}
}
#endif /* WASM_ENABLE_MULTI_MODULE != 0 */ #endif /* WASM_ENABLE_MULTI_MODULE != 0 */
/* (table (export "table") 10 20 funcref) */ /* (table (export "table") 10 20 funcref) */
@ -2750,13 +2735,13 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
} }
/* now we believe all declaration are ok */ /* now we believe all declaration are ok */
table->elem_type = declare_elem_type; table->table_type.elem_type = declare_elem_type;
table->init_size = declare_init_size; table->table_type.init_size = declare_init_size;
table->flags = declare_max_size_flag; table->table_type.flags = declare_max_size_flag;
table->max_size = declare_max_size; table->table_type.max_size = declare_max_size;
#if WASM_ENABLE_WAMR_COMPILER != 0 #if WASM_ENABLE_WAMR_COMPILER != 0
if (table->elem_type == VALUE_TYPE_EXTERNREF) if (table->table_type.elem_type == VALUE_TYPE_EXTERNREF)
parent_module->is_ref_types_used = true; parent_module->is_ref_types_used = true;
#endif #endif
(void)parent_module; (void)parent_module;
@ -2884,24 +2869,11 @@ load_memory_import(const uint8 **p_buf, const uint8 *buf_end,
sub_module = (WASMModule *)wasm_runtime_load_depended_module( sub_module = (WASMModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)parent_module, sub_module_name, error_buf, (WASMModuleCommon *)parent_module, sub_module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) { if (sub_module) {
#if WASM_ENABLE_LIB_WASI_THREADS != 0
/* Avoid memory import failure when wasi-threads is enabled
and the memory is shared */
if (!(mem_flag & SHARED_MEMORY_FLAG))
return false;
#else
return false;
#endif /* WASM_ENABLE_LIB_WASI_THREADS */
}
else {
linked_memory = wasm_loader_resolve_memory( linked_memory = wasm_loader_resolve_memory(
sub_module_name, memory_name, declare_init_page_count, sub_module_name, memory_name, declare_init_page_count,
declare_max_page_count, error_buf, error_buf_size); declare_max_page_count, error_buf, error_buf_size);
if (!linked_memory) { if (linked_memory) {
return false;
}
/** /**
* reset with linked memory limit * reset with linked memory limit
*/ */
@ -2911,6 +2883,7 @@ load_memory_import(const uint8 **p_buf, const uint8 *buf_end,
declare_max_page_count = linked_memory->max_page_count; declare_max_page_count = linked_memory->max_page_count;
} }
} }
}
#endif #endif
/* (memory (export "memory") 1 2) */ /* (memory (export "memory") 1 2) */
@ -2934,6 +2907,29 @@ load_memory_import(const uint8 **p_buf, const uint8 *buf_end,
declare_init_page_count = spectest_memory_init_page; declare_init_page_count = spectest_memory_init_page;
declare_max_page_count = spectest_memory_max_page; declare_max_page_count = spectest_memory_max_page;
} }
#if WASM_ENABLE_WASI_TEST != 0
/* a case in wasi-testsuite which imports ("foo" "bar") */
else if (!strcmp("foo", sub_module_name)) {
uint32 spectest_memory_init_page = 1;
uint32 spectest_memory_max_page = 1;
if (strcmp("bar", memory_name)) {
set_error_buf(error_buf, error_buf_size,
"incompatible import type or unknown import");
return false;
}
if (declare_init_page_count > spectest_memory_init_page
|| declare_max_page_count < spectest_memory_max_page) {
set_error_buf(error_buf, error_buf_size,
"incompatible import type");
return false;
}
declare_init_page_count = spectest_memory_init_page;
declare_max_page_count = spectest_memory_max_page;
}
#endif
/* now we believe all declaration are ok */ /* now we believe all declaration are ok */
memory->mem_type.flags = mem_flag; memory->mem_type.flags = mem_flag;
@ -2997,9 +2993,7 @@ load_tag_import(const uint8 **p_buf, const uint8 *buf_end,
sub_module = (WASMModule *)wasm_runtime_load_depended_module( sub_module = (WASMModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)parent_module, sub_module_name, error_buf, (WASMModuleCommon *)parent_module, sub_module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) { if (sub_module) {
return false;
}
/* wasm_loader_resolve_tag checks, that the imported tag /* wasm_loader_resolve_tag checks, that the imported tag
* and the declared tag have the same type * and the declared tag have the same type
*/ */
@ -3013,6 +3007,7 @@ load_tag_import(const uint8 **p_buf, const uint8 *buf_end,
tag->import_tag_index_linked = linked_tag_index; tag->import_tag_index_linked = linked_tag_index;
} }
} }
}
#endif #endif
/* store to module tag declarations */ /* store to module tag declarations */
tag->attribute = declare_tag_attribute; tag->attribute = declare_tag_attribute;
@ -3056,7 +3051,7 @@ load_global_import(const uint8 **p_buf, const uint8 *buf_end,
CHECK_BUF(p, p_end, 2); CHECK_BUF(p, p_end, 2);
/* global type */ /* global type */
declare_type = read_uint8(p); declare_type = read_uint8(p);
if (!is_value_type(declare_type)) { if (!is_valid_value_type_for_interpreter(declare_type)) {
set_error_buf(error_buf, error_buf_size, "type mismatch"); set_error_buf(error_buf, error_buf_size, "type mismatch");
return false; return false;
} }
@ -3109,10 +3104,7 @@ load_global_import(const uint8 **p_buf, const uint8 *buf_end,
sub_module = (WASMModule *)wasm_runtime_load_depended_module( sub_module = (WASMModule *)wasm_runtime_load_depended_module(
(WASMModuleCommon *)parent_module, sub_module_name, error_buf, (WASMModuleCommon *)parent_module, sub_module_name, error_buf,
error_buf_size); error_buf_size);
if (!sub_module) { if (sub_module) {
return false;
}
/* check sub modules */ /* check sub modules */
linked_global = wasm_loader_resolve_global( linked_global = wasm_loader_resolve_global(
sub_module_name, global_name, declare_type, declare_mutable, sub_module_name, global_name, declare_type, declare_mutable,
@ -3123,6 +3115,7 @@ load_global_import(const uint8 **p_buf, const uint8 *buf_end,
global->is_linked = true; global->is_linked = true;
} }
} }
}
#endif #endif
global->module_name = sub_module_name; global->module_name = sub_module_name;
@ -3156,10 +3149,10 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
#if WASM_ENABLE_GC == 0 #if WASM_ENABLE_GC == 0
CHECK_BUF(p, p_end, 1); CHECK_BUF(p, p_end, 1);
/* 0x70 or 0x6F */ /* 0x70 or 0x6F */
table->elem_type = read_uint8(p); table->table_type.elem_type = read_uint8(p);
if (VALUE_TYPE_FUNCREF != table->elem_type if (VALUE_TYPE_FUNCREF != table->table_type.elem_type
#if WASM_ENABLE_REF_TYPES != 0 #if WASM_ENABLE_REF_TYPES != 0
&& VALUE_TYPE_EXTERNREF != table->elem_type && VALUE_TYPE_EXTERNREF != table->table_type.elem_type
#endif #endif
) { ) {
set_error_buf(error_buf, error_buf_size, "incompatible import type"); set_error_buf(error_buf, error_buf_size, "incompatible import type");
@ -3171,9 +3164,9 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
error_buf_size)) { error_buf_size)) {
return false; return false;
} }
table->elem_type = ref_type.ref_type; table->table_type.elem_type = ref_type.ref_type;
if (need_ref_type_map) { if (need_ref_type_map) {
if (!(table->elem_ref_type = if (!(table->table_type.elem_ref_type =
reftype_set_insert(module->ref_type_set, &ref_type, error_buf, reftype_set_insert(module->ref_type_set, &ref_type, error_buf,
error_buf_size))) { error_buf_size))) {
return false; return false;
@ -3181,20 +3174,21 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
} }
#if TRACE_WASM_LOADER != 0 #if TRACE_WASM_LOADER != 0
os_printf("table type: "); os_printf("table type: ");
wasm_dump_value_type(table->elem_type, table->elem_ref_type); wasm_dump_value_type(table->table_type.elem_type,
table->table_type.elem_ref_type);
os_printf("\n"); os_printf("\n");
#endif #endif
#endif /* end of WASM_ENABLE_GC == 0 */ #endif /* end of WASM_ENABLE_GC == 0 */
p_org = p; p_org = p;
read_leb_uint32(p, p_end, table->flags); read_leb_uint32(p, p_end, table->table_type.flags);
#if WASM_ENABLE_SHARED_MEMORY == 0 #if WASM_ENABLE_SHARED_MEMORY == 0
if (p - p_org > 1) { if (p - p_org > 1) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"integer representation too long"); "integer representation too long");
return false; return false;
} }
if (table->flags > 1) { if (table->table_type.flags > 1) {
set_error_buf(error_buf, error_buf_size, "integer too large"); set_error_buf(error_buf, error_buf_size, "integer too large");
return false; return false;
} }
@ -3203,29 +3197,31 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
set_error_buf(error_buf, error_buf_size, "invalid limits flags"); set_error_buf(error_buf, error_buf_size, "invalid limits flags");
return false; return false;
} }
if (table->flags == 2) { if (table->table_type.flags == 2) {
set_error_buf(error_buf, error_buf_size, "tables cannot be shared"); set_error_buf(error_buf, error_buf_size, "tables cannot be shared");
return false; return false;
} }
if (table->flags > 1) { if (table->table_type.flags > 1) {
set_error_buf(error_buf, error_buf_size, "invalid limits flags"); set_error_buf(error_buf, error_buf_size, "invalid limits flags");
return false; return false;
} }
#endif #endif
read_leb_uint32(p, p_end, table->init_size); read_leb_uint32(p, p_end, table->table_type.init_size);
if (table->flags) { if (table->table_type.flags) {
read_leb_uint32(p, p_end, table->max_size); read_leb_uint32(p, p_end, table->table_type.max_size);
if (!check_table_max_size(table->init_size, table->max_size, error_buf, if (!check_table_max_size(table->table_type.init_size,
table->table_type.max_size, error_buf,
error_buf_size)) error_buf_size))
return false; return false;
} }
adjust_table_max_size(table->init_size, table->flags, &table->max_size); adjust_table_max_size(table->table_type.init_size, table->table_type.flags,
&table->table_type.max_size);
#if WASM_ENABLE_WAMR_COMPILER != 0 #if WASM_ENABLE_WAMR_COMPILER != 0
if (table->elem_type == VALUE_TYPE_EXTERNREF) if (table->table_type.elem_type == VALUE_TYPE_EXTERNREF)
module->is_ref_types_used = true; module->is_ref_types_used = true;
#endif #endif
@ -3634,6 +3630,10 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
return false; return false;
} }
if (is_indices_overflow(module->import_function_count, func_count,
error_buf, error_buf_size))
return false;
if (func_count) { if (func_count) {
module->function_count = func_count; module->function_count = func_count;
total_size = sizeof(WASMFunction *) * (uint64)func_count; total_size = sizeof(WASMFunction *) * (uint64)func_count;
@ -3768,7 +3768,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
CHECK_BUF(p_code, buf_code_end, 1); CHECK_BUF(p_code, buf_code_end, 1);
/* 0x7F/0x7E/0x7D/0x7C */ /* 0x7F/0x7E/0x7D/0x7C */
type = read_uint8(p_code); type = read_uint8(p_code);
if (!is_value_type(type)) { if (!is_valid_value_type_for_interpreter(type)) {
if (type == VALUE_TYPE_V128) if (type == VALUE_TYPE_V128)
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"v128 value type requires simd feature"); "v128 value type requires simd feature");
@ -3930,8 +3930,9 @@ load_table_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (has_init) { if (has_init) {
if (!load_init_expr(module, &p, p_end, &table->init_expr, if (!load_init_expr(module, &p, p_end, &table->init_expr,
table->elem_type, table->elem_ref_type, table->table_type.elem_type,
error_buf, error_buf_size)) table->table_type.elem_ref_type, error_buf,
error_buf_size))
return false; return false;
if (table->init_expr.init_expr_type >= INIT_EXPR_TYPE_STRUCT_NEW if (table->init_expr.init_expr_type >= INIT_EXPR_TYPE_STRUCT_NEW
&& table->init_expr.init_expr_type && table->init_expr.init_expr_type
@ -3943,7 +3944,8 @@ load_table_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
} }
} }
else { else {
if (wasm_is_reftype_htref_non_nullable(table->elem_type)) { if (wasm_is_reftype_htref_non_nullable(
table->table_type.elem_type)) {
set_error_buf( set_error_buf(
error_buf, error_buf_size, error_buf, error_buf_size,
"type mismatch: non-nullable table without init expr"); "type mismatch: non-nullable table without init expr");
@ -3953,7 +3955,7 @@ load_table_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
#endif /* end of WASM_ENABLE_GC != 0 */ #endif /* end of WASM_ENABLE_GC != 0 */
#if WASM_ENABLE_WAMR_COMPILER != 0 #if WASM_ENABLE_WAMR_COMPILER != 0
if (table->elem_type == VALUE_TYPE_EXTERNREF) if (table->table_type.elem_type == VALUE_TYPE_EXTERNREF)
module->is_ref_types_used = true; module->is_ref_types_used = true;
#endif #endif
} }
@ -4027,6 +4029,9 @@ load_global_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
#endif #endif
read_leb_uint32(p, p_end, global_count); read_leb_uint32(p, p_end, global_count);
if (is_indices_overflow(module->import_global_count, global_count,
error_buf, error_buf_size))
return false;
module->global_count = 0; module->global_count = 0;
if (global_count) { if (global_count) {
@ -4043,7 +4048,7 @@ load_global_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
CHECK_BUF(p, p_end, 2); CHECK_BUF(p, p_end, 2);
/* global type */ /* global type */
global->type.val_type = read_uint8(p); global->type.val_type = read_uint8(p);
if (!is_value_type(global->type.val_type)) { if (!is_valid_value_type_for_interpreter(global->type.val_type)) {
set_error_buf(error_buf, error_buf_size, "type mismatch"); set_error_buf(error_buf, error_buf_size, "type mismatch");
return false; return false;
} }
@ -4326,9 +4331,10 @@ check_table_elem_type(WASMModule *module, uint32 table_index,
if (table_index < module->import_table_count) if (table_index < module->import_table_count)
table_declared_elem_type = table_declared_elem_type =
module->import_tables[table_index].u.table.elem_type; module->import_tables[table_index].u.table.table_type.elem_type;
else else
table_declared_elem_type = (module->tables + table_index)->elem_type; table_declared_elem_type =
(module->tables + table_index)->table_type.elem_type;
if (table_declared_elem_type == type_from_elem_seg) if (table_declared_elem_type == type_from_elem_seg)
return true; return true;
@ -4925,6 +4931,10 @@ load_tag_section(const uint8 *buf, const uint8 *buf_end, const uint8 *buf_code,
/* get tag count */ /* get tag count */
read_leb_uint32(p, p_end, section_tag_count); read_leb_uint32(p, p_end, section_tag_count);
if (is_indices_overflow(module->import_tag_count, section_tag_count,
error_buf, error_buf_size))
return false;
module->tag_count = section_tag_count; module->tag_count = section_tag_count;
if (section_tag_count) { if (section_tag_count) {
@ -6532,6 +6542,8 @@ load(const uint8 *buf, uint32 size, WASMModule *module,
return false; return false;
} }
module->package_version = version;
if (!create_sections(buf, size, &section_list, error_buf, error_buf_size) if (!create_sections(buf, size, &section_list, error_buf, error_buf_size)
|| !load_from_sections(module, section_list, true, wasm_binary_freeable, || !load_from_sections(module, section_list, true, wasm_binary_freeable,
error_buf, error_buf_size)) { error_buf, error_buf_size)) {
@ -9308,6 +9320,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
bool disable_emit, int16 operand_offset, bool disable_emit, int16 operand_offset,
char *error_buf, uint32 error_buf_size) char *error_buf, uint32 error_buf_size)
{ {
uint32 cell_num_to_push, i;
if (type == VALUE_TYPE_VOID) if (type == VALUE_TYPE_VOID)
return true; return true;
@ -9334,6 +9348,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
if (is_32bit_type(type)) if (is_32bit_type(type))
return true; return true;
cell_num_to_push = wasm_value_type_cell_num(type) - 1;
for (i = 0; i < cell_num_to_push; i++) {
if (ctx->p_code_compiled == NULL) { if (ctx->p_code_compiled == NULL) {
if (!check_offset_push(ctx, error_buf, error_buf_size)) if (!check_offset_push(ctx, error_buf, error_buf_size))
return false; return false;
@ -9344,11 +9360,12 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
ctx->dynamic_offset++; ctx->dynamic_offset++;
if (ctx->dynamic_offset > ctx->max_dynamic_offset) { if (ctx->dynamic_offset > ctx->max_dynamic_offset) {
ctx->max_dynamic_offset = ctx->dynamic_offset; ctx->max_dynamic_offset = ctx->dynamic_offset;
if (ctx->max_dynamic_offset >= INT16_MAX) { if (ctx->max_dynamic_offset >= INT16_MAX)
goto fail; goto fail;
} }
} }
} }
return true; return true;
fail: fail:
@ -9370,37 +9387,36 @@ wasm_loader_pop_frame_offset(WASMLoaderContext *ctx, uint8 type,
BranchBlock *cur_block = ctx->frame_csp - depth; BranchBlock *cur_block = ctx->frame_csp - depth;
int32 available_stack_cell = int32 available_stack_cell =
(int32)(ctx->stack_cell_num - cur_block->stack_cell_num); (int32)(ctx->stack_cell_num - cur_block->stack_cell_num);
uint32 cell_num_to_pop;
/* Directly return success if current block is in stack /* Directly return success if current block is in stack
* polymorphic state while stack is empty. */ polymorphic state while stack is empty. */
if (available_stack_cell <= 0 && cur_block->is_stack_polymorphic) if (available_stack_cell <= 0 && cur_block->is_stack_polymorphic)
return true; return true;
if (type == VALUE_TYPE_VOID) if (type == VALUE_TYPE_VOID)
return true; return true;
if (is_32bit_type(type)) { /* Change type to ANY when the stack top is ANY, so as to avoid
popping unneeded offsets, e.g. if type is I64/F64, we may pop
two offsets */
if (available_stack_cell > 0 && *(ctx->frame_ref - 1) == VALUE_TYPE_ANY)
type = VALUE_TYPE_ANY;
cell_num_to_pop = wasm_value_type_cell_num(type);
/* Check the offset stack bottom to ensure the frame offset /* Check the offset stack bottom to ensure the frame offset
stack will not go underflow. But we don't thrown error stack will not go underflow. But we don't thrown error
and return true here, because the error msg should be and return true here, because the error msg should be
given in wasm_loader_pop_frame_ref */ given in wasm_loader_pop_frame_ref */
if (!check_offset_pop(ctx, 1)) if (!check_offset_pop(ctx, cell_num_to_pop))
return true; return true;
ctx->frame_offset -= 1; ctx->frame_offset -= cell_num_to_pop;
if ((*(ctx->frame_offset) > ctx->start_dynamic_offset) if ((*(ctx->frame_offset) > ctx->start_dynamic_offset)
&& (*(ctx->frame_offset) < ctx->max_dynamic_offset)) && (*(ctx->frame_offset) < ctx->max_dynamic_offset))
ctx->dynamic_offset -= 1; ctx->dynamic_offset -= cell_num_to_pop;
}
else {
if (!check_offset_pop(ctx, 2))
return true;
ctx->frame_offset -= 2;
if ((*(ctx->frame_offset) > ctx->start_dynamic_offset)
&& (*(ctx->frame_offset) < ctx->max_dynamic_offset))
ctx->dynamic_offset -= 2;
}
emit_operand(ctx, *(ctx->frame_offset)); emit_operand(ctx, *(ctx->frame_offset));
(void)error_buf; (void)error_buf;
@ -10820,23 +10836,25 @@ get_table_elem_type(const WASMModule *module, uint32 table_idx,
if (table_idx < module->import_table_count) { if (table_idx < module->import_table_count) {
if (p_elem_type) if (p_elem_type)
*p_elem_type = module->import_tables[table_idx].u.table.elem_type; *p_elem_type =
module->import_tables[table_idx].u.table.table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (p_ref_type) if (p_ref_type)
*((WASMRefType **)p_ref_type) = *((WASMRefType **)p_ref_type) =
module->import_tables[table_idx].u.table.elem_ref_type; module->import_tables[table_idx]
.u.table.table_type.elem_ref_type;
#endif #endif
} }
else { else {
if (p_elem_type) if (p_elem_type)
*p_elem_type = *p_elem_type =
module->tables[module->import_table_count + table_idx] module->tables[module->import_table_count + table_idx]
.elem_type; .table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (p_ref_type) if (p_ref_type)
*((WASMRefType **)p_ref_type) = *((WASMRefType **)p_ref_type) =
module->tables[module->import_table_count + table_idx] module->tables[module->import_table_count + table_idx]
.elem_ref_type; .table_type.elem_ref_type;
#endif #endif
} }
return true; return true;
@ -10888,6 +10906,12 @@ wasm_loader_get_custom_section(WASMModule *module, const char *name,
} }
#endif #endif
#if 0
#define HANDLE_OPCODE(opcode) #opcode
DEFINE_GOTO_TABLE(const char *, op_mnemonics);
#undef HANDLE_OPCODE
#endif
static bool static bool
wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func, wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
uint32 cur_func_idx, char *error_buf, uint32 cur_func_idx, char *error_buf,
@ -11182,10 +11206,15 @@ re_scan:
/* Pass parameters to block */ /* Pass parameters to block */
if (BLOCK_HAS_PARAM(block_type)) { if (BLOCK_HAS_PARAM(block_type)) {
for (i = 0; i < block_type.u.type->param_count; i++) { WASMFuncType *func_type = block_type.u.type;
#if WASM_ENABLE_GC != 0
WASMRefType *ref_type;
uint32 j = 0;
#endif
for (i = 0; i < func_type->param_count; i++) {
#if WASM_ENABLE_FAST_INTERP != 0 #if WASM_ENABLE_FAST_INTERP != 0
uint32 cell_num = wasm_value_type_cell_num( uint32 cell_num =
block_type.u.type->types[i]); wasm_value_type_cell_num(func_type->types[i]);
if (i >= available_params) { if (i >= available_params) {
/* If there isn't enough data on stack, push a dummy /* If there isn't enough data on stack, push a dummy
* offset to keep the stack consistent with * offset to keep the stack consistent with
@ -11209,7 +11238,17 @@ re_scan:
loader_ctx->frame_offset += cell_num; loader_ctx->frame_offset += cell_num;
} }
#endif #endif
PUSH_TYPE(block_type.u.type->types[i]); #if WASM_ENABLE_GC != 0
if (wasm_is_type_multi_byte_type(func_type->types[i])) {
bh_assert(func_type->ref_type_maps[j].index == i);
ref_type = func_type->ref_type_maps[j].ref_type;
bh_memcpy_s(&wasm_ref_type, sizeof(WASMRefType),
ref_type,
wasm_reftype_struct_size(ref_type));
j++;
}
#endif
PUSH_TYPE(func_type->types[i]);
} }
} }
@ -11337,6 +11376,7 @@ re_scan:
int32 available_stack_cell = int32 available_stack_cell =
(int32)(loader_ctx->stack_cell_num (int32)(loader_ctx->stack_cell_num
- cur_block->stack_cell_num); - cur_block->stack_cell_num);
int32 tti;
/* Check stack values match return types by comparing tag param /* Check stack values match return types by comparing tag param
* types with stack cells */ * types with stack cells */
@ -11345,19 +11385,21 @@ re_scan:
WASMRefTypeMap *frame_reftype_map = WASMRefTypeMap *frame_reftype_map =
loader_ctx->frame_reftype_map; loader_ctx->frame_reftype_map;
uint32 frame_reftype_map_num = loader_ctx->reftype_map_num; uint32 frame_reftype_map_num = loader_ctx->reftype_map_num;
/* Temporarily set these values since they may be used in
GET_LOCAL_REFTYPE(), remember they must be restored later */
param_reftype_maps = tag_type->ref_type_maps; param_reftype_maps = tag_type->ref_type_maps;
/* For tag_type function, it shouldn't have result_count = 0 */ /* For tag_type function, it shouldn't have result_count = 0 */
param_reftype_map_count = tag_type->ref_type_map_count; param_reftype_map_count = tag_type->ref_type_map_count;
param_count = (int32)tag_type->param_count; param_count = tag_type->param_count;
#endif #endif
for (int tti = (int32)tag_type->param_count - 1; tti >= 0; for (tti = (int32)tag_type->param_count - 1; tti >= 0; tti--) {
tti--) {
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
local_type = tag_type->types[tti]; local_type = tag_type->types[tti];
local_idx = tti; local_idx = tti;
/* Get the wasm_ref_type if the local_type is multibyte /* Get the wasm_ref_type if the local_type is multibyte
* type */ type */
GET_LOCAL_REFTYPE(); GET_LOCAL_REFTYPE();
#endif #endif
@ -11387,6 +11429,13 @@ re_scan:
wasm_value_type_cell_num(tag_type->types[tti]); wasm_value_type_cell_num(tag_type->types[tti]);
} }
#if WASM_ENABLE_GC != 0
/* Restore the values */
param_reftype_maps = func->func_type->ref_type_maps;
param_reftype_map_count = func->func_type->ref_type_map_count;
param_count = func->func_type->param_count;
#endif
/* throw is stack polymorphic */ /* throw is stack polymorphic */
(void)label_type; (void)label_type;
RESET_STACK(); RESET_STACK();
@ -11478,10 +11527,6 @@ re_scan:
goto fail; goto fail;
} }
BlockType new_block_type;
new_block_type.is_value_type = false;
new_block_type.u.type = func_type;
/* /*
* replace frame_csp by LABEL_TYPE_CATCH * replace frame_csp by LABEL_TYPE_CATCH
*/ */
@ -11491,10 +11536,24 @@ re_scan:
* CATCH Blocks */ * CATCH Blocks */
RESET_STACK(); RESET_STACK();
#if WASM_ENABLE_GC != 0
WASMRefType *ref_type;
uint32 j = 0;
#endif
/* push types on the stack according to caught type */ /* push types on the stack according to caught type */
if (BLOCK_HAS_PARAM(new_block_type)) { for (i = 0; i < func_type->param_count; i++) {
for (i = 0; i < new_block_type.u.type->param_count; i++) #if WASM_ENABLE_GC != 0
PUSH_TYPE(new_block_type.u.type->types[i]); if (wasm_is_type_multi_byte_type(func_type->types[i])) {
bh_assert(func_type->ref_type_maps[j].index == i);
ref_type = func_type->ref_type_maps[j].ref_type;
bh_memcpy_s(&wasm_ref_type, sizeof(WASMRefType),
ref_type,
wasm_reftype_struct_size(ref_type));
j++;
}
#endif
PUSH_TYPE(func_type->types[i]);
} }
break; break;
} }
@ -12312,7 +12371,7 @@ re_scan:
#if WASM_ENABLE_GC == 0 #if WASM_ENABLE_GC == 0
CHECK_BUF(p, p_end, 1); CHECK_BUF(p, p_end, 1);
type = read_uint8(p); type = read_uint8(p);
if (!is_value_type(type)) { if (!is_valid_value_type_for_interpreter(type)) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown value type"); "unknown value type");
goto fail; goto fail;
@ -14888,13 +14947,13 @@ re_scan:
if (opcode1 == WASM_OP_TABLE_GROW) { if (opcode1 == WASM_OP_TABLE_GROW) {
if (table_idx < module->import_table_count) { if (table_idx < module->import_table_count) {
module->import_tables[table_idx] module->import_tables[table_idx]
.u.table.possible_grow = true; .u.table.table_type.possible_grow = true;
} }
else { else {
module module
->tables[table_idx ->tables[table_idx
- module->import_table_count] - module->import_table_count]
.possible_grow = true; .table_type.possible_grow = true;
} }
} }

View File

@ -88,23 +88,11 @@ is_64bit_type(uint8 type)
return false; return false;
} }
static bool
is_value_type(uint8 type)
{
if (type == VALUE_TYPE_I32 || type == VALUE_TYPE_I64
|| type == VALUE_TYPE_F32 || type == VALUE_TYPE_F64
#if WASM_ENABLE_REF_TYPES != 0
|| type == VALUE_TYPE_FUNCREF || type == VALUE_TYPE_EXTERNREF
#endif
)
return true;
return false;
}
static bool static bool
is_byte_a_type(uint8 type) is_byte_a_type(uint8 type)
{ {
return is_value_type(type) || (type == VALUE_TYPE_VOID); return is_valid_value_type_for_interpreter(type)
|| (type == VALUE_TYPE_VOID);
} }
static void static void
@ -581,7 +569,7 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
type->types[param_count + j] = read_uint8(p); type->types[param_count + j] = read_uint8(p);
} }
for (j = 0; j < param_count + result_count; j++) { for (j = 0; j < param_count + result_count; j++) {
bh_assert(is_value_type(type->types[j])); bh_assert(is_valid_value_type_for_interpreter(type->types[j]));
} }
param_cell_num = wasm_get_cell_num(type->types, param_count); param_cell_num = wasm_get_cell_num(type->types, param_count);
@ -697,7 +685,7 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
read_leb_uint32(p, p_end, declare_init_size); read_leb_uint32(p, p_end, declare_init_size);
if (declare_max_size_flag & 1) { if (declare_max_size_flag & 1) {
read_leb_uint32(p, p_end, declare_max_size); read_leb_uint32(p, p_end, declare_max_size);
bh_assert(table->init_size <= table->max_size); bh_assert(table->table_type.init_size <= table->table_type.max_size);
} }
adjust_table_max_size(declare_init_size, declare_max_size_flag, adjust_table_max_size(declare_init_size, declare_max_size_flag,
@ -708,10 +696,10 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
!((declare_max_size_flag & 1) && declare_init_size > declare_max_size)); !((declare_max_size_flag & 1) && declare_init_size > declare_max_size));
/* now we believe all declaration are ok */ /* now we believe all declaration are ok */
table->elem_type = declare_elem_type; table->table_type.elem_type = declare_elem_type;
table->init_size = declare_init_size; table->table_type.init_size = declare_init_size;
table->flags = declare_max_size_flag; table->table_type.flags = declare_max_size_flag;
table->max_size = declare_max_size; table->table_type.max_size = declare_max_size;
return true; return true;
} }
@ -818,26 +806,27 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMTable *table,
CHECK_BUF(p, p_end, 1); CHECK_BUF(p, p_end, 1);
/* 0x70 or 0x6F */ /* 0x70 or 0x6F */
table->elem_type = read_uint8(p); table->table_type.elem_type = read_uint8(p);
bh_assert((VALUE_TYPE_FUNCREF == table->elem_type) bh_assert((VALUE_TYPE_FUNCREF == table->table_type.elem_type)
#if WASM_ENABLE_REF_TYPES != 0 #if WASM_ENABLE_REF_TYPES != 0
|| VALUE_TYPE_EXTERNREF == table->elem_type || VALUE_TYPE_EXTERNREF == table->table_type.elem_type
#endif #endif
); );
p_org = p; p_org = p;
read_leb_uint32(p, p_end, table->flags); read_leb_uint32(p, p_end, table->table_type.flags);
bh_assert(p - p_org <= 1); bh_assert(p - p_org <= 1);
bh_assert(table->flags <= 1); bh_assert(table->table_type.flags <= 1);
(void)p_org; (void)p_org;
read_leb_uint32(p, p_end, table->init_size); read_leb_uint32(p, p_end, table->table_type.init_size);
if (table->flags == 1) { if (table->table_type.flags == 1) {
read_leb_uint32(p, p_end, table->max_size); read_leb_uint32(p, p_end, table->table_type.max_size);
bh_assert(table->init_size <= table->max_size); bh_assert(table->table_type.init_size <= table->table_type.max_size);
} }
adjust_table_max_size(table->init_size, table->flags, &table->max_size); adjust_table_max_size(table->table_type.init_size, table->table_type.flags,
&table->table_type.max_size);
*p_buf = p; *p_buf = p;
return true; return true;
@ -1151,6 +1140,8 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
bh_assert(func_count == code_count); bh_assert(func_count == code_count);
bh_assert(module->import_function_count <= UINT32_MAX - func_count);
if (func_count) { if (func_count) {
module->function_count = func_count; module->function_count = func_count;
total_size = sizeof(WASMFunction *) * (uint64)func_count; total_size = sizeof(WASMFunction *) * (uint64)func_count;
@ -1228,7 +1219,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
CHECK_BUF(p_code, buf_code_end, 1); CHECK_BUF(p_code, buf_code_end, 1);
/* 0x7F/0x7E/0x7D/0x7C */ /* 0x7F/0x7E/0x7D/0x7C */
type = read_uint8(p_code); type = read_uint8(p_code);
bh_assert(is_value_type(type)); bh_assert(is_valid_value_type_for_interpreter(type));
for (k = 0; k < sub_local_count; k++) { for (k = 0; k < sub_local_count; k++) {
func->local_types[local_type_index++] = type; func->local_types[local_type_index++] = type;
} }
@ -1333,6 +1324,8 @@ load_global_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
read_leb_uint32(p, p_end, global_count); read_leb_uint32(p, p_end, global_count);
bh_assert(module->import_global_count <= UINT32_MAX - global_count);
module->global_count = 0; module->global_count = 0;
if (global_count) { if (global_count) {
total_size = sizeof(WASMGlobal) * (uint64)global_count; total_size = sizeof(WASMGlobal) * (uint64)global_count;
@ -2528,11 +2521,12 @@ get_table_elem_type(const WASMModule *module, uint32 table_idx,
if (p_elem_type) { if (p_elem_type) {
if (table_idx < module->import_table_count) if (table_idx < module->import_table_count)
*p_elem_type = module->import_tables[table_idx].u.table.elem_type; *p_elem_type =
module->import_tables[table_idx].u.table.table_type.elem_type;
else else
*p_elem_type = *p_elem_type =
module->tables[module->import_table_count + table_idx] module->tables[module->import_table_count + table_idx]
.elem_type; .table_type.elem_type;
} }
return true; return true;
} }
@ -4876,6 +4870,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
bool disable_emit, int16 operand_offset, bool disable_emit, int16 operand_offset,
char *error_buf, uint32 error_buf_size) char *error_buf, uint32 error_buf_size)
{ {
uint32 cell_num_to_push, i;
if (type == VALUE_TYPE_VOID) if (type == VALUE_TYPE_VOID)
return true; return true;
@ -4900,6 +4896,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
if (is_32bit_type(type)) if (is_32bit_type(type))
return true; return true;
cell_num_to_push = wasm_value_type_cell_num(type) - 1;
for (i = 0; i < cell_num_to_push; i++) {
if (ctx->p_code_compiled == NULL) { if (ctx->p_code_compiled == NULL) {
if (!check_offset_push(ctx, error_buf, error_buf_size)) if (!check_offset_push(ctx, error_buf, error_buf_size))
return false; return false;
@ -4913,6 +4911,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
bh_assert(ctx->max_dynamic_offset < INT16_MAX); bh_assert(ctx->max_dynamic_offset < INT16_MAX);
} }
} }
}
return true; return true;
} }
@ -4929,38 +4929,40 @@ wasm_loader_pop_frame_offset(WASMLoaderContext *ctx, uint8 type,
BranchBlock *cur_block = ctx->frame_csp - depth; BranchBlock *cur_block = ctx->frame_csp - depth;
int32 available_stack_cell = int32 available_stack_cell =
(int32)(ctx->stack_cell_num - cur_block->stack_cell_num); (int32)(ctx->stack_cell_num - cur_block->stack_cell_num);
uint32 cell_num_to_pop;
/* Directly return success if current block is in stack /* Directly return success if current block is in stack
* polymorphic state while stack is empty. */ polymorphic state while stack is empty. */
if (available_stack_cell <= 0 && cur_block->is_stack_polymorphic) if (available_stack_cell <= 0 && cur_block->is_stack_polymorphic)
return true; return true;
if (type == VALUE_TYPE_VOID) if (type == VALUE_TYPE_VOID)
return true; return true;
if (is_32bit_type(type)) { /* Change type to ANY when the stack top is ANY, so as to avoid
popping unneeded offsets, e.g. if type is I64/F64, we may pop
two offsets */
if (available_stack_cell > 0 && *(ctx->frame_ref - 1) == VALUE_TYPE_ANY)
type = VALUE_TYPE_ANY;
cell_num_to_pop = wasm_value_type_cell_num(type);
/* Check the offset stack bottom to ensure the frame offset /* Check the offset stack bottom to ensure the frame offset
stack will not go underflow. But we don't thrown error stack will not go underflow. But we don't thrown error
and return true here, because the error msg should be and return true here, because the error msg should be
given in wasm_loader_pop_frame_ref */ given in wasm_loader_pop_frame_ref */
if (!check_offset_pop(ctx, 1)) if (!check_offset_pop(ctx, cell_num_to_pop))
return true; return true;
ctx->frame_offset -= 1; ctx->frame_offset -= cell_num_to_pop;
if ((*(ctx->frame_offset) > ctx->start_dynamic_offset) if ((*(ctx->frame_offset) > ctx->start_dynamic_offset)
&& (*(ctx->frame_offset) < ctx->max_dynamic_offset)) && (*(ctx->frame_offset) < ctx->max_dynamic_offset))
ctx->dynamic_offset -= 1; ctx->dynamic_offset -= cell_num_to_pop;
}
else {
if (!check_offset_pop(ctx, 2))
return true;
ctx->frame_offset -= 2;
if ((*(ctx->frame_offset) > ctx->start_dynamic_offset)
&& (*(ctx->frame_offset) < ctx->max_dynamic_offset))
ctx->dynamic_offset -= 2;
}
emit_operand(ctx, *(ctx->frame_offset)); emit_operand(ctx, *(ctx->frame_offset));
(void)error_buf;
(void)error_buf_size;
return true; return true;
} }
@ -6827,7 +6829,7 @@ re_scan:
CHECK_BUF(p, p_end, 1); CHECK_BUF(p, p_end, 1);
ref_type = read_uint8(p); ref_type = read_uint8(p);
if (!is_value_type(ref_type)) { if (!is_valid_value_type_for_interpreter(ref_type)) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown value type"); "unknown value type");
goto fail; goto fail;
@ -7928,13 +7930,13 @@ re_scan:
if (opcode1 == WASM_OP_TABLE_GROW) { if (opcode1 == WASM_OP_TABLE_GROW) {
if (table_idx < module->import_table_count) { if (table_idx < module->import_table_count) {
module->import_tables[table_idx] module->import_tables[table_idx]
.u.table.possible_grow = true; .u.table.table_type.possible_grow = true;
} }
else { else {
module module
->tables[table_idx ->tables[table_idx
- module->import_table_count] - module->import_table_count]
.possible_grow = true; .table_type.possible_grow = true;
} }
} }

View File

@ -533,9 +533,9 @@ tables_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
#endif #endif
{ {
/* in order to save memory, alloc resource as few as possible */ /* in order to save memory, alloc resource as few as possible */
max_size_fixed = import->u.table.possible_grow max_size_fixed = import->u.table.table_type.possible_grow
? import->u.table.max_size ? import->u.table.table_type.max_size
: import->u.table.init_size; : import->u.table.table_type.init_size;
/* it is a built-in table, every module has its own */ /* it is a built-in table, every module has its own */
total_size = offsetof(WASMTableInstance, elems); total_size = offsetof(WASMTableInstance, elems);
@ -556,8 +556,8 @@ tables_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
*table_linked = table_inst_linked; *table_linked = table_inst_linked;
if (table_inst_linked != NULL) { if (table_inst_linked != NULL) {
#if WASM_ENABLE_GC != 0
table->elem_type = table_inst_linked->elem_type; table->elem_type = table_inst_linked->elem_type;
#if WASM_ENABLE_GC != 0
table->elem_ref_type = table_inst_linked->elem_ref_type; table->elem_ref_type = table_inst_linked->elem_ref_type;
#endif #endif
table->cur_size = table_inst_linked->cur_size; table->cur_size = table_inst_linked->cur_size;
@ -566,11 +566,12 @@ tables_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
else else
#endif #endif
{ {
table->elem_type = import->u.table.table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
table->elem_type = import->u.table.elem_type; table->elem_ref_type.elem_ref_type =
table->elem_ref_type.elem_ref_type = import->u.table.elem_ref_type; import->u.table.table_type.elem_ref_type;
#endif #endif
table->cur_size = import->u.table.init_size; table->cur_size = import->u.table.table_type.init_size;
table->max_size = max_size_fixed; table->max_size = max_size_fixed;
} }
@ -587,11 +588,11 @@ tables_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
total_size = offsetof(WASMTableInstance, elems); total_size = offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
/* in case, a module which imports this table will grow it */ /* in case, a module which imports this table will grow it */
max_size_fixed = module->tables[i].max_size; max_size_fixed = module->tables[i].table_type.max_size;
#else #else
max_size_fixed = module->tables[i].possible_grow max_size_fixed = module->tables[i].table_type.possible_grow
? module->tables[i].max_size ? module->tables[i].table_type.max_size
: module->tables[i].init_size; : module->tables[i].table_type.init_size;
#endif #endif
#if WASM_ENABLE_GC == 0 #if WASM_ENABLE_GC == 0
/* Store function indexes */ /* Store function indexes */
@ -610,11 +611,12 @@ tables_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
/* For GC, all elements have already been set to NULL_REF (0) as /* For GC, all elements have already been set to NULL_REF (0) as
uninitialized elements */ uninitialized elements */
#endif #endif
table->elem_type = module->tables[i].table_type.elem_type;
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
table->elem_type = module->tables[i].elem_type; table->elem_ref_type.elem_ref_type =
table->elem_ref_type.elem_ref_type = module->tables[i].elem_ref_type; module->tables[i].table_type.elem_ref_type;
#endif #endif
table->cur_size = module->tables[i].init_size; table->cur_size = module->tables[i].table_type.init_size;
table->max_size = max_size_fixed; table->max_size = max_size_fixed;
table = (WASMTableInstance *)((uint8 *)table + (uint32)total_size); table = (WASMTableInstance *)((uint8 *)table + (uint32)total_size);
@ -1606,7 +1608,7 @@ execute_malloc_function(WASMModuleInstance *module_inst, WASMExecEnv *exec_env,
if (ret) { if (ret) {
#if WASM_ENABLE_MEMORY64 != 0 #if WASM_ENABLE_MEMORY64 != 0
if (is_memory64) if (is_memory64)
*p_result = GET_I64_FROM_ADDR(&argv.u64); *p_result = argv.u64;
else else
#endif #endif
{ {
@ -1708,36 +1710,73 @@ check_linked_symbol(WASMModuleInstance *module_inst, char *error_buf,
&& !func->import_func_linked && !func->import_func_linked
#endif #endif
) { ) {
#if WASM_ENABLE_WAMR_COMPILER == 0
LOG_WARNING("warning: failed to link import function (%s, %s)", LOG_WARNING("warning: failed to link import function (%s, %s)",
func->module_name, func->field_name); func->module_name, func->field_name);
/* will throw exception only if calling */
#else
/* do nothing to avoid confused message */
#endif /* WASM_ENABLE_WAMR_COMPILER == 0 */
} }
} }
for (i = 0; i < module->import_global_count; i++) { for (i = 0; i < module->import_global_count; i++) {
WASMGlobalImport *global = &((module->import_globals + i)->u.global); WASMGlobalImport *global = &((module->import_globals + i)->u.global);
if (!global->is_linked) { if (!global->is_linked) {
#if WASM_ENABLE_SPEC_TEST != 0 #if WASM_ENABLE_SPEC_TEST != 0
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown import or incompatible import type"); "unknown import or incompatible import type");
return false; return false;
#else #else
#if WASM_ENABLE_WAMR_COMPILER == 0
set_error_buf_v(error_buf, error_buf_size, set_error_buf_v(error_buf, error_buf_size,
"failed to link import global (%s, %s)", "failed to link import global (%s, %s)",
global->module_name, global->field_name); global->module_name, global->field_name);
return false; return false;
#else
/* do nothing to avoid confused message */
#endif /* WASM_ENABLE_WAMR_COMPILER == 0 */
#endif /* WASM_ENABLE_SPEC_TEST != 0 */ #endif /* WASM_ENABLE_SPEC_TEST != 0 */
} }
} }
for (i = 0; i < module->import_table_count; i++) {
WASMTableImport *table = &((module->import_tables + i)->u.table);
if (!wasm_runtime_is_built_in_module(table->module_name)
#if WASM_ENABLE_MULTI_MODULE != 0
&& !table->import_table_linked
#endif
) {
set_error_buf_v(error_buf, error_buf_size,
"failed to link import table (%s, %s)",
table->module_name, table->field_name);
return false;
}
}
for (i = 0; i < module->import_memory_count; i++) {
WASMMemoryImport *memory = &((module->import_memories + i)->u.memory);
if (!wasm_runtime_is_built_in_module(memory->module_name)
#if WASM_ENABLE_MULTI_MODULE != 0
&& !memory->import_memory_linked
#endif
) {
set_error_buf_v(error_buf, error_buf_size,
"failed to link import memory (%s, %s)",
memory->module_name, memory->field_name);
return false;
}
}
#if WASM_ENABLE_MULTI_MODULE != 0
#if WASM_ENABLE_TAGS != 0
for (i = 0; i < module->import_tag_count; i++) {
WASMTagImport *tag = &((module->import_tags + i)->u.tag);
if (!tag->import_tag_linked) {
set_error_buf_v(error_buf, error_buf_size,
"failed to link import tag (%s, %s)",
tag->module_name, tag->field_name);
return false;
}
}
#endif /* WASM_ENABLE_TAGS != 0 */
#endif
return true; return true;
} }
@ -2145,8 +2184,8 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
heap_size = APP_HEAP_SIZE_MAX; heap_size = APP_HEAP_SIZE_MAX;
module_inst_mem_inst_size = module_inst_mem_inst_size =
(uint64)sizeof(WASMMemoryInstance) sizeof(WASMMemoryInstance)
* (module->import_memory_count + module->memory_count); * ((uint64)module->import_memory_count + module->memory_count);
#if WASM_ENABLE_JIT != 0 #if WASM_ENABLE_JIT != 0
/* If the module doesn't have memory, reserve one mem_info space /* If the module doesn't have memory, reserve one mem_info space
@ -2164,23 +2203,26 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
WASMTableImport *import_table = &module->import_tables[i].u.table; WASMTableImport *import_table = &module->import_tables[i].u.table;
table_size += offsetof(WASMTableInstance, elems); table_size += offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
table_size += table_size += (uint64)sizeof(table_elem_type_t)
(uint64)sizeof(table_elem_type_t) * import_table->max_size; * import_table->table_type.max_size;
#else #else
table_size += (uint64)sizeof(table_elem_type_t) table_size += (uint64)sizeof(table_elem_type_t)
* (import_table->possible_grow ? import_table->max_size * (import_table->table_type.possible_grow
: import_table->init_size); ? import_table->table_type.max_size
: import_table->table_type.init_size);
#endif #endif
} }
for (i = 0; i < module->table_count; i++) { for (i = 0; i < module->table_count; i++) {
WASMTable *table = module->tables + i; WASMTable *table = module->tables + i;
table_size += offsetof(WASMTableInstance, elems); table_size += offsetof(WASMTableInstance, elems);
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
table_size += (uint64)sizeof(table_elem_type_t) * table->max_size; table_size +=
(uint64)sizeof(table_elem_type_t) * table->table_type.max_size;
#else #else
table_size += table_size +=
(uint64)sizeof(table_elem_type_t) (uint64)sizeof(table_elem_type_t)
* (table->possible_grow ? table->max_size : table->init_size); * (table->table_type.possible_grow ? table->table_type.max_size
: table->table_type.init_size);
#endif #endif
} }
total_size += table_size; total_size += table_size;
@ -2573,7 +2615,7 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
if (memory_data) { if (memory_data) {
bh_memcpy_s(memory_data + base_offset, bh_memcpy_s(memory_data + base_offset,
(uint32)memory_size - base_offset, data_seg->data, (uint32)(memory_size - base_offset), data_seg->data,
length); length);
} }
} }
@ -3181,9 +3223,6 @@ wasm_deinstantiate(WASMModuleInstance *module_inst, bool is_sub_inst)
wasm_runtime_free(module_inst->c_api_func_imports); wasm_runtime_free(module_inst->c_api_func_imports);
if (!is_sub_inst) { if (!is_sub_inst) {
#if WASM_ENABLE_WASI_NN != 0
wasi_nn_destroy((WASMModuleInstanceCommon *)module_inst);
#endif
wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst); wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst);
} }

View File

@ -13,10 +13,6 @@
#include "../common/wasm_runtime_common.h" #include "../common/wasm_runtime_common.h"
#include "../common/wasm_exec_env.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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -2,15 +2,40 @@
## How to use ## How to use
### Host
Enable WASI-NN in the WAMR by spefiying it in the cmake building configuration as follows, Enable WASI-NN in the WAMR by spefiying it in the cmake building configuration as follows,
``` ```cmake
set (WAMR_BUILD_WASI_NN 1) set (WAMR_BUILD_WASI_NN 1)
``` ```
The definition of the functions provided by WASI-NN is in the header file `core/iwasm/libraries/wasi-nn/wasi_nn.h`. or in command line
By only including this file in your WASM application you will bind WASI-NN into your module. ```bash
$ cmake -DWAMR_BUILD_WASI_NN=1 <other options> ...
```
> ![Caution]
> If enable `WAMR_BUID_WASI_NN`, iwasm will link a shared WAMR library instead of a static one. Wasi-nn backends will be loaded dynamically at runtime. Users shall specify the path of the backend library and register it to the iwasm runtime with `--native-lib=<path of backend library>`. All shared libraries should be placed in the `LD_LIBRARY_PATH`.
### Wasm
The definition of functions provided by WASI-NN (Wasm imports) is in the header file [wasi_nn.h](_core/iwasm/libraries/wasi-nn/wasi_nn.h_). By only including this file in a WASM application you will bind WASI-NN into your module.
For some historical reasons, there are two sets of functions in the header file. The first set is the original one, and the second set is the new one. The new set is recommended to use. In code, `WASM_ENABLE_WASI_EPHEMERAL_NN` is used to control which set of functions to use. If `WASM_ENABLE_WASI_EPHEMERAL_NN` is defined, the new set of functions will be used. Otherwise, the original set of functions will be used.
There is a big difference between the two sets of functions, `tensor_type`.
```c
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
typedef enum { fp16 = 0, fp32, fp64, bf16, u8, i32, i64 } tensor_type;
#else
typedef enum { fp16 = 0, fp32, up8, ip32 } tensor_type;
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
```
It is required to recompile the Wasm application if you want to switch between the two sets of functions.
## Tests ## Tests
@ -27,9 +52,11 @@ Build the runtime image for your execution target type.
- `vx-delegate` - `vx-delegate`
- `tpu` - `tpu`
``` ```bash
EXECUTION_TYPE=cpu $ pwd
docker build -t wasi-nn-${EXECUTION_TYPE} -f core/iwasm/libraries/wasi-nn/test/Dockerfile.${EXECUTION_TYPE} . <somewhere>/wasm-micro-runtime
$ EXECUTION_TYPE=cpu docker build -t wasi-nn-${EXECUTION_TYPE} -f core/iwasm/libraries/wasi-nn/test/Dockerfile.${EXECUTION_TYPE} .
``` ```
### Build wasm app ### Build wasm app
@ -50,15 +77,19 @@ If all the tests have run properly you will the the following message in the ter
Tests: passed! Tests: passed!
``` ```
> [!TIP]
> Use _libwasi-nn-tflite.so_ as an example. You shall use whatever you have built.
- CPU - CPU
``` ```bash
docker run \ docker run \
-v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \ -v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \
-v $PWD/core/iwasm/libraries/wasi-nn/test/models:/models \ -v $PWD/core/iwasm/libraries/wasi-nn/test/models:/models \
wasi-nn-cpu \ wasi-nn-cpu \
--dir=/ \ --dir=/ \
--env="TARGET=cpu" \ --env="TARGET=cpu" \
--native-lib=/lib/libwasi-nn-tflite.so \
/assets/test_tensorflow.wasm /assets/test_tensorflow.wasm
``` ```
@ -66,7 +97,7 @@ docker run \
- Requirements: - Requirements:
- [NVIDIA docker](https://github.com/NVIDIA/nvidia-docker). - [NVIDIA docker](https://github.com/NVIDIA/nvidia-docker).
``` ```bash
docker run \ docker run \
--runtime=nvidia \ --runtime=nvidia \
-v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \ -v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \
@ -74,17 +105,19 @@ docker run \
wasi-nn-nvidia-gpu \ wasi-nn-nvidia-gpu \
--dir=/ \ --dir=/ \
--env="TARGET=gpu" \ --env="TARGET=gpu" \
--native-lib=/lib/libwasi-nn-tflite.so \
/assets/test_tensorflow.wasm /assets/test_tensorflow.wasm
``` ```
- vx-delegate for NPU (x86 simulator) - vx-delegate for NPU (x86 simulator)
``` ```bash
docker run \ docker run \
-v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \ -v $PWD/core/iwasm/libraries/wasi-nn/test:/assets \
wasi-nn-vx-delegate \ wasi-nn-vx-delegate \
--dir=/ \ --dir=/ \
--env="TARGET=gpu" \ --env="TARGET=gpu" \
--native-lib=/lib/libwasi-nn-tflite.so \
/assets/test_tensorflow_quantized.wasm /assets/test_tensorflow_quantized.wasm
``` ```
@ -92,7 +125,7 @@ docker run \
- Requirements: - Requirements:
- [Coral USB](https://coral.ai/products/accelerator/). - [Coral USB](https://coral.ai/products/accelerator/).
``` ```bash
docker run \ docker run \
--privileged \ --privileged \
--device=/dev/bus/usb:/dev/bus/usb \ --device=/dev/bus/usb:/dev/bus/usb \
@ -100,6 +133,7 @@ docker run \
wasi-nn-tpu \ wasi-nn-tpu \
--dir=/ \ --dir=/ \
--env="TARGET=tpu" \ --env="TARGET=tpu" \
--native-lib=/lib/libwasi-nn-tflite.so \
/assets/test_tensorflow_quantized.wasm /assets/test_tensorflow_quantized.wasm
``` ```
@ -113,39 +147,35 @@ Supported:
## Smoke test ## Smoke test
Use [classification-example](https://github.com/bytecodealliance/wasi-nn/tree/main/rust/examples/classification-example) as a smoke test case to make sure the wasi-nn support in WAMR is working properly. ### Testing with WasmEdge-WASINN Examples
> [!Important] To ensure everything is set up correctly, use the examples from [WasmEdge-WASINN-examples](https://github.com/second-state/WasmEdge-WASINN-examples/tree/master). These examples help verify that WASI-NN support in WAMR is functioning as expected.
> It requires openvino.
### Prepare the model and the wasm > Note: The repository contains two types of examples. Some use the [standard wasi-nn](https://github.com/WebAssembly/wasi-nn), while others use [WasmEdge's version of wasi-nn](https://github.com/second-state/wasmedge-wasi-nn), which is enhanced to meet specific customer needs.
``` bash The examples test the following machine learning backends:
- OpenVINO
- PyTorch
- TensorFlow Lite
Due to the different requirements of each backend, we'll use a Docker container for a hassle-free testing environment.
#### Prepare the execution environment
```bash
$ pwd $ pwd
/workspaces/wasm-micro-runtime/core/iwasm/libraries/wasi-nn/test /workspaces/wasm-micro-runtime/
$ docker build -t wasi-nn-example:v1.0 -f Dockerfile.wasi-nn-example . $ docker build -t wasi-nn-smoke:v1.0 -f Dockerfile.wasi-nn-smoke .
``` ```
There are model files(*mobilenet\**) and wasm files(*wasi-nn-example.wasm*) in the directory */workspaces/wasi-nn/rust/examples/classification-example/build* in the image of wasi-nn-example:v1.0. #### Execute
### build iwasm and test ```bash
$ docker run --rm wasi-nn-smoke:v1.0
*TODO: May need alternative steps to build the iwasm and test in the container of wasi-nn-example:v1.0*
``` bash
$ pwd
/workspaces/wasm-micro-runtime
$ docker run --rm -it -v $(pwd):/workspaces/wasm-micro-runtime wasi-nn-example:v1.0 /bin/bash
``` ```
> [!Caution] ### Testing with bytecodealliance wasi-nn
> The following steps are executed in the container of wasi-nn-example:v1.0.
``` bash For another example, check out [classification-example](https://github.com/bytecodealliance/wasi-nn/tree/main/rust/examples/classification-example), which focuses on OpenVINO. You can run it using the same Docker container mentioned above.
$ cd /workspaces/wasm-micro-runtime/product-mini/platforms/linux
$ cmake -S . -B build -DWAMR_BUILD_WASI_NN=1 -DWAMR_BUILD_WASI_EPHEMERAL_NN=1
$ cmake --build build
$ ./build/iwasm -v=5 --map-dir=/workspaces/wasi-nn/rust/examples/classification-example/build/::fixture /workspaces/wasi-nn/rust/examples/classification-example/build/wasi-nn-example.wasm
```

View File

@ -6,17 +6,51 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# Find tensorflow-lite # Find tensorflow-lite
find_package(tensorflow_lite REQUIRED) find_package(tensorflow_lite REQUIRED)
set(WASI_NN_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/..) set(WASI_NN_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
include_directories (${WASI_NN_ROOT_DIR}/include) #
include_directories (${WASI_NN_ROOT_DIR}/src) # wasi-nn general
include_directories (${WASI_NN_ROOT_DIR}/src/utils) add_library(
wasi-nn-general
set ( SHARED
WASI_NN_SOURCES ${WASI_NN_ROOT}/src/wasi_nn.c
${WASI_NN_ROOT_DIR}/src/wasi_nn.c ${WASI_NN_ROOT}/src/utils/wasi_nn_app_native.c
${WASI_NN_ROOT_DIR}/src/wasi_nn_tensorflowlite.cpp )
${WASI_NN_ROOT_DIR}/src/utils/wasi_nn_app_native.c target_include_directories(
wasi-nn-general
PUBLIC
${WASI_NN_ROOT}/include
${WASI_NN_ROOT}/src
${WASI_NN_ROOT}/src/utils
)
target_link_libraries(
wasi-nn-general
PUBLIC
libiwasm
)
target_compile_definitions(
wasi-nn-general
PUBLIC
$<$<CONFIG:Debug>:NN_LOG_LEVEL=0>
$<$<CONFIG:Release>:NN_LOG_LEVEL=2>
) )
set (WASI_NN_LIBS tensorflow-lite) #
# wasi-nn backends
add_library(
wasi-nn-tflite
SHARED
${WASI_NN_ROOT}/src/wasi_nn_tensorflowlite.cpp
)
#target_link_options(
# wasi-nn-tflite
# PRIVATE
# -Wl,--whole-archive libwasi-nn-general.a
# -Wl,--no-whole-archive
#)
target_link_libraries(
wasi-nn-tflite
PUBLIC
tensorflow-lite
wasi-nn-general
)

View File

@ -1,58 +0,0 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.16)
project(wasi-nn C CXX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../..)
set(WASI_NN_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
#### libvmlib ####
# NOTE: we build vmlib as a shared library here so that it can be
# shared between iwasm and native libraries.
include(${WASI_NN_ROOT_DIR}/cmake/iwasm_helper.cmake)
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib SHARED ${WAMR_RUNTIME_LIB_SOURCE})
# iwasm
include(${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
set(RUNTIME_SOURCE_ALL
${WAMR_ROOT_DIR}/product-mini/platforms/${WAMR_BUILD_PLATFORM}/main.c
${UNCOMMON_SHARED_SOURCE}
)
add_executable(iwasm ${RUNTIME_SOURCE_ALL})
target_link_libraries(iwasm vmlib -lpthread -lm -ldl)
#### TensorFlow ####
include(${WASI_NN_ROOT_DIR}/cmake/wasi_nn.cmake)
#### WASI-NN ####
include_directories(
${WAMR_ROOT_DIR}/core/iwasm/include
${WAMR_ROOT_DIR}/core/shared/utils
${WAMR_ROOT_DIR}/core/shared/platform/linux
)
add_library(wasi-nn SHARED
${WASI_NN_SOURCES}
)
# Add `get_native_lib` symbol
target_compile_definitions(wasi-nn PUBLIC
WASI_NN_SHARED
)
target_link_libraries(wasi-nn
${WASI_NN_LIBS}
vmlib
)

View File

@ -1,13 +0,0 @@
# wasi-nn as shared library
Example on how to create libwasi-nn (external library) instead of embedding wasi-nn inside iwasm
From folder `core/iwasm/libraries/wasi-nn/test`, build the test and run
```sh
../external/build/iwasm \
--dir=. \
--env="TARGET=cpu" \
--native-lib=../external/build/libwasi-nn.so \
test_tensorflow.wasm
```

View File

@ -29,6 +29,10 @@ load(graph_builder_array *builder, graph_encoding encoding,
execution_target target, graph *g) execution_target target, graph *g)
__attribute__((import_module("wasi_nn"))); __attribute__((import_module("wasi_nn")));
wasi_nn_error
load_by_name(const char *name, graph *g)
__attribute__((import_module("wasi_nn")));
/** /**
* INFERENCE * INFERENCE
* *

View File

@ -9,12 +9,18 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* ERRORS * ERRORS
* *
*/ */
// Error codes returned by functions in this API. // sync up with
// https://github.com/WebAssembly/wasi-nn/blob/main/wit/wasi-nn.wit#L136 Error
// codes returned by functions in this API.
typedef enum { typedef enum {
// No error occurred. // No error occurred.
success = 0, success = 0,
@ -22,12 +28,21 @@ typedef enum {
invalid_argument, invalid_argument,
// Invalid encoding. // Invalid encoding.
invalid_encoding, invalid_encoding,
// Caller module is missing a memory export. // The operation timed out.
missing_memory, timeout,
// Device or resource busy.
busy,
// Runtime Error. // Runtime Error.
runtime_error, runtime_error,
// Unsupported operation.
unsupported_operation,
// Graph is too large.
too_large,
// Graph not found.
not_found,
// The operation is insecure or has insufficient privilege to be performed.
// e.g., cannot access a hardware feature requested
security,
// The operation failed for an unspecified reason.
unknown,
} wasi_nn_error; } wasi_nn_error;
/** /**
@ -44,8 +59,14 @@ typedef struct {
uint32_t size; uint32_t size;
} tensor_dimensions; } tensor_dimensions;
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
// sync up with
// https://github.com/WebAssembly/wasi-nn/blob/main/wit/wasi-nn.wit#L27
// The type of the elements in a tensor. // The type of the elements in a tensor.
typedef enum { fp16 = 0, fp32, fp64, bf16, u8, i32, i64 } tensor_type;
#else
typedef enum { fp16 = 0, fp32, up8, ip32 } tensor_type; typedef enum { fp16 = 0, fp32, up8, ip32 } tensor_type;
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
// The tensor data. // The tensor data.
// //
@ -92,6 +113,8 @@ typedef struct {
// An execution graph for performing inference (i.e., a model). // An execution graph for performing inference (i.e., a model).
typedef uint32_t graph; typedef uint32_t graph;
// sync up with
// https://github.com/WebAssembly/wasi-nn/blob/main/wit/wasi-nn.wit#L75
// Describes the encoding of the graph. This allows the API to be implemented by // Describes the encoding of the graph. This allows the API to be implemented by
// various backends that encode (i.e., serialize) their graph IR with different // various backends that encode (i.e., serialize) their graph IR with different
// formats. // formats.
@ -100,7 +123,9 @@ typedef enum {
onnx, onnx,
tensorflow, tensorflow,
pytorch, pytorch,
tensorflowlite tensorflowlite,
ggml,
autodetect,
} graph_encoding; } graph_encoding;
// Define where the graph should be executed. // Define where the graph should be executed.
@ -109,4 +134,37 @@ typedef enum execution_target { cpu = 0, gpu, tpu } execution_target;
// Bind a `graph` to the input and output tensors for an inference. // Bind a `graph` to the input and output tensors for an inference.
typedef uint32_t graph_execution_context; typedef uint32_t graph_execution_context;
/* Definition of 'wasi_nn.h' structs in WASM app format (using offset) */
typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding,
execution_target, graph *);
typedef wasi_nn_error (*LOAD_BY_NAME)(void *, const char *, uint32_t, graph *);
typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph,
graph_execution_context *);
typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t,
tensor *);
typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context);
typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t,
tensor_data, uint32_t *);
/* wasi-nn general APIs */
typedef wasi_nn_error (*BACKEND_INITIALIZE)(void **);
typedef wasi_nn_error (*BACKEND_DEINITIALIZE)(void *);
typedef struct {
LOAD load;
LOAD_BY_NAME load_by_name;
INIT_EXECUTION_CONTEXT init_execution_context;
SET_INPUT set_input;
COMPUTE compute;
GET_OUTPUT get_output;
BACKEND_INITIALIZE init;
BACKEND_DEINITIALIZE deinit;
} api_function;
bool
wasi_nn_register_backend(api_function apis);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -21,7 +21,7 @@
3 -> err 3 -> err
4 -> NO LOGS 4 -> NO LOGS
*/ */
#define NN_LOG_LEVEL 0 #define NN_LOG_LEVEL 2
#endif #endif
// Definition of the levels // Definition of the levels

View File

@ -76,7 +76,7 @@ graph_builder_array_app_native(wasm_module_inst_t instance,
graph_builder *builder = (graph_builder *)wasm_runtime_malloc( graph_builder *builder = (graph_builder *)wasm_runtime_malloc(
array_size * sizeof(graph_builder)); array_size * sizeof(graph_builder));
if (builder == NULL) if (builder == NULL)
return missing_memory; return too_large;
for (uint32_t i = 0; i < array_size; ++i) { for (uint32_t i = 0; i < array_size; ++i) {
wasi_nn_error res; wasi_nn_error res;
@ -149,7 +149,7 @@ tensor_dimensions_app_native(wasm_module_inst_t instance,
*dimensions = *dimensions =
(tensor_dimensions *)wasm_runtime_malloc(sizeof(tensor_dimensions)); (tensor_dimensions *)wasm_runtime_malloc(sizeof(tensor_dimensions));
if (dimensions == NULL) if (dimensions == NULL)
return missing_memory; return too_large;
(*dimensions)->size = dimensions_wasm->size; (*dimensions)->size = dimensions_wasm->size;
(*dimensions)->buf = (uint32_t *)wasm_runtime_addr_app_to_native( (*dimensions)->buf = (uint32_t *)wasm_runtime_addr_app_to_native(

View File

@ -13,53 +13,35 @@
#include "wasi_nn_private.h" #include "wasi_nn_private.h"
#include "wasi_nn_app_native.h" #include "wasi_nn_app_native.h"
#include "wasi_nn_tensorflowlite.hpp"
#include "logger.h" #include "logger.h"
#include "bh_platform.h" #include "bh_platform.h"
#include "wasi_nn_types.h"
#include "wasm_export.h" #include "wasm_export.h"
#define HASHMAP_INITIAL_SIZE 20 #define HASHMAP_INITIAL_SIZE 20
/* Definition of 'wasi_nn.h' structs in WASM app format (using offset) */
typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding,
execution_target, graph *);
typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph,
graph_execution_context *);
typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t,
tensor *);
typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context);
typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t,
tensor_data, uint32_t *);
typedef struct {
LOAD load;
INIT_EXECUTION_CONTEXT init_execution_context;
SET_INPUT set_input;
COMPUTE compute;
GET_OUTPUT get_output;
} api_function;
/* Global variables */ /* Global variables */
// if using `load_by_name`, there is no known `encoding` at the time of loading
// so, just keep one `api_function` is enough
static api_function lookup = { 0 };
static api_function lookup[] = { #define call_wasi_nn_func(wasi_error, func, ...) \
{ NULL, NULL, NULL, NULL, NULL }, do { \
{ NULL, NULL, NULL, NULL, NULL }, if (lookup.func) { \
{ NULL, NULL, NULL, NULL, NULL }, wasi_error = lookup.func(__VA_ARGS__); \
{ NULL, NULL, NULL, NULL, NULL }, } \
{ tensorflowlite_load, tensorflowlite_init_execution_context, else { \
tensorflowlite_set_input, tensorflowlite_compute, NN_ERR_PRINTF("Error: %s is not registered", #func); \
tensorflowlite_get_output } wasi_error = unsupported_operation; \
}; } \
} while (0)
static HashMap *hashmap; static HashMap *hashmap;
static void static void
wasi_nn_ctx_destroy(WASINNContext *wasi_nn_ctx); wasi_nn_ctx_destroy(WASINNContext *wasi_nn_ctx);
/* Get wasi-nn context from module instance */
static uint32 static uint32
hash_func(const void *key) hash_func(const void *key)
{ {
@ -105,7 +87,16 @@ wasi_nn_initialize_context()
return NULL; return NULL;
} }
wasi_nn_ctx->is_model_loaded = false; wasi_nn_ctx->is_model_loaded = false;
tensorflowlite_initialize(&wasi_nn_ctx->tflite_ctx);
/* only one backend can be registered */
wasi_nn_error res;
call_wasi_nn_func(res, init, &wasi_nn_ctx->backend_ctx);
if (res != success) {
NN_ERR_PRINTF("Error while initializing backend");
wasm_runtime_free(wasi_nn_ctx);
return NULL;
}
return wasi_nn_ctx; return wasi_nn_ctx;
} }
@ -113,6 +104,7 @@ static bool
wasi_nn_initialize() wasi_nn_initialize()
{ {
NN_DBG_PRINTF("Initializing wasi-nn"); NN_DBG_PRINTF("Initializing wasi-nn");
// hashmap { instance: wasi_nn_ctx }
hashmap = bh_hash_map_create(HASHMAP_INITIAL_SIZE, true, hash_func, hashmap = bh_hash_map_create(HASHMAP_INITIAL_SIZE, true, hash_func,
key_equal_func, key_destroy_func, key_equal_func, key_destroy_func,
value_destroy_func); value_destroy_func);
@ -123,6 +115,7 @@ wasi_nn_initialize()
return true; return true;
} }
/* Get wasi-nn context from module instance */
static WASINNContext * static WASINNContext *
wasm_runtime_get_wasi_nn_ctx(wasm_module_inst_t instance) wasm_runtime_get_wasi_nn_ctx(wasm_module_inst_t instance)
{ {
@ -155,28 +148,26 @@ wasi_nn_ctx_destroy(WASINNContext *wasi_nn_ctx)
NN_DBG_PRINTF("Freeing wasi-nn"); NN_DBG_PRINTF("Freeing wasi-nn");
NN_DBG_PRINTF("-> is_model_loaded: %d", wasi_nn_ctx->is_model_loaded); NN_DBG_PRINTF("-> is_model_loaded: %d", wasi_nn_ctx->is_model_loaded);
NN_DBG_PRINTF("-> current_encoding: %d", wasi_nn_ctx->current_encoding); NN_DBG_PRINTF("-> current_encoding: %d", wasi_nn_ctx->current_encoding);
tensorflowlite_destroy(wasi_nn_ctx->tflite_ctx);
/* only one backend can be registered */
wasi_nn_error res;
call_wasi_nn_func(res, deinit, wasi_nn_ctx->backend_ctx);
if (res != success) {
NN_ERR_PRINTF("Error while destroyging backend");
}
wasm_runtime_free(wasi_nn_ctx); wasm_runtime_free(wasi_nn_ctx);
} }
void void
wasi_nn_destroy(wasm_module_inst_t instance) wasi_nn_destroy()
{ {
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); // destroy hashmap will destroy keys and values
bh_hash_map_remove(hashmap, (void *)instance, NULL, NULL); bh_hash_map_destroy(hashmap);
wasi_nn_ctx_destroy(wasi_nn_ctx);
} }
/* Utils */ /* Utils */
static bool
is_encoding_implemented(graph_encoding encoding)
{
return lookup[encoding].load && lookup[encoding].init_execution_context
&& lookup[encoding].set_input && lookup[encoding].compute
&& lookup[encoding].get_output;
}
static wasi_nn_error static wasi_nn_error
is_model_initialized(WASINNContext *wasi_nn_ctx) is_model_initialized(WASINNContext *wasi_nn_ctx)
{ {
@ -203,13 +194,9 @@ wasi_nn_load(wasm_exec_env_t exec_env, graph_builder_array_wasm *builder,
NN_DBG_PRINTF("Running wasi_nn_load [encoding=%d, target=%d]...", encoding, NN_DBG_PRINTF("Running wasi_nn_load [encoding=%d, target=%d]...", encoding,
target); target);
if (!is_encoding_implemented(encoding)) {
NN_ERR_PRINTF("Encoding not supported.");
return invalid_encoding;
}
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
bh_assert(instance); if (!instance)
return runtime_error;
wasi_nn_error res; wasi_nn_error res;
graph_builder_array builder_native = { 0 }; graph_builder_array builder_native = { 0 };
@ -233,10 +220,11 @@ wasi_nn_load(wasm_exec_env_t exec_env, graph_builder_array_wasm *builder,
} }
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
res = lookup[encoding].load(wasi_nn_ctx->tflite_ctx, &builder_native, call_wasi_nn_func(res, load, wasi_nn_ctx->backend_ctx, &builder_native,
encoding, target, g); encoding, target, g);
NN_DBG_PRINTF("wasi_nn_load finished with status %d [graph=%d]", res, *g); NN_DBG_PRINTF("wasi_nn_load finished with status %d [graph=%d]", res, *g);
if (res != success)
goto fail;
wasi_nn_ctx->current_encoding = encoding; wasi_nn_ctx->current_encoding = encoding;
wasi_nn_ctx->is_model_loaded = true; wasi_nn_ctx->is_model_loaded = true;
@ -249,6 +237,39 @@ fail:
return res; return res;
} }
wasi_nn_error
wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
graph *g)
{
NN_DBG_PRINTF("Running wasi_nn_load_by_name ...");
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
if (!instance) {
return runtime_error;
}
if (!wasm_runtime_validate_native_addr(instance, name, name_len)) {
return invalid_argument;
}
if (!wasm_runtime_validate_native_addr(instance, g,
(uint64)sizeof(graph))) {
return invalid_argument;
}
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
wasi_nn_error res;
call_wasi_nn_func(res, load_by_name, wasi_nn_ctx->backend_ctx, name,
name_len, g);
NN_DBG_PRINTF("wasi_nn_load_by_name finished with status %d", *g);
if (res != success)
return res;
wasi_nn_ctx->current_encoding = autodetect;
wasi_nn_ctx->is_model_loaded = true;
return success;
}
wasi_nn_error wasi_nn_error
wasi_nn_init_execution_context(wasm_exec_env_t exec_env, graph g, wasi_nn_init_execution_context(wasm_exec_env_t exec_env, graph g,
graph_execution_context *ctx) graph_execution_context *ctx)
@ -256,7 +277,10 @@ wasi_nn_init_execution_context(wasm_exec_env_t exec_env, graph g,
NN_DBG_PRINTF("Running wasi_nn_init_execution_context [graph=%d]...", g); NN_DBG_PRINTF("Running wasi_nn_init_execution_context [graph=%d]...", g);
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
bh_assert(instance); if (!instance) {
return runtime_error;
}
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
wasi_nn_error res; wasi_nn_error res;
@ -269,9 +293,8 @@ wasi_nn_init_execution_context(wasm_exec_env_t exec_env, graph g,
return invalid_argument; return invalid_argument;
} }
res = lookup[wasi_nn_ctx->current_encoding].init_execution_context( call_wasi_nn_func(res, init_execution_context, wasi_nn_ctx->backend_ctx, g,
wasi_nn_ctx->tflite_ctx, g, ctx); ctx);
NN_DBG_PRINTF( NN_DBG_PRINTF(
"wasi_nn_init_execution_context finished with status %d [ctx=%d]", res, "wasi_nn_init_execution_context finished with status %d [ctx=%d]", res,
*ctx); *ctx);
@ -286,7 +309,10 @@ wasi_nn_set_input(wasm_exec_env_t exec_env, graph_execution_context ctx,
index); index);
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
bh_assert(instance); if (!instance) {
return runtime_error;
}
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
wasi_nn_error res; wasi_nn_error res;
@ -299,9 +325,8 @@ wasi_nn_set_input(wasm_exec_env_t exec_env, graph_execution_context ctx,
&input_tensor_native))) &input_tensor_native)))
return res; return res;
res = lookup[wasi_nn_ctx->current_encoding].set_input( call_wasi_nn_func(res, set_input, wasi_nn_ctx->backend_ctx, ctx, index,
wasi_nn_ctx->tflite_ctx, ctx, index, &input_tensor_native); &input_tensor_native);
// XXX: Free intermediate structure pointers // XXX: Free intermediate structure pointers
if (input_tensor_native.dimensions) if (input_tensor_native.dimensions)
wasm_runtime_free(input_tensor_native.dimensions); wasm_runtime_free(input_tensor_native.dimensions);
@ -316,15 +341,17 @@ wasi_nn_compute(wasm_exec_env_t exec_env, graph_execution_context ctx)
NN_DBG_PRINTF("Running wasi_nn_compute [ctx=%d]...", ctx); NN_DBG_PRINTF("Running wasi_nn_compute [ctx=%d]...", ctx);
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
bh_assert(instance); if (!instance) {
return runtime_error;
}
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
wasi_nn_error res; wasi_nn_error res;
if (success != (res = is_model_initialized(wasi_nn_ctx))) if (success != (res = is_model_initialized(wasi_nn_ctx)))
return res; return res;
res = lookup[wasi_nn_ctx->current_encoding].compute(wasi_nn_ctx->tflite_ctx, call_wasi_nn_func(res, compute, wasi_nn_ctx->backend_ctx, ctx);
ctx);
NN_DBG_PRINTF("wasi_nn_compute finished with status %d", res); NN_DBG_PRINTF("wasi_nn_compute finished with status %d", res);
return res; return res;
} }
@ -345,7 +372,10 @@ wasi_nn_get_output(wasm_exec_env_t exec_env, graph_execution_context ctx,
index); index);
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
bh_assert(instance); if (!instance) {
return runtime_error;
}
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance); WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
wasi_nn_error res; wasi_nn_error res;
@ -359,12 +389,12 @@ wasi_nn_get_output(wasm_exec_env_t exec_env, graph_execution_context ctx,
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
res = lookup[wasi_nn_ctx->current_encoding].get_output( call_wasi_nn_func(res, get_output, wasi_nn_ctx->backend_ctx, ctx, index,
wasi_nn_ctx->tflite_ctx, ctx, index, output_tensor, &output_tensor_len); output_tensor, &output_tensor_len);
*output_tensor_size = output_tensor_len; *output_tensor_size = output_tensor_len;
#else /* WASM_ENABLE_WASI_EPHEMERAL_NN == 0 */ #else /* WASM_ENABLE_WASI_EPHEMERAL_NN == 0 */
res = lookup[wasi_nn_ctx->current_encoding].get_output( call_wasi_nn_func(res, get_output, wasi_nn_ctx->backend_ctx, ctx, index,
wasi_nn_ctx->tflite_ctx, ctx, index, output_tensor, output_tensor_size); output_tensor, output_tensor_size);
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */ #endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
NN_DBG_PRINTF("wasi_nn_get_output finished with status %d [data_size=%d]", NN_DBG_PRINTF("wasi_nn_get_output finished with status %d [data_size=%d]",
res, *output_tensor_size); res, *output_tensor_size);
@ -381,6 +411,7 @@ wasi_nn_get_output(wasm_exec_env_t exec_env, graph_execution_context ctx,
static NativeSymbol native_symbols_wasi_nn[] = { static NativeSymbol native_symbols_wasi_nn[] = {
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
REG_NATIVE_FUNC(load, "(*iii*)i"), REG_NATIVE_FUNC(load, "(*iii*)i"),
REG_NATIVE_FUNC(load_by_name, "(*i*)i"),
REG_NATIVE_FUNC(init_execution_context, "(i*)i"), REG_NATIVE_FUNC(init_execution_context, "(i*)i"),
REG_NATIVE_FUNC(set_input, "(ii*)i"), REG_NATIVE_FUNC(set_input, "(ii*)i"),
REG_NATIVE_FUNC(compute, "(i)i"), REG_NATIVE_FUNC(compute, "(i)i"),
@ -397,17 +428,47 @@ static NativeSymbol native_symbols_wasi_nn[] = {
uint32_t uint32_t
get_wasi_nn_export_apis(NativeSymbol **p_native_symbols) get_wasi_nn_export_apis(NativeSymbol **p_native_symbols)
{ {
if (!wasi_nn_initialize())
return 0;
*p_native_symbols = native_symbols_wasi_nn; *p_native_symbols = native_symbols_wasi_nn;
return sizeof(native_symbols_wasi_nn) / sizeof(NativeSymbol); return sizeof(native_symbols_wasi_nn) / sizeof(NativeSymbol);
} }
#if defined(WASI_NN_SHARED) __attribute__((used)) uint32_t
uint32_t
get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols) get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
{ {
NN_DBG_PRINTF("--|> get_native_lib");
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
*p_module_name = "wasi_ephemeral_nn";
#else /* WASM_ENABLE_WASI_EPHEMERAL_NN == 0 */
*p_module_name = "wasi_nn"; *p_module_name = "wasi_nn";
#endif /* WASM_ENABLE_WASI_EPHEMERAL_NN != 0 */
return get_wasi_nn_export_apis(p_native_symbols); return get_wasi_nn_export_apis(p_native_symbols);
} }
#endif
__attribute__((used)) int
init_native_lib()
{
NN_DBG_PRINTF("--|> init_native_lib");
if (!wasi_nn_initialize())
return 1;
return 0;
}
__attribute__((used)) void
deinit_native_lib()
{
NN_DBG_PRINTF("--|> deinit_native_lib");
wasi_nn_destroy();
}
__attribute__((used)) bool
wasi_nn_register_backend(api_function apis)
{
NN_DBG_PRINTF("--|> wasi_nn_register_backend");
lookup = apis;
return true;
}

View File

@ -11,16 +11,9 @@
typedef struct { typedef struct {
bool is_model_loaded; bool is_model_loaded;
// Optional
graph_encoding current_encoding; graph_encoding current_encoding;
void *tflite_ctx; void *backend_ctx;
} WASINNContext; } WASINNContext;
/**
* @brief Destroy wasi-nn on app exists
*
*/
void
wasi_nn_destroy(wasm_module_inst_t instance);
#endif #endif

View File

@ -3,11 +3,11 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/ */
#include "wasi_nn_types.h"
#include "wasi_nn_tensorflowlite.hpp" #include "wasi_nn_tensorflowlite.hpp"
#include "logger.h" #include "logger.h"
#include "bh_platform.h" #include "bh_platform.h"
#include "wasi_nn_types.h"
#include "wasm_export.h" #include "wasm_export.h"
#include <tensorflow/lite/interpreter.h> #include <tensorflow/lite/interpreter.h>
@ -145,7 +145,7 @@ tensorflowlite_load(void *tflite_ctx, graph_builder_array *builder,
tfl_ctx->models[*g].model_pointer = (char *)wasm_runtime_malloc(size); tfl_ctx->models[*g].model_pointer = (char *)wasm_runtime_malloc(size);
if (tfl_ctx->models[*g].model_pointer == NULL) { if (tfl_ctx->models[*g].model_pointer == NULL) {
NN_ERR_PRINTF("Error when allocating memory for model."); NN_ERR_PRINTF("Error when allocating memory for model.");
return missing_memory; return too_large;
} }
bh_memcpy_s(tfl_ctx->models[*g].model_pointer, size, builder->buf[0].buf, bh_memcpy_s(tfl_ctx->models[*g].model_pointer, size, builder->buf[0].buf,
@ -160,7 +160,7 @@ tensorflowlite_load(void *tflite_ctx, graph_builder_array *builder,
NN_ERR_PRINTF("Loading model error."); NN_ERR_PRINTF("Loading model error.");
wasm_runtime_free(tfl_ctx->models[*g].model_pointer); wasm_runtime_free(tfl_ctx->models[*g].model_pointer);
tfl_ctx->models[*g].model_pointer = NULL; tfl_ctx->models[*g].model_pointer = NULL;
return missing_memory; return too_large;
} }
// Save target // Save target
@ -168,6 +168,30 @@ tensorflowlite_load(void *tflite_ctx, graph_builder_array *builder,
return success; return success;
} }
wasi_nn_error
tensorflowlite_load_by_name(void *tflite_ctx, const char *filename,
uint32_t filename_len, graph *g)
{
TFLiteContext *tfl_ctx = (TFLiteContext *)tflite_ctx;
wasi_nn_error res = initialize_g(tfl_ctx, g);
if (success != res)
return res;
// Load model
tfl_ctx->models[*g].model =
std::move(tflite::FlatBufferModel::BuildFromFile(filename, NULL));
if (tfl_ctx->models[*g].model == NULL) {
NN_ERR_PRINTF("Loading model error.");
return too_large;
}
// Use CPU as default
tfl_ctx->models[*g].target = cpu;
return success;
}
wasi_nn_error wasi_nn_error
tensorflowlite_init_execution_context(void *tflite_ctx, graph g, tensorflowlite_init_execution_context(void *tflite_ctx, graph g,
graph_execution_context *ctx) graph_execution_context *ctx)
@ -188,7 +212,7 @@ tensorflowlite_init_execution_context(void *tflite_ctx, graph g,
tflite_builder(&tfl_ctx->interpreters[*ctx].interpreter); tflite_builder(&tfl_ctx->interpreters[*ctx].interpreter);
if (tfl_ctx->interpreters[*ctx].interpreter == NULL) { if (tfl_ctx->interpreters[*ctx].interpreter == NULL) {
NN_ERR_PRINTF("Error when generating the interpreter."); NN_ERR_PRINTF("Error when generating the interpreter.");
return missing_memory; return too_large;
} }
bool use_default = false; bool use_default = false;
@ -208,7 +232,7 @@ tensorflowlite_init_execution_context(void *tflite_ctx, graph g,
if (tfl_ctx->delegate == NULL) { if (tfl_ctx->delegate == NULL) {
NN_ERR_PRINTF("Error when generating GPU delegate."); NN_ERR_PRINTF("Error when generating GPU delegate.");
use_default = true; use_default = true;
return missing_memory; return too_large;
} }
if (tfl_ctx->interpreters[*ctx] if (tfl_ctx->interpreters[*ctx]
.interpreter->ModifyGraphWithDelegate(tfl_ctx->delegate) .interpreter->ModifyGraphWithDelegate(tfl_ctx->delegate)
@ -233,7 +257,7 @@ tensorflowlite_init_execution_context(void *tflite_ctx, graph g,
if (tfl_ctx->delegate == NULL) { if (tfl_ctx->delegate == NULL) {
NN_ERR_PRINTF("Error when generating External delegate."); NN_ERR_PRINTF("Error when generating External delegate.");
use_default = true; use_default = true;
return missing_memory; return too_large;
} }
if (tfl_ctx->interpreters[*ctx] if (tfl_ctx->interpreters[*ctx]
.interpreter->ModifyGraphWithDelegate(tfl_ctx->delegate) .interpreter->ModifyGraphWithDelegate(tfl_ctx->delegate)
@ -277,7 +301,7 @@ tensorflowlite_set_input(void *tflite_ctx, graph_execution_context ctx,
auto tensor = tfl_ctx->interpreters[ctx].interpreter->input_tensor(index); auto tensor = tfl_ctx->interpreters[ctx].interpreter->input_tensor(index);
if (tensor == NULL) { if (tensor == NULL) {
NN_ERR_PRINTF("Missing memory"); NN_ERR_PRINTF("Missing memory");
return missing_memory; return too_large;
} }
uint32_t model_tensor_size = 1; uint32_t model_tensor_size = 1;
@ -364,7 +388,7 @@ tensorflowlite_get_output(void *tflite_ctx, graph_execution_context ctx,
auto tensor = tfl_ctx->interpreters[ctx].interpreter->output_tensor(index); auto tensor = tfl_ctx->interpreters[ctx].interpreter->output_tensor(index);
if (tensor == NULL) { if (tensor == NULL) {
NN_ERR_PRINTF("Missing memory"); NN_ERR_PRINTF("Missing memory");
return missing_memory; return too_large;
} }
uint32_t model_tensor_size = 1; uint32_t model_tensor_size = 1;
@ -373,7 +397,7 @@ tensorflowlite_get_output(void *tflite_ctx, graph_execution_context ctx,
if (*output_tensor_size < model_tensor_size) { if (*output_tensor_size < model_tensor_size) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return missing_memory; return too_large;
} }
if (tensor->quantization.type == kTfLiteNoQuantization) { if (tensor->quantization.type == kTfLiteNoQuantization) {
@ -410,13 +434,13 @@ tensorflowlite_get_output(void *tflite_ctx, graph_execution_context ctx,
return success; return success;
} }
void wasi_nn_error
tensorflowlite_initialize(void **tflite_ctx) tensorflowlite_initialize(void **tflite_ctx)
{ {
TFLiteContext *tfl_ctx = new TFLiteContext(); TFLiteContext *tfl_ctx = new TFLiteContext();
if (tfl_ctx == NULL) { if (tfl_ctx == NULL) {
NN_ERR_PRINTF("Error when allocating memory for tensorflowlite."); NN_ERR_PRINTF("Error when allocating memory for tensorflowlite.");
return; return runtime_error;
} }
NN_DBG_PRINTF("Initializing models."); NN_DBG_PRINTF("Initializing models.");
@ -434,9 +458,10 @@ tensorflowlite_initialize(void **tflite_ctx)
tfl_ctx->delegate = NULL; tfl_ctx->delegate = NULL;
*tflite_ctx = (void *)tfl_ctx; *tflite_ctx = (void *)tfl_ctx;
return success;
} }
void wasi_nn_error
tensorflowlite_destroy(void *tflite_ctx) tensorflowlite_destroy(void *tflite_ctx)
{ {
/* /*
@ -486,4 +511,21 @@ tensorflowlite_destroy(void *tflite_ctx)
os_mutex_destroy(&tfl_ctx->g_lock); os_mutex_destroy(&tfl_ctx->g_lock);
delete tfl_ctx; delete tfl_ctx;
NN_DBG_PRINTF("Memory free'd."); NN_DBG_PRINTF("Memory free'd.");
return success;
}
__attribute__((constructor(200))) void
tflite_register_backend()
{
api_function apis = {
.load = tensorflowlite_load,
.load_by_name = tensorflowlite_load_by_name,
.init_execution_context = tensorflowlite_init_execution_context,
.set_input = tensorflowlite_set_input,
.compute = tensorflowlite_compute,
.get_output = tensorflowlite_get_output,
.init = tensorflowlite_initialize,
.deinit = tensorflowlite_destroy,
};
wasi_nn_register_backend(apis);
} }

View File

@ -32,10 +32,10 @@ tensorflowlite_get_output(void *tflite_ctx, graph_execution_context ctx,
uint32_t index, tensor_data output_tensor, uint32_t index, tensor_data output_tensor,
uint32_t *output_tensor_size); uint32_t *output_tensor_size);
void wasi_nn_error
tensorflowlite_initialize(void **tflite_ctx); tensorflowlite_initialize(void **tflite_ctx);
void wasi_nn_error
tensorflowlite_destroy(void *tflite_ctx); tensorflowlite_destroy(void *tflite_ctx);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -5,31 +5,28 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008 # hadolint ignore=DL3008,DL3009
RUN apt-get update && apt-get install -y \ RUN apt-get update \
cmake build-essential git --no-install-recommends && apt-get install -y --no-install-recommends\
ca-certificates cmake build-essential git wget
WORKDIR /usr/local/share/ca-certificates/cacert.org
RUN wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates
WORKDIR /home/wamr WORKDIR /home/wamr
COPY . . COPY . .
RUN git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
WORKDIR /home/wamr/product-mini/platforms/linux/build WORKDIR /home/wamr/product-mini/platforms/linux
RUN rm -rf build \
# hadolint ignore=DL3008 && cmake -S . -B build -DWAMR_BUILD_WASI_NN=1 \
RUN apt-get install -y wget ca-certificates --no-install-recommends \ && cmake --build build -j "$(grep -c ^processor /proc/cpuinfo)"
&& mkdir /usr/local/share/ca-certificates/cacert.org \
&& wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates \
&& git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
RUN cmake \
-DWAMR_BUILD_WASI_NN=1 \
..
RUN make -j "$(grep -c ^processor /proc/cpuinfo)"
FROM ubuntu:22.04 FROM ubuntu:22.04
COPY --from=base /home/wamr/product-mini/platforms/linux/build/iwasm /iwasm COPY --from=base /home/wamr/product-mini/platforms/linux/build/iwasm /usr/bin/iwasm
COPY --from=base /home/wamr/product-mini/platforms/linux/build/libiwasm.so /lib/libiwasm.so
COPY --from=base /home/wamr/product-mini/platforms/linux/build/libwasi-nn-*.so /lib/
ENTRYPOINT [ "/iwasm" ] ENTRYPOINT [ "iwasm" ]

View File

@ -5,29 +5,25 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008 # hadolint ignore=DL3008,DL3009
RUN apt-get update && apt-get install -y \ RUN apt-get update \
cmake build-essential git --no-install-recommends && apt-get install -y --no-install-recommends\
ca-certificates cmake build-essential git wget
WORKDIR /usr/local/share/ca-certificates/cacert.org
RUN wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates
WORKDIR /home/wamr WORKDIR /home/wamr
COPY . . COPY . .
RUN git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
WORKDIR /home/wamr/product-mini/platforms/linux/build WORKDIR /home/wamr/product-mini/platforms/linux/build
RUN rm -rf build \
# hadolint ignore=DL3008 && cmake -S . -B build \
RUN apt-get install -y wget ca-certificates --no-install-recommends \
&& mkdir /usr/local/share/ca-certificates/cacert.org \
&& wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates \
&& git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
RUN cmake \
-DWAMR_BUILD_WASI_NN=1 \ -DWAMR_BUILD_WASI_NN=1 \
-DWAMR_BUILD_WASI_NN_ENABLE_GPU=1 \ -DWAMR_BUILD_WASI_NN_ENABLE_GPU=1 \
.. && cmake --build build -j "$(grep -c ^processor /proc/cpuinfo)"
RUN make -j "$(grep -c ^processor /proc/cpuinfo)"
FROM nvidia/cuda:11.3.0-runtime-ubuntu20.04 FROM nvidia/cuda:11.3.0-runtime-ubuntu20.04
@ -44,6 +40,8 @@ RUN mkdir -p /etc/OpenCL/vendors && \
ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
COPY --from=base /home/wamr/product-mini/platforms/linux/build/iwasm /iwasm COPY --from=base /home/wamr/product-mini/platforms/linux/build/iwasm /usr/bin/iwasm
COPY --from=base /home/wamr/product-mini/platforms/linux/build/libiwasm.so /lib/libiwasm.so
COPY --from=base /home/wamr/product-mini/platforms/linux/build/libwasi-nn-*.so /lib/
ENTRYPOINT [ "/iwasm" ] ENTRYPOINT [ "iwasm" ]

View File

@ -5,33 +5,31 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008 # hadolint ignore=DL3008,DL3009
RUN apt-get update && apt-get install -y \ RUN apt-get update \
cmake build-essential git curl gnupg --no-install-recommends && \ && apt-get install -y --no-install-recommends\
rm -rf /var/lib/apt/lists/* ca-certificates cmake build-essential git wget
# hadolint ignore=DL3008,DL4006 WORKDIR /usr/local/share/ca-certificates/cacert.org
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list && \ RUN wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ && update-ca-certificates
apt-get update && apt-get install -y libedgetpu1-std --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/wamr WORKDIR /home/wamr
COPY . . COPY . .
RUN git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
WORKDIR /home/wamr/product-mini/platforms/linux/build WORKDIR /home/wamr/product-mini/platforms/linux
RUN rm -rf build \
RUN cmake \ && cmake -S . -B build -DWAMR_BUILD_WASI_NN=1 \
-DWAMR_BUILD_WASI_NN=1 \ -DWAMR_BUILD_WASI_NN=1 \
-DWAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE=1 \ -DWAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE=1 \
-DWAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH="libedgetpu.so.1.0" \ -DWAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH="libedgetpu.so.1.0" \
-DWAMR_BUILD_WASI_NN_ENABLE_GPU=1 \ -DWAMR_BUILD_WASI_NN_ENABLE_GPU=1 \
.. && cmake --build build -j "$(grep -c ^processor /proc/cpuinfo)"
RUN make -j "$(grep -c ^processor /proc/cpuinfo)" && \ RUN cp /home/wamr/product-mini/platforms/linux/build/iwasm /usr/bin/iwasm \
cp /home/wamr/product-mini/platforms/linux/build/iwasm /iwasm && cp /home/wamr/product-mini/platforms/linux/build/libiwasm.so /lib/libiwasm.so \
&& cp /home/wamr/product-mini/platforms/linux/build/libwasi-nn-*.so /lib/
WORKDIR /assets WORKDIR /assets
ENTRYPOINT [ "iwasm" ]
ENTRYPOINT [ "/iwasm" ]

View File

@ -1,7 +1,7 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved. # Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye@sha256:ddc1ee022d327f024c07484c9333db3fbbfd504bc096cdb66635653a2bebb33e
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asian/Shanghai ENV TZ=Asian/Shanghai
@ -10,10 +10,6 @@ ENV TZ=Asian/Shanghai
RUN apt-get update \ RUN apt-get update \
&& apt-get upgrade -y && apt-get upgrade -y
#
# Rust targets
RUN rustup target add wasm32-wasi wasm32-unknown-unknown
# #
# Openvino # Openvino
# Refer to # Refer to
@ -42,16 +38,43 @@ RUN tar -xf wasmtime-v21.0.0-x86_64-linux.tar.xz \
# #
# wasi-nn # wasi-nn
# compilation requirements
RUN rustup target add wasm32-wasi wasm32-unknown-unknown
WORKDIR /workspaces/wasi-nn WORKDIR /workspaces/wasi-nn
RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git . RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git .
# hadolint ignore=DL3059 # hadolint ignore=DL3059
RUN ./build.sh rust #RUN ./build.sh rust
# There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory, # There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
# /workspaces/wasi-nn/rust/examples/classification-example/build # /workspaces/wasi-nn/rust/examples/classification-example/build
RUN apt-get autoremove -y \ #
&& apt-get clean -y \ # wasmedge
&& rm -rf /tmp/* WORKDIR /tmp
RUN wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh \
&& chmod a+x ./install.sh
RUN ./install.sh -p /opt/wasmedge --plugins wasi_nn-tensorflowlite
ENV PATH=/opt/wasmedge/bin:${PATH}
ENV WASMEDGE_LIB_DIR=/opt/wasmedge/lib
WORKDIR /workspaces #
# wasmedge-wasinn-examples
WORKDIR /workspaces/wasmedge-wasinn-examples
RUN git clone --depth 1 https://github.com/second-state/WasmEdge-WASINN-examples.git .
#
# iwasm. build from source
WORKDIR /workspaces/wamr
COPY . .
WORKDIR /workspaces/wamr/product-mini/platforms/linux
RUN cmake -S . -B build -DWAMR_BUILD_WASI_NN=1 -DWAMR_BUILD_WASI_EPHEMERAL_NN=1 \
&& cmake --build build
RUN ln -sf "$(realpath ./build/iwasm)" /usr/local/bin/iwasm
#
# add smoke test script
COPY core/iwasm/libraries/wasi-nn/test/run_smoke_test.py /
#
WORKDIR /workspaces/wasmedge-wasinn-examples
CMD ["python3", "/run_smoke_test.py"]

View File

@ -1 +1,2 @@
tensorflow==2.11.1 tensorflow==2.11.1
numpy==1.26.4

View File

@ -0,0 +1,120 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
from pathlib import Path
from pprint import pprint
import re
import shlex
import shutil
import subprocess
from typing import List
def execute_tflite_birds_v1_image_once(
runtime_bin: str, runtime_args: List[str], cwd: Path
) -> str:
"""
execute tflite_birds_v1_image example with
```
iwasm --native-lib=somewhere/libwasi-nn-tflite.so --map-dir=.:. \
./wasmedge-wasinn-example-tflite-bird-image.wasm \
lite-model_aiy_vision_classifier_birds_V1_3.tflite \
bird.jpg
```
or
```
wasmedge --dir=.:. \
./wasmedge-wasinn-example-tflite-bird-image.wasm \
lite-model_aiy_vision_classifier_birds_V1_3.tflite \
bird.jpg
```
assumption:
- under the right directory, tflite-birds_v1-image
- every materials are ready
"""
wasm_file = "./wasmedge-wasinn-example-tflite-bird-image.wasm"
wasm_args = ["lite-model_aiy_vision_classifier_birds_V1_3.tflite", "bird.jpg"]
cmd = [runtime_bin]
cmd.extend(runtime_args)
cmd.append(wasm_file)
cmd.extend(wasm_args)
try:
p = subprocess.run(
cmd,
cwd=cwd,
capture_output=True,
check=True,
text=True,
universal_newlines=True,
)
return p.stdout
except subprocess.CalledProcessError as e:
print(e.stderr)
print()
print(e.stdout)
def filter_output_tflite_birds_v1_image(output: str) -> List[str]:
"""
not all output is needed for comparision
pick lines like: " 1.) [526](136)Cathartes burrovianus"
"""
filtered = []
PATTERN = re.compile(r"^\s+\d\.\)\s+\[\d+\]\(\d+\)\w+")
for line in output.split("\n"):
if PATTERN.search(line):
filtered.append(line.strip())
return filtered
def execute_tflite_birds_v1_image(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
iwasm_output = execute_tflite_birds_v1_image_once(
iwasm_bin,
[
"--native-lib=/workspaces/wamr/product-mini/platforms/linux/build/libwasi-nn-tflite.so",
"--map-dir=.:.",
],
cwd,
)
iwasm_output = filter_output_tflite_birds_v1_image(iwasm_output)
wasmedge_output = execute_tflite_birds_v1_image_once(
wasmedge_bin, ["--dir=.:."], cwd
)
wasmedge_output = filter_output_tflite_birds_v1_image(wasmedge_output)
if iwasm_output == wasmedge_output:
print("- tflite_birds_v1_image. PASS")
return
print("- tflite_birds_v1_image. FAILED")
print("------------------------------------------------------------")
pprint(iwasm_output)
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
pprint(wasmedge_output)
print("------------------------------------------------------------")
def execute_wasmedge_wasinn_exmaples(iwasm_bin: str, wasmedge_bin: str):
assert Path.cwd().name == "wasmedge-wasinn-examples"
assert shutil.which(iwasm_bin)
assert shutil.which(wasmedge_bin)
tflite_birds_v1_image_dir = Path.cwd().joinpath("./tflite-birds_v1-image")
execute_tflite_birds_v1_image(iwasm_bin, wasmedge_bin, tflite_birds_v1_image_dir)
if __name__ == "__main__":
execute_wasmedge_wasinn_exmaples("iwasm", "wasmedge")

View File

@ -23,14 +23,14 @@ wasm_load(char *model_name, graph *g, execution_target target)
buffer = (uint8_t *)malloc(sizeof(uint8_t) * MAX_MODEL_SIZE); buffer = (uint8_t *)malloc(sizeof(uint8_t) * MAX_MODEL_SIZE);
if (buffer == NULL) { if (buffer == NULL) {
fclose(pFile); fclose(pFile);
return missing_memory; return too_large;
} }
result = fread(buffer, 1, MAX_MODEL_SIZE, pFile); result = fread(buffer, 1, MAX_MODEL_SIZE, pFile);
if (result <= 0) { if (result <= 0) {
fclose(pFile); fclose(pFile);
free(buffer); free(buffer);
return missing_memory; return too_large;
} }
graph_builder_array arr; graph_builder_array arr;
@ -40,7 +40,7 @@ wasm_load(char *model_name, graph *g, execution_target target)
if (arr.buf == NULL) { if (arr.buf == NULL) {
fclose(pFile); fclose(pFile);
free(buffer); free(buffer);
return missing_memory; return too_large;
} }
arr.buf[0].size = result; arr.buf[0].size = result;
@ -54,6 +54,13 @@ wasm_load(char *model_name, graph *g, execution_target target)
return res; return res;
} }
wasi_nn_error
wasm_load_by_name(const char *model_name, graph *g)
{
wasm_nn_error res = load_by_name(model_name, g);
return res;
}
wasi_nn_error wasi_nn_error
wasm_init_execution_context(graph g, graph_execution_context *ctx) wasm_init_execution_context(graph g, graph_execution_context *ctx)
{ {
@ -67,7 +74,7 @@ wasm_set_input(graph_execution_context ctx, float *input_tensor, uint32_t *dim)
dims.size = INPUT_TENSOR_DIMS; dims.size = INPUT_TENSOR_DIMS;
dims.buf = (uint32_t *)malloc(dims.size * sizeof(uint32_t)); dims.buf = (uint32_t *)malloc(dims.size * sizeof(uint32_t));
if (dims.buf == NULL) if (dims.buf == NULL)
return missing_memory; return too_large;
tensor tensor; tensor tensor;
tensor.dimensions = &dims; tensor.dimensions = &dims;

View File

@ -8,7 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include "wasi_nn.h" #include "wasi_nn_types.h"
#define MAX_MODEL_SIZE 85000000 #define MAX_MODEL_SIZE 85000000
#define MAX_OUTPUT_TENSOR_SIZE 1000000 #define MAX_OUTPUT_TENSOR_SIZE 1000000

View File

@ -49,9 +49,15 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
if ((uint64)size >= UINT32_MAX) void *addr;
if (size >= UINT32_MAX)
return NULL; return NULL;
return BH_MALLOC((uint32)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
} }
void void

View File

@ -43,8 +43,10 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t); uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin; *addr_field = (uintptr_t)buf_origin;
#if (WASM_MEM_DUAL_BUS_MIRROR != 0) #if (WASM_MEM_DUAL_BUS_MIRROR != 0)
memset(buf_fixed + MEM_DUAL_BUS_OFFSET, 0, size);
return buf_fixed + MEM_DUAL_BUS_OFFSET; return buf_fixed + MEM_DUAL_BUS_OFFSET;
#else #else
memset(buf_fixed, 0, size);
return buf_fixed; return buf_fixed;
#endif #endif
} }
@ -71,6 +73,7 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t); uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin; *addr_field = (uintptr_t)buf_origin;
memset(buf_fixed, 0, size);
return buf_fixed; return buf_fixed;
} }
} }

View File

@ -52,9 +52,15 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
if (size > ((unsigned)~0)) void *addr;
if (size >= UINT32_MAX)
return NULL; return NULL;
return BH_MALLOC((unsigned)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
} }
void * void *

View File

@ -200,7 +200,12 @@ os_cond_wait(korp_cond *cond, korp_mutex *mutex)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
return rt_malloc(size); void *addr;
if ((addr = rt_malloc(size)))
memset(addr, 0, size);
return addr;
} }
void void

View File

@ -179,12 +179,19 @@ strcspn(const char *s, const char *reject)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
void *addr;
if ((uint64)size >= UINT32_MAX) if ((uint64)size >= UINT32_MAX)
return NULL; return NULL;
if (exec_mem_alloc_func) if (exec_mem_alloc_func)
return exec_mem_alloc_func((uint32)size); addr = exec_mem_alloc_func((uint32)size);
else else
return BH_MALLOC(size); addr = BH_MALLOC(size);
if (addr)
memset(addr, 0, size);
return addr;
} }
void * void *

View File

@ -7,5 +7,5 @@
#define _WAMR_VERSION_H_ #define _WAMR_VERSION_H_
#define WAMR_VERSION_MAJOR 2 #define WAMR_VERSION_MAJOR 2
#define WAMR_VERSION_MINOR 1 #define WAMR_VERSION_MINOR 1
#define WAMR_VERSION_PATCH 0 #define WAMR_VERSION_PATCH 1
#endif #endif

View File

@ -2,7 +2,7 @@
We all know Docker containers and may use them a lot in school or work. It resolves dependency management for our projects/applications, prevents package version confusion and conflict, and contamination of the local environment. We all know Docker containers and may use them a lot in school or work. It resolves dependency management for our projects/applications, prevents package version confusion and conflict, and contamination of the local environment.
Now WAMR has a Dockerfile under path `.devontainer` to create a container image, dev container images that you could easily use in VS Code. In case you prefer other IDE like Clion, you can also build it and use for the IDE you like. Now WAMR has a Dockerfile under path `.devcontainer` to create a container image, dev container images that you could easily use in VS Code. In case you prefer other IDE like Clion, you can also build it and use for the IDE you like.
## How to use it ## How to use it

View File

@ -123,6 +123,18 @@ if (WAMR_BUILD_DEBUG_INTERP EQUAL 1)
set (WAMR_BUILD_SIMD 0) set (WAMR_BUILD_SIMD 0)
endif () endif ()
# if enable wasi-nn, both wasi-nn-backends and iwasm
# need to use same WAMR (dynamic) libraries
if (WAMR_BUILD_WASI_NN EQUAL 1)
set (WAMR_BUILD_SHARED 1)
endif ()
if (NOT DEFINED WAMR_BUILD_SHARED)
set (WAMR_BUILD_SHARED 0)
elseif (WAMR_BUILD_SHARED EQUAL 1)
message ("build WAMR as shared libraries")
endif ()
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
@ -160,9 +172,16 @@ add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})
set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
install (TARGETS iwasm DESTINATION bin) target_link_libraries(iwasm
$<$<BOOL:${WAMR_BUILD_SHARED}>:libiwasm> $<$<NOT:$<BOOL:${WAMR_BUILD_SHARED}>>:vmlib>
${LLVM_AVAILABLE_LIBS}
${UV_A_LIBS}
-lm
-ldl
-lpthread
)
target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN_LIBS} -lm -ldl -lpthread) install (TARGETS iwasm DESTINATION bin)
add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
@ -170,4 +189,4 @@ install (TARGETS libiwasm DESTINATION lib)
set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN_LIBS} -lm -ldl -lpthread) target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)

View File

@ -295,7 +295,8 @@ load_native_lib(const char *name)
/* open the native library */ /* open the native library */
if (!(lib->handle = dlopen(name, RTLD_NOW | RTLD_GLOBAL)) if (!(lib->handle = dlopen(name, RTLD_NOW | RTLD_GLOBAL))
&& !(lib->handle = dlopen(name, RTLD_LAZY))) { && !(lib->handle = dlopen(name, RTLD_LAZY))) {
LOG_WARNING("warning: failed to load native library %s", name); LOG_WARNING("warning: failed to load native library %s. %s", name,
dlerror());
goto fail; goto fail;
} }

View File

@ -49,6 +49,12 @@ endif ()
if (NOT DEFINED WAMR_BUILD_JIT) if (NOT DEFINED WAMR_BUILD_JIT)
set(WAMR_BUILD_JIT 0) set(WAMR_BUILD_JIT 0)
endif () endif ()
if (NOT DEFINED WAMR_BUILD_DUMP_CALL_STACK)
set(WAMR_BUILD_DUMP_CALL_STACK 0)
endif ()
if (NOT DEFINED WAMR_BUILD_GC)
set(WAMR_BUILD_GC 0)
endif ()
set(WAMR_BUILD_SIMD 1) set(WAMR_BUILD_SIMD 1)
set(WAMR_BUILD_REF_TYPES 1) set(WAMR_BUILD_REF_TYPES 1)
set(WAMR_BUILD_LIBC_BUILTIN 1) set(WAMR_BUILD_LIBC_BUILTIN 1)
@ -141,6 +147,7 @@ ExternalProject_Add(WASM_MODULE
-DWASI_SDK_PREFIX=${WASI_SDK_DIR} -DWASI_SDK_PREFIX=${WASI_SDK_DIR}
-DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE} -DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
-DCMAKE_SYSROOT=${WASI_SYS_ROOT} -DCMAKE_SYSROOT=${WASI_SYS_ROOT}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps
BUILD_COMMAND ${CMAKE_COMMAND} --build . BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
@ -172,17 +179,24 @@ if (WAMR_BUILD_AOT EQUAL 1)
message(STATUS "WAMR_COMPILER is ${WAMR_COMPILER}") message(STATUS "WAMR_COMPILER is ${WAMR_COMPILER}")
endif() endif()
if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1)
list(APPEND WAMR_AOT_COMPILE_OPTIONS "--enable-dump-call-stack")
endif ()
if (WAMR_BUILD_GC EQUAL 1)
list(APPEND WAMR_AOT_COMPILE_OPTIONS "--enable-gc")
endif ()
add_custom_target( add_custom_target(
wasm_to_aot wasm_to_aot
ALL ALL
DEPENDS DEPENDS
WASM_MODULE ${WAMR_COMPILER} WASM_MODULE ${WAMR_COMPILER}
COMMAND COMMAND
${WAMR_COMPILER} -o mA.aot ./mA.wasm ${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mA.aot ./mA.wasm
COMMAND COMMAND
${WAMR_COMPILER} -o mB.aot ./mB.wasm ${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mB.aot ./mB.wasm
COMMAND COMMAND
${WAMR_COMPILER} -o mC.aot ./mC.wasm ${WAMR_COMPILER} ${WAMR_AOT_COMPILE_OPTIONS} -o mC.aot ./mC.wasm
WORKING_DIRECTORY WORKING_DIRECTORY
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
) )

View File

@ -57,6 +57,7 @@ function(COMPILE_WITH_CLANG SOURCE_FILE COMMAND)
add_executable(${MAIN_TARGET_NAME} ${SOURCE_FILE}) add_executable(${MAIN_TARGET_NAME} ${SOURCE_FILE})
set_target_properties(${MAIN_TARGET_NAME} PROPERTIES OUTPUT_NAME ${WASM_MODULE}) set_target_properties(${MAIN_TARGET_NAME} PROPERTIES OUTPUT_NAME ${WASM_MODULE})
target_compile_options (${MAIN_TARGET_NAME} PRIVATE -fno-exceptions)
if(${COMMAND}) if(${COMMAND})
message(STATUS "Generating ${WASM_MODULE} as COMMAND...") message(STATUS "Generating ${WASM_MODULE} as COMMAND...")

View File

@ -35,9 +35,8 @@ ExternalProject_Add(libz_src
################ bwa ################ ################ bwa ################
ExternalProject_Add(bwa ExternalProject_Add(bwa
GIT_REPOSITORY https://github.com/lh3/bwa.git GIT_REPOSITORY https://github.com/lh3/bwa.git
GIT_TAG 139f68fc4c3747813783a488aef2adc86626b01b GIT_TAG v0.7.18
GIT_PROGRESS ON GIT_PROGRESS ON
GIT_SHALLOW ON
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bwa SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bwa
DEPENDS libz_src DEPENDS libz_src
UPDATE_COMMAND git clean -ffdx && git checkout -- * UPDATE_COMMAND git clean -ffdx && git checkout -- *

View File

@ -42,5 +42,5 @@ Then compile wasm file to aot file and run:
``` shell ``` shell
$ cd <wamr dir>/samples/workload/bwa/build $ cd <wamr dir>/samples/workload/bwa/build
$ <wamr dir>/wamr-compiler/build/wamrc -o bwa.aot bwa.wasm $ <wamr dir>/wamr-compiler/build/wamrc -o bwa.aot bwa.wasm
$ <wamr dir>/product-mini/platforms/linux/iwasm --dir=. bwa.aot index hs38DH.fa $ <wamr dir>/product-mini/platforms/linux/iwasm --dir=. bwa.aot index hs38DH-extra.fa
``` ```

View File

@ -85,4 +85,4 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
add_executable (aot-analyzer src/main.cc src/aot_file.cc src/binary_file.cc src/option_parser.cc src/wasm_file.cc ${UNCOMMON_SHARED_SOURCE}) add_executable (aot-analyzer src/main.cc src/aot_file.cc src/binary_file.cc src/option_parser.cc src/wasm_file.cc ${UNCOMMON_SHARED_SOURCE})
target_link_libraries (aot-analyzer vmlib -lm -ldl -lpthread -lrt) target_link_libraries (aot-analyzer vmlib -lm -ldl -lpthread)

View File

@ -169,8 +169,8 @@ DumpInfo(AoTFile *aot)
aot->GetExectuionMachineName(target_info.e_machine).c_str()); aot->GetExectuionMachineName(target_info.e_machine).c_str());
printf("Exectuion version: %u\n", target_info.e_version); printf("Exectuion version: %u\n", target_info.e_version);
printf("Exectuion flags: %u\n", target_info.e_flags); printf("Exectuion flags: %u\n", target_info.e_flags);
printf("Feature flags: %ld\n", target_info.feature_flags); printf("Feature flags: %" PRId64 "\n", target_info.feature_flags);
printf("Reserved: %ld\n", target_info.reserved); printf("Reserved: %" PRId64 "\n", target_info.reserved);
printf("Arch: %s\n", target_info.arch); printf("Arch: %s\n", target_info.arch);
} }
@ -272,8 +272,8 @@ DumpDetails(AoTFile *aot)
AOTImportMemory memory = import_memories[index]; AOTImportMemory memory = import_memories[index];
printf(" -[%u] num_bytes_per_page:%5u init_page_count:%5u " printf(" -[%u] num_bytes_per_page:%5u init_page_count:%5u "
"max_page_count:%5u module_name: %s memory_name: %s\n", "max_page_count:%5u module_name: %s memory_name: %s\n",
index, memory.memory.num_bytes_per_page, index, memory.mem_type.num_bytes_per_page,
memory.memory.init_page_count, memory.memory.max_page_count, memory.mem_type.init_page_count, memory.mem_type.max_page_count,
memory.module_name, memory.memory_name); memory.module_name, memory.memory_name);
} }
printf("\n"); printf("\n");
@ -285,14 +285,15 @@ DumpDetails(AoTFile *aot)
printf(" -[%u] ", index); printf(" -[%u] ", index);
printf("elem_type: "); printf("elem_type: ");
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
wasm_dump_value_type(table.elem_type, table.elem_ref_type); wasm_dump_value_type(table.table_type.elem_type,
table.table_type.elem_ref_type);
#else #else
dump_value_type(table.elem_type); dump_value_type(table.table_type.elem_type);
#endif #endif
printf(" init_size:%5u max_size:%5u " printf(" init_size:%5u max_size:%5u "
"module_name: %s table_name: %s\n", "module_name: %s table_name: %s\n",
table.table_init_size, table.table_max_size, table.module_name, table.table_type.init_size, table.table_type.max_size,
table.table_name); table.module_name, table.table_name);
} }
printf("\n"); printf("\n");
@ -302,7 +303,7 @@ DumpDetails(AoTFile *aot)
AOTImportGlobal global = import_globals[index]; AOTImportGlobal global = import_globals[index];
printf(" -[%u] ", index); printf(" -[%u] ", index);
printf("type: "); printf("type: ");
dump_value_type(global.type); dump_value_type(global.type.val_type);
printf(" module_name: %s global_name: %s\n", global.module_name, printf(" module_name: %s global_name: %s\n", global.module_name,
global.global_name); global.global_name);
} }
@ -348,12 +349,13 @@ DumpDetails(AoTFile *aot)
printf(" -[%u] ", index); printf(" -[%u] ", index);
printf("elem_type: "); printf("elem_type: ");
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
wasm_dump_value_type(table.elem_type, table.elem_ref_type); wasm_dump_value_type(table.table_type.elem_type,
table.table_type.elem_ref_type);
#else #else
dump_value_type(table.elem_type); dump_value_type(table.table_type.elem_type);
#endif #endif
printf(" init_size:%5u max_size:%5u\n", table.table_init_size, printf(" init_size:%5u max_size:%5u\n",
table.table_max_size); table.table_type.init_size, table.table_type.max_size);
} }
printf("\n\n"); printf("\n\n");
@ -382,9 +384,9 @@ DumpDetails(AoTFile *aot)
AOTGlobal global = globals[index]; AOTGlobal global = globals[index];
printf(" -[%u] ", index); printf(" -[%u] ", index);
printf("type: "); printf("type: ");
dump_value_type(global.type); dump_value_type(global.type.val_type);
printf(" is_mutable: %d size: %u data_offset: %u\n", printf(" is_mutable: %d size: %u data_offset: %u\n",
global.is_mutable, global.size, global.data_offset); global.type.is_mutable, global.size, global.data_offset);
} }
printf("\n\n"); printf("\n\n");

View File

@ -16,7 +16,7 @@ mkdir -p ${OUT_DIR}
if [[ $1 != "--no-simd" ]];then if [[ $1 != "--no-simd" ]];then
NATIVE_SIMD_FLAGS="-msse2 -msse3 -msse4" NATIVE_SIMD_FLAGS="-msse2 -msse3 -msse4"
WASM_SIMD_FLAGS="-msimd128 -msse2 -msse3 -msse4" WASM_SIMD_FLAGS="-msimd128"
else else
NATIVE_SIMD_FLAGS="" NATIVE_SIMD_FLAGS=""
WASM_SIMD_FLAGS="" WASM_SIMD_FLAGS=""

View File

@ -3,20 +3,25 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
if (NOT DEFINED CMAKE_C_COMPILER)
set (CMAKE_C_COMPILER "clang")
endif ()
if (NOT DEFINED CMAKE_CXX_COMPILER)
set (CMAKE_CXX_COMPILER "clang++")
endif ()
project(wasm_mutator) project(wasm_mutator)
set (CMAKE_BUILD_TYPE Debug) set (CMAKE_BUILD_TYPE Debug)
set (CMAKE_C_COMPILER "clang") string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
set (CMAKE_CXX_COMPILER "clang++")
set (WAMR_BUILD_PLATFORM "linux")
# Reset default linker flags # Reset default linker flags
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set (CMAKE_C_STANDARD 99) set (CMAKE_C_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)
# Set WAMR_BUILD_TARGET, currently values supported: # Set WAMR_BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", # "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
@ -37,6 +42,10 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
endif () endif ()
endif () endif ()
if (APPLE)
add_definitions(-DBH_PLATFORM_DARWIN)
endif ()
if(CUSTOM_MUTATOR EQUAL 1) if(CUSTOM_MUTATOR EQUAL 1)
add_compile_definitions(CUSTOM_MUTATOR) add_compile_definitions(CUSTOM_MUTATOR)
endif() endif()
@ -120,14 +129,28 @@ add_compile_options(-fsanitize=fuzzer)
add_link_options(-fsanitize=fuzzer) add_link_options(-fsanitize=fuzzer)
# if not calling from oss-fuzz helper, enable all support sanitizers # if not calling from oss-fuzz helper, enable all support sanitizers
# oss-fuzz always defines `HELPER=True` # oss-fuzz will define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in CFLAGS and CXXFLAGS
if (NOT "$ENV{HELPER}" STREQUAL "True") set(CFLAGS_ENV $ENV{CFLAGS})
string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" IN_OSS_FUZZ)
if (IN_OSS_FUZZ EQUAL -1)
message("[ceith]:Enable ASan and UBSan in non-oss-fuzz environment")
add_compile_options( add_compile_options(
-fsanitize=signed-integer-overflow
-fprofile-instr-generate -fcoverage-mapping -fprofile-instr-generate -fcoverage-mapping
-fno-sanitize-recover=all
-fsanitize=address,undefined -fsanitize=address,undefined
# reference: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
# -fsanitize=undefined: All of the checks listed above other than float-divide-by-zero,
# unsigned-integer-overflow, implicit-conversion, local-bounds and
# the nullability-* group of checks.
#
# for now, we disable below from UBSan
# -alignment
# -implicit-conversion
#
-fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability
-fno-sanitize=alignment
) )
add_link_options(-fsanitize=address) add_link_options(-fsanitize=address -fprofile-instr-generate)
endif () endif ()
include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake) include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake)

View File

@ -1722,6 +1722,38 @@
"stdout content": "WASM module load failed: data count and data section have inconsistent lengths", "stdout content": "WASM module load failed: data count and data section have inconsistent lengths",
"description": "Check data segment count" "description": "Check data segment count"
} }
},
{
"deprecated": false,
"ids": [
3513
],
"runtime": "iwasm-default-wasi-disabled",
"file": "iwasm_poc_04.wasm",
"mode": "fast-interp",
"options": "-f main",
"argument": "",
"expected return": {
"ret code": 0,
"stdout content": "",
"description": "no sanitizer 'heap-buffer-overflow'"
}
},
{
"deprecated": false,
"ids": [
3514
],
"runtime": "iwasm-default-wasi-disabled",
"file": "iwasm_poc_05.wasm",
"mode": "fast-interp",
"options": "-f main",
"argument": "",
"expected return": {
"ret code": 0,
"stdout content": "",
"description": "no sanitizer 'heap-buffer-overflow'"
}
} }
] ]
} }

BIN
tests/standalone/bfs/bfs.wasm Executable file

Binary file not shown.

24
tests/standalone/bfs/run.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run bfs.wasm"
${IWASM_CMD} --heap-size=0 -f bfs bfs.wasm
else
echo "============> compile bfs.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o bfs.aot bfs.wasm \
|| ${WAMRC_CMD} -o bfs.aot bfs.wasm
echo "============> run bfs.aot"
${IWASM_CMD} --heap-size=0 -f bfs bfs.aot
fi

Binary file not shown.

View File

@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run binary_trees.wasm"
${IWASM_CMD} binary_trees.wasm 14
else
echo "============> compile binary_trees.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o binary_trees.aot binary_trees.wasm \
|| ${WAMRC_CMD} -o binary_trees.aot binary_trees.wasm
echo "============> run binary_trees.aot"
${IWASM_CMD} binary_trees.aot 18
fi

Binary file not shown.

23
tests/standalone/blake3/run.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run blake3.wasm"
${IWASM_CMD} blake3.wasm
else
echo "============> compile blake3.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o blake3.aot blake3.wasm \
|| ${WAMRC_CMD} -o blake3.aot blake3.wasm
echo "============> run blake3.aot"
${IWASM_CMD} blake3.aot
fi

Binary file not shown.

27
tests/standalone/brotli/run.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Download alice29.txt
wget https://raw.githubusercontent.com/google/brotli/master/tests/testdata/alice29.txt
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run brotli.wasm"
cat alice29.txt | ${IWASM_CMD} brotli.wasm -c > alice29.txt.comp
else
echo "============> compile brotli.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o brotli.aot brotli.wasm \
|| ${WAMRC_CMD} -o brotli.aot brotli.wasm
echo "============> run brotli.aot"
cat alice29.txt | ${IWASM_CMD} brotli.aot -c > alice29.txt.comp
fi

Binary file not shown.

23
tests/standalone/c-ray/run.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run c_ray.wasm"
cat scene | ${IWASM_CMD} c_ray.wasm -s 1024x768 > foo.ppm
else
echo "============> compile c_ray.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o c_ray.aot c_ray.wasm \
|| ${WAMRC_CMD} -o c_ray.aot c_ray.wasm
echo "============> run c_ray.aot"
cat scene | ${IWASM_CMD} c_ray.aot -s 1024x768 > foo.ppm
fi

View File

@ -0,0 +1,18 @@
# spheres
# position radius color shininess reflectivity
s -1.5 -0.3 -1 0.7 1.0 0.2 0.05 50.0 0.3
s 1.5 -0.4 0 0.6 0.1 0.85 1.0 50.0 0.4
# walls
s 0 -1000 2 999 0.1 0.2 0.6 80.0 0.8
# bouncing ball
s 0 0 2 1 1.0 0.5 0.1 60.0 0.7
# lights...
l -50 100 -50
l 40 40 150
# camera (there can be only one!)
# position FOV target
c 0 6 -17 45 0 -1 0

View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run c_wasm_simd128_example.wasm"
${IWASM_CMD} c_wasm_simd128_example.wasm
else
echo "============> compile c_wasm_simd128_example.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o c_wasm_simd128_example.aot c_wasm_simd128_example.wasm \
|| ${WAMRC_CMD} -o c_wasm_simd128_example.aot c_wasm_simd128_example.wasm
echo "============> run c_wasm_simd128_example.aot"
${IWASM_CMD} c_wasm_simd128_example.aot
fi

Binary file not shown.

View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
dd if=/dev/urandom of=./random bs=4k count=1k
if [[ $1 != "--aot" ]]; then
echo "============> run cat_sync.wasm"
${IWASM_CMD} cat_sync.wasm 0 < ./random > image.ppm
else
echo "============> compile cat_sync.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o cat_sync.aot cat_sync.wasm \
|| ${WAMRC_CMD} -o cat_sync.aot cat_sync.wasm
echo "============> run cat_sync.aot"
${IWASM_CMD} cat_sync.aot 0 < ./random > image.ppm
fi

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,32 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
if [[ $1 != "--aot" ]]; then
echo "============> run coremark_wasi_nofp.wasm"
${IWASM_CMD} coremark_wasi_nofp.wasm
echo "============> run coremark_wasi.wasm"
${IWASM_CMD} coremark_wasi.wasm
else
echo "============> compile coremark_wasi_nofp.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o coremark_wasi_nofp.aot coremark_wasi_nofp.wasm \
|| ${WAMRC_CMD} -o coremark_wasi_nofp.aot coremark_wasi_nofp.wasm
echo "============> run coremark_wasi_nofp.aot"
${IWASM_CMD} coremark_wasi_nofp.aot
echo "============> compile coremark_wasi.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o coremark_wasi.aot coremark_wasi.wasm \
|| ${WAMRC_CMD} -o coremark_wasi.aot coremark_wasi.wasm
echo "============> run coremark_wasi.aot"
${IWASM_CMD} coremark_wasi.aot
fi

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