wasm-micro-runtime/samples
TianlongLiang 8a55a1e7a1
Shared heap enhancements for Interpreter and AOT (#4400)
Propose two enhancements:

- Shared heap created from preallocated memory buffer: The user can create a shared heap from a pre-allocated buffer and see that memory region as one large chunk; there's no need to dynamically manage it(malloc/free). The user needs to make sure the native address and size of that memory region are valid.
- Introduce shared heap chain: The user can create a shared heap chain, from the wasm app point of view, it's still a continuous memory region in wasm app's point of view while in the native it can consist of multiple shared heaps (each of which is a continuous memory region). For example, one 500MB shared heap 1 and one 500 MB shared heap 2 form a chain, in Wasm's point of view, it's one 1GB shared heap.

After these enhancements, the data sharing between wasm apps, and between hosts can be more efficient and flexible. Admittedly shared heap management can be more complex for users, but it's similar to the zero-overhead principle. No overhead will be imposed for the users who don't use the shared heap enhancement or don't use the shared heap at all.
2025-07-04 10:44:51 +08:00
..
basic Enable runtime API exposure for MSVC builds (#4287) 2025-05-28 20:30:05 +08:00
bh-atomic Update cmake min to 3.14 (#4175) 2025-04-02 07:13:53 +08:00
cmake Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187) 2025-04-17 16:41:47 +08:00
debug-tools Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187) 2025-04-17 16:41:47 +08:00
file Improve readlinkat_dup() to handle symlink size correctly (#4229) 2025-05-09 14:01:29 +08:00
inst-context Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218) 2024-03-13 12:28:45 +08:00
inst-context-threads Enable MASM automatically in runtime_lib.cmake (#2634) 2023-10-12 20:42:25 +08:00
linux-perf Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187) 2025-04-17 16:41:47 +08:00
mem-allocator Update cmake min to 3.14 (#4175) 2025-04-02 07:13:53 +08:00
multi-module Update cmake min to 3.14 (#4175) 2025-04-02 07:13:53 +08:00
multi-thread Fix some compile warnings and typos (#3854) 2024-10-15 16:04:58 +08:00
native-lib Update cmake min to 3.14 (#4175) 2025-04-02 07:13:53 +08:00
native-stack-overflow samples/native-stack-overflow: Examine native functions with signature (#3382) 2024-05-03 09:16:35 +08:00
printversion add a sample to use cmake package (#4291) 2025-05-23 16:56:21 +08:00
ref-types Change WASM_ANYREF to WASM_EXTERNREF (#3426) 2024-05-14 11:08:16 +08:00
sgx-ra Update cmake min to 3.14 (#4175) 2025-04-02 07:13:53 +08:00
shared-heap Shared heap enhancements for Interpreter and AOT (#4400) 2025-07-04 10:44:51 +08:00
shared-module Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218) 2024-03-13 12:28:45 +08:00
socket-api Collective fix: fix some typos (#4337) 2025-06-06 15:06:57 +08:00
spawn-thread Fix some compile warnings and typos (#3854) 2024-10-15 16:04:58 +08:00
terminate Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218) 2024-03-13 12:28:45 +08:00
wasi-threads Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187) 2025-04-17 16:41:47 +08:00
wasm-c-api samples/wasm-c-api: remove unused valgrind detection (#4249) 2025-05-07 11:32:29 +08:00
wasm-c-api-imports fix: correct typos and improve comments across multiple files by codespell (#4116) 2025-03-07 08:21:54 +08:00
workload fix: correct typos and improve comments across multiple files by codespell (#4116) 2025-03-07 08:21:54 +08:00
README.md Get location info from function indexes in addr2line script (#3206) 2024-03-08 10:20:04 +08:00

Samples

  • basic: Demonstrating how to use runtime exposed API's to call WASM functions, how to register native functions and call them, and how to call WASM function from native function.
  • file: Demonstrating the supported file interaction API of WASI. This sample can also demonstrate the SGX IPFS (Intel Protected File System), enabling an enclave to seal and unseal data at rest.
  • multi-thread: Demonstrating how to run wasm application which creates multiple threads to execute wasm functions concurrently, and uses mutex/cond by calling pthread related API's.
  • spawn-thread: Demonstrating how to execute wasm functions of the same wasm application concurrently, in threads created by host embedder or runtime, but not the wasm application itself.
  • wasi-threads: Demonstrating how to run wasm application which creates multiple threads to execute wasm functions concurrently based on lib wasi-threads.
  • multi-module: Demonstrating the multiple modules as dependencies feature which implements the load-time dynamic linking.
  • ref-types: Demonstrating how to call wasm functions with argument of externref type introduced by reference types proposal.
  • wasm-c-api: Demonstrating how to run some samples from wasm-c-api proposal and showing the supported API's.
  • socket-api: Demonstrating how to run wasm tcp server and tcp client applications, and how they communicate with each other.
  • native-lib: Demonstrating how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm.
  • sgx-ra: Demonstrating how to execute Remote Attestation on SGX with librats, which enables mutual attestation with other runtimes or other entities that support librats to ensure that each is running within the TEE.
  • workload: Demonstrating how to build and run some complex workloads, e.g. tensorflow-lite, XNNPACK, wasm-av1, meshoptimizer and bwa.
  • debug-tools: Demonstrating how to symbolicate a stack trace.