diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-08-02 13:37:57 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-08-06 09:47:32 +0100 |
commit | 290ec750343a340d5f2cef8bf844f3822c9629e0 (patch) | |
tree | 8b17e12863ec7c121180129b89ca65a11a4ea7ca /compiler/codeGen | |
parent | 5620662e08d126ad69b8619360b4ef226f497440 (diff) | |
download | haskell-290ec750343a340d5f2cef8bf844f3822c9629e0.tar.gz |
Add a comment to explain why the FCode monad is lazy
Diffstat (limited to 'compiler/codeGen')
-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 |