Make tablesNextToCode a proper dynamic flag (#15548)
AbandonedPublic

Authored by nomeata on Aug 21 2018, 12:39 AM.

Details

Reviewers
hvr
bgamari
Trac Issues
#15548
Summary

There is no more use of the TABLES_NEXT_TO_CODE CPP macro in
compiler/. The default value of tablesNextToCode is calculated as
before, but now users of the GHCI API can modify this flag.

nomeata created this revision.Aug 21 2018, 12:39 AM
nomeata updated this revision to Diff 17714.Aug 21 2018, 1:20 AM

Use the right function

The default value of tablesNextToCode is calculated as before, but now users of the GHCI API can modify this flag.

I'm confused; yes, they can now modify the flag but they would be unable to run any code compiled with the modification with a runtime built in the same way. Is the goal here to allow cross-compilation?

In general this seems like a reasonable change; I'm just a bit confused by the motivation.

I'm confused; yes, they can now modify the flag but they would be unable to run any code compiled with the modification with a runtime built in the same way. Is the goal here to allow cross-compilation?

It is for the benefit of those who implement their own code-generation, picking up at the Cmm state, such as the Haskell→WebAssembly “Asterius” compiler that Tweag is working on. They currently have to build GHC with TABLES_NEXT_TO_CODE unset.

nomeata updated this revision to Diff 17720.Aug 21 2018, 1:36 PM
  • Found a few more ifdefs in the GHCi code
nomeata updated this revision to Diff 17752.Aug 22 2018, 3:49 PM
  • Do not pass -DTABLES_NEXT_TO_CODE to gcc (untested)
bgamari abandoned this revision.Jan 20 2019, 6:18 PM

Merged in a0dcf76fa7b23cf1cacababadaa1b54d90453f9a.

Sigh, no, this isn't merged. I just confused myself. Regardless, I have pushed this to GitLab as wip/D5082. Do you intend on continuing this, @nomeata?

This was for the benefit of @TerrorJack's asterius efforts. @TerrorJack, do you think this is helpful for your purposes?