Skip to content

Instantly share code, notes, and snippets.

@mpickering
Last active December 23, 2021 14:53
Show Gist options
  • Save mpickering/c2a839fd6754fa76fdb6dc638f88638c to your computer and use it in GitHub Desktop.
Save mpickering/c2a839fd6754fa76fdb6dc638f88638c to your computer and use it in GitHub Desktop.
Backport instructions
stage1.*.ghc.hs.opts += -finfo-table-map -fdistinct-constructor-tables
stage1.ghc-bin.ghc.link.opts += -eventlog

These instructions will tell you how to build 8.10.2 with the -hi, -finfo-table-map and -fdistinct-constructor-tables patch backported.

GHC Branch: https://gitlab.haskell.org/mpickering/ghc/-/commits/ghc-con-info-backport

Building GHC

  1. mkdir _build, Copy the hadrian.settings file into _build.
  2. git submodule update --init
  3. perl boot
  4. ./configure
  5. ./hadrian/build.cabal.sh -j4

You will now have an instrumented version of GHC which has support for the -hi mode, -finfo-table-map and -fdistinct-constructor-tables flags.

Building graphql-engine

  1. Modify the cabal.project file in the package * stanza to build dependencies with -finfo-table-map and -fdistinct-constructor-tables.
  2. Modify graphql-engine.cabal by adding -eventlog to ghc-options.
  3. Remove specific 8.10.2 bounds from cabal.project.freeze.
  4. Modify RUN_INVOCATION to pass -hi -l-au
  5. Start server normally, the resulting eventlog ends up in the server/ directory.

Viewing the profile

If you wish to view the profile, use eventlog2html. This is still very rough so it might not be so easy to understand what's going on.

https://github.com/mpickering/eventlog2html/tree/wip/profile-info-table

@m4dc4p
Copy link

m4dc4p commented Apr 26, 2021

After adding your fork as a remote (git remote add mpickering https://gitlab.haskell.org/mpickering/ghc), I was able to merge this branch into ghc's 8.10 branch and build successfully. Thanks for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment