Stream: git-wasmtime

Topic: wasmtime / PR #13913 feat: GHC calling convention


view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:28):

playX18 opened PR #13913 from playX18:ap/ghc-callconv to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

This PR adds LLVM’s GHC (ghccc) calling convention to Cranelift as CallConv::Ghc / CLIF ghc, for x86_64, aarch64, and riscv64.

Why?

People writing compilers for functional languages often want "register
pinning": keep runtime / VM state in fixed hardware registers, and jump
between functions instead of doing normal C calls. Haskell does this with
the STG machine and LLVM's ghccc. SML/NJ (and similar CPS systems) do
heap-allocated continuations and need something like jump-with-arguments.
Scheme compilers in CPS style want the same kind of thing.

In Cranelift today, enable_pinned_reg only gives you one reserved
register. tail helps with return_call, but it is still basically a
SysV-like ABI: it still builds native frames, and it does not pin a big
set of STG-style registers for you.

So this PR adds LLVM's GHC calling convention. Then you can map many
virtual machine registers to real regs through the callconv, with no
callee-saves, and use return_call between ghc functions.

Summary

Test plan

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:32):

playX18 updated PR #13913.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:33):

playX18 has marked PR #13913 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:33):

playX18 requested wasmtime-compiler-s390x-reviewers for a review on PR #13913.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:33):

playX18 requested cfallin for a review on PR #13913.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 00:33):

playX18 requested wasmtime-compiler-reviewers for a review on PR #13913.


Last updated: Jul 29 2026 at 05:03 UTC