Skip to content

Instantly share code, notes, and snippets.

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 += -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:

Building GHC

  1. mkdir _build, Copy the hadrian.settings file into _build.
  2. git submodule update --init
  3. perl boot
  4. ./configure
  5. ./hadrian/ -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.

Copy link

Building GHC worked for me, after switching to 8.6.5, thanks!

Copy link

Built graphql-engine successfully. I just added the following lines to cabal.project but I assume changing the path should work fine too:

with-compiler: /path/to/ghc/_build/stage1/bin/ghc
with-hc-pkg: /path/to/ghc/_build/stage1/bin/ghc-pkg

Copy link

m4dc4p commented Apr 23, 2021

Do the same instructions (and branch) apply if you want to do this with GHC 8.10.4? For example, would attempting to merge con-info-backport to the ghc-8.10 be one way?

In any case, thanks so much for putting this together!

Copy link

@m4c4p You can try rebasing I suppose? I don't think the backport is based on exactly the 8.10.2 commit.

Copy link

m4dc4p commented Apr 26, 2021

After adding your fork as a remote (git remote add mpickering, 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