Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 3.84 KB

README.md

File metadata and controls

94 lines (65 loc) · 3.84 KB

WasmKit Icon

WasmKit

WasmKit is a standalone and embeddable WebAssembly runtime implementation written in Swift.

Usage

The best way to learn how to use WasmKit is to look at the Examples directory.

Command Line Tool

WasmKit provides a command line tool to run WebAssembly binaries compliant with WASI.

$ git clone https://github.com/swiftwasm/WasmKit.git
$ cd WasmKit
$ swift run wasmkit-cli run ./Examples/wasm/hello.wasm
Hello, World!

As a Library

Swift Package Manager

You can use WasmKit as a Swift Package Manager dependency by adding the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/swiftwasm/WasmKit.git", from: "0.1.0"),
],

You can find API documentation on the Swift Package Index.

Features

  • Reasonably fast
  • Minimal dependencies
    • The core runtime engine depends only on swift-system.
    • No Foundation dependency
  • Compact and embeddable
    • Debug build complete in 5 seconds1
  • Batteries included
    • WASI support, WAT parser, etc.

Supported Platforms

WasmKit engine works on all major platforms supported by Swift. It is continuously tested on macOS, Ubuntu, and Windows, and should work on the following platforms:

  • macOS 10.13 , iOS 12.0 , tvOS 12.0 , watchOS 6.0
  • Ubuntu 20.04
  • Windows 10

Implementation Status

Category Feature Status
WebAssembly MVP Parsing binary format ✅ Implemented
Parsing text format (WAT) ✅ Implemented
Execution ✅ Implemented
Validation ✅ Implemented
WebAssembly Proposal Reference types ✅ Implemented
Bulk memory operations ✅ Implemented
Mutable globals ✅ Implemented
Sign-extension operators ✅ Implemented
Non-trapping float-to-int conversions ✅ Implemented
Memory64 ✅ Implemented
Threads and atomics 🚧 Parser implemented
WASI WASI Preview 1 ✅ Implemented

Minimum Supported Swift Version

The minimum supported Swift version of WasmKit is 5.8, which is the version used to bootstrap the Swift toolchain in ci.swift.org.

Testing

To run the WasmKit test suite, you need to checkout the test suite repositories first.

# Checkout test suite repositories
$ ./Vendor/checkout-dependency
# Run tests
$ swift test

Acknowledgement

This project was originally developed by @akkyie, and is now maintained by the community.

Footnotes

  1. On a 2020 Mac mini (M1, 16GB RAM) with Swift 5.10. Measured by swift package resolve && swift package clean && time swift build --product PrintAdd.