Skip to content

A Vision for WebAssembly Support in Swift #2590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 6, 2025
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
368591a
Initial draft of "A Vision for WebAssembly Support in Swift"
MaxDesiatov Mar 9, 2024
f0813d9
Placeholder for "Goals" section
MaxDesiatov Mar 9, 2024
4ceaf01
Fix line length
MaxDesiatov Mar 9, 2024
f3bd451
Apply suggestions from code review
MaxDesiatov Mar 9, 2024
c51de07
Restructure "Introduction", mention a few goals
MaxDesiatov Mar 14, 2024
1a427da
Wording cleanup, add Wasm Component Model goal
MaxDesiatov Mar 14, 2024
9e07dd2
Add "Proposed Language Features" section
MaxDesiatov Mar 14, 2024
bd1b5c6
Update webassembly.md
MaxDesiatov Mar 14, 2024
699af86
Apply suggestions from code review
MaxDesiatov Mar 14, 2024
8e48421
Address PR feedback
MaxDesiatov Mar 14, 2024
edb2c31
Apply suggestions from code review
MaxDesiatov Mar 14, 2024
387b8fd
Apply suggestions from code review
MaxDesiatov Mar 14, 2024
ae72732
Apply suggestions from code review
MaxDesiatov Mar 15, 2024
e177c67
Define WasmKit in the introduction section
MaxDesiatov Mar 15, 2024
9f4fddf
Update webassembly.md
MaxDesiatov Mar 18, 2024
51e5d1b
Update visions/webassembly.md
MaxDesiatov Mar 18, 2024
f1195a6
Apply suggestions from code review
MaxDesiatov Mar 26, 2024
b665179
Incorporate recent vision feedback
MaxDesiatov Oct 15, 2024
67909f0
Clean up wording and formatting
MaxDesiatov Oct 16, 2024
a88c667
Address feedback
MaxDesiatov Oct 16, 2024
33e4eb5
Apply suggestions from code review
MaxDesiatov Oct 31, 2024
00063f5
Address PSG meeting feedback
MaxDesiatov Nov 8, 2024
c5d8bae
Add debugging as a separate goal to the "Goals" section
MaxDesiatov Nov 13, 2024
fda62f8
Clean up wording and links in `visions/webassembly.md`
MaxDesiatov Apr 3, 2025
7264453
Fix broken `wasip2` link in `webassembly.md`
MaxDesiatov Apr 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Alex Hoppen <[email protected]>
  • Loading branch information
MaxDesiatov and ahoppen authored Mar 14, 2024
commit edb2c31dc1f3d9cf1249205a789b05fcd8d3eb6c
8 changes: 4 additions & 4 deletions visions/webassembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ examples of its possible adoption in the Swift toolchain itself. To quote
> WebAssembly could provide a way to build Swift macros into binaries that can be distributed and run anywhere,
> eliminating the need to rebuild them continually.

This can be applicable not only to Swift macros, but also SwiftPM manifests and plugins.
This can be applicable not only to Swift macros, but also for the evaluation of SwiftPM manifests and plugins.

WebAssembly instruction set has useful properties from a security perspective, as it has
no interrupts or peripherals access instructions. Access to the underlying system is always done by calling an
Expand All @@ -36,7 +36,7 @@ In the context of Swift developer tools, arbitrary code execution during build t
While Swift macros, SwiftPM manifests, and plugins are sandboxed on Darwin platforms, with Wasm we can provide stronger
security guarantees on other platforms that have a compatible Wasm runtime available.

WebAssembly instruction set is designed with performance in mind. A WebAssembly module can be JIT-compiled or
The WebAssembly instruction set is designed with performance in mind. A WebAssembly module can be JIT-compiled or
compiled on a client machine to an optimized native binary ahead of time. With recently accepted proposals to the Wasm
specification it now supports features such as SIMD, atomics, multi-threading, and more. A WebAssembly runtime can
generate a restricted subset of native binary code that implements these features with little performance overhead.
Expand All @@ -53,11 +53,11 @@ don't "support" those directly either. Actual implementation of I/O for a hardwa
system, and for a Wasm module it's provided by a runtime that executes it.

A standardized set of APIs implemented by a Wasm runtime for interaction with the host operating system is called
[WebAssembly System Interface](https://wasi.dev). A layer on top of WASI that Swift apps compiled to Wasm can already
[WebAssembly System Interface (WASI)](https://wasi.dev). A layer on top of WASI that Swift apps compiled to Wasm can already
use thanks to C interop is [WASI libc](https://github.com/WebAssembly/wasi-libc). In fact, the current implementation of
Swift stdlib and runtime for `wasm32-unknown-wasi` triple is based on this C library.

At the same time, W3C WebAssembly Working Group was considering multiple proposals for improving the WebAssembly [type
At the same time, the W3C WebAssembly Working Group was considering multiple proposals for improving the WebAssembly [type
system](https://github.com/webassembly/interface-types) and
[module linking](https://github.com/webassembly/module-linking). These were later subsumed into a combined
[Component Model](https://component-model.bytecodealliance.org) proposal thanks to the ongoing work on
Expand Down