Skip to content

GHC 9.6+ updates #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dmjio
Copy link

@dmjio dmjio commented May 1, 2025

Hey @csabahruska,

In preparation for @mpickering and @alt-romes to release an alpha version of dap integration w/ GHC, I'd like to ensure that our work with the haskell-estgi-debugger is building along with the coming dap changes.

This PR updates the external-stg-interpreter, external-stg and external-stg-syntax to build with GHC 9.6+.

Things done:

  • Adjusted primops and tests for 64-bit Word and Int since ghc-prim had slightly changed (primop tests pass now ✅ )
  • cabal.project file was added and it does build with the latest souffle-haskell-0.4.0.0 and a working version of final-pretty
  • A cabal flag was introduced (-fexternal-ext-stg-gc and -fexternal-ext-liveness-analysis -- disabled by default in the cabal file - but enabled by default in cabal.project) to allow users to build the souffle generated C++ by hand. This simplifies the build, and runSouffle is able to find the ext-stg-gc binary in $PATH.
  • Re-introduced import Control.Monad, it was decided that Control.Monad should no longer be re-exported from mtl modules.
  • Adds a github workflow file. This workflow will use cabal's resolver to build the Haskell code, and nix to acquire bzip2 and zlib.
  • Adds a github workflow badge to the README.md
    neWord16# [✔]
     +++ OK, passed 100 tests.

Finished in 0.0904 seconds
240 examples, 0 failures
Test suite primop-test: PASS
Test suite logged to:
/home/dmjio/Desktop/ghc-whole-program-compiler-project/dist-newstyle/build/x86_64-linux/ghc-9.6.6/external-stg-interpreter-0.1.0.1/t/primop-test/test/external-stg-interpreter-0.1.0.1-primop-test.log
1 of 1 test suites (1 of 1 test cases) passed.

^ these tests should run in CI now

Then in the haskell-debugger I'm able to make ext-stg-gc available on PATH so runSouffle will always be able to find it, when we call the external-stg-interpreter from haskell-debugger.

  ext-stg-gc =
    pkgs.stdenv.mkDerivation {
      name = "ext-stg-gc";
      src = "${ghc-wpo-src}/external-stg-interpreter";
      buildInputs = with pkgs; [ souffle openmpi ];
      buildPhase = ''
        mkdir -pv $out/bin
        g++ -fopenmp $src/datalog/ext-stg-gc.cpp \
           -D_OPENMP -std=c++17 \
           -o $out/bin/ext-stg-gc
      '';
    };
    ```

dmjio added 5 commits April 30, 2025 22:52
This fixes the build for GHC-9.6.6 and above.

- [x] Imports Control.Monad (mtl modules no longer re-export this)
- [x] Update 64-bit primops (some functions in ghc-prim have changed for 64-bit primops)
- [x] Adds conditional cabal flag for compiling ext-stg-gc externally
- Adds cabal projects to cabal.project
- Disables cabal building C++ by default in cabal.project
- Updates some of the wpc-plugin and external-stg-compiler code
@dmjio dmjio changed the title GHC 9.6 updates GHC 9.6+ updates May 1, 2025
- This re-invokes `souffle` (per the README) to get an updated version
of the C++ code for use w/ `runGC` / `runSouffle`.
@dmjio
Copy link
Author

dmjio commented May 1, 2025

Since we've updated souffle, we've regen'd the reachability analysis for GC (per the README.md instructions).

It seems to build and do the right thing (checks roots for mark and sweep)

❯ $(nix-build -A ext-stg-gc)/bin/ext-stg-gc
Error loading GCRoot data: Cannot open fact file GCRoot.facts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant