Skip to content

Commit be82cd1

Browse files
committed
Turn On WebAssembly Tail Calls
With Safari 18.2 having shipped today, 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 ee62d69 commit be82cd1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

buildCore.js

Lines changed: 1 addition & 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.

0 commit comments

Comments
 (0)