Skip to content

Commit 10eb4ec

Browse files
authored
Turn On WebAssembly Tail Calls (#992)
With Safari 18.2 having shipped, all browsers now support WebAssembly Tail Calls. This allows the compiler to call a function at the end of the current function by reusing the stack frame. This should be a tiny bit faster and allow for recursion without stack overflows... except that Rust doesn't have any way of guaranteeing this yet, so you can't really rely on it.
1 parent 318ed82 commit 10eb4ec

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ jobs:
167167
--enable-extended-const \
168168
--enable-multivalue \
169169
--enable-reference-types \
170+
--enable-tail-call \
170171
--strip-dwarf \
171172
--strip-producers \
172173
--strip-target-features \

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ npm run serve
5959

6060
| Browser | Compatibility | Known Issues |
6161
| ----------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62-
| Chrome |91 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
63-
| Firefox |89 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Firefox.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AFirefox) |
64-
| Edge |91 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
65-
| Safari |16.4 | |
66-
| Opera |77 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
67-
| iOS |16.4 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/iOS.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AiOS) |
68-
| Android WebView |91 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
69-
| Chrome Android |91 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
70-
| Firefox Android |89 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
62+
| Chrome |112 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
63+
| Firefox |121 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Firefox.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AFirefox) |
64+
| Edge |112 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
65+
| Safari |18.2 | |
66+
| Opera |98 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Chromium.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3A"Chromium") |
67+
| iOS |18.2 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/iOS.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AiOS) |
68+
| Android WebView |112 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
69+
| Chrome Android |112 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
70+
| Firefox Android |121 | [![GitHub issues by-label](https://img.shields.io/github/issues/LiveSplit/LiveSplitOne/Android.svg)](https://github.com/LiveSplit/LiveSplitOne/issues?q=is%3Aissue+is%3Aopen+label%3AAndroid) |
7171
| Internet Explorer | Unsupported | |
7272
| Opera Mini | Unsupported | |

buildCore.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let profile = "debug";
66
let cargoFlags = "";
77
// Keep .github/workflows/ci.yml in sync with these flags, so wasm-opt works.
88
let rustFlags =
9-
"-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128,+extended-const,+multivalue,+reference-types";
9+
"-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128,+extended-const,+multivalue,+reference-types,+tail-call";
1010
let wasmBindgenFlags = "--encode-into always --target web --reference-types";
1111
let target = "wasm32-unknown-unknown";
1212
let targetFolder = target;
@@ -28,9 +28,6 @@ if (process.argv.some((v) => v === "--max-opt")) {
2828
if (process.argv.some((v) => v === "--unstable")) {
2929
// Relaxed SIMD is not supported by Firefox and Safari yet.
3030
rustFlags += ",+relaxed-simd";
31-
32-
// Tail calls are not supported by Safari yet until 18.2 (early December).
33-
rustFlags += ",+tail-call";
3431
}
3532

3633
// Use the nightly toolchain, which enables some more optimizations.
@@ -41,6 +38,7 @@ if (process.argv.some((v) => v === "--nightly")) {
4138
rustFlags += " -Z wasm-c-abi=spec";
4239

4340
// FIXME: Apparently the multivalue ABI is broken again.
41+
// Caused by: https://github.com/rust-lang/rust/pull/135534
4442
// target = "../wasm32-multivalue.json";
4543
// targetFolder = "wasm32-multivalue";
4644

0 commit comments

Comments
 (0)