├── .github
├── ISSUE_TEMPLATE
│ ├── general.md
│ ├── document_translation.md
│ ├── feature_request.md
│ └── bug_report.md
├── codecov.yml
├── dependabot.yml
├── workflows
│ ├── reusable-call-linter.yml
│ └── witx.yml
└── scripts
│ └── clang-format.sh
├── docs
├── book
│ ├── zh
│ │ ├── src
│ │ │ ├── os.md
│ │ │ ├── os
│ │ │ │ ├── mac.md
│ │ │ │ ├── wasmedge-sel4.png
│ │ │ │ ├── windows.md
│ │ │ │ ├── android.md
│ │ │ │ └── raspberrypi.md
│ │ │ ├── dev
│ │ │ │ ├── js.md
│ │ │ │ ├── kotlin.md
│ │ │ │ ├── swift.md
│ │ │ │ ├── grain.md
│ │ │ │ └── as.md
│ │ │ ├── intro.md
│ │ │ ├── intro
│ │ │ │ ├── faq.md
│ │ │ │ ├── features.md
│ │ │ │ ├── proprietary.md
│ │ │ │ ├── standard.md
│ │ │ │ ├── integrations.md
│ │ │ │ ├── use
│ │ │ │ │ ├── saas.md
│ │ │ │ │ ├── edge.md
│ │ │ │ │ └── runtime.md
│ │ │ │ └── use.md
│ │ │ ├── embed.md
│ │ │ ├── extend.md
│ │ │ ├── frameworks.md
│ │ │ ├── embed
│ │ │ │ ├── c
│ │ │ │ │ └── ref.md
│ │ │ │ └── python.md
│ │ │ ├── frameworks
│ │ │ │ ├── mesh
│ │ │ │ │ ├── mosn.md
│ │ │ │ │ └── eventmesh.md
│ │ │ │ ├── serverless
│ │ │ │ │ ├── aws.md
│ │ │ │ │ ├── netlify.md
│ │ │ │ │ ├── tencent.md
│ │ │ │ │ ├── vercel.md
│ │ │ │ │ └── secondstate.md
│ │ │ │ ├── app.md
│ │ │ │ └── mesh.md
│ │ │ ├── kubernetes
│ │ │ │ ├── container
│ │ │ │ │ ├── runc.md
│ │ │ │ │ ├── youki.md
│ │ │ │ │ └── crun.md
│ │ │ │ ├── kubernetes
│ │ │ │ │ └── superedge.md
│ │ │ │ ├── container.md
│ │ │ │ ├── cri.md
│ │ │ │ ├── demo.md
│ │ │ │ └── kubernetes.md
│ │ │ ├── kubernetes.md
│ │ │ ├── extend
│ │ │ │ └── plugin.md
│ │ │ ├── start
│ │ │ │ └── universal.md
│ │ │ └── dev.md
│ │ ├── theme
│ │ │ └── head.hbs
│ │ └── book.toml
│ ├── zh-TW
│ │ ├── src
│ │ │ ├── dev
│ │ │ │ ├── go.md
│ │ │ │ ├── rust.md
│ │ │ │ ├── grain.md
│ │ │ │ ├── js.md
│ │ │ │ ├── js
│ │ │ │ │ ├── es6.md
│ │ │ │ │ ├── fetch.md
│ │ │ │ │ ├── networking.md
│ │ │ │ │ ├── quickstart.md
│ │ │ │ │ ├── ssr.md
│ │ │ │ │ ├── npm.md
│ │ │ │ │ ├── rust.md
│ │ │ │ │ └── tensorflow.md
│ │ │ │ ├── kotlin.md
│ │ │ │ ├── python.md
│ │ │ │ ├── swift.md
│ │ │ │ ├── as.md
│ │ │ │ └── rust
│ │ │ │ │ ├── command.md
│ │ │ │ │ ├── wasi.md
│ │ │ │ │ ├── bindgen.md
│ │ │ │ │ ├── networking.md
│ │ │ │ │ └── tensorflow.md
│ │ │ ├── intro
│ │ │ │ ├── faq.md
│ │ │ │ ├── integrations.md
│ │ │ │ ├── features.md
│ │ │ │ ├── proprietary.md
│ │ │ │ ├── standard.md
│ │ │ │ ├── use
│ │ │ │ │ ├── saas.md
│ │ │ │ │ ├── edge.md
│ │ │ │ │ └── runtime.md
│ │ │ │ └── use.md
│ │ │ ├── os
│ │ │ │ ├── linux.md
│ │ │ │ ├── mac.md
│ │ │ │ ├── sel4.md
│ │ │ │ ├── android.md
│ │ │ │ ├── windows.md
│ │ │ │ ├── openharmony.md
│ │ │ │ └── raspberrypi.md
│ │ │ ├── embed
│ │ │ │ ├── go.md
│ │ │ │ ├── rust.md
│ │ │ │ ├── c
│ │ │ │ │ └── ref.md
│ │ │ │ ├── go
│ │ │ │ │ ├── memory.md
│ │ │ │ │ ├── ref.md
│ │ │ │ │ ├── app.md
│ │ │ │ │ ├── function.md
│ │ │ │ │ ├── bindgen.md
│ │ │ │ │ └── tensorflow.md
│ │ │ │ ├── node.md
│ │ │ │ └── python.md
│ │ │ ├── extend.md
│ │ │ ├── intro.md
│ │ │ ├── dev.md
│ │ │ ├── embed.md
│ │ │ ├── frameworks.md
│ │ │ ├── frameworks
│ │ │ │ ├── app.md
│ │ │ │ ├── app
│ │ │ │ │ ├── yomo.md
│ │ │ │ │ └── reactr.md
│ │ │ │ ├── mesh
│ │ │ │ │ ├── dapr.md
│ │ │ │ │ ├── mosn.md
│ │ │ │ │ └── eventmesh.md
│ │ │ │ ├── serverless
│ │ │ │ │ ├── aws.md
│ │ │ │ │ ├── netlify.md
│ │ │ │ │ ├── tencent.md
│ │ │ │ │ ├── vercel.md
│ │ │ │ │ └── secondstate.md
│ │ │ │ ├── mesh.md
│ │ │ │ └── serverless.md
│ │ │ ├── kubernetes
│ │ │ │ ├── demo.md
│ │ │ │ ├── cri.md
│ │ │ │ ├── cri
│ │ │ │ │ ├── crio.md
│ │ │ │ │ └── containerd.md
│ │ │ │ ├── quickstart.md
│ │ │ │ ├── container.md
│ │ │ │ ├── container
│ │ │ │ │ ├── crun.md
│ │ │ │ │ ├── runc.md
│ │ │ │ │ └── youki.md
│ │ │ │ ├── demo
│ │ │ │ │ ├── server.md
│ │ │ │ │ └── wasi.md
│ │ │ │ ├── kubernetes.md
│ │ │ │ └── kubernetes
│ │ │ │ │ ├── kind.md
│ │ │ │ │ ├── kubeedge.md
│ │ │ │ │ ├── openyurt.md
│ │ │ │ │ ├── superedge.md
│ │ │ │ │ ├── kubernetes-crio.md
│ │ │ │ │ └── kubernetes-containerd.md
│ │ │ ├── extend
│ │ │ │ ├── build_on_mac.md
│ │ │ │ ├── plugin.md
│ │ │ │ ├── build_for_android.md
│ │ │ │ ├── build_on_windows.md
│ │ │ │ └── plugin
│ │ │ │ │ ├── externref.md
│ │ │ │ │ └── hostfunction.md
│ │ │ ├── start
│ │ │ │ └── universal.md
│ │ │ ├── kubernetes.md
│ │ │ └── os.md
│ │ ├── theme
│ │ │ └── head.hbs
│ │ └── book.toml
│ └── en
│ │ ├── src
│ │ ├── use_cases
│ │ │ ├── frameworks
│ │ │ │ ├── mesh
│ │ │ │ │ ├── mosn.md
│ │ │ │ │ └── eventmesh.md
│ │ │ │ ├── serverless-wasmedge.png
│ │ │ │ ├── serverless
│ │ │ │ │ └── tencent.md
│ │ │ │ └── app.md
│ │ │ ├── kubernetes.png
│ │ │ └── kubernetes
│ │ │ │ ├── container
│ │ │ │ ├── runc.md
│ │ │ │ └── youki.md
│ │ │ │ ├── container.md
│ │ │ │ ├── docker
│ │ │ │ └── containerd.md
│ │ │ │ ├── docker.md
│ │ │ │ ├── cri.md
│ │ │ │ ├── demo.md
│ │ │ │ └── kubernetes.md
│ │ ├── contribute
│ │ │ ├── internal.md
│ │ │ ├── build_from_src
│ │ │ │ ├── wasmedge-sel4.png
│ │ │ │ ├── openharmony.md
│ │ │ │ └── raspberrypi.md
│ │ │ └── wish_list.md
│ │ ├── write_wasm
│ │ │ ├── c.md
│ │ │ ├── javascript.png
│ │ │ ├── swift.md
│ │ │ ├── kotlin.md
│ │ │ ├── grain.md
│ │ │ └── as.md
│ │ ├── sdk
│ │ │ └── python.md
│ │ ├── quick_start.md
│ │ ├── cli.md
│ │ ├── sdk.md
│ │ └── features
│ │ │ └── platforms.md
│ │ └── theme
│ │ └── head.hbs
├── architecture.png
├── wasmedge_logo.jpeg
├── wasmedge-runtime-logo.png
└── witx
│ └── .gitignore
├── .dockerignore
├── utils
├── android
│ ├── app
│ │ ├── app
│ │ │ ├── .gitignore
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ └── res
│ │ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── colors.xml
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.webp
│ │ │ │ │ └── ic_launcher_round.webp
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.webp
│ │ │ │ │ └── ic_launcher_round.webp
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.webp
│ │ │ │ │ └── ic_launcher_round.webp
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.webp
│ │ │ │ │ └── ic_launcher_round.webp
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.webp
│ │ │ │ │ └── ic_launcher_round.webp
│ │ │ │ │ └── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ └── proguard-rules.pro
│ │ ├── lib
│ │ │ ├── .gitignore
│ │ │ ├── consumer-rules.pro
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ ├── AndroidManifest.xml
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── wasmedge
│ │ │ │ │ └── native_lib
│ │ │ │ │ └── NativeLib.kt
│ │ │ └── proguard-rules.pro
│ │ ├── .idea
│ │ │ ├── .name
│ │ │ ├── .gitignore
│ │ │ ├── compiler.xml
│ │ │ ├── vcs.xml
│ │ │ ├── misc.xml
│ │ │ └── gradle.xml
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── .gitignore
│ │ ├── settings.gradle
│ │ └── build.gradle
│ └── standalone
│ │ └── build_for_android.sh
├── corpus
│ └── po
│ │ ├── add.txt
│ │ ├── help.txt
│ │ ├── simple.txt
│ │ ├── disable1.txt
│ │ ├── enable1.txt
│ │ ├── enable2.txt
│ │ ├── reactor.txt
│ │ ├── version.txt
│ │ ├── gas-limit1.txt
│ │ ├── gas-limit2.txt
│ │ ├── time-limit1.txt
│ │ ├── time-limit2.txt
│ │ ├── memory-page-limit1.txt
│ │ └── memory-page-limit2.txt
├── witx-doc
│ ├── .gitignore
│ ├── Cargo.toml
│ └── generate.sh
├── wasi-nn
│ ├── test-wasinn-ubuntu-openvino.sh
│ ├── download-pytorch-fixtures.sh
│ ├── build-wasinn-ubuntu-openvino.sh
│ ├── download-tflite-fixtures.sh
│ └── download-openvino-fixtures.sh
├── docker
│ ├── Dockerfile.build-gcc
│ ├── Dockerfile.build-clang
│ ├── Dockerfile.base
│ ├── Dockerfile.release
│ ├── Dockerfile.ubuntu2004_x86_64
│ └── Dockerfile.ci-image-base
├── wasi-cpp-header
│ ├── .gitignore
│ ├── change-tag-type.patch
│ ├── Cargo.toml
│ ├── generate.sh
│ ├── add-wasi_opt.patch
│ └── crypto_generate.sh
├── openwrt
│ └── build_for_openwrt.sh
└── ohos
│ └── configuration
│ └── ohos.build
├── .clang-format
├── .devcontainer
├── Dockerfile
└── devcontainer.json
├── .gitattribute
├── test
├── loader
│ └── filemgrTestData
│ │ ├── readNameTest.bin
│ │ ├── readF32Test.bin
│ │ ├── readF64Test.bin
│ │ ├── readS32Test.bin
│ │ ├── readS64Test.bin
│ │ ├── readU32Test.bin
│ │ ├── readU64Test.bin
│ │ ├── readByteTest.bin
│ │ ├── readS32TestTooLarge.bin
│ │ ├── readS32TestTooLong.bin
│ │ ├── readS64TestTooLarge.bin
│ │ ├── readS64TestTooLong.bin
│ │ ├── readU32TestTooLarge.bin
│ │ ├── readU32TestTooLong.bin
│ │ ├── readU64TestTooLarge.bin
│ │ └── readU64TestTooLong.bin
├── api
│ └── apiTestData
│ │ ├── test.wasm
│ │ ├── import.wasm
│ │ ├── fibonacci.wasm
│ │ └── fibonacci.wat
├── expected
│ ├── main.cpp
│ ├── relops.cpp
│ ├── gtest.cpp
│ ├── constexpr.cpp
│ └── CMakeLists.txt
├── externref
│ ├── externrefTestData
│ │ ├── stl.wasm
│ │ └── funcs.wasm
│ └── CMakeLists.txt
├── mixcall
│ ├── mixcallTestData
│ │ ├── module1.wasm
│ │ ├── module2.wasm
│ │ └── module2.wat
│ └── CMakeLists.txt
├── po
│ ├── gtest.cpp
│ └── CMakeLists.txt
├── common
│ └── CMakeLists.txt
├── errinfo
│ └── CMakeLists.txt
├── memlimit
│ └── CMakeLists.txt
├── span
│ └── CMakeLists.txt
├── plugins
│ ├── wasmedge_httpsreq
│ │ └── CMakeLists.txt
│ ├── wasmedge_process
│ │ └── CMakeLists.txt
│ ├── CMakeLists.txt
│ └── wasi_crypto
│ │ └── CMakeLists.txt
├── executor
│ └── CMakeLists.txt
├── host
│ ├── wasi
│ │ └── CMakeLists.txt
│ └── socket
│ │ └── CMakeLists.txt
└── thread
│ └── CMakeLists.txt
├── examples
├── js
│ ├── hello.js
│ ├── qjs.wasm
│ └── qjs_tf.wasm
├── plugin
│ ├── wasi-crypto-signature
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ └── get-string
│ │ ├── test.wasm
│ │ └── CMakeLists.txt
├── capi
│ ├── host_functions
│ │ └── parse_json
│ │ │ ├── test.json
│ │ │ ├── parse-json.wasm
│ │ │ ├── parse-json.wat
│ │ │ ├── Makefile
│ │ │ └── README.md
│ ├── wasi-env
│ │ ├── wasi_get_env.wasm
│ │ └── rust
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ └── lib.rs
│ └── mandelbrot-set-in-threads
│ │ ├── mandelbrot.wasm
│ │ ├── output-node.png
│ │ ├── output-wasmedge.png
│ │ ├── convert.js
│ │ ├── worker.js
│ │ └── Makefile
├── wasm
│ ├── add.wasm
│ ├── hello.wasm
│ ├── factorial.wasm
│ ├── fibonacci.wasm
│ ├── factorial.wat
│ └── fibonacci.wat
└── embed_cxx
│ ├── script
│ ├── fibonacci.cpp
│ ├── fibonacci.h
│ └── CMakeLists.txt
│ └── README.md
├── bindings
├── java
│ ├── wasmedge-java
│ │ ├── settings.gradle
│ │ ├── src
│ │ │ ├── main
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── wasmedge
│ │ │ │ │ ├── Result.java
│ │ │ │ │ ├── WasmEdgeValue.java
│ │ │ │ │ ├── WrapFunction.java
│ │ │ │ │ ├── HostFunction.java
│ │ │ │ │ ├── enums
│ │ │ │ │ ├── CompilerOutputFormat.java
│ │ │ │ │ ├── HostRegistration.java
│ │ │ │ │ ├── Proposal.java
│ │ │ │ │ ├── ExternalType.java
│ │ │ │ │ ├── RefType.java
│ │ │ │ │ ├── WasmEdgeMutability.java
│ │ │ │ │ └── ValueType.java
│ │ │ │ │ ├── NativeResource.java
│ │ │ │ │ ├── ValidatorContext.java
│ │ │ │ │ ├── CompilerContext.java
│ │ │ │ │ ├── ASTModuleContext.java
│ │ │ │ │ ├── VMContext.java
│ │ │ │ │ ├── LoaderContext.java
│ │ │ │ │ ├── StoreContext.java
│ │ │ │ │ ├── MemoryTypeContext.java
│ │ │ │ │ ├── WasmEdgeI32Value.java
│ │ │ │ │ ├── WasmEdgeI64Value.java
│ │ │ │ │ ├── WasmEdgeF32Value.java
│ │ │ │ │ ├── WasmEdgeF64Value.java
│ │ │ │ │ ├── WasmEdgeFuncRef.java
│ │ │ │ │ ├── TableTypeContext.java
│ │ │ │ │ └── StatisticsContext.java
│ │ │ └── test
│ │ │ │ ├── resources
│ │ │ │ └── apiTestData
│ │ │ │ │ ├── fibonacci.wasm
│ │ │ │ │ ├── test.wasm
│ │ │ │ │ └── import.wasm
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── wasmedge
│ │ │ │ ├── ValueTest.java
│ │ │ │ ├── ASTModuleContextTest.java
│ │ │ │ ├── MemoryTypeContextTest.java
│ │ │ │ ├── WasmEdgeTest.java
│ │ │ │ ├── GlobalTypeContextTest.java
│ │ │ │ └── ValidatorContextTest.java
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ └── build.gradle
│ └── wasmedge-jni
│ │ ├── wasmedge-version.properties.in
│ │ ├── README.md
│ │ ├── lib
│ │ ├── ValueType.h
│ │ ├── WasmEdgeAsync.h
│ │ ├── ConfigureContext.h
│ │ ├── AstModuleContext.h
│ │ ├── ExportTypeContext.h
│ │ ├── ImportTypeContext.h
│ │ ├── StatisticsContext.h
│ │ ├── StoreContext.h
│ │ ├── GlobalInstanceContext.h
│ │ ├── TableTypeContext.h
│ │ ├── GlobalTypeContext.h
│ │ ├── MemoryTypeContext.h
│ │ ├── TableInstanceContext.h
│ │ ├── MemoryInstanceContext.h
│ │ ├── ModuleInstanceContext.h
│ │ ├── ExternRef.c
│ │ ├── FunctionTypeInstance.h
│ │ └── VmContext.c
│ │ └── jni
│ │ ├── org_wasmedge_WasmEdge_LogLevel.h
│ │ └── org_wasmedge_VMContext.h
└── rust
│ ├── wasmedge-sys
│ ├── tests
│ │ └── data
│ │ │ ├── fibonacci.wasm
│ │ │ ├── test.wasm
│ │ │ ├── import.wasm
│ │ │ └── fibonacci.wat
│ ├── examples
│ │ ├── data
│ │ │ ├── fibonacci.wasm
│ │ │ ├── funcs.wasm
│ │ │ ├── module1.wasm
│ │ │ ├── module2.wasm
│ │ │ ├── wasi_print_env.wasm
│ │ │ ├── funcs.wat
│ │ │ ├── fibonacci.wat
│ │ │ └── module2.wat
│ │ └── wasi_print_env
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ └── lib.rs
│ ├── src
│ │ └── instance
│ │ │ └── mod.rs
│ ├── README_zh.md
│ └── CONTRIBUTION.md
│ ├── wasmedge-sdk
│ ├── examples
│ │ └── data
│ │ │ ├── funcs.wasm
│ │ │ └── mandelbrot.wasm
│ ├── src
│ │ ├── externals
│ │ │ └── mod.rs
│ │ ├── plugin.rs
│ │ ├── log.rs
│ │ └── utils.rs
│ └── CHANGELOG.md
│ ├── Cargo.toml
│ ├── wasmedge-macro
│ ├── CHANGELOG.md
│ ├── README.md
│ └── Cargo.toml
│ └── wasmedge-types
│ ├── CHANGELOG.md
│ ├── README.md
│ └── Cargo.toml
├── .rustfmt.toml
├── lib
├── host
│ └── CMakeLists.txt
├── api
│ └── libwasmedge.lds
├── po
│ └── CMakeLists.txt
├── validator
│ └── CMakeLists.txt
├── vm
│ └── CMakeLists.txt
├── system
│ └── CMakeLists.txt
├── plugin
│ └── CMakeLists.txt
├── CMakeLists.txt
├── common
│ └── log.cpp
├── aot
│ └── blake3.cpp
├── executor
│ ├── CMakeLists.txt
│ └── instantiate
│ │ └── table.cpp
├── driver
│ └── CMakeLists.txt
└── loader
│ ├── ast
│ └── expression.cpp
│ └── CMakeLists.txt
├── thirdparty
└── CMakeLists.txt
├── cmake
└── cpack_config.cmake
├── tools
├── CMakeLists.txt
├── fuzz
│ ├── tool.cpp
│ └── po.cpp
└── wasmedge
│ ├── wasmedger.cpp
│ └── wasmedgec.cpp
├── rpm
└── CMakeLists.txt
├── include
├── common
│ ├── expected.h
│ └── span.h
├── host
│ └── wasi
│ │ ├── wasimodule.h
│ │ ├── wasibase.h
│ │ ├── error.h
│ │ └── vfs.h
├── driver
│ ├── tool.h
│ ├── compiler.h
│ ├── fuzzPO.h
│ └── fuzzTool.h
├── system
│ └── path.h
├── aot
│ └── version.h
└── executor
│ └── engine
│ └── vector_helper.h
├── plugins
├── wasmedge_httpsreq
│ ├── httpsreqenv.h
│ ├── httpsreqmodule.h
│ ├── httpsreqbase.h
│ └── httpsreqmodule.cpp
├── wasi_nn
│ ├── wasinnmodule.h
│ ├── wasinnbase.h
│ └── wasinnmodule.cpp
├── wasmedge_process
│ ├── processmodule.h
│ └── processbase.h
├── CMakeLists.txt
├── test
│ └── CMakeLists.txt
└── wasi_crypto
│ └── kx
│ └── module.cpp
├── fossa-deps.yml
└── .clang-tidy
/.github/ISSUE_TEMPLATE/general.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/book/zh/src/os.md:
--------------------------------------------------------------------------------
1 | # 操作系统
2 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | /build
2 | /debug
3 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/go.md:
--------------------------------------------------------------------------------
1 | # Go
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/os/mac.md:
--------------------------------------------------------------------------------
1 | # Mac
2 |
--------------------------------------------------------------------------------
/utils/android/app/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/utils/android/app/lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust.md:
--------------------------------------------------------------------------------
1 | # Rust
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/faq.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/linux.md:
--------------------------------------------------------------------------------
1 | # Linux
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/mac.md:
--------------------------------------------------------------------------------
1 | # Mac
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/sel4.md:
--------------------------------------------------------------------------------
1 | # seL4
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/dev/js.md:
--------------------------------------------------------------------------------
1 | # JavaScript
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/dev/kotlin.md:
--------------------------------------------------------------------------------
1 | # Kotlin
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/dev/swift.md:
--------------------------------------------------------------------------------
1 | # Swift
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 介绍
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/faq.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
--------------------------------------------------------------------------------
/utils/android/app/.idea/.name:
--------------------------------------------------------------------------------
1 | WasmEdgeApp
--------------------------------------------------------------------------------
/utils/android/app/lib/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/grain.md:
--------------------------------------------------------------------------------
1 | # Grain
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js.md:
--------------------------------------------------------------------------------
1 | # JavaScript
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/es6.md:
--------------------------------------------------------------------------------
1 | # ES6 模組
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/kotlin.md:
--------------------------------------------------------------------------------
1 | # Kotlin
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/python.md:
--------------------------------------------------------------------------------
1 | # Python
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/swift.md:
--------------------------------------------------------------------------------
1 | # Swift
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go.md:
--------------------------------------------------------------------------------
1 | # Go SDK
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/rust.md:
--------------------------------------------------------------------------------
1 | # Rust SDK
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend.md:
--------------------------------------------------------------------------------
1 | # 貢獻 WasmEdge
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro.md:
--------------------------------------------------------------------------------
1 | # 什麼是 WasmEdge
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/android.md:
--------------------------------------------------------------------------------
1 | # Android
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/windows.md:
--------------------------------------------------------------------------------
1 | # Windows
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/embed.md:
--------------------------------------------------------------------------------
1 | # 嵌入 WasmEdge 函数
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/extend.md:
--------------------------------------------------------------------------------
1 | # 为 WasmEdge 贡献代码
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks.md:
--------------------------------------------------------------------------------
1 | # 应用框架与平台
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev.md:
--------------------------------------------------------------------------------
1 | # 開發 WasmEdge 應用程式
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/as.md:
--------------------------------------------------------------------------------
1 | # AssemblyScript
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/fetch.md:
--------------------------------------------------------------------------------
1 | # Fetch API
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/networking.md:
--------------------------------------------------------------------------------
1 | # 使用網路服務
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/quickstart.md:
--------------------------------------------------------------------------------
1 | # 快速開始
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/ssr.md:
--------------------------------------------------------------------------------
1 | # 範例: React SSR
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust/command.md:
--------------------------------------------------------------------------------
1 | # 命令列接口
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust/wasi.md:
--------------------------------------------------------------------------------
1 | # 使用系統服務
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed.md:
--------------------------------------------------------------------------------
1 | # 嵌入 WasmEdge 函式
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/c/ref.md:
--------------------------------------------------------------------------------
1 | # API 完整說明文件
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/memory.md:
--------------------------------------------------------------------------------
1 | # 傳遞複雜參數
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/ref.md:
--------------------------------------------------------------------------------
1 | # API 完整說明文件
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/node.md:
--------------------------------------------------------------------------------
1 | # Node.js SDK
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/python.md:
--------------------------------------------------------------------------------
1 | # Python SDK
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks.md:
--------------------------------------------------------------------------------
1 | # 應用程式框架與平台
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/app.md:
--------------------------------------------------------------------------------
1 | # 應用程式框架
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/app/yomo.md:
--------------------------------------------------------------------------------
1 | # YoMo
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/demo.md:
--------------------------------------------------------------------------------
1 | # Demo 範例
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/embed/c/ref.md:
--------------------------------------------------------------------------------
1 | # API references
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/embed/python.md:
--------------------------------------------------------------------------------
1 | # Python SDK
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/mesh/mosn.md:
--------------------------------------------------------------------------------
1 | # MOSN
2 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: LLVM
2 | IndentWidth: 2
3 |
--------------------------------------------------------------------------------
/.devcontainer/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM wasmedge/wasmedge:latest
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/npm.md:
--------------------------------------------------------------------------------
1 | # NodeJS & NPM 模組
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/rust.md:
--------------------------------------------------------------------------------
1 | # 使用 Rust 實作 JS API
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust/bindgen.md:
--------------------------------------------------------------------------------
1 | # rustwasmc
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust/networking.md:
--------------------------------------------------------------------------------
1 | # 使用網路服務
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/app.md:
--------------------------------------------------------------------------------
1 | # 嵌入 WASM 應用程式
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/function.md:
--------------------------------------------------------------------------------
1 | # 嵌入 WASM 函式
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/build_on_mac.md:
--------------------------------------------------------------------------------
1 | # 在 Mac 上編譯
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/plugin.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 外掛 API
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/app/reactr.md:
--------------------------------------------------------------------------------
1 | # Reactr
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/mesh/dapr.md:
--------------------------------------------------------------------------------
1 | # Dapr
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/mesh/mosn.md:
--------------------------------------------------------------------------------
1 | # MOSN
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless/aws.md:
--------------------------------------------------------------------------------
1 | # AWS
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/integrations.md:
--------------------------------------------------------------------------------
1 | # 與第三方框架結合
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/cri.md:
--------------------------------------------------------------------------------
1 | # CRI runtimes
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/cri/crio.md:
--------------------------------------------------------------------------------
1 | # CRI-O
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/quickstart.md:
--------------------------------------------------------------------------------
1 | # 快速開始
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/openharmony.md:
--------------------------------------------------------------------------------
1 | # Open Harmony
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/serverless/aws.md:
--------------------------------------------------------------------------------
1 | # AWS
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/features.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 的优势与特点
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/proprietary.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 特有的扩展
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/standard.md:
--------------------------------------------------------------------------------
1 | # WebAssembly 的标准扩展
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/container/runc.md:
--------------------------------------------------------------------------------
1 | # runc
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/container/youki.md:
--------------------------------------------------------------------------------
1 | # youki
2 |
--------------------------------------------------------------------------------
/.gitattribute:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.wasm -text
3 | *.png -text
4 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/js/tensorflow.md:
--------------------------------------------------------------------------------
1 | # 使用 Tensorflow
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/dev/rust/tensorflow.md:
--------------------------------------------------------------------------------
1 | # 使用 Tensorflow
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/bindgen.md:
--------------------------------------------------------------------------------
1 | # 使用 wasm-bindgen
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/embed/go/tensorflow.md:
--------------------------------------------------------------------------------
1 | # 使用 Tensorflow
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/features.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 的優勢與特色
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/proprietary.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 特有的擴充
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/standard.md:
--------------------------------------------------------------------------------
1 | # WebAssembly 標準擴充
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/container.md:
--------------------------------------------------------------------------------
1 | # Runtimes 容器
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/container/crun.md:
--------------------------------------------------------------------------------
1 | # crun
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/container/runc.md:
--------------------------------------------------------------------------------
1 | # runc
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/container/youki.md:
--------------------------------------------------------------------------------
1 | # youki
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/demo/server.md:
--------------------------------------------------------------------------------
1 | # HTTP 伺服器範例
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/demo/wasi.md:
--------------------------------------------------------------------------------
1 | # 基本 Wasm 範例
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes.md:
--------------------------------------------------------------------------------
1 | # Kubernetes
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/kind.md:
--------------------------------------------------------------------------------
1 | # KinD
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os/raspberrypi.md:
--------------------------------------------------------------------------------
1 | # Raspberry Pi 3/4
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/start/universal.md:
--------------------------------------------------------------------------------
1 | # 通用 Wasm binary 格式
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/serverless/netlify.md:
--------------------------------------------------------------------------------
1 | # Netlify
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/serverless/tencent.md:
--------------------------------------------------------------------------------
1 | # Tencent
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/serverless/vercel.md:
--------------------------------------------------------------------------------
1 | # Vercel
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/integrations.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 特有的集成
2 |
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readNameTest.bin:
--------------------------------------------------------------------------------
1 | test Loader
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/build_for_android.md:
--------------------------------------------------------------------------------
1 | # 為 Android 編譯
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/build_on_windows.md:
--------------------------------------------------------------------------------
1 | # 在 Windows 上編譯
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/mesh.md:
--------------------------------------------------------------------------------
1 | # Service mesh 與分散式框架
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless.md:
--------------------------------------------------------------------------------
1 | # Serverless 平台
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless/netlify.md:
--------------------------------------------------------------------------------
1 | # Netlify
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless/tencent.md:
--------------------------------------------------------------------------------
1 | # Tencent
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless/vercel.md:
--------------------------------------------------------------------------------
1 | # Vercel
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes.md:
--------------------------------------------------------------------------------
1 | # 在 Kubernetes 使用 WasmEdge
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/cri/containerd.md:
--------------------------------------------------------------------------------
1 | # containerd
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/kubeedge.md:
--------------------------------------------------------------------------------
1 | # KubeEdge
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/openyurt.md:
--------------------------------------------------------------------------------
1 | # OpenYurt
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/mesh/eventmesh.md:
--------------------------------------------------------------------------------
1 | # Apache EventMesh
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes.md:
--------------------------------------------------------------------------------
1 | # 用 Kubernetes 管理 WasmEdge 应用
2 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/kubernetes/superedge.md:
--------------------------------------------------------------------------------
1 | # SuperEdge
2 |
--------------------------------------------------------------------------------
/examples/js/hello.js:
--------------------------------------------------------------------------------
1 | args = args.slice(1)
2 | print("Hello",...args)
--------------------------------------------------------------------------------
/examples/plugin/wasi-crypto-signature/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .cargo/
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/plugin/externref.md:
--------------------------------------------------------------------------------
1 | # External references
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/extend/plugin/hostfunction.md:
--------------------------------------------------------------------------------
1 | # Host functions
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/mesh/eventmesh.md:
--------------------------------------------------------------------------------
1 | # Apache EventMesh
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/superedge.md:
--------------------------------------------------------------------------------
1 | # SuperEdge
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/frameworks/serverless/secondstate.md:
--------------------------------------------------------------------------------
1 | # Second State
2 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/frameworks/mesh/mosn.md:
--------------------------------------------------------------------------------
1 | # MOSN
2 |
3 | Coming soon.
4 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'wasmedge-java'
2 |
3 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/kubernetes-crio.md:
--------------------------------------------------------------------------------
1 | # Kubernetes + CRI-O
2 |
--------------------------------------------------------------------------------
/examples/capi/host_functions/parse_json/test.json:
--------------------------------------------------------------------------------
1 | {
2 | "testValue": "Success"
3 | }
--------------------------------------------------------------------------------
/docs/architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/architecture.png
--------------------------------------------------------------------------------
/docs/book/en/src/contribute/internal.md:
--------------------------------------------------------------------------------
1 | # WasmEdge Internal
2 |
3 | Work in progress.
4 |
--------------------------------------------------------------------------------
/examples/js/qjs.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/js/qjs.wasm
--------------------------------------------------------------------------------
/utils/android/app/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/wasmedge-version.properties.in:
--------------------------------------------------------------------------------
1 | wasmedge.version=${WasmEdge_VERSION}
2 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/kubernetes/kubernetes/kubernetes-containerd.md:
--------------------------------------------------------------------------------
1 | # Kubernetes + containerd
2 |
--------------------------------------------------------------------------------
/docs/wasmedge_logo.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/wasmedge_logo.jpeg
--------------------------------------------------------------------------------
/examples/js/qjs_tf.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/js/qjs_tf.wasm
--------------------------------------------------------------------------------
/examples/wasm/add.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/wasm/add.wasm
--------------------------------------------------------------------------------
/utils/corpus/po/add.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/add.txt
--------------------------------------------------------------------------------
/utils/witx-doc/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | /target
3 | Cargo.lock
4 |
--------------------------------------------------------------------------------
/.rustfmt.toml:
--------------------------------------------------------------------------------
1 | format_macro_matchers = true
2 | imports_granularity = "Crate"
3 | edition = "2018"
4 |
--------------------------------------------------------------------------------
/examples/wasm/hello.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/wasm/hello.wasm
--------------------------------------------------------------------------------
/utils/corpus/po/help.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/help.txt
--------------------------------------------------------------------------------
/utils/corpus/po/simple.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/simple.txt
--------------------------------------------------------------------------------
/utils/corpus/po/disable1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/disable1.txt
--------------------------------------------------------------------------------
/utils/corpus/po/enable1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/enable1.txt
--------------------------------------------------------------------------------
/utils/corpus/po/enable2.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/enable2.txt
--------------------------------------------------------------------------------
/utils/corpus/po/reactor.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/reactor.txt
--------------------------------------------------------------------------------
/utils/corpus/po/version.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/version.txt
--------------------------------------------------------------------------------
/docs/wasmedge-runtime-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/wasmedge-runtime-logo.png
--------------------------------------------------------------------------------
/examples/wasm/factorial.wasm:
--------------------------------------------------------------------------------
1 | asm ` fac
2 | AHA Ak l name fac
--------------------------------------------------------------------------------
/test/api/apiTestData/test.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/api/apiTestData/test.wasm
--------------------------------------------------------------------------------
/utils/corpus/po/gas-limit1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/gas-limit1.txt
--------------------------------------------------------------------------------
/utils/corpus/po/gas-limit2.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/gas-limit2.txt
--------------------------------------------------------------------------------
/utils/corpus/po/time-limit1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/time-limit1.txt
--------------------------------------------------------------------------------
/utils/corpus/po/time-limit2.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/time-limit2.txt
--------------------------------------------------------------------------------
/docs/witx/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 |
3 | # ignore generated markdown files
4 | /*.md
5 |
--------------------------------------------------------------------------------
/examples/wasm/fibonacci.wasm:
--------------------------------------------------------------------------------
1 | asm ` fib
2 | AH@A Ak Ak j name fib n
--------------------------------------------------------------------------------
/test/api/apiTestData/import.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/api/apiTestData/import.wasm
--------------------------------------------------------------------------------
/test/expected/main.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: CC0-1.0
2 | #define CATCH_CONFIG_MAIN
3 | #include "catch.hpp"
4 |
--------------------------------------------------------------------------------
/examples/plugin/get-string/test.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/plugin/get-string/test.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/c.md:
--------------------------------------------------------------------------------
1 | # C
2 |
3 | A simple example for compiling C code into WebAssembly is [SIMD](c/simd.md).
4 |
--------------------------------------------------------------------------------
/docs/book/zh/src/os/wasmedge-sel4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/book/zh/src/os/wasmedge-sel4.png
--------------------------------------------------------------------------------
/test/api/apiTestData/fibonacci.wasm:
--------------------------------------------------------------------------------
1 | asm ` fib
2 | AH@A Ak Ak j name fib n
--------------------------------------------------------------------------------
/utils/corpus/po/memory-page-limit1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/memory-page-limit1.txt
--------------------------------------------------------------------------------
/utils/corpus/po/memory-page-limit2.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/corpus/po/memory-page-limit2.txt
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/Result.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class Result {
4 | }
5 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/book/en/src/use_cases/kubernetes.png
--------------------------------------------------------------------------------
/docs/book/zh/src/os/windows.md:
--------------------------------------------------------------------------------
1 | # Windows
2 |
3 | WasmEdge 提供了一个标准的 Windows PowerShell 二进制构建程序作为其官方发布包的一部分。你可以通过我们的标准安装脚本来安装它。
4 |
--------------------------------------------------------------------------------
/examples/capi/host_functions/parse_json/parse-json.wasm:
--------------------------------------------------------------------------------
1 | asm `ooexternfunc-parse-json
parseJson
2 |
--------------------------------------------------------------------------------
/examples/capi/wasi-env/wasi_get_env.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/capi/wasi-env/wasi_get_env.wasm
--------------------------------------------------------------------------------
/test/externref/externrefTestData/stl.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/externref/externrefTestData/stl.wasm
--------------------------------------------------------------------------------
/test/mixcall/mixcallTestData/module1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/mixcall/mixcallTestData/module1.wasm
--------------------------------------------------------------------------------
/test/mixcall/mixcallTestData/module2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/mixcall/mixcallTestData/module2.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/javascript.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/book/en/src/write_wasm/javascript.png
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readF32Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readF32Test.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readF64Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readF64Test.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS32Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS32Test.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS64Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS64Test.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU32Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU32Test.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU64Test.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU64Test.bin
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | WasmEdgeApp
3 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/tests/data/fibonacci.wasm:
--------------------------------------------------------------------------------
1 | asm ` fib
2 | AH@A Ak Ak j name fib n
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readByteTest.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readByteTest.bin
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/examples/data/funcs.wasm:
--------------------------------------------------------------------------------
1 | asm `o
extern_moduleadd call_add memory
2 |
3 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/fibonacci.wasm:
--------------------------------------------------------------------------------
1 | asm ` fib
2 | AH@A Ak Ak j name fib n
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/funcs.wasm:
--------------------------------------------------------------------------------
1 | asm `o
extern_moduleadd call_add memory
2 |
3 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/tests/data/test.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sys/tests/data/test.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/sdk/python.md:
--------------------------------------------------------------------------------
1 | # WasmEdge Python SDK
2 |
3 | Coming soon, or you can [help out](https://github.com/WasmEdge/WasmEdge/pull/633).
4 |
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/swift.md:
--------------------------------------------------------------------------------
1 | # Swift
2 |
3 | The [swiftwasm](https://swiftwasm.org/) project compiles Swift source code to WebAssembly.
4 |
--------------------------------------------------------------------------------
/utils/witx-doc/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "witx-doc"
3 | version = "0.0.0"
4 | edition = "2018"
5 |
6 | [dependencies]
7 | witx = "0.9.0"
8 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/tests/data/import.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sys/tests/data/import.wasm
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS32TestTooLarge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS32TestTooLarge.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS32TestTooLong.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS32TestTooLong.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS64TestTooLarge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS64TestTooLarge.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readS64TestTooLong.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readS64TestTooLong.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU32TestTooLarge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU32TestTooLarge.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU32TestTooLong.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU32TestTooLong.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU64TestTooLarge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU64TestTooLarge.bin
--------------------------------------------------------------------------------
/test/loader/filemgrTestData/readU64TestTooLong.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/test/loader/filemgrTestData/readU64TestTooLong.bin
--------------------------------------------------------------------------------
/utils/android/app/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/module1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sys/examples/data/module1.wasm
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/module2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sys/examples/data/module2.wasm
--------------------------------------------------------------------------------
/lib/host/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | add_subdirectory(wasi)
5 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/resources/apiTestData/fibonacci.wasm:
--------------------------------------------------------------------------------
1 | asm ` fib
2 | AH@A Ak Ak j name fib n
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/examples/data/mandelbrot.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sdk/examples/data/mandelbrot.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/container/runc.md:
--------------------------------------------------------------------------------
1 | # runc
2 |
3 | Coming soon, or you can [help out](https://github.com/WasmEdge/WasmEdge/issues/639)
4 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/container/youki.md:
--------------------------------------------------------------------------------
1 | # youki
2 |
3 | Coming soon, or you can [help out](https://github.com/WasmEdge/WasmEdge/issues/664)
4 |
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/mandelbrot.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/capi/mandelbrot-set-in-threads/mandelbrot.wasm
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/output-node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/capi/mandelbrot-set-in-threads/output-node.png
--------------------------------------------------------------------------------
/examples/plugin/wasi-crypto-signature/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "wasi-crypto-example"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 |
--------------------------------------------------------------------------------
/.github/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | status:
3 | project:
4 | default:
5 | target: 70%
6 | threshold: 1%
7 | ignore:
8 | - "build"
9 |
--------------------------------------------------------------------------------
/lib/api/libwasmedge.lds:
--------------------------------------------------------------------------------
1 | {
2 | global:
3 | WasmEdge*;
4 | extern "C++" {
5 | WasmEdge::*
6 | };
7 |
8 | local:
9 | *;
10 | };
11 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/java/wasmedge-java/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/wasi_print_env.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/rust/wasmedge-sys/examples/data/wasi_print_env.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/contribute/build_from_src/wasmedge-sel4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/book/en/src/contribute/build_from_src/wasmedge-sel4.png
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/frameworks/mesh/eventmesh.md:
--------------------------------------------------------------------------------
1 | # Apache EventMesh
2 |
3 | Coming soon, or you can [help out](https://github.com/WasmEdge/WasmEdge/issues/632)
4 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/frameworks/serverless-wasmedge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/docs/book/en/src/use_cases/frameworks/serverless-wasmedge.png
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/output-wasmedge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/examples/capi/mandelbrot-set-in-threads/output-wasmedge.png
--------------------------------------------------------------------------------
/docs/book/zh/src/dev/grain.md:
--------------------------------------------------------------------------------
1 | # Grain
2 |
3 | [Grain](https://grain-lang.org/) 是为 WebAssembly 设计的强类型语言。 查看它的 [Hello world](https://grain-lang.org/docs/guide/hello_world) 示例。
4 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/docs/book/zh/src/dev/as.md:
--------------------------------------------------------------------------------
1 | # AssemblyScript
2 |
3 | [AssemblyScript](https://www.assemblyscript.org/) 是一种为 WebAssembly 设计的类 TypeScript 语言。 AssemblyScript 程序可以很容易地编译成 WebAssembly。
4 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/resources/apiTestData/test.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/java/wasmedge-java/src/test/resources/apiTestData/test.wasm
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/resources/apiTestData/import.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/bindings/java/wasmedge-java/src/test/resources/apiTestData/import.wasm
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/kotlin.md:
--------------------------------------------------------------------------------
1 | # Kotlin
2 |
3 | Check out how to [compile Kotlin programs to WebAssembly](https://blog.jdriven.com/2021/04/running-kotlin-in-the-browser-with-wasm/)
4 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/bindings/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | exclude = ["build/", "utils/", "wasmedge-sys/examples/wasi_print_env"]
3 | members = ["wasmedge-sys", "wasmedge-types", "wasmedge-sdk", "wasmedge-macro"]
4 |
--------------------------------------------------------------------------------
/examples/embed_cxx/script/fibonacci.cpp:
--------------------------------------------------------------------------------
1 | #include "fibonacci.h"
2 |
3 | auto fib(int32_t n) -> int32_t {
4 | if (n < 2) {
5 | return 1;
6 | }
7 | return fib(n - 2) + fib(n - 1);
8 | }
9 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/font/WasmEdge/master/utils/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/thirdparty/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | if(WASMEDGE_BUILD_AOT_RUNTIME)
5 | add_subdirectory(blake3)
6 | endif()
7 |
--------------------------------------------------------------------------------
/test/expected/relops.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: CC0-1.0
2 | #include
3 | #include
4 |
5 | TEST(RelationOperatorsTest, RelationOperators) {
6 | // TODO
7 | }
8 |
--------------------------------------------------------------------------------
/utils/wasi-nn/test-wasinn-ubuntu-openvino.sh:
--------------------------------------------------------------------------------
1 | source /opt/intel/openvino_2021/bin/setupvars.sh
2 | ldconfig
3 | export LD_LIBRARY_PATH="$(pwd)/build/lib/api:$LD_LIBRARY_PATH"
4 |
5 | cd build
6 | ctest
7 | cd -
8 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeValue.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public interface WasmEdgeValue {
6 | ValueType getType();
7 | }
8 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/README.md:
--------------------------------------------------------------------------------
1 | ### Build and install
2 | - Clone this project
3 | - Go to `WasmEdge/bindings/java/wasmedge-jni`
4 | - Run `mkdir build && cd build`
5 | - Run `cmake .. && make && make install`
6 |
7 |
--------------------------------------------------------------------------------
/test/expected/gtest.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: CC0-1.0
2 | #include
3 |
4 | GTEST_API_ int main(int argc, char **argv) {
5 | testing::InitGoogleTest(&argc, argv);
6 | return RUN_ALL_TESTS();
7 | }
8 |
--------------------------------------------------------------------------------
/utils/android/app/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/utils/android/app/lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/grain.md:
--------------------------------------------------------------------------------
1 | # Grain
2 |
3 | [Grain](https://grain-lang.org/) is a strongly typed languages designed for WebAssembly. Checkout its [Hello world](https://grain-lang.org/docs/guide/hello_world) example.
4 |
--------------------------------------------------------------------------------
/docs/book/en/src/write_wasm/as.md:
--------------------------------------------------------------------------------
1 | # AssemblyScript
2 |
3 | [AssemblyScript](https://www.assemblyscript.org/) is a TypeScript-like language designed for WebAssembly. AssemblyScript programs can be easily compiled into WebAssembly.
4 |
--------------------------------------------------------------------------------
/docs/book/en/src/contribute/build_from_src/openharmony.md:
--------------------------------------------------------------------------------
1 | # Build WasmEdge for Open Harmony
2 |
3 | WIP. For Chinese speakers, please [check out this instruction](https://github.com/WasmEdge/WasmEdge/blob/master/utils/ohos/README-zh.md).
4 |
--------------------------------------------------------------------------------
/utils/android/app/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.build-gcc:
--------------------------------------------------------------------------------
1 | ARG BASE=wasmedge/wasmedge:ubuntu-base
2 | FROM ${BASE}
3 |
4 | RUN apt update && apt install -y \
5 | gcc \
6 | g++
7 |
8 | RUN rm -rf /var/lib/apt/lists/*
9 |
10 | ENV CC=gcc
11 | ENV CXX=g++
12 |
--------------------------------------------------------------------------------
/cmake/cpack_config.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | if(CPACK_GENERATOR STREQUAL "DEB")
5 | else()
6 | list(REMOVE_ITEM CPACK_COMPONENTS_ALL "static_debian")
7 | endif()
8 |
--------------------------------------------------------------------------------
/examples/capi/wasi-env/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "wasi-get-env"
3 | version = "0.1.0"
4 | authors = ["YiYing He "]
5 | edition = "2018"
6 |
7 | [lib]
8 | crate-type = ["cdylib"]
9 |
10 | [dependencies]
11 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WrapFunction.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import java.util.List;
4 |
5 | public interface WrapFunction {
6 | void apply(List params, List returns);
7 | }
8 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/ValueTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Test;
4 |
5 | public class ValueTest extends BaseTest {
6 |
7 | @Test
8 | public void testValue() {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/src/externals/mod.rs:
--------------------------------------------------------------------------------
1 | mod function;
2 | mod global;
3 | mod memory;
4 | mod table;
5 |
6 | pub use function::{Func, FuncRef, FuncTypeBuilder};
7 | pub use global::Global;
8 | pub use memory::Memory;
9 | pub use table::Table;
10 |
--------------------------------------------------------------------------------
/examples/capi/host_functions/parse_json/parse-json.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (func $i (import "extern" "func-parse-json") (param externref) (result externref) )
3 | (func (export "parseJson") (param externref) (result externref)
4 | local.get 0
5 | call $i
6 | )
7 | )
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.build-clang:
--------------------------------------------------------------------------------
1 | ARG BASE=wasmedge/wasmedge:ubuntu-base
2 | FROM ${BASE}
3 |
4 | RUN apt update && apt install -y \
5 | clang-12
6 |
7 | RUN rm -rf /var/lib/apt/lists/*
8 |
9 | ENV CC=/usr/bin/clang-12
10 | ENV CXX=/usr/bin/clang++-12
11 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/container.md:
--------------------------------------------------------------------------------
1 | # 容器运行时
2 |
3 | 容器镜像可以由任何与开放容器标准(OCI)兼容的容器运行时(runtime)启动,例如:
4 |
5 | * [crun](container/crun.md):高性能的轻量级容器运行时,用 C 语言编写
6 | * [runc](container/runc.md):应用广泛的容器运行时,用 Go 语言编写
7 | * [youki](container/youki.md):兼容 OCI 的容器运行时实现,用 Rust 编写
8 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/HostFunction.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import java.util.List;
4 |
5 | public interface HostFunction {
6 | Result apply(MemoryInstanceContext mem, List params, List returns);
7 | }
8 |
--------------------------------------------------------------------------------
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | if(WASMEDGE_BUILD_TOOLS)
5 | add_subdirectory(wasmedge)
6 | endif()
7 | if(WASMEDGE_BUILD_FUZZING)
8 | add_subdirectory(fuzz)
9 | endif()
10 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/lib/po/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgePO
5 | argument_parser.cpp
6 | )
7 |
8 | target_link_libraries(wasmedgePO
9 | PUBLIC
10 | wasmedgeCommon
11 | )
12 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Set update schedule for GitHub Actions
2 |
3 | version: 2
4 | updates:
5 |
6 | - package-ecosystem: "github-actions"
7 | directory: "/"
8 | schedule:
9 | # Check for updates to GitHub Actions every week
10 | interval: "weekly"
11 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/os.md:
--------------------------------------------------------------------------------
1 | # 作業系統支援
2 |
3 | WasmEdge 支援數種作業系統及硬體平台,使得 WebAssembly bytecode 應用程式可以移植到不同的平台上。
4 | WasmEdge 不僅能執行於 Linux-like 系統中,也能在像是 seL4 這類型的 microkernel 上運作。
5 |
6 | WasmEdge 目前支援:
7 |
8 | * Linux
9 | * Windows
10 | * macOS
11 | * seL4
12 | * OpenHarmony(進行中)
13 |
--------------------------------------------------------------------------------
/docs/book/zh/src/extend/plugin.md:
--------------------------------------------------------------------------------
1 | # WasmEdge 插件 API
2 |
3 | WasmEdge 提供了一套基于 C++ 的 API 用来注册自定义扩展和 host 函数。虽然 WasmEdge 的各种语言 SDK 允许将主机应用注册为主机功能函数,但插件 API 方式允许这种扩展被纳入 WasmEdge 自己的构建和发布过程。
4 |
5 | 事实上,WasmEdge 对 Tensorflow 、图像处理、键值存储等的扩展都是通过插件 API 实现的。插件 API 是你可以为 WasmEdge Runtime 本身贡献新功能的方式。
6 |
--------------------------------------------------------------------------------
/test/po/gtest.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include
5 |
6 | GTEST_API_ int main(int argc, char **argv) {
7 | testing::InitGoogleTest(&argc, argv);
8 | return RUN_ALL_TESTS();
9 | }
10 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | /target
3 | Cargo.lock
4 | typenames.witx
5 | proposal_kx.witx
6 | proposal_asymmetric_common.witx
7 | proposal_common.witx
8 | proposal_signatures.witx
9 | proposal_symmetric.witx
10 | proposal_external_secrets.witx
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/cri.md:
--------------------------------------------------------------------------------
1 | # CRI runtimes
2 |
3 | 高级容器运行时,例如 [CRI-O](https://cri-o.io/) 和 [containerd](https://containerd.io/),从注册表拉取容器镜像(例如,Docker Hub),在磁盘上管理这些镜像,并启动一个低级容器运行时来运行容器进程。
4 | 在本章节中,你可以看到一些针对 CRI-O 和 containerd 的具体教程。
5 |
6 | * [CRI-O](cri/crio.md)
7 | * [containerd](cri/containerd.md)
8 |
--------------------------------------------------------------------------------
/examples/capi/host_functions/parse_json/Makefile:
--------------------------------------------------------------------------------
1 | CC = gcc
2 |
3 | all: host_function parse-json.wasm
4 |
5 | host_function: host_function.c
6 | $(CC) $^ -ljson-c -lwasmedge -o $@
7 |
8 | %.wasm: %.wat
9 | wat2wasm --enable-all $^ -o $@
10 |
11 | clean:
12 | rm -f host_function parse-json.wasm
13 |
--------------------------------------------------------------------------------
/utils/android/app/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Feb 01 23:30:37 CST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/lib/validator/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeValidator
5 | formchecker.cpp
6 | validator.cpp
7 | )
8 |
9 | target_link_libraries(wasmedgeValidator
10 | PUBLIC
11 | wasmedgeCommon
12 | )
13 |
--------------------------------------------------------------------------------
/utils/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/wasi_print_env/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | edition = "2021"
3 | name = "wasi_print_env"
4 | version = "0.1.0"
5 |
6 | [lib]
7 | crate-type = ["cdylib"]
8 |
9 | # This empty workspace is a workaround for workspace.exclude issue (https://github.com/rust-lang/cargo/issues/6745).
10 | [workspace]
11 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/ASTModuleContextTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Test;
4 |
5 | public class ASTModuleContextTest extends BaseTest {
6 |
7 | @Test
8 | public void testCreation() {
9 | ASTModuleContext astContext = new ASTModuleContext();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## Unreleased
9 |
10 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-macro/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## Unreleased
9 |
10 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-types/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## Unreleased
9 |
10 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/document_translation.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Docs Translation
3 | about: Translate the original WasmEdge Book to other languages
4 | ---
5 | ### The MD file link you want to translate (must be in English)
6 |
7 |
8 | ### Target language
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/CompilerOutputFormat.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | public enum CompilerOutputFormat {
4 | /// Native dynamic library format.
5 | WasmEdge_CompilerOutputFormat_Native,
6 | /// WebAssembly with AOT compiled codes in custom section.
7 | WasmEdge_CompilerOutputFormat_Wasm
8 | }
9 |
--------------------------------------------------------------------------------
/examples/embed_cxx/script/fibonacci.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | #if __wasi__
10 | __attribute__((export_name("fib")))
11 | #else
12 | __attribute__((visibility("default")))
13 | #endif
14 | auto fib(int32_t n) -> int32_t;
15 |
16 | #ifdef __cplusplus
17 | }
18 | #endif
19 |
--------------------------------------------------------------------------------
/examples/wasm/factorial.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (func $fac (export "fac") (param i32) (result i32)
3 | local.get 0
4 | i32.const 1
5 | i32.lt_s
6 | if (result i32)
7 | i32.const 1
8 | else
9 | local.get 0
10 | local.get 0
11 | i32.const 1
12 | i32.sub
13 | call $fac
14 | i32.mul
15 | end))
16 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-macro/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | The [wasmedge-macro](https://crates.io/crates/wasmedge-macro) crate defines a group of procedural macros used by both [wasmedge-sdk](https://crates.io/crates/wasmedge-sdk) and [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crates.
4 |
5 | See also
6 |
7 | * [WasmEdge Runtime](https://wasmedge.org/)
8 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-types/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | The [wasmedge-types](https://crates.io/crates/wasmedge-types) crate defines a group of common data structures used by both [wasmedge-rs](https://crates.io/crates/wasmedge-sdk) and [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crates.
4 |
5 | See also
6 |
7 | * [WasmEdge Runtime](https://wasmedge.org/)
8 |
--------------------------------------------------------------------------------
/utils/witx-doc/generate.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | set -x
6 |
7 | WD="$(realpath $(dirname "${BASH_SOURCE[0]}"))"
8 | ROOT="$(realpath $WD/../../)"
9 | WITX_DIR="$ROOT/docs/witx"
10 |
11 | cd $WD
12 | cargo build --release
13 | target/release/witx-doc "$WITX_DIR"
14 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ValueType.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-13.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_VALUETYPE_H
6 | #define WASMEDGE_JAVA_VALUETYPE_H
7 |
8 | WasmEdge_Value JavaValueToWasmEdgeValue(JNIEnv *env, jobject jVal);
9 | jobject WasmEdgeValueToJavaValue(JNIEnv *env, WasmEdge_Value value);
10 |
11 | #endif // WASMEDGE_JAVA_VALUETYPE_H
12 |
--------------------------------------------------------------------------------
/docs/book/en/theme/head.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/theme/head.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/docs/book/zh/theme/head.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/examples/capi/wasi-env/rust/src/lib.rs:
--------------------------------------------------------------------------------
1 | use std::env;
2 |
3 | #[no_mangle]
4 | pub fn print_env() {
5 | println!("The env vars are as follows.");
6 | for (key, value) in env::vars() {
7 | println!("{}: {}", key, value);
8 | }
9 |
10 | println!("The args are as follows.");
11 | for argument in env::args() {
12 | println!("{}", argument);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/utils/android/app/settings.gradle:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3 | repositories {
4 | google()
5 | mavenCentral()
6 | jcenter() // Warning: this repository is going to shut down soon
7 | }
8 | }
9 | rootProject.name = "WasmEdgeApp"
10 | include ':lib'
11 | include ':app'
12 |
--------------------------------------------------------------------------------
/rpm/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | set(WASMEDGE_GIT_VERSION ${CPACK_PACKAGE_VERSION})
5 |
6 | string(REPLACE "-" "~" WASMEDGE_SRPM_VERSION ${WASMEDGE_GIT_VERSION})
7 | configure_file(wasmedge.spec.in wasmedge.spec @ONLY)
8 |
9 | unset(WASMEDGE_GIT_VERSION)
10 | unset(WASMEDGE_SRPM_VERSION)
11 |
--------------------------------------------------------------------------------
/test/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeCommonTests
5 | int128Test.cpp
6 | )
7 |
8 | add_test(wasmedgeCommonTests wasmedgeCommonTests)
9 |
10 | target_link_libraries(wasmedgeCommonTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | wasmedgeCommon
14 | )
15 |
--------------------------------------------------------------------------------
/test/externref/externrefTestData/funcs.wasm:
--------------------------------------------------------------------------------
1 | asm `o`o`ooS
extern_modulefunctor_square
extern_module class_add
extern_modulefunc_mul @memory call_add call_mul call_square call_add_square
2 | /
3 |
4 | fname& functor_square class_addfunc_mul7
--------------------------------------------------------------------------------
/test/errinfo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeErrinfoTests
5 | errinfoTest.cpp
6 | )
7 |
8 | add_test(wasmedgeErrinfoTests wasmedgeErrinfoTests)
9 |
10 | target_link_libraries(wasmedgeErrinfoTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | wasmedgeCommon
14 | )
15 |
--------------------------------------------------------------------------------
/docs/book/zh/src/start/universal.md:
--------------------------------------------------------------------------------
1 | # 通用 wasm 二进制格式
2 |
3 | WasmEdge 可以将 AOT 编译的原生二进制包装到原始 wasm 文件中的自定义部分。我们将其称之为通用 wasm 二进制格式。
4 |
5 | AOT 编译的 wasm 文件与任何 wasm 运行时兼容。然而,当 WasmEdge 运行时执行此 wasm 文件时,WasmEdge 将从自定义部分中提取原生二进制并执行它。
6 |
7 | 当然,用户仍然可以选择使用 `wasmedgec` AOT 编译器生成原生二进制文件。
8 | WasmEdge 将以输出文件扩展名来确定生成的文件格式。举例来说,如果你将 `wasmedgec` 的输出文件扩展名设置为 `.so`,它将生成 Linux 共享库格式的原生二进制文件;否则,它将默认生成一个通用的 wasm 二进制文件。
9 |
--------------------------------------------------------------------------------
/test/api/apiTestData/fibonacci.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (export "fib" (func $fib))
3 | (func $fib (param $n i32) (result i32)
4 | (if (i32.lt_s (get_local $n) (i32.const 2)) (return (i32.const 1)))
5 | (return
6 | (i32.add
7 | (call $fib (i32.sub (get_local $n) (i32.const 2)))
8 | (call $fib (i32.sub (get_local $n) (i32.const 1)))
9 | )
10 | )
11 | )
12 | )
13 |
--------------------------------------------------------------------------------
/test/memlimit/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeMemLimitTests
5 | MemLimitTest.cpp
6 | )
7 |
8 | add_test(wasmedgeMemLimitTests wasmedgeMemLimitTests)
9 |
10 | target_link_libraries(wasmedgeMemLimitTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | wasmedgeVM
14 | )
15 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/use/saas.md:
--------------------------------------------------------------------------------
1 | # SaaS 里的嵌入式函数
2 |
3 | WasmEdge 可以使用 Serverless 函数而不是传统的网络 API 来支持定制的 SaaS 扩展或应用程序。这极大地提高了 SaaS 用户和开发者的生产力。
4 |
5 | ## Slack
6 |
7 | * [为 Slack 创建 serverless 聊天机器人](http://reactor.secondstate.info/en/docs/user_guideline.html)
8 |
9 | ## 飞书
10 |
11 | 飞书为字节跳动旗下的聊天软件。
12 |
13 | * [为飞书创建 serverless 聊天机器人](http://reactor.secondstate.info/zh/docs/user_guideline.html)
14 |
--------------------------------------------------------------------------------
/lib/vm/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeVM
5 | vm.cpp
6 | )
7 |
8 | target_link_libraries(wasmedgeVM
9 | PUBLIC
10 | wasmedgeCommon
11 | wasmedgeSystem
12 | wasmedgePlugin
13 | wasmedgeLoader
14 | wasmedgeValidator
15 | wasmedgeExecutor
16 | wasmedgeHostModuleWasi
17 | )
18 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/jni/org_wasmedge_WasmEdge_LogLevel.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class org_wasmedge_WasmEdge_LogLevel */
4 |
5 | #ifndef _Included_org_wasmedge_WasmEdge_LogLevel
6 | #define _Included_org_wasmedge_WasmEdge_LogLevel
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | #ifdef __cplusplus
11 | }
12 | #endif
13 | #endif
14 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/use/saas.md:
--------------------------------------------------------------------------------
1 | # 用於 SaaS 的互動函式
2 |
3 | WasmEdge 可以使用 Serverless 函式而不是傳統的網路 API 來支援客製化的 SaaS 擴充或應用程式。這大大地提高 SaaS 使用者和開發者的生產力。
4 |
5 | ## Slack
6 |
7 | * [為 Slack 建立 serverless 聊天機器人](http://reactor.secondstate.info/en/docs/user_guideline.html)
8 |
9 | ## 飛書
10 |
11 | 飛書為字節跳動,即抖音母公司,旗下的聊天軟體。
12 |
13 | * [為非書建立 serverless 聊天機器人](http://reactor.secondstate.info/zh/docs/user_guideline.html)
14 |
--------------------------------------------------------------------------------
/test/span/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(spanTests
5 | span.cpp
6 | )
7 |
8 | add_test(spanTests spanTests)
9 |
10 | target_link_libraries(spanTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | )
14 |
15 | target_include_directories(spanTests
16 | PRIVATE
17 | ${PROJECT_SOURCE_DIR}/include
18 | )
19 |
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.base:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | MAINTAINER hydai hydai@secondstate.io
4 | ENV DEBIAN_FRONTEND=noninteractive
5 |
6 | RUN apt update && apt upgrade -y \
7 | && apt install -y \
8 | software-properties-common \
9 | dpkg-dev \
10 | wget \
11 | cmake \
12 | ninja-build \
13 | curl \
14 | git \
15 | libboost-all-dev \
16 | llvm-12-dev \
17 | liblld-12-dev
18 |
19 | RUN rm -rf /var/lib/apt/lists/*
20 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/container.md:
--------------------------------------------------------------------------------
1 | # Container runtimes
2 |
3 | The container image can be started by any OCI-compliant container runtime, such as
4 |
5 | * [crun](container/crun.md): a high performance and lightweight container runtime written in C
6 | * [runc](container/runc.md): a widely used container runtime written in Go
7 | * [youki](container/youki.md): a OCI-compatible container runtime implementation written in Rust
8 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/demo.md:
--------------------------------------------------------------------------------
1 | # Demo 应用
2 |
3 | 在本章中,我们将介绍两个 demo 应用。 我们将从 Rust 源码进行构建,并围绕它们构建 OCI 镜像,然后将这些镜像发布到 Docker Hub。
4 |
5 | 如果你还没有这样做,请先
6 |
7 | * [安装 Rust](https://www.rust-lang.org/tools/install)
8 | * [注册 Docker Hub](https://hub.docker.com/)
9 |
10 | 接下来,探索示例
11 |
12 | * [一个简单的 WASI 示例](demo/wasi.md)
13 | * [一个 HTTP 服务器示例](demo/server.md)
14 |
15 | 由于我们已经在 Docker Hub 上构建并发布了这些 demo 应用,你也可以直接进入容器运行时部分来使用这些镜像。
16 |
--------------------------------------------------------------------------------
/test/plugins/wasmedge_httpsreq/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeHttpsReqTests
5 | httpsreq.cpp
6 | )
7 |
8 | target_link_libraries(wasmedgeHttpsReqTests
9 | PRIVATE
10 | ${GTEST_BOTH_LIBRARIES}
11 | wasmedgePlugin
12 | wasmedgePluginHttpsReq
13 | )
14 |
15 | add_test(wasmedgeHttpsReqTests wasmedgeHttpsReqTests)
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/WasmEdgeAsync.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by elfgum on 2022/8/1.
3 | //
4 |
5 | #ifndef WASMEDGE_JNI_WASMEDGEASYNC_H
6 | #define WASMEDGE_JNI_WASMEDGEASYNC_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | WasmEdge_Async *getAsync(JNIEnv *env, jobject thisObject);
12 |
13 | jobject createJAsyncObject(JNIEnv *env, const WasmEdge_Async *asyncObj);
14 | #endif // WASMEDGE_JNI_WASMEDGEASYNC_H
15 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/funcs.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (type $t1 (func (param externref i32 i32) (result i32)))
3 | (import "extern_module" "add" (func $add (type $t1)))
4 | (func $call_add (export "call_add") (type $t1) (param $p0 externref) (param $p1 i32) (param $p2 i32) (result i32)
5 | (call $add
6 | (local.get $p0)
7 | (local.get $p1)
8 | (local.get $p2)))
9 | (memory $memory (export "memory") 1))
10 |
--------------------------------------------------------------------------------
/docs/book/en/src/quick_start.md:
--------------------------------------------------------------------------------
1 | # Quick Start
2 |
3 | In this chapter, we introduce how to install and run the WASM quickly with WasmEdge runtime.
4 |
5 | * [Install and uninstall](quick_start/install.md) WasmEdge on your platforms
6 | * How to [use WasmEdge Docker images](quick_start/use_docker.md)
7 | * [Execute WASM](quick_start/run_cli.md) with WasmEdge CLI
8 | * Run WASM [in Ahead-of-time (AOT) compiled mode](quick_start/run_in_aot_mode.md)
9 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/docker/containerd.md:
--------------------------------------------------------------------------------
1 | # Use the containerd shim
2 |
3 | As we discussed, wrapping WebAssembly inside a Docker Linux container results in performance and security penalties. However, we cannot easily replace the OCI runtime (`runc`) in the Docker toolchain as well. In this chapter, we will discuss another approach to start and run WebAssembly bytecode applications directly from the Docker CLI.
4 |
5 | Coming soon
6 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/docker.md:
--------------------------------------------------------------------------------
1 | # Running WasmEdge apps with the Docker CLI
2 |
3 | The Docker CLI is a very popular developer tool. However, it is not easy to replace Docker's underlying OCI runtime (`runc`) with the WasmEdge-enabled `crun`. In this section, we will discuss two ways to run WasmEdge applications in Docker.
4 |
5 | * [Wrap WasmEdge in a slim Linux container](docker/lxc.md)
6 | * [Use containerd shim](docker/containerd.md)
7 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/HostRegistration.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | public enum HostRegistration {
4 |
5 | WasmEdge_HostRegistration_Wasi(0),
6 | WasmEdge_HostRegistration_WasmEdge_Process(1);
7 |
8 | private final int val;
9 |
10 | HostRegistration(int val) {
11 | this.val = val;
12 | }
13 |
14 | public int getVal() {
15 | return val;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/test/plugins/wasmedge_process/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeProcessTests
5 | wasmedge_process.cpp
6 | )
7 |
8 | target_link_libraries(wasmedgeProcessTests
9 | PRIVATE
10 | ${GTEST_BOTH_LIBRARIES}
11 | wasmedgePlugin
12 | wasmedgePluginWasmEdgeProcess
13 | )
14 |
15 | add_test(wasmedgeProcessTests wasmedgeProcessTests)
16 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/NativeResource.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class NativeResource {
4 | private long pointer;
5 |
6 | public NativeResource() {
7 | nativeInit();
8 | }
9 |
10 | public void release() {
11 | cleanUp();
12 | pointer = 0;
13 | }
14 |
15 | protected native void nativeInit();
16 |
17 | protected native void cleanUp();
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/lib/system/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeSystem
5 | allocator.cpp
6 | fault.cpp
7 | mmap.cpp
8 | path.cpp
9 | )
10 |
11 | target_include_directories(wasmedgeSystem
12 | PUBLIC
13 | ${CMAKE_CURRENT_BINARY_DIR}
14 | )
15 |
16 | target_link_libraries(wasmedgeSystem
17 | PUBLIC
18 | wasmedgeCommon
19 | Boost::boost
20 | )
21 |
--------------------------------------------------------------------------------
/test/executor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeExecutorCoreTests
5 | ExecutorTest.cpp
6 | )
7 |
8 | add_test(wasmedgeExecutorCoreTests wasmedgeExecutorCoreTests)
9 |
10 | target_link_libraries(wasmedgeExecutorCoreTests
11 | PRIVATE
12 | std::filesystem
13 | ${GTEST_BOTH_LIBRARIES}
14 | wasmedgeTestSpec
15 | wasmedgeVM
16 | )
17 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ConfigureContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2021-11-19.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_CONFIGURECONTEXT_H
6 | #define WASMEDGE_JAVA_CONFIGURECONTEXT_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | WasmEdge_ConfigureContext *getConfigureContext(JNIEnv *env,
12 | jobject jConfigureContext);
13 |
14 | #endif // WASMEDGE_JAVA_CONFIGURECONTEXT_H
15 |
--------------------------------------------------------------------------------
/docs/book/zh/src/dev.md:
--------------------------------------------------------------------------------
1 | # 开发 WasmEdge 应用
2 |
3 | WebAssembly 的一个关键点就是它支持多种编程语言。WebAssembly 是一个可控的运行时,支持多种编程语言,包含 C/C++、 Rust、 Go、 Swift、 Kotlin、 AssemblyScript、 Grain,甚至还有 JavaScript 和 Python。
4 |
5 | * 对于编译型语言(比如 C 和 Rust)来说,WasmEdge WebAssembly 提供了一个相比于原生客户端(NaCl)更安全的、受保护的、隔离的并且容器化的运行时。
6 | * 对于解释型语言或者是受控型语言(比如 JavaScript 和 Python)来说,WasmEdge WebAssembly 提供了一个比 Docker + 客人操作系统(Guest OS) + 原生解释器这种组合更安全、快速、轻量且容器化的运行时。
7 |
8 | 在这一章中,我们将讨论如何在 WasmEdge 中运行由不同语言编写的应用程序。
9 |
--------------------------------------------------------------------------------
/utils/android/app/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/cri.md:
--------------------------------------------------------------------------------
1 | # CRI runtimes
2 |
3 | The high-level container runtime, such as [CRI-O](https://cri-o.io/) and [containerd](https://containerd.io/), pulls container images from registries (e.g., Docker Hub), manages them on disk, and launches a lower-level runtime to run container processes.
4 | From this chapter, you can check out specific tutorials for CRI-O and containerd.
5 |
6 | * [CRI-O](cri/crio.md)
7 | * [containerd](cri/containerd.md)
8 |
--------------------------------------------------------------------------------
/lib/plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgePlugin
5 | plugin.cpp
6 | )
7 |
8 | target_include_directories(wasmedgePlugin
9 | PRIVATE
10 | ${PROJECT_BINARY_DIR}/include/api
11 | ${PROJECT_SOURCE_DIR}/include/api
12 | )
13 |
14 | target_link_libraries(wasmedgePlugin
15 | PUBLIC
16 | wasmedgeCommon
17 | wasmedgeLoaderFileMgr
18 | wasmedgePO
19 | )
20 |
--------------------------------------------------------------------------------
/test/po/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(poTests
5 | gtest.cpp
6 | po.cpp
7 | help.cpp
8 | subcommand.cpp
9 | )
10 |
11 | add_test(poTests poTests)
12 |
13 | target_link_libraries(poTests
14 | PRIVATE
15 | wasmedgePO
16 | ${GTEST_BOTH_LIBRARIES}
17 | )
18 |
19 | target_include_directories(poTests
20 | PRIVATE
21 | ${PROJECT_SOURCE_DIR}/include
22 | )
23 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/AstModuleContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2021-12-20.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_ASTMODULECONTEXT_H
6 | #define WASMEDGE_JAVA_ASTMODULECONTEXT_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | WasmEdge_ASTModuleContext *getASTModuleContext(JNIEnv *env, jobject thisObject);
12 | jobject createAstModuleContext(JNIEnv *env, WasmEdge_ASTModuleContext *mod);
13 |
14 | #endif // WASMEDGE_JAVA_ASTMODULECONTEXT_H
15 |
--------------------------------------------------------------------------------
/docs/book/zh/src/os/android.md:
--------------------------------------------------------------------------------
1 | # Android
2 |
3 | 在 WasmEdge 发布版本中具有用于 Android 操作系统的预构建二进制文件。但是,WasmEdge installer 不支持 Android。 用户必须将发布文件下载到计算机,然后使用 `adb` 工具将文件传输到 Android 设备或模拟器。我们将向您展示如何做到这一点。
4 |
5 | > 如果您更喜欢自己构建适用于 Android 的 WasmEdge Runtime 二进制文件,可以参考 [build WasmEdge for Android](../extend/build_for_android.md) 文档。
6 |
7 | * [适用于 Android 的 WasmEdge CLI 工具](android/cli.md)
8 | * [从 NDK 原生应用调用 WasmEdge 函数](android/ndk.md)
9 | * [从 Android APK 应用调用 WasmEdge 函数](android/studio.md)
10 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ExportTypeContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-06.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_EXPORTTYPECONTEXT_H
6 | #define WASMEDGE_JAVA_EXPORTTYPECONTEXT_H
7 | #include "jni.h"
8 | #include "wasmedge/wasmedge.h"
9 |
10 | jobject createExportTypeContext(JNIEnv *env,
11 | const WasmEdge_ExportTypeContext *cxt,
12 | jobject jAstMo);
13 | #endif // WASMEDGE_JAVA_EXPORTTYPECONTEXT_H
14 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ImportTypeContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-06.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_IMPORTTYPECONTEXT_H
6 | #define WASMEDGE_JAVA_IMPORTTYPECONTEXT_H
7 | #include "jni.h"
8 | #include "wasmedge/wasmedge.h"
9 |
10 | jobject createImportTypeContext(JNIEnv *env,
11 | const WasmEdge_ImportTypeContext *cxt,
12 | jobject jAstMo);
13 | #endif // WASMEDGE_JAVA_IMPORTTYPECONTEXT_H
14 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/StatisticsContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-09.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_STATISTICSCONTEXT_H
6 | #define WASMEDGE_JAVA_STATISTICSCONTEXT_H
7 |
8 | WasmEdge_StatisticsContext *getStatisticsContext(JNIEnv *env, jobject jStatCxt);
9 |
10 | jobject
11 | CreateJavaStatisticsContext(JNIEnv *env,
12 | WasmEdge_StatisticsContext *statisticsContext);
13 |
14 | #endif // WASMEDGE_JAVA_STATISTICSCONTEXT_H
15 |
--------------------------------------------------------------------------------
/docs/book/en/src/cli.md:
--------------------------------------------------------------------------------
1 | # WasmEdge Command Line Tools
2 |
3 | After the [WasmEdge installataion](quick_start/install.md), the `wasmedge` and `wasmedgec` tools are installed.
4 |
5 | Users can use these WasmEdge CLI tools to execute the WebAssembly files quickly.
6 |
7 | * The [`wasmedge` CLI tool](cli/wasmedge.md) is the WebAssembly runtime to execute the WASM files.
8 | * The [`wasmedgec` CLI tool](cli/wasmedgec.md) is the ahead-of-time compiler to compile the WebAssembly file into native code.
9 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/ValidatorContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class ValidatorContext {
4 | private long pointer;
5 |
6 | public ValidatorContext(ConfigureContext configureContext) {
7 | nativeInit(configureContext);
8 | }
9 |
10 | public native void validate(ASTModuleContext astCtx);
11 |
12 | private native void nativeInit(ConfigureContext configureContext);
13 |
14 | public native void delete();
15 | }
16 |
--------------------------------------------------------------------------------
/include/common/expected.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "experimental/expected.hpp"
7 |
8 | namespace WasmEdge {
9 |
10 | /// Type aliasing of expected class.
11 | template using Expected = cxx20::expected;
12 |
13 | /// Type aliasing of unexpected class.
14 | template using Unexpected = cxx20::unexpected;
15 |
16 | } // namespace WasmEdge
17 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/CompilerContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class CompilerContext {
4 | private long pointer;
5 |
6 | public CompilerContext(ConfigureContext configureContext) {
7 | nativeInit(configureContext);
8 | }
9 |
10 | private native void nativeInit(ConfigureContext configureContext);
11 |
12 | public native void compile(String inputPath, String outputPath);
13 |
14 | public native void delete();
15 | }
16 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/Proposal.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | public enum Proposal {
4 | WasmEdge_Proposal_BulkMemoryOperations,
5 | WasmEdge_Proposal_ReferenceTypes,
6 | WasmEdge_Proposal_SIMD,
7 | WasmEdge_Proposal_TailCall,
8 | WasmEdge_Proposal_Annotations,
9 | WasmEdge_Proposal_Memory64,
10 | WasmEdge_Proposal_Threads,
11 | WasmEdge_Proposal_ExceptionHandling,
12 | WasmEdge_Proposal_FunctionReferences
13 | }
14 |
--------------------------------------------------------------------------------
/docs/book/en/src/contribute/wish_list.md:
--------------------------------------------------------------------------------
1 | # Wish list
2 |
3 | 👉 Check out our ["help wanted" issues](https://github.com/WasmEdge/WasmEdge/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)!
4 |
5 | We are also looking for developer help in the following general areas. Please [create an issue](https://github.com/WasmEdge/WasmEdge/issues) and let us know!
6 |
7 | * Improvements to technical documentation, examples, and tutorials.
8 | * Non-English language translations of documentation and tutorials.
9 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/kubernetes.md:
--------------------------------------------------------------------------------
1 | # Kubernetes
2 |
3 | 大多数高级容器运行时都实现了 Kubernetes 的 CRI(Container Runtime Interface)规范,以便能够被 Kubernetes 工具管理。这个意味着可以利用 Kubernetes 工具来管理 pod 和命名空间中 WebAssembly 应用程序镜像。
4 |
5 | 不同场景的 Kubernetes 设置具体说明如下所示:
6 |
7 | * [Kubernetes + CRI-O](kubernetes/kubernetes-crio.md)
8 | * [Kubernetes + containerd](kubernetes/kubernetes-containerd.md)
9 | * [KubeEdge](kubernetes/kubeedge.md)
10 | * [SuperEdge](kubernetes/superedge.md)
11 | * [OpenYurt](kubernetes/openyurt.md)
12 |
--------------------------------------------------------------------------------
/test/expected/constexpr.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: CC0-1.0
2 | #include
3 | #include
4 | #include
5 |
6 | TEST(ConstexprTest, Constexpr) {
7 | EXPECT_EQ(([]() { return *cxx20::expected(5); }()), 5);
8 | EXPECT_EQ(([]() { return cxx20::unexpected(3).value(); }()), 3);
9 | EXPECT_EQ(([]() {
10 | return cxx20::expected(cxx20::unexpect, 5).value_or(4);
11 | }()),
12 | 4);
13 | }
14 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/StoreContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2021-11-19.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_STORECONTEXT_H
6 | #define WASMEDGE_JAVA_STORECONTEXT_H
7 | #include "jni.h"
8 | #include "wasmedge/wasmedge.h"
9 |
10 | WasmEdge_StoreContext *getStoreContext(JNIEnv *env, jobject jStoreContext);
11 |
12 | jobject CreateJavaStoreContext(JNIEnv *env,
13 | WasmEdge_StoreContext *storeContext);
14 |
15 | #endif // WASMEDGE_JAVA_STORECONTEXT_H
16 |
--------------------------------------------------------------------------------
/tools/fuzz/tool.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "wasmedge/wasmedge.h"
5 | #include
6 |
7 | /// Entrypoint for the fuzz tool.
8 | WASMEDGE_CAPI_EXPORT extern "C" int
9 | WasmEdge_Driver_FuzzTool(const uint8_t *Data, size_t Size);
10 |
11 | extern "C" [[gnu::visibility("default")]] int
12 | LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
13 | return WasmEdge_Driver_FuzzTool(Data, Size);
14 | }
15 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-types/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | categories = ["data-structures"]
3 | description = "The common data structures for WasmEdge Rust bindings."
4 | documentation = "https://wasmedge.github.io/WasmEdge/wasmedge_types/"
5 | edition = "2021"
6 | license = "Apache-2.0"
7 | name = "wasmedge-types"
8 | readme = "README.md"
9 | repository = "https://github.com/WasmEdge/WasmEdge/tree/master/bindings/rust/wasmedge-types"
10 | version = "0.3.0"
11 |
12 | [dependencies]
13 | thiserror = "1.0.30"
14 | wat = "1.0"
15 |
--------------------------------------------------------------------------------
/docs/book/zh/src/os/raspberrypi.md:
--------------------------------------------------------------------------------
1 | # Raspberry Pi 3/4
2 |
3 | Raspberry Pi 从 3 Model B 开始就使用 64-bit 处理器。WasmEdge 能够在 arm 64-bit 上运行,所以 WasmEdge 同样能够在 Raspberry Pi 上运行。你可以选择任何 64-bit Linux 发行版本,例如 Raspbian, Ubuntu 或者支持 ARM 的 Manjaro。当前文档已经在支持 ARM 的 Manjaro 发行版本和 Raspberry Pi 3 Model B 硬件上测试可行。
4 |
5 | 在 Raspberry Pi 上的安装步骤等同于[安装文档](https://wasmedge.org/book/en/start/install.html),执行过程也一样。以下有一个视频,通过安装 WasmEdge 和运行一个简单的 WebAssembly 模块实现两数相加的功能。
6 |
7 | [](https://asciinema.org/a/458453)
8 |
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.release:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 | ARG VERSION
3 |
4 | RUN apt-get update && apt-get install -y netbase
5 | ADD WasmEdge-$VERSION-Linux.tar.gz /tmp/
6 | RUN cp -rf /tmp/WasmEdge-$VERSION-Linux/bin/* /usr/local/bin && \
7 | cp -rf /tmp/WasmEdge-$VERSION-Linux/lib64/* /usr/local/lib && \
8 | cp -rf /tmp/WasmEdge-$VERSION-Linux/include/* /usr/local/include && \
9 | ldconfig /usr/local/lib
10 | RUN rm -rf /tmp/WasmEdge-$VERSION-Linux
11 |
12 | WORKDIR /app
13 | CMD ["/usr/local/bin/wasmedge"]
14 |
--------------------------------------------------------------------------------
/.github/workflows/reusable-call-linter.yml:
--------------------------------------------------------------------------------
1 | name: Clang-Format
2 |
3 | on:
4 | workflow_call:
5 |
6 | jobs:
7 | lint:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v3
11 | with:
12 | fetch-depth: 0
13 | - name: Install clang-format-12
14 | run: |
15 | sudo apt update
16 | sudo apt install clang-format-12
17 | - name: Run clang-format
18 | run: |
19 | bash ./.github/scripts/clang-format.sh `which clang-format-12`
20 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/frameworks/serverless/tencent.md:
--------------------------------------------------------------------------------
1 | # WebAssembly serverless functions on Tencent Cloud
2 |
3 | As the main users of Tencent Cloud are from China, so the tutorial is [written in Chinese](https://my.oschina.net/u/4532842/blog/5172639).
4 |
5 | We also provide a code template for deploying serverless WebAssembly functions on Tencent Cloud, please check out [the tencent-scf-wasm-runtime repo](https://github.com/second-state/tencent-scf-wasm-runtime).
6 |
7 | Fork the repo and start writing your own rust functions.
8 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/src/plugin.rs:
--------------------------------------------------------------------------------
1 | //! Defines PluginManager struct
2 |
3 | use wasmedge_sys as sys;
4 |
5 | /// Defines the API to manage plugins.
6 | #[derive(Debug)]
7 | pub struct PluginManager {}
8 | impl PluginManager {
9 | /// Loads plugins from default paths. The default paths include:
10 | ///
11 | /// * The path specified by the `WASMEDGE_PLUGIN_PATH` environment variable.
12 | ///
13 | pub fn load_from_default_paths() {
14 | sys::utils::load_plugin_from_default_paths();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/plugins/wasmedge_httpsreq/httpsreqenv.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "plugin/plugin.h"
7 |
8 | #include
9 | #include
10 |
11 | namespace WasmEdge {
12 | namespace Host {
13 |
14 | class WasmEdgeHttpsReqEnvironment {
15 | public:
16 | std::string Rcv;
17 |
18 | /// Initial Configurations
19 | static Plugin::PluginRegister Register;
20 | };
21 |
22 | } // namespace Host
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.ubuntu2004_x86_64:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | MAINTAINER hydai hydai@secondstate.io
4 | ENV DEBIAN_FRONTEND=noninteractive
5 |
6 | RUN apt update && apt upgrade -y \
7 | && apt install -y \
8 | software-properties-common \
9 | wget \
10 | cmake \
11 | ninja-build \
12 | curl \
13 | git \
14 | dpkg-dev \
15 | libboost-all-dev \
16 | llvm-12-dev \
17 | liblld-12-dev \
18 | gcc \
19 | rpm \
20 | dpkg-dev \
21 | g++
22 |
23 | RUN rm -rf /var/lib/apt/lists/*
24 |
25 | ENV CC=gcc
26 | ENV CXX=g++
27 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/ASTModuleContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import java.util.List;
4 |
5 | public class ASTModuleContext {
6 | private long pointer;
7 |
8 | public ASTModuleContext() {
9 | }
10 |
11 | private ASTModuleContext(long pointer) {
12 | this.pointer = pointer;
13 | }
14 |
15 | public native List listImports();
16 |
17 | public native List listExports();
18 |
19 | public native void delete();
20 | }
21 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/src/instance/mod.rs:
--------------------------------------------------------------------------------
1 | //! Defines WasmEdge instance structs, including Function, Global, Memory, and Table.
2 |
3 | pub mod function;
4 | pub mod global;
5 | pub mod memory;
6 | pub mod module;
7 | pub mod table;
8 |
9 | #[doc(hidden)]
10 | pub use function::{FuncType, Function};
11 | #[doc(hidden)]
12 | pub use global::{Global, GlobalType};
13 | #[doc(hidden)]
14 | pub use memory::{MemType, Memory};
15 | #[doc(hidden)]
16 | pub use module::Instance;
17 | #[doc(hidden)]
18 | pub use table::{Table, TableType};
19 |
--------------------------------------------------------------------------------
/examples/wasm/fibonacci.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (export "fib" (func $fib))
3 | (func $fib (param $n i32) (result i32)
4 | (if
5 | (i32.lt_s
6 | (get_local $n)
7 | (i32.const 2)
8 | )
9 | (return
10 | (i32.const 1)
11 | )
12 | )
13 | (return
14 | (i32.add
15 | (call $fib
16 | (i32.sub
17 | (get_local $n)
18 | (i32.const 2)
19 | )
20 | )
21 | (call $fib
22 | (i32.sub
23 | (get_local $n)
24 | (i32.const 1)
25 | )
26 | )
27 | )
28 | )
29 | )
30 | )
31 |
--------------------------------------------------------------------------------
/test/plugins/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | if (CMAKE_SYSTEM_NAME MATCHES "Linux")
5 | add_subdirectory(wasmedge_process)
6 | endif()
7 | if (WASMEDGE_PLUGIN_WASI_NN_BACKEND)
8 | add_subdirectory(wasi_nn)
9 | endif()
10 | if(WASMEDGE_PLUGIN_HTTPSREQ)
11 | if(CMAKE_SYSTEM_NAME MATCHES "Linux")
12 | add_subdirectory(wasmedge_httpsreq)
13 | endif()
14 | endif()
15 | if (WASMEDGE_PLUGIN_WASI_CRYPTO)
16 | add_subdirectory(wasi_crypto)
17 | endif()
18 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/GlobalInstanceContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_GLOBALINSTANCECONTEXT_H
6 | #define WASMEDGE_JAVA_GLOBALINSTANCECONTEXT_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 | WasmEdge_GlobalInstanceContext *
11 | getGlobalInstanceContext(JNIEnv *env, jobject jGlobalInstanceContext);
12 | jobject createJGlobalInstanceContext(
13 | JNIEnv *env, const WasmEdge_GlobalInstanceContext *globInstance);
14 |
15 | #endif // WASMEDGE_JAVA_GLOBALINSTANCECONTEXT_H
16 |
--------------------------------------------------------------------------------
/test/externref/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeExternrefTests
5 | ExternrefTest.cpp
6 | )
7 |
8 | add_test(wasmedgeExternrefTests wasmedgeExternrefTests)
9 |
10 | file(COPY
11 | ${CMAKE_CURRENT_SOURCE_DIR}/externrefTestData
12 | DESTINATION
13 | ${CMAKE_CURRENT_BINARY_DIR}
14 | )
15 |
16 | target_link_libraries(wasmedgeExternrefTests
17 | PRIVATE
18 | ${GTEST_BOTH_LIBRARIES}
19 | std::filesystem
20 | wasmedge_shared
21 | )
22 |
--------------------------------------------------------------------------------
/test/mixcall/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeMixcallTests
5 | mixcallTest.cpp
6 | )
7 |
8 | add_test(wasmedgeMixcallTests wasmedgeMixcallTests)
9 |
10 | file(COPY
11 | ${CMAKE_CURRENT_SOURCE_DIR}/mixcallTestData
12 | DESTINATION
13 | ${CMAKE_CURRENT_BINARY_DIR}
14 | )
15 |
16 | target_link_libraries(wasmedgeMixcallTests
17 | PRIVATE
18 | std::filesystem
19 | ${GTEST_BOTH_LIBRARIES}
20 | wasmedgeAOT
21 | wasmedgeVM
22 | )
23 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/change-tag-type.patch:
--------------------------------------------------------------------------------
1 | --- a/api.hpp
2 | +++ b/api.hpp
3 | @@ -1348,7 +1348,7 @@ union __wasi_subscription_u_u_t {
4 | __wasi_subscription_fd_readwrite_t fd_write;
5 | };
6 | struct __wasi_subscription_u_t {
7 | - uint8_t tag;
8 | + __wasi_eventtype_t tag;
9 | __wasi_subscription_u_u_t u;
10 | };
11 |
12 | @@ -1685,7 +1685,7 @@ union __wasi_prestat_u_t {
13 | __wasi_prestat_dir_t dir;
14 | };
15 | struct __wasi_prestat_t {
16 | - uint8_t tag;
17 | + __wasi_preopentype_t tag;
18 | __wasi_prestat_u_t u;
19 | };
20 |
21 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/fibonacci.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (export "fib" (func $fib))
3 | (func $fib (param $n i32) (result i32)
4 | (if
5 | (i32.lt_s
6 | (get_local $n)
7 | (i32.const 2)
8 | )
9 | (return
10 | (i32.const 1)
11 | )
12 | )
13 | (return
14 | (i32.add
15 | (call $fib
16 | (i32.sub
17 | (get_local $n)
18 | (i32.const 2)
19 | )
20 | )
21 | (call $fib
22 | (i32.sub
23 | (get_local $n)
24 | (i32.const 1)
25 | )
26 | )
27 | )
28 | )
29 | )
30 | )
31 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/tests/data/fibonacci.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (export "fib" (func $fib))
3 | (func $fib (param $n i32) (result i32)
4 | (if
5 | (i32.lt_s
6 | (get_local $n)
7 | (i32.const 2)
8 | )
9 | (return
10 | (i32.const 1)
11 | )
12 | )
13 | (return
14 | (i32.add
15 | (call $fib
16 | (i32.sub
17 | (get_local $n)
18 | (i32.const 2)
19 | )
20 | )
21 | (call $fib
22 | (i32.sub
23 | (get_local $n)
24 | (i32.const 1)
25 | )
26 | )
27 | )
28 | )
29 | )
30 | )
31 |
--------------------------------------------------------------------------------
/tools/fuzz/po.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "wasmedge/wasmedge.h"
5 | #include
6 |
7 | /// Entrypoint for the fuzz PO library.
8 | WASMEDGE_CAPI_EXPORT extern "C" int WasmEdge_Driver_FuzzPO(const uint8_t *Data,
9 | size_t Size);
10 |
11 | extern "C" [[gnu::visibility("default")]] int
12 | LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
13 | return WasmEdge_Driver_FuzzPO(Data, Size);
14 | }
15 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/VMContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class VMContext {
4 | private long pointer;
5 |
6 | public VMContext(ConfigureContext configContext, StoreContext storeContext) {
7 | initNative(configContext, storeContext);
8 | }
9 |
10 | public void release() {
11 | this.cleanUp();
12 | pointer = 0;
13 | }
14 |
15 | private native void initNative(ConfigureContext context, StoreContext storeContext);
16 |
17 | private native void cleanUp();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/use/edge.md:
--------------------------------------------------------------------------------
1 | # 边缘计算
2 |
3 | WasmEdge 非常适合在任务关键的边缘设备或边缘网络上运行。
4 |
5 | ## YoMo Flow
6 |
7 | YoMo 是一种用于远边缘(far edge)网络的高性能数据流框架。 WasmEdge 集成到 YoMo 中以运行用户定义的工作负载,例如在工厂装配线上进行的图像识别。
8 |
9 | * [教程](https://www.secondstate.io/articles/yomo-wasmedge-real-time-data-streams/)
10 | * [代码模板](https://github.com/yomorun/yomo-wasmedge-tensorflow)
11 |
12 | ## seL4 微内核操作系统
13 |
14 | seL4 是一个高度安全的实时操作系统。 WasmEdge 是唯一可以在 seL4 上运行的 WebAssembly runtime,它以本机速度运行。我们还提供了一个管理工具来支持 wasm 模块的 OTA 部署。
15 |
16 | * [Demo](https://github.com/second-state/wasmedge-seL4)
17 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/TableTypeContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_TABLETYPECONTEXT_H
6 | #define WASMEDGE_JAVA_TABLETYPECONTEXT_H
7 | #include "wasmedge/wasmedge.h"
8 |
9 | WasmEdge_TableTypeContext *getTableTypeContext(JNIEnv *env,
10 | jobject jTableTypeContext);
11 |
12 | jobject
13 | createJTableTypeContext(JNIEnv *env,
14 | const WasmEdge_TableTypeContext *tableTypeContext);
15 |
16 | #endif // WASMEDGE_JAVA_TABLETYPECONTEXT_H
17 |
--------------------------------------------------------------------------------
/plugins/wasi_nn/wasinnmodule.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "runtime/instance/module.h"
7 | #include "wasinnenv.h"
8 |
9 | namespace WasmEdge {
10 | namespace Host {
11 |
12 | class WasiNNModule : public Runtime::Instance::ModuleInstance {
13 | public:
14 | WasiNNModule();
15 |
16 | WASINN::WasiNNEnvironment &getEnv() { return Env; }
17 |
18 | private:
19 | WASINN::WasiNNEnvironment Env;
20 | };
21 |
22 | } // namespace Host
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/test/plugins/wasi_crypto/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasiCryptoTests
5 | aeads.cpp
6 | asymmetric.cpp
7 | common.cpp
8 | hash.cpp
9 | helper.cpp
10 | kdf.cpp
11 | kx.cpp
12 | mac.cpp
13 | notimplement.cpp
14 | signatures.cpp
15 | )
16 |
17 | target_link_libraries(wasiCryptoTests
18 | PRIVATE
19 | ${GTEST_BOTH_LIBRARIES}
20 | wasmedgePlugin
21 | wasmedgePluginWasiCrypto
22 | )
23 |
24 | add_test(wasiCryptoTests wasiCryptoTests)
25 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/LoaderContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class LoaderContext {
4 | private long pointer;
5 |
6 | public LoaderContext(ConfigureContext configureContext) {
7 | nativeInit(configureContext);
8 | }
9 |
10 | public native ASTModuleContext parseFromFile(String path);
11 |
12 | public native ASTModuleContext parseFromBuffer(byte[] buf, int bufSize);
13 |
14 | private native void nativeInit(ConfigureContext configureContext);
15 |
16 | public native void delete();
17 | }
18 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/GlobalTypeContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-12.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_GLOBALTYPECONTEXT_H
6 | #define WASMEDGE_JAVA_GLOBALTYPECONTEXT_H
7 | #include "wasmedge/wasmedge.h"
8 |
9 | WasmEdge_GlobalTypeContext *getGlobalTypeContext(JNIEnv *env,
10 | jobject jGlobalTypeContext);
11 |
12 | jobject
13 | createJGlobalTypeContext(JNIEnv *env,
14 | const WasmEdge_GlobalTypeContext *globalTypeContext);
15 | #endif // WASMEDGE_JAVA_GLOBALTYPECONTEXT_H
16 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/MemoryTypeContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_MEMORYTYPECONTEXT_H
6 | #define WASMEDGE_JAVA_MEMORYTYPECONTEXT_H
7 | #include "wasmedge/wasmedge.h"
8 |
9 | WasmEdge_MemoryTypeContext *getMemoryTypeContext(JNIEnv *env,
10 | jobject jMemoryTypeContext);
11 | jobject
12 | createJMemoryTypeContext(JNIEnv *env,
13 | const WasmEdge_MemoryTypeContext *memTypeContext);
14 |
15 | #endif // WASMEDGE_JAVA_MEMORYTYPECONTEXT_H
16 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/use/edge.md:
--------------------------------------------------------------------------------
1 | # 邊緣運算
2 |
3 | WasmEdge 非常適合在需要執行關鍵任務的終端裝置或邊緣網路上執行。
4 |
5 | ## YoMo Flow
6 |
7 | YoMo 是一種用於遠端邊緣(far edge)網路的高效能資料流框架。 WasmEdge 集成到 YoMo 中以執行使用者定義的工作負載,例如在工廠組裝線上的影像辨識。
8 |
9 | * [教學](https://www.secondstate.io/articles/yomo-wasmedge-real-time-data-streams/)
10 | * [程式碼範本](https://github.com/yomorun/yomo-wasmedge-tensorflow)
11 |
12 | ## seL4 微型核心作業系統
13 |
14 | seL4 是一個高度安全的即時作業系統。 WasmEdge 是唯一可以在 seL4 上以原生速度運行的 WebAssembly runtime 。我們還提供了一個管理工具來支援 Wasm module 的 OTA 部署。
15 |
16 | * [Demo](https://github.com/second-state/wasmedge-seL4)
17 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/app.md:
--------------------------------------------------------------------------------
1 | # 应用框架
2 |
3 | WasmEdge 为应用程序提供安全高效的扩展机制。当然,应用程序开发人员随时可以使用 [WasmEdge SDK](https://github.com/WasmEdge/WasmEdge/blob/master/docs/book/en/src/embed.md) 来嵌入 WebAssembly 函数。但有些应用程序和框架选择在 WasmEdge SDK 之上构建扩展/嵌入 API,后者支持与应用程序的本地应用场景和编程模型进行更符合人体工程学的集成。
4 |
5 | * [YoMo](https://github.com/WasmEdge/WasmEdge/blob/master/docs/book/en/src/frameworks/app/yomo.md) 是一个数据流处理框架。WasmEdge 函数可以插入到框架中来处理流中的数据。
6 | * [Reactr](https://github.com/WasmEdge/WasmEdge/blob/master/docs/book/en/src/frameworks/app/reactr.md) 是一个 Go 语言框架,用于管理和扩展 WebAssembly 函数,以便轻松嵌入到其他 Go 应用程序中。
7 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/ExternalType.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | import java.util.Arrays;
4 |
5 | public enum ExternalType {
6 | FUNCTION(0x00),
7 | TABLE(0x01),
8 | MEMORY(0x02),
9 | GLOBAL(0x03);
10 |
11 | private final int val;
12 |
13 | ExternalType(int val) {
14 | this.val = val;
15 | }
16 |
17 | public static ExternalType getByValue(int val) {
18 | return Arrays.stream(values()).filter(type -> type.val == val)
19 | .findAny().orElse(null);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/TableInstanceContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_TABLEINSTANCECONTEXT_H
6 | #define WASMEDGE_JAVA_TABLEINSTANCECONTEXT_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | jobject
12 | createJTableInstanceContext(JNIEnv *env,
13 | const WasmEdge_TableInstanceContext *tabInstance);
14 |
15 | WasmEdge_TableInstanceContext *
16 | getTableInstanceContext(JNIEnv *env, jobject jTableInstanceContext);
17 |
18 | #endif // WASMEDGE_JAVA_TABLEINSTANCECONTEXT_H
19 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-macro/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | description = "The procedural macros for WasmEdge Rust bindings."
3 | documentation = "https://wasmedge.github.io/WasmEdge/wasmedge_macro/"
4 | edition = "2021"
5 | license = "Apache-2.0"
6 | name = "wasmedge-macro"
7 | readme = "README.md"
8 | repository = "https://github.com/WasmEdge/WasmEdge/blob/master/bindings/rust/wasmedge-macro"
9 | version = "0.1.1"
10 |
11 | [lib]
12 | proc-macro = true
13 |
14 | [dependencies]
15 | proc-macro2 = "1.0.43"
16 | quote = "1"
17 | syn = {version = "1.0", features = ["full", "extra-traits"]}
18 |
--------------------------------------------------------------------------------
/examples/plugin/wasi-crypto-signature/src/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod signatures;
2 |
3 | pub fn encode>(s: S) -> Vec {
4 | let length = s.as_ref().len() / 2;
5 | let mut res = Vec::with_capacity(length);
6 | for i in 0..length {
7 | let code = &s.as_ref()[i * 2..i * 2 + 2];
8 | res.push(u8::from_str_radix(code, 16).expect("Unable to cast hex"));
9 | }
10 | res
11 | }
12 |
13 | pub fn decode(s: Vec) -> String {
14 | s.iter()
15 | .map(|n| format!("{:X}", n))
16 | .collect::>()
17 | .join("")
18 | }
19 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "WasmEdge dev environment",
3 | "dockerFile": "Dockerfile",
4 |
5 | // Set *default* container specific settings.json values on container create.
6 | "settings": {
7 | "terminal.integrated.shell.linux": "/bin/bash",
8 | "lldb.executable": "/usr/bin/lldb"
9 | },
10 |
11 | // Add the IDs of extensions you want installed when the container is created.
12 | "extensions": [
13 | "rust-lang.rust",
14 | "bungcip.better-toml",
15 | "vadimcn.vscode-lldb",
16 | "loiane.ts-extension-pack",
17 | "dbaeumer.vscode-eslint"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/MemoryInstanceContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_MEMORYINSTANCECONTEXT_H
6 | #define WASMEDGE_JAVA_MEMORYINSTANCECONTEXT_H
7 |
8 | #include "jni.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | WasmEdge_MemoryInstanceContext *
12 | getMemoryInstanceContext(JNIEnv *env, jobject jMemoryInstanceContext);
13 | jobject
14 | createJMemoryInstanceContext(JNIEnv *env,
15 | const WasmEdge_MemoryInstanceContext *memInstance);
16 |
17 | #endif // WASMEDGE_JAVA_MEMORYINSTANCECONTEXT_H
18 |
--------------------------------------------------------------------------------
/plugins/wasmedge_process/processmodule.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "processenv.h"
7 |
8 | #include "runtime/instance/module.h"
9 |
10 | namespace WasmEdge {
11 | namespace Host {
12 |
13 | class WasmEdgeProcessModule : public Runtime::Instance::ModuleInstance {
14 | public:
15 | WasmEdgeProcessModule();
16 |
17 | WasmEdgeProcessEnvironment &getEnv() { return Env; }
18 |
19 | private:
20 | WasmEdgeProcessEnvironment Env;
21 | };
22 |
23 | } // namespace Host
24 | } // namespace WasmEdge
25 |
--------------------------------------------------------------------------------
/utils/openwrt/build_for_openwrt.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-License-Identifier: Apache-2.0
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | OPENWRT_DIR_PATH=$1
6 | WASMEDGE_FATHER_PATH=$(dirname $(dirname $(dirname $(pwd))))
7 |
8 | cd ${OPENWRT_DIR_PATH}/package/utils
9 | mkdir WasmEdge && cd WasmEdge
10 | cp -r ${WASMEDGE_FATHER_PATH}/WasmEdge ${OPENWRT_DIR_PATH}/package/utils/WasmEdge/src
11 | cp ${WASMEDGE_FATHER_PATH}/WasmEdge/utils/openwrt/configuration/Makefile ${OPENWRT_DIR_PATH}/package/utils/WasmEdge/
12 | cd ${OPENWRT_DIR_PATH}
13 |
14 | make menuconfig
15 |
16 | make -j1 V=s
17 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/RefType.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | import java.util.Arrays;
4 |
5 | public enum RefType {
6 |
7 | FUNCREF(0x70),
8 | EXTERREF(0x6F);
9 | private final int val;
10 |
11 | RefType(int val) {
12 | this.val = val;
13 | }
14 |
15 | public static RefType getType(int val) {
16 | return Arrays.stream(values())
17 | .filter(type -> type.val == val)
18 | .findAny().orElse(null);
19 | }
20 |
21 | public int getVal() {
22 | return this.val;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/src/log.rs:
--------------------------------------------------------------------------------
1 | //! Defines WasmEdge LogManager struct
2 |
3 | use wasmedge_sys as sys;
4 |
5 | /// Manipulates the runtime logger.
6 | #[derive(Debug)]
7 | pub struct LogManager {}
8 | impl LogManager {
9 | /// Logs the debug information.
10 | pub fn log_debug_info() {
11 | sys::utils::log_debug_info()
12 | }
13 |
14 | /// Logs the error information.
15 | pub fn log_error_info() {
16 | sys::utils::log_error_info()
17 | }
18 |
19 | /// Sets the logging system off.
20 | pub fn log_off() {
21 | sys::utils::log_off()
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/convert.js:
--------------------------------------------------------------------------------
1 | const { createCanvas } = require("canvas");
2 | const fs = require("fs");
3 | const { argv } = require("process");
4 |
5 | let binary = fs.readFileSync(argv[2]);
6 |
7 | const canvasData = new Uint8Array(binary, 0, 1200 * 800 * 4);
8 |
9 | const canvas = createCanvas(1200, 800);
10 | const context = canvas.getContext("2d");
11 | const imageData = context.createImageData(1200, 800);
12 | imageData.data.set(canvasData);
13 | context.putImageData(imageData, 0, 0);
14 |
15 | const buffer = canvas.toBuffer("image/png");
16 | fs.writeFileSync(argv[3], buffer);
17 |
--------------------------------------------------------------------------------
/lib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | if(WASMEDGE_BUILD_AOT_RUNTIME)
5 | add_subdirectory(aot)
6 | endif()
7 | add_subdirectory(common)
8 | add_subdirectory(system)
9 | add_subdirectory(plugin)
10 | add_subdirectory(po)
11 | add_subdirectory(loader)
12 | add_subdirectory(validator)
13 | add_subdirectory(executor)
14 | add_subdirectory(host)
15 | add_subdirectory(vm)
16 | add_subdirectory(driver)
17 | if(WASMEDGE_BUILD_SHARED_LIB OR WASMEDGE_BUILD_STATIC_LIB OR WASMEDGE_BUILD_TOOLS)
18 | add_subdirectory(api)
19 | endif()
20 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/wasi_print_env/src/lib.rs:
--------------------------------------------------------------------------------
1 | //! The project is used to generate wasi_print_env.wasm, which will be used by the example wasi_print_env.rs
2 | //!
3 | //! # Usage
4 | //!
5 | //! run `cargo build --target=wasm32-wasi --release`
6 | use std::env;
7 |
8 | #[no_mangle]
9 | pub fn print_env() {
10 | println!("The env vars are as follows.");
11 | for (key, value) in env::vars() {
12 | println!("{}: {}", key, value);
13 | }
14 |
15 | println!("The args are as follows.");
16 | for argument in env::args() {
17 | println!("{}", argument);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/utils/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:7.0.4"
9 | classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | task clean(type: Delete) {
17 | delete rootProject.buildDir
18 | }
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/StoreContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import java.util.List;
4 |
5 | public class StoreContext {
6 | private long pointer = 0;
7 |
8 | public StoreContext() {
9 | nativeInit();
10 | }
11 |
12 | private StoreContext(long pointer) {
13 | this.pointer = pointer;
14 | }
15 |
16 | public void destroy() {
17 | delete();
18 | pointer = 0;
19 | }
20 |
21 | private native void nativeInit();
22 |
23 | private native void delete();
24 |
25 | public native List listModule();
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ModuleInstanceContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-17.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_MODULEINSTANCECONTEXT_H
6 | #define WASMEDGE_JAVA_MODULEINSTANCECONTEXT_H
7 | #include "jni.h"
8 | #include "wasmedge/wasmedge.h"
9 |
10 | jobject
11 | createJModuleInstanceContext(JNIEnv *env,
12 | const WasmEdge_ModuleInstanceContext *impObj);
13 |
14 | WasmEdge_ModuleInstanceContext *getModuleInstanceContext(JNIEnv *env,
15 | jobject jImpObjCxt);
16 | #endif // WASMEDGE_JAVA_MODULEINSTANCECONTEXT_H
17 |
--------------------------------------------------------------------------------
/include/host/wasi/wasimodule.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "host/wasi/environ.h"
7 | #include "runtime/instance/module.h"
8 |
9 | namespace WasmEdge {
10 | namespace Host {
11 |
12 | class WasiModule : public Runtime::Instance::ModuleInstance {
13 | public:
14 | WasiModule();
15 |
16 | WASI::Environ &getEnv() noexcept { return Env; }
17 | const WASI::Environ &getEnv() const noexcept { return Env; }
18 |
19 | private:
20 | WASI::Environ Env;
21 | };
22 |
23 | } // namespace Host
24 | } // namespace WasmEdge
25 |
--------------------------------------------------------------------------------
/plugins/wasi_nn/wasinnbase.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "common/errcode.h"
7 | #include "runtime/hostfunc.h"
8 | #include "wasinnenv.h"
9 |
10 | namespace WasmEdge {
11 | namespace Host {
12 |
13 | template class WasiNN : public Runtime::HostFunction {
14 | public:
15 | WasiNN(WASINN::WasiNNEnvironment &HostEnv)
16 | : Runtime::HostFunction(0), Env(HostEnv) {}
17 |
18 | protected:
19 | WASINN::WasiNNEnvironment &Env;
20 | };
21 |
22 | } // namespace Host
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/include/host/wasi/wasibase.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "common/errcode.h"
7 | #include "host/wasi/environ.h"
8 | #include "runtime/callingframe.h"
9 | #include "runtime/hostfunc.h"
10 |
11 | namespace WasmEdge {
12 | namespace Host {
13 |
14 | template class Wasi : public Runtime::HostFunction {
15 | public:
16 | Wasi(WASI::Environ &HostEnv) : Runtime::HostFunction(0), Env(HostEnv) {}
17 |
18 | protected:
19 | WASI::Environ &Env;
20 | };
21 |
22 | } // namespace Host
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/plugins/wasmedge_httpsreq/httpsreqmodule.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "httpsreqenv.h"
7 | #include "runtime/instance/module.h"
8 | #include
9 |
10 | namespace WasmEdge {
11 | namespace Host {
12 |
13 | class WasmEdgeHttpsReqModule : public Runtime::Instance::ModuleInstance {
14 | public:
15 | WasmEdgeHttpsReqModule();
16 |
17 | WasmEdgeHttpsReqEnvironment &getEnv() { return Env; }
18 |
19 | private:
20 | WasmEdgeHttpsReqEnvironment Env;
21 | };
22 |
23 | } // namespace Host
24 | } // namespace WasmEdge
25 |
--------------------------------------------------------------------------------
/test/host/wasi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasiTests
5 | wasi.cpp
6 | )
7 |
8 | add_test(wasiTests wasiTests)
9 |
10 | target_link_libraries(wasiTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | wasmedgeHostModuleWasi
14 | )
15 |
16 | if(WASMEDGE_BUILD_COVERAGE)
17 | add_test(
18 | NAME wasi-test
19 | COMMAND bash -c "[ -e \"$HOME/.cargo/env\" ] && . \"$HOME/.cargo/env\"; \"${PROJECT_SOURCE_DIR}\"/utils/wasi-test/run-wasi-test.sh \"${PROJECT_BINARY_DIR}/tools/wasmedge\""
20 | )
21 | endif()
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature Request
3 | about: Found some fantastic features or cool ideas, but WasmEdge is not yet provided?
4 | ---
5 |
6 | ## Motivation
7 |
8 |
11 |
12 | ## Details
13 |
14 |
17 |
18 | ## Appendix
19 |
20 |
24 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/WasmEdgeMutability.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | import java.util.Arrays;
4 |
5 | public enum WasmEdgeMutability {
6 | CONST(0x00),
7 | VAR(0x01);
8 |
9 | private final int value;
10 |
11 | WasmEdgeMutability(int value) {
12 | this.value = value;
13 | }
14 |
15 | public static WasmEdgeMutability parseMutability(int value) {
16 | return Arrays.stream(values()).filter(v -> v.value == value)
17 | .findAny().orElse(null);
18 | }
19 |
20 | public int getValue() {
21 | return value;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/plugins/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | # Only Linux systems support wasmedge_process now.
5 | if (CMAKE_SYSTEM_NAME MATCHES "Linux")
6 | add_subdirectory(wasmedge_process)
7 | endif()
8 |
9 | if (WASMEDGE_PLUGIN_WASI_NN_BACKEND)
10 | add_subdirectory(wasi_nn)
11 | endif()
12 |
13 | if(WASMEDGE_PLUGIN_HTTPSREQ)
14 | if(CMAKE_SYSTEM_NAME MATCHES "Linux")
15 | add_subdirectory(wasmedge_httpsreq)
16 | endif()
17 | endif()
18 |
19 | if (WASMEDGE_PLUGIN_WASI_CRYPTO)
20 | add_subdirectory(wasi_crypto)
21 | endif()
22 |
23 | add_subdirectory(test)
24 |
--------------------------------------------------------------------------------
/tools/wasmedge/wasmedger.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "wasmedge/wasmedge.h"
5 | #include "wasmedge/wincli_helper.h"
6 |
7 | int main(int Argc, const char *Argv[]) {
8 | #if WASMEDGE_WINCLI_HELPER_ENABLE
9 | WasmEdge_SetConsoleOutputCPtoUTF8();
10 | (void)Argv; // We can not ensure the encoding of Argv, make compiler slient.
11 | auto ArgvUTF8 =
12 | WasmEdge_CommandLineToUTF8ArgvW(WasmEdge_GetCommandLineW(), &Argc);
13 | return WasmEdge_Driver_Tool(Argc, ArgvUTF8);
14 | #else
15 | return WasmEdge_Driver_Tool(Argc, Argv);
16 | #endif
17 | }
18 |
--------------------------------------------------------------------------------
/utils/android/app/lib/src/main/java/org/wasmedge/native_lib/NativeLib.kt:
--------------------------------------------------------------------------------
1 | package org.wasmedge.native_lib
2 |
3 | import android.content.Context
4 |
5 | class NativeLib(ctx : Context) {
6 | private external fun nativeWasmFibonacci(imageBytes : ByteArray, idx : Int ) : Int
7 |
8 | companion object {
9 | init {
10 | System.loadLibrary("wasmedge_lib")
11 | }
12 | }
13 |
14 | private var fibonacciWasmImageBytes : ByteArray = ctx.assets.open("fibonacci.wasm").readBytes()
15 |
16 | fun wasmFibonacci(idx : Int) : Int{
17 | return nativeWasmFibonacci(fibonacciWasmImageBytes, idx)
18 | }
19 | }
--------------------------------------------------------------------------------
/lib/common/log.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "common/log.h"
5 |
6 | namespace WasmEdge {
7 | namespace Log {
8 |
9 | void setLogOff() { spdlog::set_level(spdlog::level::off); }
10 |
11 | void setDebugLoggingLevel() { spdlog::set_level(spdlog::level::debug); }
12 |
13 | void setInfoLoggingLevel() { spdlog::set_level(spdlog::level::info); }
14 |
15 | void setWarnLoggingLevel() { spdlog::set_level(spdlog::level::warn); }
16 |
17 | void setErrorLoggingLevel() { spdlog::set_level(spdlog::level::err); }
18 |
19 | } // namespace Log
20 | } // namespace WasmEdge
21 |
--------------------------------------------------------------------------------
/plugins/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgePluginTest
5 | SHARED
6 | test.c
7 | )
8 |
9 | set_target_properties(wasmedgePluginTest PROPERTIES
10 | C_STANDARD 11
11 | )
12 |
13 | target_compile_options(wasmedgePluginTest
14 | PUBLIC
15 | -DWASMEDGE_PLUGIN
16 | )
17 |
18 | if(WASMEDGE_LINK_PUGLINS_STATIC)
19 | target_link_libraries(wasmedgePluginTest
20 | PRIVATE
21 | wasmedgeCAPI
22 | )
23 | else()
24 | target_link_libraries(wasmedgePluginTest
25 | PRIVATE
26 | wasmedge_shared
27 | )
28 | endif()
29 |
--------------------------------------------------------------------------------
/tools/wasmedge/wasmedgec.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "wasmedge/wasmedge.h"
5 | #include "wasmedge/wincli_helper.h"
6 |
7 | int main(int Argc, const char *Argv[]) {
8 | #if WASMEDGE_WINCLI_HELPER_ENABLE
9 | WasmEdge_SetConsoleOutputCPtoUTF8();
10 | (void)Argv; // We can not ensure the encoding of Argv, make compiler slient.
11 | auto ArgvUTF8 =
12 | WasmEdge_CommandLineToUTF8ArgvW(WasmEdge_GetCommandLineW(), &Argc);
13 | return WasmEdge_Driver_Compiler(Argc, ArgvUTF8);
14 | #else
15 | return WasmEdge_Driver_Compiler(Argc, Argv);
16 | #endif
17 | }
18 |
--------------------------------------------------------------------------------
/utils/docker/Dockerfile.ci-image-base:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | MAINTAINER hydai hydai@secondstate.io
4 | ENV DEBIAN_FRONTEND=noninteractive
5 |
6 | RUN apt update && apt upgrade -y \
7 | && apt install -y \
8 | apt-transport-https \
9 | ca-certificates \
10 | curl \
11 | gnupg-agent \
12 | software-properties-common
13 |
14 | RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
15 | RUN add-apt-repository \
16 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
17 | $(lsb_release -cs) \
18 | stable"
19 |
20 | RUN apt update && apt install -y \
21 | docker-ce \
22 | docker-ce-cli \
23 | containerd.io
24 |
--------------------------------------------------------------------------------
/plugins/wasmedge_process/processbase.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "processenv.h"
7 |
8 | #include "common/errcode.h"
9 | #include "runtime/hostfunc.h"
10 |
11 | namespace WasmEdge {
12 | namespace Host {
13 |
14 | template class WasmEdgeProcess : public Runtime::HostFunction {
15 | public:
16 | WasmEdgeProcess(WasmEdgeProcessEnvironment &HostEnv)
17 | : Runtime::HostFunction(0), Env(HostEnv) {}
18 |
19 | protected:
20 | WasmEdgeProcessEnvironment &Env;
21 | };
22 |
23 | } // namespace Host
24 | } // namespace WasmEdge
25 |
--------------------------------------------------------------------------------
/test/expected/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(expectedTests
5 | assignment.cpp
6 | bases.cpp
7 | constexpr.cpp
8 | constructors.cpp
9 | emplace.cpp
10 | extensions.cpp
11 | gtest.cpp
12 | issues.cpp
13 | noexcept.cpp
14 | observers.cpp
15 | relops.cpp
16 | swap.cpp
17 | )
18 |
19 | add_test(expectedTests expectedTests)
20 |
21 | target_link_libraries(expectedTests
22 | PRIVATE
23 | ${GTEST_BOTH_LIBRARIES}
24 | )
25 |
26 | target_include_directories(expectedTests
27 | PRIVATE
28 | ${PROJECT_SOURCE_DIR}/include
29 | )
30 |
--------------------------------------------------------------------------------
/utils/ohos/configuration/ohos.build:
--------------------------------------------------------------------------------
1 | {
2 | "subsystem": "wasmedge",
3 | "parts": {
4 | "wasmedge": {
5 | "module_list": [
6 | "//third_party/WasmEdge:wasmedge",
7 | "//third_party/WasmEdge:wasmedge_hello",
8 | "//third_party/WasmEdge:wasmedge_add",
9 | "//third_party/WasmEdge:wasmedge_fibonacci",
10 | "//third_party/WasmEdge:wasmedge_factorial",
11 | "//third_party/WasmEdge:wasmedge_js_hello",
12 | "//third_party/WasmEdge:wasmedge_js_qjs"
13 | ],
14 | "inner_kits": [
15 | ],
16 | "system_kits": [
17 | ],
18 | "test_list": [
19 | ]
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/fossa-deps.yml:
--------------------------------------------------------------------------------
1 | remote-dependencies:
2 | - name: "Boost"
3 | version: "1.76"
4 | url: "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2"
5 | metadata:
6 | homepage: "https://www.boost.org/"
7 | - name: "GoogleTest"
8 | version: "1.11.0"
9 | url: "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz"
10 | metadata:
11 | homepage: "https://github.com/google/googletest"
12 | - name: "spdlog"
13 | version: "1.9.1"
14 | url: "https://github.com/gabime/spdlog/archive/refs/tags/v1.9.1.tar.gz"
15 | metadata:
16 | homepage: "https://github.com/gabime/spdlog"
17 |
--------------------------------------------------------------------------------
/test/thread/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasmedgeThreadTests
5 | ThreadTest.cpp
6 | )
7 |
8 | add_test(wasmedgeThreadTests wasmedgeThreadTests)
9 |
10 | target_link_libraries(wasmedgeThreadTests
11 | PRIVATE
12 | std::filesystem
13 | ${GTEST_BOTH_LIBRARIES}
14 | wasmedgeVM
15 | )
16 |
17 | if(WASMEDGE_BUILD_AOT_RUNTIME)
18 | target_compile_definitions(wasmedgeThreadTests
19 | PRIVATE
20 | -DWASMEDGE_BUILD_AOT_RUNTIME
21 | )
22 | target_link_libraries(wasmedgeThreadTests
23 | PRIVATE
24 | wasmedgeAOT
25 | )
26 | endif()
27 |
--------------------------------------------------------------------------------
/utils/wasi-nn/download-pytorch-fixtures.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | TODIR=$1
6 | if [[ $# -eq 0 ]]; then
7 | TODIR=.
8 | fi
9 | FIXTURE=https://github.com/second-state/WasmEdge-WASINN-examples/raw/master/pytorch-mobilenet-image/
10 | if [ ! -d $TODIR ]; then
11 | mkdir $TODIR
12 | fi
13 |
14 | if [ ! -f $TODIR/mobilenet.pt ]; then
15 | curl -sL $FIXTURE/mobilenet.pt -o $TODIR/mobilenet.pt
16 | fi
17 | if [ ! -f $TODIR/image-1x3x224x224.rgb ]; then
18 | curl -sL $FIXTURE/image-1x3x224x224.rgb -o $TODIR/image-1x3x224x224.rgb
19 | fi
20 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/MemoryTypeContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class MemoryTypeContext {
4 | private long pointer;
5 | private WasmEdgeLimit limit;
6 |
7 | private MemoryTypeContext(long pointer) {
8 | this.pointer = pointer;
9 | }
10 |
11 | public MemoryTypeContext(WasmEdgeLimit limit) {
12 | this.limit = limit;
13 | nativeInit(limit.isHasMax(), limit.getMin(), limit.getMax());
14 | }
15 |
16 | public native WasmEdgeLimit getLimit();
17 |
18 | private native void nativeInit(boolean hasMax, long min, long max);
19 |
20 | public native void delete();
21 | }
22 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeI32Value.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public final class WasmEdgeI32Value implements WasmEdgeValue {
6 | private int value;
7 |
8 | public WasmEdgeI32Value() {
9 |
10 | }
11 |
12 | public WasmEdgeI32Value(int value) {
13 | this.value = value;
14 | }
15 |
16 | @Override
17 | public ValueType getType() {
18 | return ValueType.i32;
19 | }
20 |
21 | public int getValue() {
22 | return this.value;
23 | }
24 |
25 | public void setValue(int value) {
26 | this.value = value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/worker.js:
--------------------------------------------------------------------------------
1 | const { parentPort, workerData } = require("worker_threads");
2 | const fs = require("fs");
3 |
4 | const { memory, config, num_threads, rank, bytes } = workerData.data;
5 |
6 | console.log(`number_of_workers = ${num_threads}, rank = ${rank}`);
7 | let offset = 0;
8 |
9 | WebAssembly.instantiate(bytes, {
10 | env: {
11 | memory,
12 | },
13 | }).then((Module) => {
14 | Module.instance.exports.mandelbrotThread(
15 | config.iterations,
16 | num_threads,
17 | rank,
18 | config.x,
19 | config.y,
20 | config.d
21 | );
22 |
23 | parentPort.postMessage(Module.instance.exports.getImage());
24 | });
25 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeI64Value.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public final class WasmEdgeI64Value implements WasmEdgeValue {
6 | private long value;
7 |
8 | public WasmEdgeI64Value(long value) {
9 | this.value = value;
10 | }
11 |
12 | public WasmEdgeI64Value() {
13 |
14 | }
15 |
16 | @Override
17 | public ValueType getType() {
18 | return ValueType.i64;
19 | }
20 |
21 | public long getValue() {
22 | return this.value;
23 | }
24 |
25 | public void setValue(long value) {
26 | this.value = value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sdk/src/utils.rs:
--------------------------------------------------------------------------------
1 | use wasmedge_sys::utils;
2 |
3 | /// Defines WasmEdge Driver functions
4 | #[derive(Debug)]
5 | pub struct Driver {}
6 | impl Driver {
7 | /// Triggers the WasmEdge AOT compiler tool
8 | pub fn aot_compiler(args: I) -> i32
9 | where
10 | I: IntoIterator- ,
11 | V: AsRef,
12 | {
13 | utils::driver_aot_compiler(args)
14 | }
15 |
16 | /// Triggers the WasmEdge runtime tool
17 | pub fn runtime_tool(args: I) -> i32
18 | where
19 | I: IntoIterator
- ,
20 | V: AsRef,
21 | {
22 | utils::driver_runtime_tool(args)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/README_zh.md:
--------------------------------------------------------------------------------
1 | # `wasmedge-sys` 说明
2 |
3 | ## `-sys`库设计原则
4 |
5 | 一般而言,`-sys`库应该只保留 `unsafe` 的 C 接口绑定,不应该有多余的安全抽象。
6 |
7 | 但是,对于最终我们要构建的 `wasmedge-rs`这样的纯 Rust SDK 而言,不应该使用太多的 C 绑定接口。所以,出于这样的考虑,`wasmedge-sys`库使用了一层薄的 Rust 包装,只暴露合适的接口,供上层 `wasmedge-rs` 来抽象更易于使用的纯 Rust SDK。
8 |
9 | `-sys` 库暴露的接口,应该是稳定的。即, 当 C 接口改变时,只需改变 `-sys`库,而无需改变上层的 SDK 。
10 |
11 | ## 库接口说明
12 |
13 | - 错误处理: 统一返回 `ErrReport` 结构,在上层`wasmedge-rs` SDK 中再进一步做 Rust 风格的错误处理。
14 | - 将基本类型纳入 `-sys` 库,比如字符串/Value 等,上层 SDK 只需要使用即可。
15 | - 配置/模块加载/创建VM/启动VM计算返回结果,这些放到 `-sys` 库中,作为 SDK 的基础接口。
16 | - 基础接口,涉及创建或初始化,使用了基本的「封装」,不对下游开放修改,以保证基础接口的稳定性。
17 | - Dosc 目录下记录对应的 `C-API` 头文件和对应的 Rust 绑定接口,作为文档。
18 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/Cargo.toml:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | [package]
5 | name = "wasi-cpp-header"
6 | version = "0.0.1"
7 | authors = ["Dan Gohman ", "Pat Hickey ", "Shen-Ta Hsieh "]
8 | description = "Generate c++ header from wix file, fork from https://github.com/WebAssembly/wasi-libc/tree/master/tools/wasi-headers"
9 | license = "Apache-2.0"
10 | edition = "2018"
11 | publish = false
12 |
13 | [dependencies]
14 | heck = "0.3.1"
15 | witx = "0.9.0"
16 | anyhow = "1.0.22"
17 | clap = "2.23"
18 |
19 | [dev-dependencies]
20 | diff = "0.1.11"
21 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeF32Value.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public final class WasmEdgeF32Value implements WasmEdgeValue {
6 | private float value;
7 |
8 | public WasmEdgeF32Value() {
9 |
10 | }
11 |
12 | public WasmEdgeF32Value(float value) {
13 | this.value = value;
14 | }
15 |
16 | @Override
17 | public ValueType getType() {
18 | return ValueType.f32;
19 | }
20 |
21 | public float getValue() {
22 | return this.value;
23 | }
24 |
25 | public void setValue(float value) {
26 | this.value = value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeF64Value.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public final class WasmEdgeF64Value implements WasmEdgeValue {
6 | private double value;
7 |
8 | public WasmEdgeF64Value(double value) {
9 | this.value = value;
10 | }
11 |
12 | public WasmEdgeF64Value() {
13 |
14 | }
15 |
16 | @Override
17 | public ValueType getType() {
18 | return ValueType.f64;
19 | }
20 |
21 | public double getValue() {
22 | return this.value;
23 | }
24 |
25 | public void setValue(double value) {
26 | this.value = value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/demo.md:
--------------------------------------------------------------------------------
1 | # Demo apps
2 |
3 | In this chapter, we will cover two demo apps. We will build them from Rust source code, build OCI images around them, and then publish the images to Docker Hub.
4 |
5 | If you have not done so, please
6 |
7 | * [Install Rust](https://www.rust-lang.org/tools/install)
8 | * [Register for Docker Hub](https://hub.docker.com/)
9 |
10 | Next, explore the examples
11 |
12 | * [A simple WASI example](demo/wasi.md)
13 | * [A HTTP server example](demo/server.md)
14 |
15 | Since we have already built and published those demo apps on Docker Hub, you could also just go straight to the container runtime sections to use these images.
16 |
--------------------------------------------------------------------------------
/lib/aot/blake3.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "aot/blake3.h"
5 |
6 | #include "common/config.h"
7 | #include "common/defines.h"
8 |
9 | namespace WasmEdge {
10 | namespace AOT {
11 |
12 | namespace {}
13 |
14 | Blake3::Blake3() noexcept { blake3_hasher_init(&Hasher); }
15 |
16 | void Blake3::update(Span Data) noexcept {
17 | blake3_hasher_update(&Hasher, Data.data(), Data.size());
18 | }
19 |
20 | void Blake3::finalize(Span Output) noexcept {
21 | blake3_hasher_finalize(&Hasher, Output.data(), Output.size());
22 | }
23 |
24 | } // namespace AOT
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/utils/android/app/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/embed_cxx/script/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 |
3 | project(script)
4 |
5 | set(CMAKE_CXX_STANDARD 20)
6 |
7 | add_library(
8 | fibonacci
9 | SHARED
10 | fibonacci.cpp
11 | )
12 |
13 | if(${CMAKE_SYSTEM_NAME} STREQUAL "WASI")
14 | set(CMAKE_SHARED_LIBRARY_PREFIX "")
15 | set(CMAKE_SHARED_LIBRARY_SUFFIX ".wasm")
16 |
17 | target_link_options(
18 | fibonacci
19 | PRIVATE
20 | -mexec-model=reactor
21 | )
22 |
23 | add_custom_command(
24 | TARGET fibonacci
25 | POST_BUILD
26 | COMMAND ${CMAKE_COMMAND} -E copy "$" "${WASM_OUT_DIR}" VERBATIM
27 | )
28 | endif()
29 |
--------------------------------------------------------------------------------
/plugins/wasmedge_httpsreq/httpsreqbase.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "httpsreqenv.h"
7 |
8 | #include "common/errcode.h"
9 | #include "runtime/callingframe.h"
10 | #include "runtime/hostfunc.h"
11 |
12 | namespace WasmEdge {
13 | namespace Host {
14 |
15 | template class WasmEdgeHttpsReq : public Runtime::HostFunction {
16 | public:
17 | WasmEdgeHttpsReq(WasmEdgeHttpsReqEnvironment &HostEnv)
18 | : Runtime::HostFunction(0), Env(HostEnv) {}
19 |
20 | protected:
21 | WasmEdgeHttpsReqEnvironment &Env;
22 | };
23 |
24 | } // namespace Host
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/examples/embed_cxx/README.md:
--------------------------------------------------------------------------------
1 | # Example of Embedding WasmEdge SDK in C++
2 |
3 | This is an example of embedding WasmEdge SDK in C++, and how to build WebAssembly from C++ sources.
4 |
5 | First, download and extract [wasi-sdk](https://github.com/WebAssembly/wasi-sdk/releases), setup environment variable `WASI_SDK_HOME=path/to/wasi-sdk` .
6 |
7 | Build with cmake
8 |
9 | ```bash
10 | cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF; cmake --build build
11 | ```
12 |
13 | Run `embed_cxx`
14 |
15 | ```bash
16 | $ cd build
17 | $ ./embed_cxx
18 | Get result: 3524578
19 | run native fib(32), ints : 0.006482 s
20 | Get result: 3524578
21 | run wasm fib(32), ints : 2.84775 s
22 | ```
23 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/generate.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | set -x
6 |
7 | ROOT="$(realpath $(dirname "${BASH_SOURCE[0]}")/../../)"
8 | API_FILE="$ROOT/thirdparty/wasi/api.hpp"
9 | cargo build --release
10 | curl -s -L --remote-name-all https://raw.githubusercontent.com/WebAssembly/WASI/master/phases/snapshot/witx/typenames.witx
11 | patch -p1 < add-wasi_sock.patch
12 | patch -p1 < add-addrinfo.patch
13 | patch -p1 < add-wasi_opt.patch
14 | target/release/wasi-cpp-header generate --output "$API_FILE" typenames.witx
15 | clang-format-12 -i "$API_FILE"
16 | patch -p1 -d "$ROOT/thirdparty/wasi" < change-tag-type.patch
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/MemoryTypeContextTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class MemoryTypeContextTest extends BaseTest {
7 | @Test
8 | public void testCreation() {
9 | WasmEdgeLimit limit = new WasmEdgeLimit(true, 1, 1000);
10 | MemoryTypeContext memoryTypeContext = new MemoryTypeContext(limit);
11 |
12 | Assert.assertEquals(memoryTypeContext.getLimit().isHasMax(), limit.isHasMax());
13 | Assert.assertEquals(memoryTypeContext.getLimit().getMin(), limit.getMin());
14 | Assert.assertEquals(memoryTypeContext.getLimit().getMax(), limit.getMax());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/CONTRIBUTION.md:
--------------------------------------------------------------------------------
1 |
2 | # Design Principles
3 |
4 | In general, the `*-sys` library should keep only `unsafe` C interface bindings and should not have redundant security abstractions. The interfaces exposed by the `*-sys` library are supposed to be stable. That is, when the C interface changes, only the `*-sys` library needs to be changed, not the upper-layer SDK.
5 |
6 | The [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crate follows the design principle. `wasmedge-sys` defines a group of low-level Rust APIs, which simply wrap WasmEdge C APIs and provide the safe counterparts. The APIs in [wasmedge-sys](https://crates.io/crates/wasmedge-sys) should be used to construct high-level libraries.
7 |
--------------------------------------------------------------------------------
/docs/book/en/src/sdk.md:
--------------------------------------------------------------------------------
1 | # Use WasmEdge Library in Programming Languages
2 |
3 | Besides using the WasmEdge command line tools to executing the WebAssembly applications, WasmEdge also provides SDKs for various programming languages.
4 | The WasmEdge library allows developers to embed the WasmEdge into their host applications, so that the WebAssembly applications can be executed in the WasmEdge sandbox safely.
5 | Furthermore, developers can implement the host functions for the extensions with the WasmEdge library.
6 |
7 | In this chapter, we will discuss how to use WasmEdge SDKs to embed WasmEdge into [C](sdk/c.md), [Rust](sdk/rust.md), [Go](sdk/go.md), [Node.js](sdk/node.md), and [Python](sdk/python.md) host applications.
8 |
--------------------------------------------------------------------------------
/include/driver/tool.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/driver/tool.h - Tool entrypoint --------------------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contents the entrypoint for the tooling executable.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | namespace WasmEdge {
17 | namespace Driver {
18 |
19 | int Tool(int Argc, const char *Argv[]) noexcept;
20 |
21 | } // namespace Driver
22 | } // namespace WasmEdge
23 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/enums/ValueType.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge.enums;
2 |
3 | import java.util.Arrays;
4 |
5 | public enum ValueType {
6 | i32(0x7F),
7 | i64(0x7E),
8 | f32(0x7D),
9 | f64(0x7C),
10 | v128(0x7B),
11 | FuncRef(0x70),
12 | ExternRef(0x6F);
13 | private final int value;
14 |
15 | ValueType(int value) {
16 | this.value = value;
17 | }
18 |
19 | public static ValueType parseType(int value) {
20 | return Arrays.stream(values()).filter(v -> v.value == value)
21 | .findAny()
22 | .orElse(null);
23 | }
24 |
25 | public int getValue() {
26 | return value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/include/driver/compiler.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/driver/compiler.h - Compiler entrypoint ------------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contents the entrypoint for the compiler executable.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | namespace WasmEdge {
17 | namespace Driver {
18 |
19 | int Compiler(int Argc, const char *Argv[]) noexcept;
20 |
21 | } // namespace Driver
22 | } // namespace WasmEdge
23 |
--------------------------------------------------------------------------------
/examples/capi/mandelbrot-set-in-threads/Makefile:
--------------------------------------------------------------------------------
1 |
2 | all: mandelbrot.so main
3 |
4 | mandelbrot.o: mandelbrot.c
5 | clang -O3 --no-standard-libraries --target=wasm32 -c -o $@ $^
6 |
7 | mandelbrot.wasm: mandelbrot.o
8 | wasm-ld --no-entry $^ -o $@ --import-memory --export-all --shared-memory --features=mutable-globals,atomics,bulk-memory
9 |
10 | mandelbrot.wat: mandelbrot.wasm
11 | wasm2wat --enable-all mandelbrot.wasm -o mandelbrot.wat
12 |
13 | mandelbrot.so: mandelbrot.wasm
14 | wasmedgec --enable-threads mandelbrot.wasm mandelbrot.so
15 |
16 | main: main.cc
17 | clang++ -lwasmedge -std=c++17 -pthread -o $@ $^
18 |
19 | clean:
20 | rm -f main mandelbrot.wasm mandelbrot.so mandelbrot.o mandelbrot.wat output-*.bin
21 |
22 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/kubernetes/kubernetes.md:
--------------------------------------------------------------------------------
1 | # Kubernetes
2 |
3 | Most high-level container runtimes implement Kubernetes' CRI (Container Runtime Interface) spec so that they can be managed by Kubernetes tools. That means you can use Kubernetes tools to manage the WebAssembly app image in pods and namespaces.
4 | Check out specific instructions for different flavors of Kubernetes setup in this chapter.
5 |
6 | * [Kubernetes + CRI-O](kubernetes/kubernetes-crio.md)
7 | * [Kubernetes + containerd](kubernetes/kubernetes-containerd.md)
8 | * [KinD](kubernetes/kind.md)
9 | * [KubeEdge](kubernetes/kubeedge.md)
10 | * [SuperEdge](kubernetes/superedge.md)
11 | * [OpenYurt](kubernetes/openyurt.md)
12 | * [Knative](kubernetes/knative.md)
13 |
--------------------------------------------------------------------------------
/docs/book/zh/src/kubernetes/container/crun.md:
--------------------------------------------------------------------------------
1 | # crun
2 |
3 | [crun 项目](https://github.com/containers/crun)已经内置了对 WasmEdge 的支持。
4 | 目前,最简单的方法是自己从源代码构建它。首先,让我们确保 crun 在你的 Ubuntu 20.04 上安装了依赖包。
5 | 对于其他 Linux 发行版,请[参见此处](https://github.com/containers/crun#readme)。
6 |
7 | ```bash
8 | $ sudo apt update
9 | $ sudo apt install -y make git gcc build-essential pkgconf libtool \
10 | libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev \
11 | go-md2man libtool autoconf python3 automake
12 | ```
13 |
14 | 接下来,配置、构建及安装一个支持 WasmEdge 的 crun 二进制文件。
15 |
16 | ```bash
17 | git clone https://github.com/containers/crun
18 | cd crun
19 | ./autogen.sh
20 | ./configure --with-wasmedge
21 | make
22 | sudo make install
23 | ```
24 |
--------------------------------------------------------------------------------
/plugins/wasi_crypto/kx/module.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "kx/module.h"
5 | #include "kx/func.h"
6 |
7 | #include
8 |
9 | namespace WasmEdge {
10 | namespace Host {
11 |
12 | WasiCryptoKxModule::WasiCryptoKxModule(std::shared_ptr C)
13 | : ModuleInstance("wasi_ephemeral_crypto_kx"), Ctx(C) {
14 | using namespace WasiCrypto;
15 |
16 | addHostFunc("kx_dh", std::make_unique(*Ctx));
17 | addHostFunc("kx_encapsulate", std::make_unique(*Ctx));
18 | addHostFunc("kx_decapsulate", std::make_unique(*Ctx));
19 | }
20 |
21 | } // namespace Host
22 | } // namespace WasmEdge
23 |
--------------------------------------------------------------------------------
/docs/book/en/src/contribute/build_from_src/raspberrypi.md:
--------------------------------------------------------------------------------
1 | # Build WasmEdge for Raspberry Pi 3/4
2 |
3 | Raspberry Pi uses 64-bit processors starting from the 3 Model B. So WasmEdge can be executed on Raspberry Pi as well. You can choose any 64-bit Linux distribution, such as Raspbian, Ubuntu or Manjaro for ARM. This document has been tested on the Manjaro for ARM distribution and the hardware is the Raspberry Pi 3 Model B.
4 |
5 | The installation steps are no different from the [installation document](../../quick_start/install.md), and the execution is the same. Here's a video about installing WasmEdge and running a simple WebAssembly module to add two numbers up.
6 |
7 | [](https://asciinema.org/a/458453)
8 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/WasmEdgeFuncRef.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.ValueType;
4 |
5 | public class WasmEdgeFuncRef implements WasmEdgeValue {
6 | private long value;
7 |
8 | public WasmEdgeFuncRef() {
9 |
10 | }
11 |
12 | public WasmEdgeFuncRef(long index) {
13 | this.value = index;
14 | }
15 |
16 | @Override
17 | public ValueType getType() {
18 | return ValueType.FuncRef;
19 | }
20 |
21 | public long getValue() {
22 | return this.value;
23 | }
24 |
25 | public void setValue(long value) {
26 | this.value = value;
27 | }
28 |
29 | public long getIndex() {
30 | return value;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/WasmEdgeTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class WasmEdgeTest extends BaseTest {
7 | @Test
8 | public void testVersion() {
9 | WasmEdge wasmEdge = new WasmEdge();
10 | Assert.assertNotNull(wasmEdge.getVersion());
11 | Assert.assertTrue(wasmEdge.getMajorVersion() >= 0);
12 | Assert.assertTrue(wasmEdge.getMinorVersion() >= 0);
13 | Assert.assertTrue(wasmEdge.getPatchVersion() >= 0);
14 | }
15 |
16 | @Test
17 | public void testSetLogLevel() {
18 | WasmEdge wasmEdge = new WasmEdge();
19 | wasmEdge.setLogLevel(WasmEdge.LogLevel.DEBUG);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/utils/wasi-nn/build-wasinn-ubuntu-openvino.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | if [[ ! -v "${CMAKE_BUILD_TYPE}" ]]; then
6 | CMAKE_BUILD_TYPE=Release
7 | fi
8 |
9 | source /opt/intel/openvino_2021/bin/setupvars.sh
10 | ldconfig
11 | git config --global --add safe.directory $(pwd)
12 | if ! cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_PLUGIN_WASI_NN_BACKEND="OpenVINO" .; then
13 | echo === CMakeOutput.log ===
14 | cat build/CMakeFiles/CMakeOutput.log
15 | echo === CMakeError.log ===
16 | cat build/CMakeFiles/CMakeError.log
17 | exit 1
18 | fi
19 | cmake --build build
20 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/add-wasi_opt.patch:
--------------------------------------------------------------------------------
1 | --- a/typenames.witx 2021-12-26 23:54:28.211448600 +0800
2 | +++ b/typenames.witx 2021-12-27 21:29:35.422274600 +0800
3 | @@ -748,6 +748,31 @@
4 | )
5 | )
6 |
7 | +(typename $sock_opt_level
8 | + (enum (@witx tag u32)
9 | + $sol_socket
10 | + )
11 | +)
12 | +
13 | +(typename $sock_opt_so
14 | + (enum (@witx tag u32)
15 | + $reuseaddr
16 | + $type
17 | + $error
18 | + $dontroute
19 | + $broadcast
20 | + $sndbuf
21 | + $rcvbuf
22 | + $keepalive
23 | + $oobinline
24 | + $linger
25 | + $rcvlowat
26 | + $rcvtimeo
27 | + $sndtimeo
28 | + $acceptconn
29 | + )
30 | +)
31 | +
32 | ;;; Flags provided to `getaddrinfo`.
33 | (typename $aiflags
34 | (flags (@witx repr u16)
35 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/GlobalTypeContextTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 | import org.wasmedge.enums.ValueType;
6 | import org.wasmedge.enums.WasmEdgeMutability;
7 |
8 | public class GlobalTypeContextTest extends BaseTest {
9 | @Test
10 | public void testCreation() {
11 | ValueType valueType = ValueType.f32;
12 | WasmEdgeMutability mutability = WasmEdgeMutability.VAR;
13 | GlobalTypeContext globalTypeContext = new GlobalTypeContext(valueType, mutability);
14 |
15 | Assert.assertEquals(globalTypeContext.getValueType(), valueType);
16 | Assert.assertEquals(globalTypeContext.getMutability(), mutability);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/ExternRef.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-01-16.
3 | //
4 |
5 | #include "../jni/org_wasmedge_WasmEdgeExternRef.h"
6 | #include "common.h"
7 | #include
8 | #include
9 |
10 | JNIEXPORT void JNICALL Java_org_wasmedge_WasmEdgeExternRef_nativeInit(
11 | JNIEnv *env, jobject thisObject, jobject jVal) {
12 | jint len = (*env)->GetStringUTFLength(env, jVal);
13 | char *ptr = (char *)malloc(sizeof(char) * len);
14 |
15 | const char *val = (*env)->GetStringUTFChars(env, jVal, NULL);
16 |
17 | memcpy(ptr, val, len);
18 |
19 | (*env)->ReleaseStringUTFChars(env, jVal, val);
20 | WasmEdge_Value ref = WasmEdge_ValueGenExternRef(ptr);
21 |
22 | setPointer(env, thisObject, (long)&ref);
23 | }
24 |
--------------------------------------------------------------------------------
/include/common/span.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/common/span.h - Helper template of std::span -------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contents the helper template aliasing of std::span.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | #include "experimental/span.hpp"
17 |
18 | namespace WasmEdge {
19 |
20 | template
21 | using Span = cxx20::span;
22 |
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/include/system/path.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/system/path.h - Get system directory path ----------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contains helper to get system path for various operating system.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | #include "common/filesystem.h"
17 |
18 | namespace WasmEdge {
19 |
20 | class Path {
21 | public:
22 | static std::filesystem::path home() noexcept;
23 | };
24 |
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/plugins/wasi_nn/wasinnmodule.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "wasinnmodule.h"
5 | #include "wasinnfunc.h"
6 |
7 | namespace WasmEdge {
8 | namespace Host {
9 |
10 | WasiNNModule::WasiNNModule() : ModuleInstance("wasi_ephemeral_nn") {
11 | addHostFunc("load", std::make_unique(Env));
12 | addHostFunc("init_execution_context",
13 | std::make_unique(Env));
14 | addHostFunc("set_input", std::make_unique(Env));
15 | addHostFunc("get_output", std::make_unique(Env));
16 | addHostFunc("compute", std::make_unique(Env));
17 | }
18 |
19 | } // namespace Host
20 | } // namespace WasmEdge
21 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/FunctionTypeInstance.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2022-03-14.
3 | //
4 |
5 | #ifndef WASMEDGE_JAVA_FUNCTIONTYPEINSTANCE_H
6 | #define WASMEDGE_JAVA_FUNCTIONTYPEINSTANCE_H
7 | #include "jni.h"
8 | #include "wasmedge/wasmedge.h"
9 |
10 | typedef struct HostFuncParam {
11 | JNIEnv *env;
12 | const char *jFuncKey;
13 | } HostFuncParam;
14 |
15 | WasmEdge_FunctionInstanceContext *
16 | getFunctionInstanceContext(JNIEnv *env, jobject jFuncInstance);
17 |
18 | jobject createJFunctionInstanceContext(
19 | JNIEnv *env, const WasmEdge_FunctionInstanceContext *funcInstance);
20 |
21 | uint32_t
22 | GetReturnLen(WasmEdge_FunctionInstanceContext *functionInstanceContext);
23 |
24 | #endif // WASMEDGE_JAVA_FUNCTIONTYPEINSTANCE_H
25 |
--------------------------------------------------------------------------------
/include/aot/version.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/aot/version.h - version definition -----------------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contains the binary version signature of WasmEdge.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | #include
17 |
18 | namespace WasmEdge {
19 | namespace AOT {
20 |
21 | static inline constexpr const uint32_t kBinaryVersion [[maybe_unused]] = 1;
22 |
23 | } // namespace AOT
24 | } // namespace WasmEdge
25 |
--------------------------------------------------------------------------------
/include/executor/engine/vector_helper.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | namespace WasmEdge {
9 | namespace Executor {
10 | namespace detail {
11 |
12 | template
13 | [[gnu::always_inline]] constexpr inline std::enable_if_t<
14 | !std::is_arithmetic_v, V>
15 | vectorSelect(U Cond, V A, V B) noexcept {
16 | #if defined(__clang__)
17 | return reinterpret_cast((Cond & reinterpret_cast(A)) |
18 | (~Cond & reinterpret_cast(B)));
19 | #else
20 | return Cond ? A : B;
21 | #endif
22 | }
23 |
24 | } // namespace detail
25 | } // namespace Executor
26 | } // namespace WasmEdge
27 |
--------------------------------------------------------------------------------
/test/mixcall/mixcallTestData/module2.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (type $t0 (func (param i32)))
3 | (type $t1 (func (param f64)))
4 | (type $t2 (func (param i32 i32)))
5 | (type $t3 (func (param f64 f64)))
6 | (import "host" "host_printI32" (func $host_printI32 (type $t0)))
7 | (import "host" "host_printF64" (func $host_printF64 (type $t1)))
8 | (func $impl_printAdd (type $t2) (param $p0 i32) (param $p1 i32)
9 | local.get $p0
10 | local.get $p1
11 | i32.add
12 | call $host_printI32)
13 | (func $impl_printDiv (type $t3) (param $p0 f64) (param $p1 f64)
14 | local.get $p0
15 | local.get $p1
16 | f64.div
17 | call $host_printF64)
18 | (export "impl_printAdd" (func $impl_printAdd))
19 | (export "impl_printDiv" (func $impl_printDiv)))
20 |
--------------------------------------------------------------------------------
/bindings/rust/wasmedge-sys/examples/data/module2.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (type $t0 (func (param i32)))
3 | (type $t1 (func (param f64)))
4 | (type $t2 (func (param i32 i32)))
5 | (type $t3 (func (param f64 f64)))
6 | (import "host" "host_printI32" (func $host_printI32 (type $t0)))
7 | (import "host" "host_printF64" (func $host_printF64 (type $t1)))
8 | (func $impl_printAdd (type $t2) (param $p0 i32) (param $p1 i32)
9 | local.get $p0
10 | local.get $p1
11 | i32.add
12 | call $host_printI32)
13 | (func $impl_printDiv (type $t3) (param $p0 f64) (param $p1 f64)
14 | local.get $p0
15 | local.get $p1
16 | f64.div
17 | call $host_printF64)
18 | (export "impl_printAdd" (func $impl_printAdd))
19 | (export "impl_printDiv" (func $impl_printDiv)))
20 |
--------------------------------------------------------------------------------
/docs/book/en/src/use_cases/frameworks/app.md:
--------------------------------------------------------------------------------
1 | # App frameworks
2 |
3 | WasmEdge provides a safe and efficient extension mechanism for applications.
4 | Of course, application developers can always use [WasmEdge SDKs](../../sdk.md) to embed WebAssembly functions. But some applications and frameworks opt to build their own extension / embedding APIs on top of the WasmEdge SDK, which supports more ergonomic integration with the application's native use cases and programming models.
5 |
6 | * [YoMo](app/yomo.md) is a data stream processing framework. WasmEdge functions can be plugged into the framework to process data in-stream.
7 | * [Reactr](app/reactr.md) is a Go language framework for managing and extending WebAssembly functions for the purpose of easy embedding into other Go applications.
8 |
--------------------------------------------------------------------------------
/include/driver/fuzzPO.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/driver/fuzzPO.h - Fuzz PO entrypoint ---------------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contents the entrypoint for the fuzz PO executable.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | #include
17 | #include
18 |
19 | namespace WasmEdge {
20 | namespace Driver {
21 |
22 | int FuzzPO(const uint8_t *Data, size_t Size) noexcept;
23 |
24 | } // namespace Driver
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/lib/executor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeExecutor
5 | instantiate/import.cpp
6 | instantiate/function.cpp
7 | instantiate/global.cpp
8 | instantiate/table.cpp
9 | instantiate/memory.cpp
10 | instantiate/elem.cpp
11 | instantiate/data.cpp
12 | instantiate/export.cpp
13 | instantiate/module.cpp
14 | engine/proxy.cpp
15 | engine/controlInstr.cpp
16 | engine/tableInstr.cpp
17 | engine/threadInstr.cpp
18 | engine/memoryInstr.cpp
19 | engine/variableInstr.cpp
20 | engine/engine.cpp
21 | helper.cpp
22 | executor.cpp
23 | )
24 |
25 | target_link_libraries(wasmedgeExecutor
26 | PUBLIC
27 | wasmedgeCommon
28 | wasmedgeSystem
29 | )
30 |
--------------------------------------------------------------------------------
/.github/scripts/clang-format.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # Usage: $0 clang-format(version >= 10.0)
4 | # $ bash clang-format.sh `which clang-format`
5 |
6 | lint() {
7 | local targets="include lib tools plugins examples"
8 | local clang_format="${1}"
9 |
10 | if [ "$#" -ne 1 ]; then
11 | echo "please provide clang-format command. Usage ${0} `which clang-format`"
12 | exit 1
13 | fi
14 |
15 | if [ ! -f "${clang_format}" ]; then
16 | echo "clang-format not found. Please install clang-format first"
17 | exit 1
18 | fi
19 |
20 | find ${targets} -type f -iname *.[ch] -o -iname *.cpp -o -iname *.[ch]xx \
21 | | xargs -n1 ${clang_format} -i -style=file -Werror --dry-run
22 |
23 | exit $?
24 | }
25 |
26 | lint $@
27 |
--------------------------------------------------------------------------------
/include/driver/fuzzTool.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | //===-- wasmedge/driver/fuzzTool.h - Fuzz Tool entrypoint -----------------===//
5 | //
6 | // Part of the WasmEdge Project.
7 | //
8 | //===----------------------------------------------------------------------===//
9 | ///
10 | /// \file
11 | /// This file contents the entrypoint for the fuzz tool executable.
12 | ///
13 | //===----------------------------------------------------------------------===//
14 | #pragma once
15 |
16 | #include
17 | #include
18 |
19 | namespace WasmEdge {
20 | namespace Driver {
21 |
22 | int FuzzTool(const uint8_t *Data, size_t Size) noexcept;
23 |
24 | } // namespace Driver
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/test/host/socket/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_executable(wasiSocketTests
5 | wasi_socket.cpp
6 | )
7 |
8 | add_test(wasiSocketTests wasiSocketTests)
9 |
10 | target_link_libraries(wasiSocketTests
11 | PRIVATE
12 | ${GTEST_BOTH_LIBRARIES}
13 | wasmedgeHostModuleWasi
14 | )
15 |
16 | if(WIN32)
17 | target_link_libraries(wasiSocketTests
18 | PRIVATE
19 | wsock32
20 | ws2_32
21 | )
22 | endif()
23 |
24 | if(WASMEDGE_BUILD_COVERAGE)
25 | add_test(
26 | NAME wasi-test
27 | COMMAND bash -c "[ -e \"$HOME/.cargo/env\" ] && . \"$HOME/.cargo/env\"; \"${PROJECT_SOURCE_DIR}\"/utils/wasi-test/run-wasi-test.sh \"${PROJECT_BINARY_DIR}/tools/wasmedge\""
28 | )
29 | endif()
30 |
--------------------------------------------------------------------------------
/utils/wasi-nn/download-tflite-fixtures.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | TODIR=$1
6 | if [[ $# -eq 0 ]]; then
7 | TODIR=.
8 | fi
9 | FIXTURE=https://raw.githubusercontent.com/gusye1234/WasmEdge-WASINN-examples/demo-tflite-image/tflite-birds_v1-image
10 | if [ ! -d $TODIR ]; then
11 | mkdir $TODIR
12 | fi
13 |
14 | if [ ! -f $TODIR/lite-model_aiy_vision_classifier_birds_V1_3.tflite ]; then
15 | curl -sL $FIXTURE/lite-model_aiy_vision_classifier_birds_V1_3.tflite -o $TODIR/lite-model_aiy_vision_classifier_birds_V1_3.tflite
16 | fi
17 | if [ ! -f $TODIR/birdx224x224x3.rgb ]; then
18 | curl -sL $FIXTURE/birdx224x224x3.rgb -o $TODIR/birdx224x224x3.rgb
19 | fi
20 |
--------------------------------------------------------------------------------
/examples/plugin/get-string/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | add_library(GetString
5 | SHARED
6 | getstring.cpp
7 | )
8 |
9 | target_compile_options(GetString
10 | PUBLIC
11 | -DWASMEDGE_PLUGIN
12 | )
13 |
14 | if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
15 | target_link_options(GetString
16 | PUBLIC
17 | -Wl,-U,__ZN8WasmEdge6Plugin14PluginRegisterC1EPKNS0_6Plugin16PluginDescriptorE
18 | -Wl,-U,__ZN8WasmEdge6Plugin14PluginRegisterD1Ev
19 | )
20 | endif()
21 |
22 | target_include_directories(GetString
23 | PUBLIC
24 | $
25 | )
26 |
27 | target_link_libraries(GetString
28 | PUBLIC
29 | wasmedgeCommon
30 | wasmedgeSystem
31 | )
32 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/test/java/org/wasmedge/ValidatorContextTest.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.junit.Test;
4 |
5 | public class ValidatorContextTest extends BaseTest {
6 |
7 | @Test
8 | public void testCreation() {
9 | ConfigureContext configureContext = new ConfigureContext();
10 |
11 | LoaderContext loaderContext = new LoaderContext(configureContext);
12 |
13 | ASTModuleContext astModuleContext = loaderContext.parseFromFile(getResourcePath(TEST_WASM_PATH));
14 |
15 | ValidatorContext validatorContext = new ValidatorContext(null);
16 | validatorContext.validate(astModuleContext);
17 |
18 | astModuleContext.delete();
19 | configureContext.destroy();
20 | validatorContext.delete();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/lib/VmContext.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Kenvi Zhu on 2021-11-19.
3 | //
4 |
5 | #include "../jni/org_wasmedge_VMContext.h"
6 | #include "ConfigureContext.h"
7 | #include "StoreContext.h"
8 | #include "common.h"
9 | #include "wasmedge/wasmedge.h"
10 |
11 | JNIEXPORT void JNICALL Java_org_wasmedge_VMContext_initNative(
12 | JNIEnv *env, jobject jVmContext, jobject jConfigureContext,
13 | jobject jStoreContext) {
14 |
15 | WasmEdge_ConfigureContext *ConfigureContext =
16 | getConfigureContext(env, jConfigureContext);
17 | WasmEdge_StoreContext *StoreContext = getStoreContext(env, jStoreContext);
18 |
19 | WasmEdge_VMContext *VMContext =
20 | WasmEdge_VMCreate(ConfigureContext, StoreContext);
21 |
22 | setPointer(env, jVmContext, (jlong)VMContext);
23 | }
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/use/runtime.md:
--------------------------------------------------------------------------------
1 | # 云原生的 runtime
2 |
3 | WasmEdge 可以通过其 [C](../../embed/c.md), [Go](../../embed/go.md), [Rust](../../embed/rust.md), 和 [JavaScript](../../embed/node.md) 的 SDK 嵌入到云原生基础设施中。它也是一个符合 OCI 的 runtime ,可以由 [CRI-O 和 Docker 工具直接管理](https://www.secondstate.io/articles/manage-webassembly-apps-in-wasmedge-using-docker-tools/) ,作为 Docker 的轻量级和高性能替代。
4 |
5 | ## Dapr (分布式应用 Runtime)
6 |
7 | * [教程](https://www.secondstate.io/articles/dapr-wasmedge-webassembly/)
8 | * [代码教程](https://github.com/second-state/dapr-wasm)
9 |
10 | ## Service mesh (开发进行中)
11 |
12 | * Linkerd
13 | * MOSN
14 | * Envoy
15 |
16 | ## 编排和管理
17 |
18 | * [Kubernetes](https://www.secondstate.io/articles/manage-webassembly-apps-in-wasmedge-using-docker-tools/)
19 | * KubeEdge
20 | * SuperEdge
21 | * OpenYurt
22 |
--------------------------------------------------------------------------------
/include/host/wasi/error.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "common/expected.h"
7 | #include "wasi/api.hpp"
8 |
9 | namespace WasmEdge {
10 | namespace Host {
11 | namespace WASI {
12 |
13 | /// Type aliasing for Expected.
14 | template using WasiExpect = Expected;
15 |
16 | /// Helper function for Unexpected.
17 | constexpr auto WasiUnexpect(__wasi_errno_t Val) {
18 | return Unexpected<__wasi_errno_t>(Val);
19 | }
20 | template constexpr auto WasiUnexpect(const WasiExpect &Val) {
21 | return Unexpected<__wasi_errno_t>(Val.error());
22 | }
23 |
24 | } // namespace WASI
25 | } // namespace Host
26 | } // namespace WasmEdge
27 |
--------------------------------------------------------------------------------
/docs/book/zh/src/intro/use.md:
--------------------------------------------------------------------------------
1 | # 应用场景
2 |
3 | WasmEdge 是由 CNCF 托管的云原生 WebAssembly runtime。它广泛应用于边缘计算、汽车、Jamstack、Serverless、SaaS、服务网格,乃至区块链应用。 WasmEdge 可以进行 AOT (提前编译)编译器优化,是当今市场上最快的 WebAssembly runtime 之一。
4 |
5 | * [云原生 runtime](use/runtime.md)
6 | * Dapr
7 | * Kubernetes
8 | * [JavaScript 或 DSL runtime](use/js.md)
9 | * JavaScript
10 | * 用于图像识别的 DSL
11 | * 用于聊天机器人的 DSL
12 | * [公有云中的 Serverless 函数即服务](use/serverless.md)
13 | * AWS Lambda
14 | * 腾讯 Serverless 函数
15 | * Vercel Serverless 函数
16 | * Netlify Functions
17 | * Second State Functions
18 | * [边缘计算](use/edge.md)
19 | * YoMo Flow
20 | * seL4 micokernel and RTOS
21 | * [用于 SaaS 的响应式函数](use/saas.md)
22 | * Slack
23 | * 飞书
24 |
25 | 如果关于 WasmEdge 有什么好主意,马上开 [一个 GitHub issue](https://github.com/WasmEdge/WasmEdge/issues) 来一起讨论吧。
26 |
--------------------------------------------------------------------------------
/lib/driver/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeDriver
5 | compilerTool.cpp
6 | runtimeTool.cpp
7 | fuzzTool.cpp
8 | fuzzPO.cpp
9 | )
10 |
11 | if(WASMEDGE_BUILD_AOT_RUNTIME)
12 | target_link_libraries(wasmedgeDriver
13 | PRIVATE
14 | wasmedgeLoader
15 | wasmedgeCommon
16 | wasmedgePO
17 | wasmedgeVM
18 | wasmedgeAOT
19 | )
20 | else()
21 | target_link_libraries(wasmedgeDriver
22 | PRIVATE
23 | wasmedgeLoader
24 | wasmedgeCommon
25 | wasmedgePO
26 | wasmedgeVM
27 | )
28 | endif()
29 |
30 | if(WASMEDGE_BUILD_AOT_RUNTIME)
31 | target_compile_definitions(wasmedgeDriver
32 | PRIVATE
33 | -DWASMEDGE_BUILD_AOT_RUNTIME
34 | )
35 | endif()
36 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/TableTypeContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | import org.wasmedge.enums.RefType;
4 |
5 | public class TableTypeContext {
6 |
7 | private long pointer;
8 |
9 | public TableTypeContext(RefType refType, WasmEdgeLimit limit) {
10 | nativeInit(refType.getVal(), limit);
11 | }
12 |
13 | private TableTypeContext(long pointer) {
14 | this.pointer = pointer;
15 | }
16 |
17 | private native void nativeInit(int refType, WasmEdgeLimit limit);
18 |
19 | public native WasmEdgeLimit getLimit();
20 |
21 | public RefType getRefType() {
22 | return RefType.getType(nativeGetRefType());
23 | }
24 |
25 | private native int nativeGetRefType();
26 |
27 | public native void delete();
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/use.md:
--------------------------------------------------------------------------------
1 | # 使用情境
2 |
3 | WasmEdge 是由 CNCF 託管的雲端原生 WebAssembly runtime ,廣泛應用在邊緣運算、汽車、 Jamstack 、 Serverless 、 SaaS 、 服務網格,甚至是區塊鏈應用程式。 WasmEdge 可以進行 AOT (預先編譯)編譯器最佳化,是目前市場上最快的 WebAssembly runtime 之一。
4 |
5 | ## 目錄
6 |
7 | * [雲端原生 runtime](use/runtime.md)
8 | * Dapr
9 | * Kubernetes
10 | * [JavaScript 或 DSL runtime](use/js.md)
11 | * JavaScript
12 | * 用於影像辨識的 DSL
13 | * 用於聊天機器人的 DSL
14 | * [公開雲端中的 Serverless 函式即服務](use/serverless.md)
15 | * AWS Lambda
16 | * 騰訊 Serverless 函式
17 | * Vercel Serverless 函式
18 | * Netlify 函式
19 | * Second State 函式
20 | * [邊緣運算](use/edge.md)
21 | * YoMo Flow
22 | * seL4 微型核心 and RTOS
23 | * [用於 SaaS 的互動函式](use/saas.md)
24 | * Slack
25 | * 飛書
26 |
27 | 如果對於 WasmEdge 有任何建議,歡迎提出 [GitHub issue](https://github.com/WasmEdge/WasmEdge/issues) 來討論。
28 |
--------------------------------------------------------------------------------
/lib/executor/instantiate/table.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "executor/executor.h"
5 |
6 | #include
7 |
8 | namespace WasmEdge {
9 | namespace Executor {
10 |
11 | // Instantiate table instance. See "include/executor/executor.h".
12 | Expect Executor::instantiate(Runtime::Instance::ModuleInstance &ModInst,
13 | const AST::TableSection &TabSec) {
14 | // Iterate through the table types to instantiate table instance.
15 | for (const auto &TabType : TabSec.getContent()) {
16 | // Create and add the table instance into the module instance.
17 | ModInst.addTable(TabType);
18 | }
19 | return {};
20 | }
21 |
22 | } // namespace Executor
23 | } // namespace WasmEdge
24 |
--------------------------------------------------------------------------------
/lib/loader/ast/expression.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "loader/loader.h"
5 |
6 | #include
7 |
8 | namespace WasmEdge {
9 | namespace Loader {
10 |
11 | // Load to construct Expression node. See "include/loader/loader.h".
12 | Expect Loader::loadExpression(AST::Expression &Expr,
13 | std::optional SizeBound) {
14 | if (auto Res = loadInstrSeq(SizeBound)) {
15 | // For the section size mismatch case, check in caller.
16 | Expr.getInstrs() = std::move(*Res);
17 | } else {
18 | spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Expression));
19 | return Unexpect(Res);
20 | }
21 | return {};
22 | }
23 |
24 | } // namespace Loader
25 | } // namespace WasmEdge
26 |
--------------------------------------------------------------------------------
/plugins/wasmedge_httpsreq/httpsreqmodule.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #include "httpsreqmodule.h"
5 | #include "httpsreqfunc.h"
6 |
7 | namespace WasmEdge {
8 | namespace Host {
9 |
10 | /// Register your functions in module.
11 | WasmEdgeHttpsReqModule::WasmEdgeHttpsReqModule()
12 | : ModuleInstance("wasmedge_httpsreq") {
13 | addHostFunc("wasmedge_httpsreq_send_data",
14 | std::make_unique(Env));
15 | addHostFunc("wasmedge_httpsreq_get_rcv",
16 | std::make_unique(Env));
17 | addHostFunc("wasmedge_httpsreq_get_rcv_len",
18 | std::make_unique(Env));
19 | }
20 |
21 | } // namespace Host
22 | } // namespace WasmEdge
23 |
--------------------------------------------------------------------------------
/.github/workflows/witx.yml:
--------------------------------------------------------------------------------
1 | name: "Verify Witx"
2 |
3 | concurrency:
4 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
5 | cancel-in-progress: true
6 |
7 | on:
8 | push:
9 | branches:
10 | - master
11 | paths:
12 | - 'docs/witx/**'
13 | pull_request:
14 | branches:
15 | - master
16 | paths:
17 | - 'docs/witx/**'
18 |
19 | jobs:
20 | gen_doc:
21 | runs-on: ubuntu-latest
22 |
23 | steps:
24 | - uses: actions/checkout@v3
25 | with:
26 | fetch-depth: 0
27 |
28 | - name: rustup
29 | run: |
30 | rustup update stable --no-self-update
31 | rustup default stable
32 |
33 | - name: generate md from witx # XXX: md files goes nowhere
34 | run: ./generate.sh
35 | working-directory: utils/witx-doc
36 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/src/intro/use/runtime.md:
--------------------------------------------------------------------------------
1 | # 雲端原生 runtime (作為 Docker 的輕量級替代方案)
2 |
3 | WasmEdge 可以透過其 [C](../../embed/c.md) 、 [Go](../../embed/go.md) 、 [Rust](../../embed/rust.md) 和[JavaScript](../../embed/node.md)的 SDK 嵌入到雲端原生基礎架構中。它也是一個符合 OCI 的 runtime ,可以由 [CRI-O 和 Docker 工具直接管理](https://www.secondstate.io/articles/manage-webassembly-apps-in-wasmedge-using-docker-tools/) ,作為 Docker 的輕量級和高效能替代方案。
4 |
5 | ## Dapr (分散式應用程式 Runtime)
6 |
7 | * [教學](https://www.secondstate.io/articles/dapr-wasmedge-webassembly/)
8 | * [程式碼教學](https://github.com/second-state/dapr-wasm)
9 |
10 | ## Service mesh (開發進行中)
11 |
12 | * Linkerd
13 | * MOSN
14 | * Envoy
15 |
16 | ## 編排和管理
17 |
18 | * [Kubernetes](https://www.secondstate.io/articles/manage-webassembly-apps-in-wasmedge-using-docker-tools/)
19 | * KubeEdge
20 | * SuperEdge
21 | * OpenYurt
22 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/src/main/java/org/wasmedge/StatisticsContext.java:
--------------------------------------------------------------------------------
1 | package org.wasmedge;
2 |
3 | public class StatisticsContext {
4 | private long pointer;
5 |
6 | public StatisticsContext() {
7 | nativeInit();
8 | }
9 |
10 | private StatisticsContext(long pointer) {
11 | this.pointer = pointer;
12 | }
13 |
14 | private native void nativeInit();
15 |
16 | public native int getInstrCount();
17 |
18 | public native double getInstrPerSecond();
19 |
20 | public native void setCostTable(long[] costTable);
21 |
22 | public native void setCostLimit(long costLimit);
23 |
24 | public native long getTotalCost();
25 |
26 | public void destroy() {
27 | delete();
28 | pointer = 0;
29 | }
30 |
31 | public native void delete();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/utils/wasi-cpp-header/crypto_generate.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0
3 | set -x
4 |
5 | ROOT="$(realpath $(dirname "${BASH_SOURCE[0]}")/../../)"
6 | cargo build --release
7 |
8 | for name in "asymmetric_common" "common" "external_secrets" "kx" "signatures" "symmetric" ;
9 | do
10 | curl -s -L --remote-name-all https://raw.githubusercontent.com/WebAssembly/wasi-crypto/main/witx/proposal_${name}.witx
11 | done
12 |
13 | target/release/wasi-cpp-header generate --output $ROOT/thirdparty/wasi_crypto/api.hpp proposal_kx.witx proposal_asymmetric_common.witx proposal_common.witx proposal_signatures.witx proposal_symmetric.witx proposal_external_secrets.witx
14 | clang-format-12 -i "$ROOT/thirdparty/wasi_crypto/$api.hpp"
15 | patch -p1 -d "$ROOT/thirdparty/wasi_crypto" < crypto-custom.patch
16 |
17 |
--------------------------------------------------------------------------------
/utils/wasi-nn/download-openvino-fixtures.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
4 |
5 | TODIR=$1
6 | if [[ $# -eq 0 ]]; then
7 | TODIR=.
8 | fi
9 | FIXTURE=https://github.com/intel/openvino-rs/raw/v0.3.3/crates/openvino/tests/fixtures/mobilenet/
10 | if [ ! -d $TODIR ]; then
11 | mkdir $TODIR
12 | fi
13 | if [ ! -d $TODIR ]; then
14 | mkdir $TODIR
15 | fi
16 |
17 | if [ ! -f $TODIR/mobilenet.bin ]; then
18 | curl -sL $FIXTURE/mobilenet.bin -o $TODIR/mobilenet.bin
19 | fi
20 | if [ ! -f $TODIR/mobilenet.xml ]; then
21 | curl -sL $FIXTURE/mobilenet.xml -o $TODIR/mobilenet.xml
22 | fi
23 | if [ ! -f $TODIR/tensor-1x224x224x3-f32.bgr ]; then
24 | curl -sL $FIXTURE/tensor-1x224x224x3-f32.bgr -o $TODIR/tensor-1x224x224x3-f32.bgr
25 | fi
26 |
--------------------------------------------------------------------------------
/docs/book/zh/book.toml:
--------------------------------------------------------------------------------
1 | [book]
2 | title = "WasmEdge Runtime"
3 | description = ""
4 | author = ["Second State", "Michael Yuan", "Vivian Hu", "Miley Fu"]
5 | language = "zh"
6 |
7 | [output.html]
8 | git-repository-url = "https://github.com/WasmEdge/WasmEdge"
9 | git-repository-icon = "fa-github"
10 | edit-url-template = "https://github.com/WasmEdge/WasmEdge/tree/master/docs/book/zh/{path}"
11 | site-url = "/book/zh/"
12 | cname = "wasmedge.org"
13 |
14 | [output.html.playground]
15 | editable = false
16 | copy-js = true
17 | line-numbers = false
18 |
19 | [output.html.fold]
20 | enable = true
21 |
22 | [output.html.search]
23 | enable = true
24 | limit-results = 30
25 | teaser-word-count = 30
26 | use-boolean-and = true
27 | boost-title = 2
28 | boost-hierarchy = 1
29 | boost-paragraph = 1
30 | expand = true
31 | heading-split-level = 3
32 | copy-js = true
33 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-jni/jni/org_wasmedge_VMContext.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class org_wasmedge_VMContext */
4 |
5 | #ifndef _Included_org_wasmedge_VMContext
6 | #define _Included_org_wasmedge_VMContext
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: org_wasmedge_VMContext
12 | * Method: initNative
13 | * Signature: (Lorg/wasmedge/ConfigureContext;Lorg/wasmedge/StoreContext;)V
14 | */
15 | JNIEXPORT void JNICALL Java_org_wasmedge_VMContext_initNative
16 | (JNIEnv *, jobject, jobject, jobject);
17 |
18 | /*
19 | * Class: org_wasmedge_VMContext
20 | * Method: cleanUp
21 | * Signature: ()V
22 | */
23 | JNIEXPORT void JNICALL Java_org_wasmedge_VMContext_delete
24 | (JNIEnv *, jobject);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 | #endif
30 |
--------------------------------------------------------------------------------
/docs/book/en/src/features/platforms.md:
--------------------------------------------------------------------------------
1 | # Supported Platforms
2 |
3 | WasmEdge supports a wide range of operating systems and hardware platforms.
4 | It allows WebAssembly applications to be truly portable across platforms.
5 | It runs not only on Linux-like systems, but also on microkernels such as the `seL4` real-time system.
6 |
7 | WasmEdge now supports:
8 |
9 | * [Linux](../contribute/build_from_src/linux.md) (`x86_64` and `aarch64`)
10 | * [MacOS](../contribute/build_from_src/macos.md) (`x86_64` and `M1`)
11 | * [Windows](../contribute/build_from_src/windows.md)
12 | * [Android](../contribute/build_from_src/android.md)
13 | * [seL4](../contribute/build_from_src/sel4.md)
14 | * [OpenWrt](../contribute/build_from_src/openwrt.md)
15 | * [OpenHarmony](../contribute/build_from_src/openharmony.md)
16 | * [Respberry Pi](../contribute/build_from_src/raspberrypi.md)
17 |
--------------------------------------------------------------------------------
/utils/android/app/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/utils/android/app/lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/utils/android/standalone/build_for_android.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! $ANDROID_NDK_HOME ]; then
4 | echo "Environment variable ANDROID_NDK_HOME is not set."
5 | exit 1
6 | else
7 | echo "Use Android NDK path: $ANDROID_NDK_HOME"
8 | fi
9 |
10 | WASMEDGE_ROOT_PATH=$(dirname $(dirname $(dirname $(dirname $0))))
11 |
12 | cd ${WASMEDGE_ROOT_PATH}
13 |
14 | if ! cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=23 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_STL_TYPE=c++_static; then
15 | echo === CMakeOutput.log ===
16 | cat build/CMakeFiles/CMakeOutput.log
17 | echo === CMakeError.log ===
18 | cat build/CMakeFiles/CMakeError.log
19 | exit 1
20 | fi
21 |
22 | cmake --build build
23 |
24 | echo "Build finished."
25 |
--------------------------------------------------------------------------------
/docs/book/zh-TW/book.toml:
--------------------------------------------------------------------------------
1 | [book]
2 | title = "WasmEdge Runtime"
3 | description = ""
4 | author = ["Second State", "Michael Yuan", "Vivian Hu", "YiYing He"]
5 | language = "zh-TW"
6 |
7 | [output.html]
8 | git-repository-url = "https://github.com/WasmEdge/WasmEdge"
9 | git-repository-icon = "fa-github"
10 | edit-url-template = "https://github.com/WasmEdge/WasmEdge/tree/master/docs/book/zh-TW/{path}"
11 | site-url = "/book/zh-TW/"
12 | cname = "wasmedge.org"
13 |
14 | [output.html.playground]
15 | editable = false
16 | copy-js = true
17 | line-numbers = false
18 |
19 | [output.html.fold]
20 | enable = true
21 |
22 | [output.html.search]
23 | enable = true
24 | limit-results = 30
25 | teaser-word-count = 30
26 | use-boolean-and = true
27 | boost-title = 2
28 | boost-hierarchy = 1
29 | boost-paragraph = 1
30 | expand = true
31 | heading-split-level = 3
32 | copy-js = true
33 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/serverless/secondstate.md:
--------------------------------------------------------------------------------
1 | # Second State 函数
2 |
3 | Second State 函数由 WasmEdge 驱动,并且支持 Rust 语言作为其一等公民。
4 |
5 | 它可以
6 |
7 | * [处理基于文本的输入和输出](https://www.secondstate.io/articles/getting-started-with-function-as-a-service-in-rust/)
8 | * [使用二进制数据作为函数输入和输出](https://www.secondstate.io/articles/use-binary-data-as-function-input-and-output/)
9 | * [在函数参数和返回值中混合字节和字符串类型](https://www.secondstate.io/articles/use-binary-data-as-function-input-and-output/)
10 | * [使用 webhooks 作为函数输入和输出](https://www.secondstate.io/articles/internet-of-functions-webhooks/)
11 | * [通过 `http_proxy` API 来访问互联网资源](https://www.secondstate.io/articles/internet-of-functions-http-proxy/)
12 | * [通过 WasmEdge TensorFlow API 以原生速度运行 TensorFlow 模型](https://www.secondstate.io/articles/wasi-tensorflow/)
13 |
14 | 查看 [Second State Functions](https://www.secondstate.io/faas/) 官网内容来获得更多教程。
15 |
--------------------------------------------------------------------------------
/include/host/wasi/vfs.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | #pragma once
5 |
6 | #include "common/filesystem.h"
7 | #include "host/wasi/error.h"
8 |
9 | #include
10 |
11 | namespace WasmEdge {
12 | namespace Host {
13 | namespace WASI {
14 |
15 | class VINode;
16 | class VFS {
17 | public:
18 | VFS(const VFS &) = delete;
19 | VFS &operator=(const VFS &) = delete;
20 | VFS(VFS &&) = default;
21 | VFS &operator=(VFS &&) = default;
22 |
23 | VFS() = default;
24 |
25 | /// Flags for open path
26 | enum VFSFlags : uint8_t {
27 | Read = 1, ///< Open for read.
28 | Write = 2, ///< Open for write.
29 | AllowEmpty = 4, ///< Allow empty path for self reference.
30 | };
31 | };
32 |
33 | } // namespace WASI
34 | } // namespace Host
35 | } // namespace WasmEdge
36 |
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
2 | CheckOptions:
3 | - key: readability-identifier-naming.ClassCase
4 | value: CamelCase
5 | - key: readability-identifier-naming.EnumCase
6 | value: CamelCase
7 | - key: readability-identifier-naming.FunctionCase
8 | value: camelBack
9 | - key: readability-identifier-naming.MemberCase
10 | value: CamelCase
11 | - key: readability-identifier-naming.ParameterCase
12 | value: CamelCase
13 | - key: readability-identifier-naming.UnionCase
14 | value: CamelCase
15 | - key: readability-identifier-naming.VariableCase
16 | value: CamelCase
17 |
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug Report
3 | about: Building or Using WasmEdge, but it's not working as you expect?
4 | ---
5 |
6 | ## Description
7 |
8 | ### Current State
9 |
10 |
11 |
12 | ### Expected
13 |
14 |
15 |
16 | ## Environment
17 |
18 |
19 | - Hardware Architecture: (e.g. x86\_64 or aarch64)
20 | - Operating system: (e.g. Ubuntu 20.04 or CentOS 7.6)
21 |
22 | The following information is optional. Please provide them only if you have built from source.
23 | - C++ Compiler version:
24 | - CMake version:
25 | - CMake flags: (e.g. `-DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=ON`)
26 | - Boost version:
27 |
28 | ## Steps to Reproduce
29 |
30 |
31 |
--------------------------------------------------------------------------------
/examples/capi/host_functions/parse_json/README.md:
--------------------------------------------------------------------------------
1 | # Parse JSON example with WasmEdge C API
2 |
3 | The `parse-json` example shows how to use a host function with a shared library `json-c`. The `parseJson` function accepts a string as a key, parses the JSON file `test.json` and returns the corresponding value.
4 |
5 | The `parse-json.wat` is a WebAssembly script. It is compiled into WebAssembly in the form of `parse-json.wasm` using the [WABT tool](https://github.com/WebAssembly/wabt).
6 |
7 | ## Installation
8 |
9 | The version of `json-c` installed is `0.13.1` in `Ubuntu 20.04.3`.
10 |
11 | Install json-c using the command below.
12 |
13 | ```bash
14 | sudo apt install -y libjson-c-dev
15 | ```
16 |
17 | ## Instructions
18 |
19 | ```bash
20 | # Compilation
21 | $ gcc host_function.c -ljson-c -lwasmedge -o host_function
22 | $ ./host_function
23 | Got the result: Success
24 | ```
25 |
--------------------------------------------------------------------------------
/bindings/java/wasmedge-java/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 |
3 | repositories {
4 | mavenCentral()
5 | }
6 |
7 | configurations {
8 | checkstyleConfig
9 | }
10 |
11 | dependencies {
12 | testImplementation('junit:junit:4.13.2')
13 | }
14 |
15 |
16 | def libPath = System.getenv("LIB_JNI_PATH")
17 |
18 | test {
19 | systemProperty "java.library.path", "$libPath"
20 | if (System.getProperty('DEBUG', 'false') == 'true') {
21 | jvmArgs '-Xdebug',
22 | '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
23 | }
24 | testLogging {
25 | exceptionFormat = 'full'
26 | }
27 |
28 | }
29 |
30 | task buildJarWithJni(type : Jar) {
31 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
32 | with jar
33 | from new File(project.buildDir, 'jni-libs')
34 | }
35 |
36 |
37 |
--------------------------------------------------------------------------------
/docs/book/zh/src/frameworks/mesh.md:
--------------------------------------------------------------------------------
1 | # Service mesh 与分布式框架
2 |
3 | WasmEdge 可以作为 sidecar 微服务的轻量级运行时,也可以作为 Docker 替代方案的 API 代理。
4 |
5 | ## Sidecar 微服务
6 |
7 | 对于支持多个应用程序运行时的 sidecar 框架,我们可以通过其 C、Go、Rust 或 Node.js SDK 将 WasmEdge 应用程序简单地嵌入到 sidecar 中。 另外,WasmEdge 应用程序可以直接由容器工具管理并充当 sidecar 微服务。
8 |
9 | * [Dapr](mesh/dapr.md) 展示了如何将 WasmEdge 微服务作为 Dapr sidecar 运行。
10 | * [Apache EventMesh](mesh/evenmesh.md) 展示了如何将 WasmEdge 微服务作为 Apache EventMesh sidecar 运行
11 |
12 | ## API porxy 的扩展
13 |
14 | API proxy 是服务网格中的另一个关键组件。 它以保持系统可扩展性的方式管理 API 请求并将其定向到 sidecar。 开发人员需要编写这些代理脚本,以根据不断变化的基础设施和运营要求来路由流量。 看到用户希望使用 WebAssembly 而不是 LUA 脚本语言的广泛需求,社区一起创建了 proxy-wasm 规范。 它定义了 WebAssembly 运行时必须支持的插入 proxy 的主机接口。 WasmEdge 现在已经支持 proxy-wasm。
15 |
16 | * [MOSN](mesh/mosn.md) 展示了如何使用 WasmEdge 作为 MOSN 的扩展。
17 |
18 | 如果你对 WasmEdge 和微服务有一些好的想法,请随时在 [WasmEdge](https://github.com/WasmEdge/WasmEdge) GitHub 存储库上创建问题或 PR!
19 |
--------------------------------------------------------------------------------
/lib/loader/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 | # SPDX-FileCopyrightText: 2019-2022 Second State INC
3 |
4 | wasmedge_add_library(wasmedgeLoaderFileMgr
5 | filemgr.cpp
6 | ldmgr.cpp
7 | shared_library.cpp
8 | )
9 |
10 | target_link_libraries(wasmedgeLoaderFileMgr
11 | PUBLIC
12 | wasmedgeCommon
13 | wasmedgeSystem
14 | std::filesystem
15 | )
16 |
17 | if(NOT WIN32)
18 | target_link_libraries(wasmedgeLoaderFileMgr
19 | PUBLIC
20 | dl
21 | )
22 | endif()
23 |
24 | wasmedge_add_library(wasmedgeLoader
25 | ast/module.cpp
26 | ast/section.cpp
27 | ast/description.cpp
28 | ast/segment.cpp
29 | ast/type.cpp
30 | ast/expression.cpp
31 | ast/instruction.cpp
32 | loader.cpp
33 | )
34 |
35 | target_link_libraries(wasmedgeLoader
36 | PUBLIC
37 | wasmedgeCommon
38 | wasmedgeLoaderFileMgr
39 | Boost::boost
40 | std::filesystem
41 | )
42 |
--------------------------------------------------------------------------------
/utils/android/app/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------