bytecodealliance/wasm-micro-runtime
GitHub: bytecodealliance/wasm-micro-runtime
一个轻量级、高性能的 WebAssembly 运行时,支持 AOT/JIT 编译,专为嵌入式、物联网和边缘计算等资源受限环境设计。
Stars: 5826 | Forks: 770
# WebAssembly Micro Runtime
**一个 [Bytecode Alliance][BA] 项目**
**[指南](https://wamr.gitbook.io/)** **[网站](https://bytecodealliance.github.io/wamr.dev)** **[聊天](https://bytecodealliance.zulipchat.com/#narrow/stream/290350-wamr)**
[构建 WAMR](./doc/build_wamr.md) | [构建 AOT 编译器](./wamr-compiler/README.md) | [嵌入 WAMR](./doc/embed_wamr.md) | [导出原生 API](./doc/export_native_api.md) | [构建 Wasm 应用](./doc/build_wasm_app.md) | [示例](./samples/README.md)
WebAssembly Micro Runtime (WAMR) 是一个轻量级的独立 WebAssembly (Wasm) 运行时,具有占用空间小、高性能和高度可配置的特性,适用于从嵌入式、物联网、边缘计算到可信执行环境 (TEE)、智能合约、云原生等跨领域应用。它包含以下几个部分:
- [**VMcore**](./core/iwasm/):一组用于加载和运行 Wasm 模块的运行时库。它支持丰富的运行模式,包括解释器、Ahead-of-Time 编译 和 Just-in-Time 编译 (JIT)。WAMR 支持两个 JIT 层级 —— Fast JIT 和 LLVM JIT,并支持从 Fast JIT 动态分层升级到 LLVM JIT。
- [**iwasm**](./product-mini/):使用 WAMR VMcore 构建的可执行二进制文件,支持 WASI 和命令行接口。
- [**wamrc**](./wamr-compiler/):用于将 Wasm 文件编译为 AOT 文件的 AOT 编译器。
- 使用 WAMR vmcore 构建实际解决方案的有用组件和工具:
- [App-framework](https://github.com/bytecodealliance/wamr-app-framework/blob/main/app-framework/README.md):一个用于支持 Wasm 应用程序 API 的框架
- [App-manager](https://github.com/bytecodealliance/wamr-app-framework/blob/main/app-mgr/README.md):一个用于远程动态加载 Wasm 模块的框架
- [WAMR-IDE](./test-tools/wamr-ide):一个实验性的 VSCode 扩展,用于使用 C/C++ 开发 WebAssembly 应用程序
### 关键特性
- 完全符合 W3C Wasm MVP 标准
- 运行时二进制文件体积小(在 cortex-m4f 上的核心 vmlib,支持 tail-call/bulk memory/shared memory,文本大小来自 bloaty)
* ~58.9K 用于快速解释器
* ~56.3K 用于经典解释器
* ~29.4K 用于 aot 运行时
* ~21.4K 用于 libc-wasi 库
* ~3.7K 用于 libc-builtin 库
- 通过 AOT 和 JIT 实现接近原生的速度
- 自主实现的 AOT 模块加载器,使 AOT 能够在 Linux、Windows、MacOS、Android、SGX 和 MCU 系统上运行
- Wasm 应用程序 libc 支持的选择:用于嵌入式环境的内置 libc 子集或用于标准 libc 的 [WASI](https://github.com/WebAssembly/WASI)
- [将 WAMR 嵌入宿主环境的简单 C API](./doc/embed_wamr.md),请参阅[如何集成 WAMR](./doc/embed_wamr.md)和 [API 列表](./core/iwasm/include/wasm_export.h)
- [将原生 API 导出给 Wasm 应用程序的机制](./doc/export_native_api.md),请参阅[如何注册原生 API](./doc/export_native_api.md)
- [作为依赖项的多模块支持](./doc/multi_module.md),参考[文档](./doc/multi_module.md)和[示例](samples/multi-module)
- [多线程、pthread API 和线程管理](./doc/pthread_library.md),参考[文档](./doc/pthread_library.md)和[示例](samples/multi-thread)
- [wasi-threads](./doc/pthread_impls.md#wasi-threads-new),参考[文档](./doc/pthread_impls.md#wasi-threads-new)和[示例](samples/wasi-threads)
- [Linux SGX (Intel Software Guard Extension) 支持](./doc/linux_sgx.md),参考[文档](./doc/linux_sgx.md)
- [源代码级调试支持](./doc/source_debugging.md),参考[文档](./doc/source_debugging.md)
- [XIP (Execution In Place) 支持](./doc/xip.md),参考[文档](./doc/xip.md)
- [Berkeley/Posix Socket 支持](./doc/socket_api.md),参考[文档](./doc/socket_api.md)和[示例](./samples/socket-api)
- [多层级 JIT](./product-mini#linux) 和[运行模式控制](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
- 语言绑定:[Go](./language-bindings/go/README.md)、[Python](./language-bindings/python/README.md)、[Rust](./language-bindings/rust/README.md)
### Wasm post-MVP 特性
- [wasm-c-api](https://github.com/WebAssembly/wasm-c-api),参考[文档](doc/wasm_c_api.md)和[示例](samples/wasm-c-api)
- [128-bit SIMD](https://github.com/WebAssembly/simd),参考[samples/workload](samples/workload)
- [Reference Types](https://github.com/WebAssembly/reference-types),参考[文档](doc/ref_types.md)和[示例](samples/ref-types)
- [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations)、[Shared memory](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md#shared-linear-memory)、[Memory64](https://github.com/WebAssembly/memory64)
- [Tail-call](https://github.com/WebAssembly/tail-call)、[Garbage Collection](https://github.com/WebAssembly/gc)、[Exception Handling](https://github.com/WebAssembly/exception-handling)、[Branch Hinting](https://github.com/WebAssembly/branch-hinting)
- [Extended Constant Expressions](https://github.com/WebAssembly/extended-const)
### 支持的架构和平台
WAMR VMcore 支持以下架构:
- X86-64, X86-32
- ARM, THUMB (已测试 ARMV7 Cortex-M7 和 Cortex-A15)
- AArch64 (已测试 Cortex-A57 和 Cortex-A53)
- RISCV64, RISCV32 (已测试 RISC-V LP64 和 RISC-V LP64D)
- XTENSA, MIPS, ARC
支持以下平台,点击下方链接了解如何在该平台上构建 iwasm。有关如何将 WAMR 移植到新平台,请参考 [WAMR 移植指南](./doc/port_wamr.md)。
- [Linux](./product-mini/README.md#linux)、[Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md)、[MacOS](./product-mini/README.md#macos)、[Android](./product-mini/README.md#android)、[Windows](./product-mini/README.md#windows)、[Windows (MinGW, MSVC)](./product-mini/README.md#mingw)
- [Zephyr](./product-mini/README.md#zephyr)、[AliOS-Things](./product-mini/README.md#alios-things)、[VxWorks](./product-mini/README.md#vxworks)、[NuttX](./product-mini/README.md#nuttx)、[RT-Thread](./product-mini/README.md#RT-Thread)、[ESP-IDF(FreeRTOS)](./product-mini/README.md#esp-idf)
## 入门指南
- [构建 VM core](./doc/build_wamr.md) 和[构建 wamrc AOT 编译器](./wamr-compiler/README.md)
- [构建 iwasm (mini product)](./product-mini/README.md):[Linux](./product-mini/README.md#linux)、[SGX](./doc/linux_sgx.md)、[MacOS](./product-mini/README.md#macos) 和 [Windows](./product-mini/README.md#windows)
- [嵌入到 C/C++](./doc/embed_wamr.md)、[嵌入到 Python](./language-bindings/python)、[嵌入到 Go](./language-bindings/go)、[嵌入到 Rust](./language-bindings/rust)
- [为 Wasm 应用注册原生 API](./doc/export_native_api.md)
- [构建 wamrc AOT 编译器](./wamr-compiler/README.md)
- [构建 Wasm 应用程序](./doc/build_wasm_app.md)
- [将 WAMR 移植到新平台](./doc/port_wamr.md)
- [VS Code 开发容器](./doc/devcontainer.md)
- [示例](./samples)和[基准测试](./tests/benchmarks)
- [终端用户 API 文档](https://bytecodealliance.github.io/wamr.dev/apis/)
### 性能与内存
- [博客:WAMR 内存模型](https://bytecodealliance.github.io/wamr.dev/blog/the-wamr-memory-model/)
- [博客:理解 WAMR 堆](https://bytecodealliance.github.io/wamr.dev/blog/understand-the-wamr-heaps/)和[栈](https://bytecodealliance.github.io/wamr.dev/blog/understand-the-wamr-stacks/)
- [博客:WAMR 运行模式介绍](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
- [内存使用调优](./doc/memory_tune.md):内存模型以及如何调整内存使用
- [内存使用分析](./doc/build_wamr.md#enable-memory-profiling-experiment):如何分析内存使用情况
- [性能调优](./doc/perf_tune.md):如何调整性能
- [基准测试](./tests/benchmarks):查看这些链接以了解如何运行基准测试:[PolyBench](./tests/benchmarks/polybench)、[CoreMark](./tests/benchmarks/coremark)、[Sightglass](./tests/benchmarks/sightglass)、[JetStream2](./tests/benchmarks/jetstream)
- [性能和占用数据](https://github.com/bytecodealliance/wasm-micro-runtime/wiki/Performance):性能和占用空间数据
# 项目技术指导委员会
[WAMR PTSC 章程](./TSC_Charter.md) 管理项目 TSC 的运作。
现任 TSC 成员:
- [dongsheng28849455](https://github.com/dongsheng28849455) - **Dongsheng Yan**,
- [loganek](https://github.com/loganek) - **Marcin Kolny**,
- [lum1n0us](https://github.com/lum1n0us) - **Liang He**,
- [no1wudi](https://github.com/no1wudi) **Qi Huang**,
- [qinxk-inter](https://github.com/qinxk-inter) - **Xiaokang Qin**,
- [ttrenner ](https://github.com/ttrenner) - **Trenner, Thomas**,
- [wei-tang](https://github.com/wei-tang) - **Wei Tang**,
- [wenyongh](https://github.com/wenyongh) - **Wenyong Huang**,
- [woodsmc](https://github.com/woodsmc) - **Woods, Chris**,
- [xujuntwt95329](https://github.com/xujuntwt95329) - **Jun Xu**,
- [xwang98](https://github.com/xwang98) - **Xin Wang**, (chair)
- [yamt](https://github.com/yamt) - **Takashi Yamamoto**,
# 许可证
WAMR 使用与 LLVM 相同的许可证:带有 LLVM 例外的 `Apache 2.0 license`。
有关详细信息,请参阅 LICENSE 文件。此许可证允许您自由地使用、修改、分发和销售基于 WAMR 的自有产品。
您做出的任何贡献都将使用相同的许可证。
# 更多资源
- [谁在使用 WAMR?](https://github.com/bytecodealliance/wasm-micro-runtime/wiki)
- [WAMR 博客](https://bytecodealliance.github.io/wamr.dev/blog/)
- [社区新闻和活动](https://bytecodealliance.github.io/wamr.dev/events/)
- [WAMR TSC 会议](https://github.com/bytecodealliance/wasm-micro-runtime/wiki/TSC-meeting-notes)
标签:AI工具, AOT编译, C/C++, DNS 反向解析, JIT编译, LangChain, LLVM, WAMR, WASI, WebAssembly, Web报告查看器, 事务性I/O, 可信执行环境, 字节码联盟, 客户端加密, 嵌入式系统, 智能合约, 物联网, 生成式AI安全, 知识库安全, 系统底层开发, 虚拟机, 解释器, 轻量级, 边缘计算, 运行时