DEBUG removal
[ghc-hetmet.git] / compiler / codeGen / CgStackery.lhs
index e015895..4196997 100644 (file)
@@ -12,7 +12,7 @@ Stack-twiddling operations, which are pretty low-down and grimy.
 -- The above warning supression flag is a temporary kludge.
 -- While working on this module you are encouraged to remove it and fix
 -- any warnings in the module. See
---     http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
 -- for details
 
 module CgStackery (
@@ -41,6 +41,8 @@ import Util
 import FastString
 import OrdList
 import Outputable
+
+import Control.Monad
 \end{code}
 
 %************************************************************************
@@ -275,12 +277,10 @@ pushUpdateFrame :: CmmExpr -> Code -> Code
 
 pushUpdateFrame updatee code
   = do {
-#ifdef DEBUG
-         EndOfBlockInfo _ sequel <- getEndOfBlockInfo ;
-         ASSERT(case sequel of { OnStack -> True; _ -> False})
-#endif
-
-         allocStackTop (fixedHdrSize + 
+      when debugIsOn $ do
+       { EndOfBlockInfo _ sequel <- getEndOfBlockInfo ;
+       ; MASSERT(case sequel of { OnStack -> True; _ -> False}) }
+       ; allocStackTop (fixedHdrSize + 
                           sIZEOF_StgUpdateFrame_NoHdr `quot` wORD_SIZE)
        ; vsp <- getVirtSp
        ; setStackFrame vsp