How wasmerio/wasmer works
Main Components (Core Layer)
• Compiler Infrastructure (lib/compiler/)
• Runtime Engine (lib/vm/)
• API Layer (lib/api/)
• WASI Implementation (lib/wasix/)
Compilation Pipeline (Left Side)
• Three compiler backends as parallel paths:
• Cranelift (lib/compiler-cranelift/)
• LLVM (lib/compiler-llvm/)
• Singlepass (lib/compiler-singlepass/)
• Them to the core compiler infrastructure
• Middleware components (lib/middlewares/)
Runtime Components (Center)
• VM execution environment:
• Memory Management
• Function Calls
• Table Operations
• Global Variables
• Connection to the store and instance management
API Integration Layer (Right Side)
• Multiple language bindings:
• C API (lib/c-api/)
• JavaScript/WASM (lib/api/src/js/)
• Native Rust API
• How they connect to the core runtime
Extension Systems (Top)
• WASI/WASIX Implementation
• Package Management
• Cache System (lib/cache/)
• Virtual File System (lib/virtual-fs/)
Support Systems (Bottom)
• Testing Framework
• Benchmarking System
• Build Tools
• Documentation Generation
Use the following visual elements:
• Rectangles for main components
• Blue: Core components
• Green: Compiler backends
• Yellow: API layers
• Orange: Extension systems
• Gray: Support systems
Important Relationships to Show:
Compilation Flow
• Source -> Parser -> Compiler Backend -> Native Code
Execution Flow
• Module -> Instance -> Runtime -> Host System
API Integration
• Host Language -> API Binding -> Runtime Core
Annotations for:
• Version compatibility
• Security boundaries
• Performance critical paths
• Extension points
• Compilation
• Execution
• Host Integration
• System Extensions
This structure reflects Wasmer's architecture as a high-performance WebAssembly runtime with multiple compilation backends and extensive language support.