diff options
-rw-r--r-- | compiler/codeGen/StgCmmBind.hs | 3 | ||||
-rw-r--r-- | compiler/codeGen/StgCmmMonad.hs | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index a0fcc1ac5d..148d53a4e3 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -113,7 +113,8 @@ cgBind (StgRec pairs) ; addBindsC new_binds ; emit (catAGraphs inits <*> body) } -{- Recursive let-bindings are tricky. +{- Note [cgBind rec] + Recursive let-bindings are tricky. Consider the following pseudocode: let x = \_ -> ... y ... y = \_ -> ... z ... diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index 287302fb0a..eb6b9a988f 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -143,6 +143,13 @@ thenFC (FCode m) k = FCode ( in kcode info_down new_state ) + -- Note: this is a lazy monad. We can't easily make it strict due + -- to the use of fixC for compiling recursive bindings (see Note + -- [cgBind rec]). cgRhs returns a CgIdInfo which is fed back in + -- via the CgBindings, and making the monad strict means that we + -- can't look at the CgIdInfo too early. Things seem to just + -- about work when the monad is lazy. I hate this stuff --SDM + listFCs :: [FCode a] -> FCode [a] listFCs = Prelude.sequence |