[commit: ghc] wip/libdw-unwind: REVISIT: CmmLayoutStack: Always use new label (b7ed064)

git at git.haskell.org git at git.haskell.org
Mon Jan 4 22:20:32 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/libdw-unwind
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7ed064a2cd4c93abc8d8ad969d45df584664c73/ghc

>---------------------------------------------------------------

commit b7ed064a2cd4c93abc8d8ad969d45df584664c73
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Jan 4 12:57:52 2016 +0100

    REVISIT: CmmLayoutStack: Always use new label
    
    Otherwise we might end up with a reference to a block that was
    eliminated during flow control.
    
    Ideally we would just ensure that these unwindings are dropped along
    with the block itself.


>---------------------------------------------------------------

b7ed064a2cd4c93abc8d8ad969d45df584664c73
 compiler/cmm/CmmLayoutStack.hs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs
index 49503e9..2732470 100644
--- a/compiler/cmm/CmmLayoutStack.hs
+++ b/compiler/cmm/CmmLayoutStack.hs
@@ -28,6 +28,7 @@ import DynFlags
 import FastString
 import Outputable hiding ( isEmpty )
 import qualified Data.Set as Set
+import Control.Monad ((<=<))
 import Control.Monad.Fix
 import Data.Array as Array
 import Data.Bits
@@ -788,12 +789,13 @@ manifestSp dflags stackmaps stack0 sp0 sp_high
   = do
     let -- Add unwind pseudo-instructions to document Sp level for debugging
         add_unwind_info block
-          | debugLevel dflags > 0 = CmmUnwind (ExistingLabel $ entryLabel first) Sp sp_unwind : block
-          | otherwise             = block
+          | debugLevel dflags > 0 = do lbl <- newBlockId
+                                       pure $ CmmUnwind (NewLabel lbl) Sp sp_unwind : block
+          | otherwise             = pure block
         sp_unwind = CmmRegOff (CmmGlobal Sp) (sp0 - wORD_SIZE dflags)
 
-    final_middle <- maybeAddSpAdj dflags sp0 sp_off $
-                    blockFromList $
+    final_middle <- maybeAddSpAdj dflags sp0 sp_off <=<
+                    pure . blockFromList <=<
                     add_unwind_info $
                     map adj_pre_sp $
                     elimStackStores stack0 stackmaps area_off $



More information about the ghc-commits mailing list