Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Run simplifier before generating ByteCode #410

Merged
merged 1 commit into from
Feb 12, 2020

Conversation

mpickering
Copy link
Contributor

Running the simplifier is necessary to do things like inline data
constructor wrappers.

Fixes #256 and #393

Copy link
Collaborator

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! It would be great to have a testcase for this. #393 looks reasonably easy to test.

@@ -144,9 +145,14 @@ compileModule packageState deps tmr =
let pm' = pm{pm_mod_summary = tweak $ pm_mod_summary pm}
let tm' = tm{tm_parsed_module = pm'}
GHC.dm_core_module <$> GHC.desugarModule tm'

let tc_result = fst (tm_internals_ (tmrModule tmr))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set -O0 explicitly or does hie-bios set that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that ghcide set all the flags it was interested in. At least on the .hi files branch, I believe this is the case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t know any code that sets -O0. I think so far it just didn’t matter since we didn’t run the simplifier and don’t do code generation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hie-bios definitely sets it: https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Environment.hs#L41
Assuming, ghcide still uses initSession.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the .hi file branch this will need to be set but for now, initSession does set it.

Running the simplifier is necessary to do things like inline data
constructor wrappers.

Fixes #256 and #393
@mpickering
Copy link
Contributor Author

Added a test now which I verified fails before this patch but succeeds with the patch.

@ocharles
Copy link
Contributor

At long last with this branch I can almost load our main API server into ghcide! Only 14 files left to go (273 files now work), but that's a different bug 🎉 Great work @mpickering!

Copy link
Collaborator

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@cocreature cocreature merged commit 2d71599 into haskell:master Feb 12, 2020
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
Running the simplifier is necessary to do things like inline data
constructor wrappers.

Fixes haskell/ghcide#256 and haskell/ghcide#393
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
Running the simplifier is necessary to do things like inline data
constructor wrappers.

Fixes haskell/ghcide#256 and haskell/ghcide#393
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
Running the simplifier is necessary to do things like inline data
constructor wrappers.

Fixes haskell/ghcide#256 and haskell/ghcide#393
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template Haskell: ByteCodeLink.lookupCE During interactive linking, GHCi couldn't find the following symbol
4 participants