summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorCheng Shao <terrorjack@type.dance>2022-12-01 14:03:38 +0000
committerCheng Shao <terrorjack@type.dance>2022-12-16 21:16:28 +0000
commit1c6930bf59223b6a70ca6045e2bbd4a4fb297b76 (patch)
tree2f652bc349bd6c520b2ab01c2a297e68387cc142 /compiler
parente3104eab043d743ae01066d79f0306e64e82d776 (diff)
downloadhaskell-1c6930bf59223b6a70ca6045e2bbd4a4fb297b76.tar.gz
compiler: change fallback function signature to Cmm function signature in wasm NCG
In the wasm NCG, when handling a `CLabel` of undefined function without knowing its function signature, we used to fallback to `() -> ()` which is accepted by `wasm-ld`. This patch changes it to the signature of Cmm functions, which equally works, but would be required when we emit tail call instructions.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/CmmToAsm/Wasm/FromCmm.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs b/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
index c406038f10..7016613d9d 100644
--- a/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
+++ b/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
@@ -1517,8 +1517,10 @@ onFuncSym sym arg_tys ret_tys = wasmModifyM $
-- 'CmmStatic's or 'CmmExpr's.
onAnySym :: CLabel -> WasmCodeGenM w ()
onAnySym lbl = case sym_kind of
- SymFunc -> wasmModifyM $ \s@WasmCodeGenState {..} ->
- s {funcTypes = addToUniqMap_C const funcTypes sym ([], [])}
+ SymFunc -> do
+ ty_word <- wasmWordTypeM
+ wasmModifyM $ \s@WasmCodeGenState {..} ->
+ s {funcTypes = addToUniqMap_C const funcTypes sym ([], [SomeWasmType ty_word])}
_ -> pure ()
where
sym = symNameFromCLabel lbl