Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,864
    • Issues 4,864
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21200
Closed
Open
Created Mar 08, 2022 by Norman Ramsey@nrnrnrDeveloper0 of 15 tasks completed0/15 tasks

Add a WebAssembly back end

A WebAssembly back end has been discussed and attempted before (#14976 (closed), closed; https://github.com/tweag/asterius, incompatible with GHC's run-time system; https://webghc.github.io/, dormant), but one has never been truly incorporated into GHC. We propose to do it by adapting GHC's native code generator and GHC's run-time system.

The attempt we know best is Asterius, but Asterius currently relies on GHC's 8.10 branch, and instead of GHC's run-time system, it uses a custom run-time system hand-written in JavaScript.

  • Wiki page on goals for the project: https://gitlab.haskell.org/ghc/ghc/-/wikis/WebAssembly-goals

  • Wiki page with status, plans, and FAQ: https://gitlab.haskell.org/ghc/ghc/-/wikis/WebAssembly-backend

Things to do, to be refined as progress is made:

  • WebAssembly native code generator

    • Add wrapper for doing dominator analysis on CmmGraph (related to #20726)
    • Add key graph-algorithm logic from FGL (#21259)
    • Add "node splitter" to convert irreducible control-flow graphs
    • Add representaiton of WebAssembly control flow
    • Add translation from CmmGraph to WebAssembly control flow
    • Add representation of WebAssembly straight-line code
    • Add representation of WebAssembly relocatable object/asm files
    • Add codeOutput function to emit WebAssembly from CmmGraph
    • Add post-HSC pipeline to support assembly and linking
    • Add WebAssembly back end to compiler driver
  • WebAssembly runtime independent of JavaScript:

    • Update build system to add a new platform (Wasi/Wasm32) to the existing POSIX and Win32 platforms
    • Build RTS and all boot libs for Wasi/Wasm32 without POSIX dependencies
  • JavaScript interoperation:

    • Refactor RTS schedule function to simplify future updates (#20968)
    • Add support for GHC/RTS inside JavaScript event loop, as per operational semantics
    • Reach agreement with GHCJS on support for JavaScript FFI
Edited Mar 18, 2022 by Norman Ramsey
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking