Swift for Wasm September 2026 Updates

Notable changes this month: WasmKit 0.4.0 made its interpreter about twice as fast and runs on microcontrollers, and 0.4.1 added the typed function references proposal; JavaScriptKit 0.59.0 can generate packages running on uWASI; uWASI shipped 1.5.0 and 1.6.0; ElementaryUI 0.8.0 added custom element support and PhaseAnimator.

Many thanks to @AnthonyLatsis, @felipepiovezan, @JDevlieghere, @kateinoigakukun, @krodak, Logan Shire, @scottm, shopifyski, @sliemeobn, Vithanco for contributions!

Blog Posts

Swift Toolchain

Toolchain development snapshots built off the main branch now includes experimental support for wasm32-unknown-wasip1-threads triple in the Wasm Swift SDK. Note that multi-threaded executors are not included in these Swift SDKs yet. See JavaScriptKit documentation for details on how to set up multi-threaded executors in the browser.

  • Pass --no-stack-first to wasm-ld swift-driver#2179, reapplied in swift-driver#2185 after the matching LLVM change landed;
  • wasiswiftsdk.py: include wasip1-threads in Wasm Swift SDK swift#87283;
  • WASI: build Concurrency C++ sources with -fno-exceptions in non-Embedded builds too swift#92171.

JavaScriptKit

0.59.0 lets PackageToJS generate packages that run on uWASI through --wasi-runtime uwasi, with @bjorn3/browser_wasi_shim staying the default for now. BridgeJS also diagnoses a type conforming to a @JS protocol that cannot cross to JavaScript, which used to compile and then trap at runtime. On main, @JS("name") renaming now applies to exported classes, structs, enums, and protocols, @JS protocols can refine other protocols, and generic imports accept protocol constraints.

  • PackageToJS: add selectable uWASI runtime #811;
  • BridgeJS: diagnose unsupported protocol conformers before lowering #812;
  • BridgeJS: unify thunk argument preparation, fixing incorrect results from struct methods and closures #813;
  • BridgeJS: support custom exported type names #814;
  • BridgeJS: support protocol refinement and constrained imports #815.

WasmKit

0.4.0 (announcement) roughly doubles interpreter speed: on the wasmi benchmark suite execution time is about half of 0.3.1's. The release also includes the Embedded Swift work of the past two months, with the engine running on an ESP32-C6 and on a Playdate handheld console, adds WASI Threads through wasmkit run --wasi-threads, and improves LLDB debugging support. 0.4.1 followed with the typed function references proposal behind --feature function-references, fuel metering to bound guest execution, hardening against untrusted modules found by fuzzing, and a stack frame layout that again runs functions with thousands of locals, which 0.4.0 rejected as too large.

  • 20+ performance optimization PRs. See the full list at 0.4.0 release page;
  • Add WASI Threads thread-spawn support #423;
  • Fix Embedded Swift builds on ARM and on host platforms #473;
  • Implement the typed function references proposal #480, #481;
  • Add fuel metering to bound guest execution #474;
  • Support LLDB's updated qWasmGlobal packet #420;
  • Advertise the qWasmInstance+ feature LLDB looks for #422;
  • Report the guest's exit status, and a trap as a stop, instead of dropping the connection #424, #468;
  • Report a stop at the start of the instruction run #425;
  • Bind breakpoint resolution to the containing function #426;
  • Support writing guest linear memory #427;
  • Answer qMemoryRegionInfo with the region containing an address #428;
  • Keep a debuggable module off the accumulator hand-off #479;
  • Stop untrusted modules and text from aborting or reading past the host #475;
  • WASI: resolve guest paths within their descriptor, and answer bad arguments with an errno #476;
  • Batch fixes found by fuzzers, and repair the fuzzing harness #472, #477;
  • Put the locals below sp so frames with many locals fit #483;
  • Make warnings-as-errors opt-in via WASMKIT_WARNINGS_AS_ERRORS #469.

ElementaryUI

0.8.0 ships the new ElementaryWebComponents module, which registers ElementaryUI views as custom elements. The release also adds a SwiftUI-style PhaseAnimator that animates content through a sequence of phases, and DOM event and style modifiers on SVG content. It requires Swift 6.4.

  • Allow DOM event and style modifiers on SVG content #119;
  • Bump minimum to Swift 6.4 #129;
  • Add ElementaryWebComponents for custom element support #128;
  • Add runtime deprecation warning in bundled runtime #130;
  • Minor performance improvements #131;
  • Upgrade to JavaScriptKit 0.59 #132;
  • Add PhaseAnimator #133.

uWASI

Four releases: 1.5.0 ships last month's expanded WASI Preview 1 support and makes every feature a factory, so useX() is the only call style, a source-breaking change. 1.5.1 fixes package entry points for resolvers that do not read exports, and 1.5.2 adds the setInstance and lineBuffered APIs that PackageToJS needs for its uWASI option. 1.6.0 lets a host serve file descriptors through extraFds.

  • Fix O(n^2) fd_write in useMemoryFS #17;
  • Require the call style for every feature #19;
  • Report oversize file requests instead of trapping the guest #20;
  • Declare entry points for resolvers that do not read exports #23;
  • Write all 64 bits of the clock_res_get resolution #25;
  • Add setInstance and a lineBuffered stdio helper for embedders #26;
  • Add extraFds to StdioOptions for character devices beyond stdio #29.

Other Notable Changes


Thank you for reading, and please feel free to add any comments or suggestions if we missed anything!

If you'd like to catch up with changes from previous months, here's a list of recent updates:

11 Likes