diff options
author | Michal Terepeta <michal.terepeta@gmail.com> | 2017-07-11 12:00:16 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-07-11 13:41:55 -0400 |
commit | fe6618b14712b829b8675fc6024dd33e9598d09a (patch) | |
tree | a52718e0cebe64688f621dd5ed1e18ce313b0fb1 /libraries | |
parent | b8f33bc6b738b0378976e42b79369f0e53b680c7 (diff) | |
download | haskell-fe6618b14712b829b8675fc6024dd33e9598d09a.tar.gz |
ByteCodeGen: use depth instead of offsets in BCEnv
This is based on unfinished work in D38 started by Simon Marlow and is
the first step for fixing #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
Reviewers: austin, hvr, bgamari, simonmar
Reviewed By: bgamari, simonmar
Subscribers: simonmar, rwbarton, thomie
GHC Trac Issues: #13825
Differential Revision: https://phabricator.haskell.org/D3708
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/ghci/GHCi/Run.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libraries/ghci/GHCi/Run.hs b/libraries/ghci/GHCi/Run.hs index eecafa1f75..d05877579a 100644 --- a/libraries/ghci/GHCi/Run.hs +++ b/libraries/ghci/GHCi/Run.hs @@ -344,9 +344,7 @@ mkCostCentres _ _ = return [] getIdValFromApStack :: HValue -> Int -> IO (Maybe HValue) getIdValFromApStack apStack (I# stackDepth) = do - case getApStackVal# apStack (stackDepth +# 1#) of - -- The +1 is magic! I don't know where it comes - -- from, but this makes things line up. --SDM + case getApStackVal# apStack stackDepth of (# ok, result #) -> case ok of 0# -> return Nothing -- AP_STACK not found |