From 9a96204d60132d20e0a84dead03edf5d722d1fb1 Mon Sep 17 00:00:00 2001 From: Gordon Smith Date: Mon, 25 Mar 2024 12:03:18 +0000 Subject: [PATCH] WIP --- .github/workflows/ubuntu.yml | 3 + test/wasm/.devcontainer/Dockerfile | 49 ++ test/wasm/.devcontainer/devcontainer.json | 29 + test/wasm/.dockerignore | 1 + {wasm => test/wasm}/.gitignore | 0 {wasm => test/wasm}/.vscode/launch.json | 0 {wasm => test/wasm}/CMakeLists.txt | 7 +- {wasm => test/wasm}/CMakePresets.json | 4 +- {wasm => test/wasm}/bool.cpp | 0 test/wasm/build.sh | 24 + {wasm => test/wasm}/float.cpp | 0 {wasm => test/wasm}/int.cpp | 0 {wasm => test/wasm}/string.cpp | 2 + {wasm => test/wasm}/test.wit | 0 {wasm => test/wasm}/uint.cpp | 0 {wasm => test/wasm}/util.cpp | 0 {wasm => test/wasm}/util.hpp | 0 test/wasmtime.cpp | 2 +- wasm/.devcontainer/devcontainer.json | 21 - wasm/build.sh | 24 - wasm/tests.rs | 933 ---------------------- wasm/wasm32-wasi/Dockerfile | 42 - 22 files changed, 116 insertions(+), 1025 deletions(-) create mode 100644 test/wasm/.devcontainer/Dockerfile create mode 100644 test/wasm/.devcontainer/devcontainer.json create mode 100644 test/wasm/.dockerignore rename {wasm => test/wasm}/.gitignore (100%) rename {wasm => test/wasm}/.vscode/launch.json (100%) rename {wasm => test/wasm}/CMakeLists.txt (75%) rename {wasm => test/wasm}/CMakePresets.json (72%) rename {wasm => test/wasm}/bool.cpp (100%) create mode 100755 test/wasm/build.sh rename {wasm => test/wasm}/float.cpp (100%) rename {wasm => test/wasm}/int.cpp (100%) rename {wasm => test/wasm}/string.cpp (98%) rename {wasm => test/wasm}/test.wit (100%) rename {wasm => test/wasm}/uint.cpp (100%) rename {wasm => test/wasm}/util.cpp (100%) rename {wasm => test/wasm}/util.hpp (100%) delete mode 100644 wasm/.devcontainer/devcontainer.json delete mode 100755 wasm/build.sh delete mode 100644 wasm/tests.rs delete mode 100644 wasm/wasm32-wasi/Dockerfile diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9a9dd7b..4882ba6 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -37,6 +37,9 @@ jobs: run: | cmake -G Ninja -S . -B build -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug + - name: build-wasm + run: ./test/wasm/build.sh + - name: build run: cmake --build build --parallel diff --git a/test/wasm/.devcontainer/Dockerfile b/test/wasm/.devcontainer/Dockerfile new file mode 100644 index 0000000..f67e87f --- /dev/null +++ b/test/wasm/.devcontainer/Dockerfile @@ -0,0 +1,49 @@ +# See: https://github.com/devcontainers/images/blob/main/src/cpp/.devcontainer/Dockerfile +ARG VARIANT=ubuntu-22.04 +FROM mcr.microsoft.com/devcontainers/base:${VARIANT} +USER root + +# Install needed packages. Use a separate RUN statement to add your own dependencies. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install cmake curl git tar xz-utils ninja-build \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +ARG USERNAME=vscode + +# Install wasi-sdk https://github.com/WebAssembly/wasi-sdk +ARG WASI_VERSION="21" +ENV WASI_VERSION_FULL="${WASI_VERSION}.0" +ENV WASI_LOCATION="${LOCATION:-"/usr/local"}/lib" +ENV WASI_FILE="wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz" +ENV WASI_SDK_PREFIX="/usr/local/lib/wasi-sdk-${WASI_VERSION_FULL}" +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/${WASI_FILE} --output ${WASI_FILE} +RUN tar -C ${WASI_LOCATION} -xvf ${WASI_FILE} +RUN rm ${WASI_FILE} + +# Install wit-bindgen https://github.com/bytecodealliance/wit-bindgen +ARG WIT_BINDGEN_VERSION="0.22.0" +RUN curl -L https://github.com/bytecodealliance/wit-bindgen/releases/download/v${WIT_BINDGEN_VERSION}/wit-bindgen-${WIT_BINDGEN_VERSION}-x86_64-linux.tar.gz --output wit-bindgen-${WIT_BINDGEN_VERSION}-x86_64-linux.tar.gz +RUN tar -xvzf wit-bindgen-${WIT_BINDGEN_VERSION}-x86_64-linux.tar.gz +RUN cp wit-bindgen-${WIT_BINDGEN_VERSION}-x86_64-linux/wit-bindgen ${LOCATION}/bin/wit-bindgen +RUN rm -r wit-bindgen-${WIT_BINDGEN_VERSION}-x86_64-linux* + +# Install wasm-tools https://github.com/bytecodealliance/wasm-tools +ARG WASM_TOOLS_VERSION="1.201.0" +RUN curl -L https://github.com/bytecodealliance/wasm-tools/releases/download/v${WASM_TOOLS_VERSION}/wasm-tools-${WASM_TOOLS_VERSION}-x86_64-linux.tar.gz --output wasm-tools-${WASM_TOOLS_VERSION}-x86_64-linux.tar.gz +RUN tar -xvzf wasm-tools-${WASM_TOOLS_VERSION}-x86_64-linux.tar.gz +RUN cp wasm-tools-${WASM_TOOLS_VERSION}-x86_64-linux/wasm-tools ${LOCATION}/bin/wasm-tools +RUN rm -r wasm-tools-${WASM_TOOLS_VERSION}-x86_64-linux* + +# Install wasi adapter https://github.com/bytecodealliance/wasmtime +ARG WASMTIME_VERSION="19.0.0" +RUN curl -L -O https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasi_snapshot_preview1.reactor.wasm +RUN mv wasi_snapshot_preview1.reactor.wasm ${LOCATION}/lib/wasi_snapshot_preview1.reactor.wasm + +# # Install wasmtime +# ENV WASMTIME_VERSION="${WASMTIME_VERSION:-"v9.0.4"}" +# ENV INSTALLER=./wasmtime-install.sh +# RUN curl https://wasmtime.dev/install.sh -L --output ${INSTALLER} +# RUN chmod a+x ${INSTALLER} +# RUN ${INSTALLER} --version ${WASMTIME_VERSION} +# RUN cp ${HOME}/.wasmtime/bin/wasmtime /usr/bin/wasmtime + diff --git a/test/wasm/.devcontainer/devcontainer.json b/test/wasm/.devcontainer/devcontainer.json new file mode 100644 index 0000000..035500a --- /dev/null +++ b/test/wasm/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "C/C++ WASM", + "build": { + "dockerfile": "./Dockerfile", + "context": "." + }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools-extension-pack", + "dtsvet.vscode-wasm" + ] + } + }, + "remoteUser": "vscode", + "remoteEnv": { + "PATH": "${containerEnv:PATH}:${WASI_SDK_PREFIX}/bin" + }, + "postCreateCommand": "echo 'Done'" +} \ No newline at end of file diff --git a/test/wasm/.dockerignore b/test/wasm/.dockerignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/test/wasm/.dockerignore @@ -0,0 +1 @@ +/build diff --git a/wasm/.gitignore b/test/wasm/.gitignore similarity index 100% rename from wasm/.gitignore rename to test/wasm/.gitignore diff --git a/wasm/.vscode/launch.json b/test/wasm/.vscode/launch.json similarity index 100% rename from wasm/.vscode/launch.json rename to test/wasm/.vscode/launch.json diff --git a/wasm/CMakeLists.txt b/test/wasm/CMakeLists.txt similarity index 75% rename from wasm/CMakeLists.txt rename to test/wasm/CMakeLists.txt index 0561747..f52038f 100644 --- a/wasm/CMakeLists.txt +++ b/test/wasm/CMakeLists.txt @@ -16,7 +16,7 @@ add_custom_command( add_custom_target(wit-generate ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tests.c) set(CMAKE_EXECUTABLE_SUFFIX ".wasm") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostartfiles -fno-exceptions --sysroot=/${WASI_SDK_PREFIX}/share/wasi-sysroot -Wl,--no-entry") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions --sysroot=/${WASI_SDK_PREFIX}/share/wasi-sysroot") include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -33,10 +33,13 @@ add_executable(wasmtests ${CMAKE_CURRENT_BINARY_DIR}/tests.h ) +target_link_options(wasmtests PRIVATE "LINKER:--no-entry") + + add_custom_command( TARGET wasmtests POST_BUILD # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/wasmtests-component.wasm - COMMAND wasm-tools component new ${CMAKE_CURRENT_BINARY_DIR}/wasmtests.wasm -o ${CMAKE_CURRENT_BINARY_DIR}/wasmtests-component.wasm --adapt wasi_snapshot_preview1=${CMAKE_CURRENT_SOURCE_DIR}/wasi_snapshot_preview1.reactor.wasm + COMMAND echo "wasm-tools component new ${CMAKE_CURRENT_BINARY_DIR}/wasmtests.wasm -o ${CMAKE_CURRENT_BINARY_DIR}/wasmtests-component.wasm --adapt wasi_snapshot_preview1=${WASI_SDK_PREFIX}/wasi_snapshot_preview1.reactor.wasm" ) target_link_libraries(wasmtests diff --git a/wasm/CMakePresets.json b/test/wasm/CMakePresets.json similarity index 72% rename from wasm/CMakePresets.json rename to test/wasm/CMakePresets.json index 7794d70..2854e5b 100644 --- a/wasm/CMakePresets.json +++ b/test/wasm/CMakePresets.json @@ -9,11 +9,11 @@ { "name": "wasi-sdk", "displayName": "wasi-sdk", - "toolchainFile": "/usr/local/lib/wasi-sdk-20.0/share/cmake/wasi-sdk.cmake", + "toolchainFile": "$env{WASI_SDK_PREFIX}/share/cmake/wasi-sdk.cmake", "binaryDir": "${sourceDir}/build", "installDir": "${sourceDir}/build/stage", "cacheVariables": { - "WASI_SDK_PREFIX": "/usr/local/lib/wasi-sdk-20.0" + "WASI_SDK_PREFIX": "$env{WASI_SDK_PREFIX}" } } ], diff --git a/wasm/bool.cpp b/test/wasm/bool.cpp similarity index 100% rename from wasm/bool.cpp rename to test/wasm/bool.cpp diff --git a/test/wasm/build.sh b/test/wasm/build.sh new file mode 100755 index 0000000..bb739d5 --- /dev/null +++ b/test/wasm/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )" +ROOT_DIR="$(pwd)" + +echo "SCRIPT_DIR: ${SCRIPT_DIR}" +echo "ROOT_DIR: $ROOT_DIR" + +function cleanup() +{ + CONTAINER_ID=$(jq -r .containerId ${SCRIPT_DIR}/up.json) + docker rm -f "${CONTAINER_ID}" + rm ${SCRIPT_DIR}/up.json +} + +trap cleanup EXIT + +npx -y @devcontainers/cli up --workspace-folder ${SCRIPT_DIR} | jq . > "${SCRIPT_DIR}/up.json" + +CMAKE_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=\${WASI_SDK_PREFIX}/share/cmake/wasi-sdk.cmake -DWASI_SDK_PREFIX=\${WASI_SDK_PREFIX}" + +npx -y @devcontainers/cli exec --workspace-folder ${SCRIPT_DIR} mkdir -p ./build +npx -y @devcontainers/cli exec --workspace-folder ${SCRIPT_DIR} sh -c 'cmake -S . -B ./build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PREFIX}/share/cmake/wasi-sdk.cmake -DWASI_SDK_PREFIX=${WASI_SDK_PREFIX}' +npx -y @devcontainers/cli exec --workspace-folder ${SCRIPT_DIR} cmake --build ./build --parallel diff --git a/wasm/float.cpp b/test/wasm/float.cpp similarity index 100% rename from wasm/float.cpp rename to test/wasm/float.cpp diff --git a/wasm/int.cpp b/test/wasm/int.cpp similarity index 100% rename from wasm/int.cpp rename to test/wasm/int.cpp diff --git a/wasm/string.cpp b/test/wasm/string.cpp similarity index 98% rename from wasm/string.cpp rename to test/wasm/string.cpp index a73f58e..b3d8af2 100644 --- a/wasm/string.cpp +++ b/test/wasm/string.cpp @@ -1,4 +1,6 @@ #include "util.hpp" +#include +#include static uint32_t tally = 0; diff --git a/wasm/test.wit b/test/wasm/test.wit similarity index 100% rename from wasm/test.wit rename to test/wasm/test.wit diff --git a/wasm/uint.cpp b/test/wasm/uint.cpp similarity index 100% rename from wasm/uint.cpp rename to test/wasm/uint.cpp diff --git a/wasm/util.cpp b/test/wasm/util.cpp similarity index 100% rename from wasm/util.cpp rename to test/wasm/util.cpp diff --git a/wasm/util.hpp b/test/wasm/util.hpp similarity index 100% rename from wasm/util.hpp rename to test/wasm/util.hpp diff --git a/test/wasmtime.cpp b/test/wasmtime.cpp index ee78f68..c8e311c 100644 --- a/test/wasmtime.cpp +++ b/test/wasmtime.cpp @@ -100,7 +100,7 @@ TEST_CASE("component-model-cpp") wasmtime::Engine engine; wasmtime::Store store(engine); - std::vector _contents = readWasmBinaryToBuffer("wasm/build/wasmtests.wasm"); + std::vector _contents = readWasmBinaryToBuffer("test/wasm/build/wasmtests.wasm"); const wasmtime::Span &contents = _contents; auto module = wasmtime::Module::compile(engine, contents).unwrap(); diff --git a/wasm/.devcontainer/devcontainer.json b/wasm/.devcontainer/devcontainer.json deleted file mode 100644 index dbe8a58..0000000 --- a/wasm/.devcontainer/devcontainer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "C/C++ WASM", - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "remoteEnv": { - "PATH": "${containerEnv:PATH}:/usr/local/lib/wasi-sdk-20.0/bin" - }, - "features": { - "devwasm.azurecr.io/dev-wasm/dev-wasm-feature/wasmtime-wasi:0.0.14": { - "version": "20" - } - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools-extension-pack", - "dtsvet.vscode-wasm" - ] - } - }, - "postCreateCommand": "sudo apt update && sudo apt install -y cmake wget && rm -rf build/*.wasm && wget https://github.com/bytecodealliance/wasmtime/releases/download/v15.0.1/wasi_snapshot_preview1.reactor.wasm" -} \ No newline at end of file diff --git a/wasm/build.sh b/wasm/build.sh deleted file mode 100755 index 4300cb9..0000000 --- a/wasm/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )" -ROOT_DIR="${SCRIPT_DIR}/../../.." - -echo "SCRIPT_DIR: ${SCRIPT_DIR}" -echo "ROOT_DIR: $ROOT_DIR" - -docker build --progress plain -f "${SCRIPT_DIR}/wasm32-wasi/Dockerfile" \ - -t wasm32-wasi:latest \ - "${SCRIPT_DIR}/." - -CMAKE_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=/hpcc-dev/wasi-sdk/share/cmake/wasi-sdk.cmake -DWASI_SDK_PREFIX=/hpcc-dev/wasi-sdk" - -docker run --rm \ - --mount source="${SCRIPT_DIR}",target=/hpcc-dev/wasmtests,type=bind,consistency=cached \ - --mount source="${ROOT_DIR}/testing/regress/ecl",target=/hpcc-dev/install-target,type=bind,consistency=cached \ - --mount source="${SCRIPT_DIR}/build",target=/hpcc-dev/build,type=bind,consistency=cached \ - wasm32-wasi:latest \ - "rm -rf ./build/* && \ - cmake -S . -B /hpcc-dev/build ${CMAKE_OPTIONS} && \ - cmake --build /hpcc-dev/build --target install" - -echo "docker run -it --mount source=\"${SCRIPT_DIR}\",target=/hpcc-dev/wasmtests,type=bind,consistency=cached wasm32-wasi:latest bash" diff --git a/wasm/tests.rs b/wasm/tests.rs deleted file mode 100644 index e7c0183..0000000 --- a/wasm/tests.rs +++ /dev/null @@ -1,933 +0,0 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! -#[allow(unused_unsafe, clippy::all)] -pub fn dbglog(msg: &str,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let vec0 = msg; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "$root")] - extern "C" { - #[link_name = "dbglog"] - fn wit_import(_: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, len0); - } -} -const _: () = { - - #[doc(hidden)] - #[export_name = "bool-and"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_bool_and(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::bool_and(wit_bindgen::rt::bool_lift(arg0 as u8), wit_bindgen::rt::bool_lift(arg1 as u8)); - match result0 { true => 1, false => 0 } - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "bool-or"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_bool_or(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::bool_or(wit_bindgen::rt::bool_lift(arg0 as u8), wit_bindgen::rt::bool_lift(arg1 as u8)); - match result0 { true => 1, false => 0 } - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "bool-xor"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_bool_xor(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::bool_xor(wit_bindgen::rt::bool_lift(arg0 as u8), wit_bindgen::rt::bool_lift(arg1 as u8)); - match result0 { true => 1, false => 0 } - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "float32-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_float32_add(arg0: f32,arg1: f32,) -> f32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::float32_add(arg0, arg1); - wit_bindgen::rt::as_f32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "float32-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_float32_sub(arg0: f32,arg1: f32,) -> f32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::float32_sub(arg0, arg1); - wit_bindgen::rt::as_f32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "float64-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_float64_add(arg0: f64,arg1: f64,) -> f64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::float64_add(arg0, arg1); - wit_bindgen::rt::as_f64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "float64-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_float64_sub(arg0: f64,arg1: f64,) -> f64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::float64_sub(arg0, arg1); - wit_bindgen::rt::as_f64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u8-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u8_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u8_add(arg0 as u8, arg1 as u8); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u8-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u8_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u8_sub(arg0 as u8, arg1 as u8); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u16-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u16_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u16_add(arg0 as u16, arg1 as u16); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u16-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u16_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u16_sub(arg0 as u16, arg1 as u16); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u32-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u32_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u32_add(arg0 as u32, arg1 as u32); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u32-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u32_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u32_sub(arg0 as u32, arg1 as u32); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u64-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u64_add(arg0: i64,arg1: i64,) -> i64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u64_add(arg0 as u64, arg1 as u64); - wit_bindgen::rt::as_i64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "u64-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_u64_sub(arg0: i64,arg1: i64,) -> i64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::u64_sub(arg0 as u64, arg1 as u64); - wit_bindgen::rt::as_i64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s8-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s8_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s8_add(arg0 as i8, arg1 as i8); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s8-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s8_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s8_sub(arg0 as i8, arg1 as i8); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s16-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s16_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s16_add(arg0 as i16, arg1 as i16); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s16-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s16_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s16_sub(arg0 as i16, arg1 as i16); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s32-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s32_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s32_add(arg0, arg1); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s32-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s32_sub(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s32_sub(arg0, arg1); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s64-add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s64_add(arg0: i64,arg1: i64,) -> i64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s64_add(arg0, arg1); - wit_bindgen::rt::as_i64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "s64-sub"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_s64_sub(arg0: i64,arg1: i64,) -> i64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::s64_sub(arg0, arg1); - wit_bindgen::rt::as_i64(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "list-char-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_list_char_append(arg0: i32,arg1: i32,arg2: i32,arg3: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let base1 = arg0; - let len1 = arg1; - let mut result1 = Vec::with_capacity(len1 as usize); - for i in 0..len1 { - let base = base1 + i * 4; - let e1 = { - let l0 = *((base + 0) as *const i32); - - wit_bindgen::rt::char_lift(l0 as u32) - }; - result1.push(e1); - } - wit_bindgen::rt::dealloc(base1, (len1 as usize) * 4, 4); - let base3 = arg2; - let len3 = arg3; - let mut result3 = Vec::with_capacity(len3 as usize); - for i in 0..len3 { - let base = base3 + i * 4; - let e3 = { - let l2 = *((base + 0) as *const i32); - - wit_bindgen::rt::char_lift(l2 as u32) - }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 4, 4); - let result4 = <_GuestImpl as Guest>::list_char_append(result1, result3); - let ptr5 = _RET_AREA.0.as_mut_ptr() as i32; - let vec6 = result4; - let len6 = vec6.len() as i32; - let layout6 = alloc::Layout::from_size_align_unchecked(vec6.len() * 4, 4); - let result6 = if layout6.size() != 0 - { - let ptr = alloc::alloc(layout6); - if ptr.is_null() - { - alloc::handle_alloc_error(layout6); - } - ptr - }else {{ - ::core::ptr::null_mut() - }}; - for (i, e) in vec6.into_iter().enumerate() { - let base = result6 as i32 + (i as i32) * 4; - { - *((base + 0) as *mut i32) = wit_bindgen::rt::as_i32(e); - } - } - *((ptr5 + 4) as *mut i32) = len6; - *((ptr5 + 0) as *mut i32) = result6 as i32; - ptr5 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_list-char-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_list_char_append(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 4, 4); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "list-list-string-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_list_list_string_append(arg0: i32,arg1: i32,arg2: i32,arg3: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let base6 = arg0; - let len6 = arg1; - let mut result6 = Vec::with_capacity(len6 as usize); - for i in 0..len6 { - let base = base6 + i * 8; - let e6 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let base5 = l0; - let len5 = l1; - let mut result5 = Vec::with_capacity(len5 as usize); - for i in 0..len5 { - let base = base5 + i * 8; - let e5 = { - let l2 = *((base + 0) as *const i32); - let l3 = *((base + 4) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); - - wit_bindgen::rt::string_lift(bytes4) - }; - result5.push(e5); - } - wit_bindgen::rt::dealloc(base5, (len5 as usize) * 8, 4); - - result5 - }; - result6.push(e6); - } - wit_bindgen::rt::dealloc(base6, (len6 as usize) * 8, 4); - let base13 = arg2; - let len13 = arg3; - let mut result13 = Vec::with_capacity(len13 as usize); - for i in 0..len13 { - let base = base13 + i * 8; - let e13 = { - let l7 = *((base + 0) as *const i32); - let l8 = *((base + 4) as *const i32); - let base12 = l7; - let len12 = l8; - let mut result12 = Vec::with_capacity(len12 as usize); - for i in 0..len12 { - let base = base12 + i * 8; - let e12 = { - let l9 = *((base + 0) as *const i32); - let l10 = *((base + 4) as *const i32); - let len11 = l10 as usize; - let bytes11 = Vec::from_raw_parts(l9 as *mut _, len11, len11); - - wit_bindgen::rt::string_lift(bytes11) - }; - result12.push(e12); - } - wit_bindgen::rt::dealloc(base12, (len12 as usize) * 8, 4); - - result12 - }; - result13.push(e13); - } - wit_bindgen::rt::dealloc(base13, (len13 as usize) * 8, 4); - let result14 = <_GuestImpl as Guest>::list_list_string_append(result6, result13); - let ptr15 = _RET_AREA.0.as_mut_ptr() as i32; - let vec16 = (result14.into_bytes()).into_boxed_slice(); - let ptr16 = vec16.as_ptr() as i32; - let len16 = vec16.len() as i32; - ::core::mem::forget(vec16); - *((ptr15 + 4) as *mut i32) = len16; - *((ptr15 + 0) as *mut i32) = ptr16; - ptr15 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_list-list-string-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_list_list_string_append(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - wit_bindgen::rt::dealloc(l0, (l1) as usize, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "string-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_string_append(arg0: i32,arg1: i32,arg2: i32,arg3: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let len1 = arg3 as usize; - let bytes1 = Vec::from_raw_parts(arg2 as *mut _, len1, len1); - let result2 = <_GuestImpl as Guest>::string_append(wit_bindgen::rt::string_lift(bytes0), wit_bindgen::rt::string_lift(bytes1)); - let ptr3 = _RET_AREA.0.as_mut_ptr() as i32; - let vec4 = (result2.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr() as i32; - let len4 = vec4.len() as i32; - ::core::mem::forget(vec4); - *((ptr3 + 4) as *mut i32) = len4; - *((ptr3 + 0) as *mut i32) = ptr4; - ptr3 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_string-append"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_string_append(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - wit_bindgen::rt::dealloc(l0, (l1) as usize, 1); - } - }; -}; -use MyWorld as _GuestImpl; -pub trait Guest { - fn bool_and(a: bool,b: bool,) -> bool; - fn bool_or(a: bool,b: bool,) -> bool; - fn bool_xor(a: bool,b: bool,) -> bool; - fn float32_add(a: f32,b: f32,) -> f32; - fn float32_sub(a: f32,b: f32,) -> f32; - fn float64_add(a: f64,b: f64,) -> f64; - fn float64_sub(a: f64,b: f64,) -> f64; - fn u8_add(a: u8,b: u8,) -> u8; - fn u8_sub(a: u8,b: u8,) -> u8; - fn u16_add(a: u16,b: u16,) -> u16; - fn u16_sub(a: u16,b: u16,) -> u16; - fn u32_add(a: u32,b: u32,) -> u32; - fn u32_sub(a: u32,b: u32,) -> u32; - fn u64_add(a: u64,b: u64,) -> u64; - fn u64_sub(a: u64,b: u64,) -> u64; - fn s8_add(a: i8,b: i8,) -> i8; - fn s8_sub(a: i8,b: i8,) -> i8; - fn s16_add(a: i16,b: i16,) -> i16; - fn s16_sub(a: i16,b: i16,) -> i16; - fn s32_add(a: i32,b: i32,) -> i32; - fn s32_sub(a: i32,b: i32,) -> i32; - fn s64_add(a: i64,b: i64,) -> i64; - fn s64_sub(a: i64,b: i64,) -> i64; - fn list_char_append(a: wit_bindgen::rt::vec::Vec::,b: wit_bindgen::rt::vec::Vec::,) -> wit_bindgen::rt::vec::Vec::; - fn list_list_string_append(a: wit_bindgen::rt::vec::Vec::>,b: wit_bindgen::rt::vec::Vec::>,) -> wit_bindgen::rt::string::String; - fn string_append(a: wit_bindgen::rt::string::String,b: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::string::String; -} - -#[allow(unused_imports)] -use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - -#[repr(align(4))] -struct _RetArea([u8; 8]); -static mut _RET_AREA: _RetArea = _RetArea([0; 8]); - -#[cfg(target_arch = "wasm32")] -#[link_section = "component-type:tests"] -#[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 709] = [3, 0, 5, 116, 101, 115, 116, 115, 0, 97, 115, 109, 13, 0, 1, 0, 7, 203, 4, 1, 65, 2, 1, 65, 45, 1, 64, 1, 3, 109, 115, 103, 115, 1, 0, 3, 0, 6, 100, 98, 103, 108, 111, 103, 1, 0, 1, 64, 2, 1, 97, 127, 1, 98, 127, 0, 127, 4, 0, 8, 98, 111, 111, 108, 45, 97, 110, 100, 1, 1, 4, 0, 7, 98, 111, 111, 108, 45, 111, 114, 1, 1, 4, 0, 8, 98, 111, 111, 108, 45, 120, 111, 114, 1, 1, 1, 64, 2, 1, 97, 118, 1, 98, 118, 0, 118, 4, 0, 11, 102, 108, 111, 97, 116, 51, 50, 45, 97, 100, 100, 1, 2, 4, 0, 11, 102, 108, 111, 97, 116, 51, 50, 45, 115, 117, 98, 1, 2, 1, 64, 2, 1, 97, 117, 1, 98, 117, 0, 117, 4, 0, 11, 102, 108, 111, 97, 116, 54, 52, 45, 97, 100, 100, 1, 3, 4, 0, 11, 102, 108, 111, 97, 116, 54, 52, 45, 115, 117, 98, 1, 3, 1, 64, 2, 1, 97, 125, 1, 98, 125, 0, 125, 4, 0, 6, 117, 56, 45, 97, 100, 100, 1, 4, 4, 0, 6, 117, 56, 45, 115, 117, 98, 1, 4, 1, 64, 2, 1, 97, 123, 1, 98, 123, 0, 123, 4, 0, 7, 117, 49, 54, 45, 97, 100, 100, 1, 5, 4, 0, 7, 117, 49, 54, 45, 115, 117, 98, 1, 5, 1, 64, 2, 1, 97, 121, 1, 98, 121, 0, 121, 4, 0, 7, 117, 51, 50, 45, 97, 100, 100, 1, 6, 4, 0, 7, 117, 51, 50, 45, 115, 117, 98, 1, 6, 1, 64, 2, 1, 97, 119, 1, 98, 119, 0, 119, 4, 0, 7, 117, 54, 52, 45, 97, 100, 100, 1, 7, 4, 0, 7, 117, 54, 52, 45, 115, 117, 98, 1, 7, 1, 64, 2, 1, 97, 126, 1, 98, 126, 0, 126, 4, 0, 6, 115, 56, 45, 97, 100, 100, 1, 8, 4, 0, 6, 115, 56, 45, 115, 117, 98, 1, 8, 1, 64, 2, 1, 97, 124, 1, 98, 124, 0, 124, 4, 0, 7, 115, 49, 54, 45, 97, 100, 100, 1, 9, 4, 0, 7, 115, 49, 54, 45, 115, 117, 98, 1, 9, 1, 64, 2, 1, 97, 122, 1, 98, 122, 0, 122, 4, 0, 7, 115, 51, 50, 45, 97, 100, 100, 1, 10, 4, 0, 7, 115, 51, 50, 45, 115, 117, 98, 1, 10, 1, 64, 2, 1, 97, 120, 1, 98, 120, 0, 120, 4, 0, 7, 115, 54, 52, 45, 97, 100, 100, 1, 11, 4, 0, 7, 115, 54, 52, 45, 115, 117, 98, 1, 11, 1, 112, 116, 1, 64, 2, 1, 97, 12, 1, 98, 12, 0, 12, 4, 0, 16, 108, 105, 115, 116, 45, 99, 104, 97, 114, 45, 97, 112, 112, 101, 110, 100, 1, 13, 1, 112, 115, 1, 112, 14, 1, 64, 2, 1, 97, 15, 1, 98, 15, 0, 115, 4, 0, 23, 108, 105, 115, 116, 45, 108, 105, 115, 116, 45, 115, 116, 114, 105, 110, 103, 45, 97, 112, 112, 101, 110, 100, 1, 16, 1, 64, 2, 1, 97, 115, 1, 98, 115, 0, 115, 4, 0, 13, 115, 116, 114, 105, 110, 103, 45, 97, 112, 112, 101, 110, 100, 1, 17, 4, 1, 35, 99, 111, 109, 112, 111, 110, 101, 110, 116, 45, 109, 111, 100, 101, 108, 45, 99, 112, 112, 58, 116, 101, 115, 116, 45, 119, 97, 115, 109, 47, 116, 101, 115, 116, 115, 4, 0, 11, 11, 1, 0, 5, 116, 101, 115, 116, 115, 3, 0, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; - -#[inline(never)] -#[doc(hidden)] -#[cfg(target_arch = "wasm32")] -pub fn __link_section() {} diff --git a/wasm/wasm32-wasi/Dockerfile b/wasm/wasm32-wasi/Dockerfile deleted file mode 100644 index c31bc8c..0000000 --- a/wasm/wasm32-wasi/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM ubuntu:22.04 - -RUN apt-get update && \ - apt-get install -y \ - autoconf \ - autogen \ - automake \ - clang \ - cmake \ - curl \ - libtool \ - lld \ - llvm \ - make \ - ninja-build \ - wget - -RUN curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y - -SHELL ["/bin/bash", "--login", "-c"] - -WORKDIR /hpcc-dev - -# List of current vertsion can be found in https://github.com/bytecodealliance/wit-bindgen/releases --- -ARG WIT_VERSION=0.22.0 -RUN cargo install wasm-tools && \ - cargo install --git https://github.com/bytecodealliance/wit-bindgen --tag v${WIT_VERSION} wit-bindgen-cli && \ - curl https://wasmtime.dev/install.sh -sSf | bash - -# List of current vertsion can be found in https://github.com/WebAssembly/wasi-sdk/releases --- -ARG WASI_VERSION=21 -ARG WASI_MINOR_VERSION=0 -ARG WASI_VERSION_FULL=${WASI_VERSION}.${WASI_MINOR_VERSION} -RUN wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz -RUN tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && rm wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz -RUN mv wasi-sdk-${WASI_VERSION_FULL} wasi-sdk - -WORKDIR /hpcc-dev/wasmtests - -ENTRYPOINT ["/bin/bash", "--login", "-c"] - -CMD ["bash"]