Skip to content

Commit ce9ac7a

Browse files
authored
wasm: disable tail-call flag for now (#2440)
As reported and confirmed from a ghc wasm backend user, tail-call opcodes may cause ios webview crashes for some large haskell wasm apps, and removing tail-call opcodes fixes the crash. Given webkit only supported tail-call since 18.2, it's better to disable tail-call flag for the time being and revisit this in the future. This patch also removes --no-turbo-fast-api-calls from the dyld script flags, since it was used to workaround nodejs/node#46777 when wasm module uses tail calls. It's not needed when tail calls are not used and it has a performance penalty.
1 parent e742479 commit ce9ac7a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/ghc/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ let
397397
" '*.*.ghc.*.opts += -fPIC' '*.*.cc.*.opts += -fPIC'"
398398
# C options for wasm
399399
+ lib.optionalString targetPlatform.isWasm (
400-
" 'stage1.*.ghc.*.opts += -optc-Wno-error=int-conversion -optc-O3 -optc-mcpu=lime1 -optc-mreference-types -optc-msimd128 -optc-mtail-call -optc-DXXH_NO_XXH3'"
400+
" 'stage1.*.ghc.*.opts += -optc-Wno-error=int-conversion -optc-O3 -optc-mcpu=lime1 -optc-mreference-types -optc-msimd128 -optc-DXXH_NO_XXH3'"
401401
+ " 'stage1.*.ghc.cpp.opts += -optc-fno-exceptions'")
402402
# `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows
403403
+ lib.optionalString (enableRelocatedStaticLibs && targetPlatform.isx86_64 && !targetPlatform.isWindows)
@@ -626,7 +626,6 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
626626
if builtins.compareVersions ghc-version "9.13" < 0
627627
then "--experimental-wasm-type-reflection"
628628
else "--max-old-space-size=65536"} \
629-
--no-turbo-fast-api-calls \
630629
--wasm-lazy-validation \
631630
"$SCRIPT" \
632631
"${lib-wasm}/lib" \

0 commit comments

Comments
 (0)