Skip to content

chiwawa(CHeckpoint/restore and Instrumentation-specific WAsm runtime on WAsm runtime)

License

Notifications You must be signed in to change notification settings

oss-fun/chiwawa

Repository files navigation

chiwawa(CHeckpoint/restore and Instrumentation-specific WAsm runtime on WAsm runtime)

Chiwawa (Japanese-like Pronunciation of chihuahua) is a self-hosted Wasm runtime that enables live migration and instrumentation that is neutral to the execution methods (e.g., interpreter, JIT, and AOT) and architectures, and runtimes.

U^ェ^U

Build and Run

cargo build --target wasm32-wasip1 --release

# Call function with Wasm parameters (I32, I64, F32, F64)
somethingWasmRuntime target/wasm32-wasip1/release/chiwawa.wasm test.wasm --invoke func-name --params "I64(100)"

# Pass command-line arguments to WASI-compiled program
somethingWasmRuntime target/wasm32-wasip1/release/chiwawa.wasm test.wasm --app-args "--version"

Checkpoint and Restore

Note: The checkpoint trigger mechanism differs between build targets:

  • wasm32-wasip1-threads: Uses a background thread to monitor checkpoint.trigger file (recommended for better performance)
  • wasm32-wasip1: Checks file existence via WASI at each instruction (use if host runtime does not support WASI threads)
cargo build --target wasm32-wasip1-threads --release

# Run with checkpoint enabled
somethingWasmRuntime target/wasm32-wasip1-threads/release/chiwawa.wasm test.wasm --invoke func-name --params "I64(100)" --cr
touch ./checkpoint.trigger # Trigger of Checkpointing
# Restore from checkpoint
somethingWasmRuntime target/wasm32-wasip1-threads/release/chiwawa.wasm test.wasm --restore checkpoint.bin

Tracing

Tracing requires the trace feature to be enabled at compile time:

# Build with trace feature
cargo build --target wasm32-wasip1 --release --features trace

# TRACE_EVENTS = (all,store,load,call,branch)
# TRACE_RESOURCE = (regs,memory,locals,globals,pc)
somethingWasmRuntime target/wasm32-wasip1/release/chiwawa.wasm test.wasm --trace --trace-events [<TRACE_EVENTS>...] --trace-resource [<TRACE_RESOURCE>...]

If --trace is used without the feature enabled, a warning is displayed and the flag is ignored.

Statistics

Statistics output requires the stats feature to be enabled at compile time:

# Build with stats feature
cargo build --target wasm32-wasip1 --release --features stats

# Run with statistics output
somethingWasmRuntime target/wasm32-wasip1/release/chiwawa.wasm test.wasm --stats

If --stats is used without the feature enabled, a warning is displayed and the flag is ignored.

Artifacts

Academic

Tech Community

References

I referred to these repositories for initial implementation. I appreciate ancestor's wisdom!

About

chiwawa(CHeckpoint/restore and Instrumentation-specific WAsm runtime on WAsm runtime)

Resources

License

Stars

Watchers

Forks

Packages

No packages published