ByteCodeGen: use depth instead of offsets in BCEnv
ClosedPublic

Authored by michalt on Jul 6 2017, 1:48 PM.

Details

Summary

This is based on unfinished work in D38 started by Simon Marlow
and is the first step for fixing Trac #13825. (next step use byte-indexing
for stack)

The change boils down to adjusting everything in BCEnv by +1, which
simplifies the code a bit.

I've also looked into a weird stack adjustement that we did in
getIdValFromApStack and moved it to ByteCodeGen to just keep
everything in one place. I've left a comment about this.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Test Plan

./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
michalt created this revision.Jul 6 2017, 1:48 PM
bgamari accepted this revision.Jul 7 2017, 9:34 AM

Looks pretty reasonable to me.

compiler/ghci/ByteCodeGen.hs
1686

Should this perhaps be a scanl'?

This revision is now accepted and ready to land.Jul 7 2017, 9:34 AM
michalt updated this revision to Diff 13065.Jul 8 2017, 9:41 AM

Use scanl' instead of scanl

michalt marked an inline comment as done.Jul 8 2017, 9:41 AM
bgamari accepted this revision.Jul 8 2017, 9:44 AM

Thanks!

simonmar accepted this revision.Jul 10 2017, 2:46 AM
simonmar added inline comments.
compiler/ghci/ByteCodeGen.hs
418

I suppose this magic 2 is the magic +1 that used to be in getIdValFromApStack and is adjusted by +1 because this patch changes the base of BCEnv. Ok, I'm convinced by conservation of magic.

This revision was automatically updated to reflect the committed changes.