[commit: ghc] wip/T14626: WIP: implement the runtime assert (1ddeb6c)

git at git.haskell.org git at git.haskell.org
Sat Jan 13 04:29:57 UTC 2018


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

On branch  : wip/T14626
Link       : http://ghc.haskell.org/trac/ghc/changeset/1ddeb6c376172173436b37e9def6c0c1cb4062bf/ghc

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

commit 1ddeb6c376172173436b37e9def6c0c1cb4062bf
Author: Gabor Greif <ggreif at gmail.com>
Date:   Sat Jan 13 05:29:24 2018 +0100

    WIP: implement the runtime assert


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

1ddeb6c376172173436b37e9def6c0c1cb4062bf
 compiler/codeGen/StgCmmCon.hs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs
index a38f7bc..d9832c7 100644
--- a/compiler/codeGen/StgCmmCon.hs
+++ b/compiler/codeGen/StgCmmCon.hs
@@ -33,6 +33,7 @@ import StgCmmProf ( curCCS )
 import CmmExpr
 import CLabel
 import MkGraph
+import BlockId
 import SMRep
 import CostCentre
 import Module
@@ -243,6 +244,7 @@ buildDynCon' dflags _ binder actually_bound ccs con args
 
           ; hp_plus_n <- allocDynClosure ticky_name info_tbl lf_info
                                           use_cc blame_cc args_w_offsets
+          ; mapM_ (checkTagOnPtr hp_plus_n) (take ptr_wds $ zip args_w_offsets $ dataConImplBangs con)
           ; return (mkRhsInit dflags reg lf_info hp_plus_n) }
     where
       use_cc      -- cost-centre to stick in the object
@@ -251,6 +253,18 @@ buildDynCon' dflags _ binder actually_bound ccs con args
 
       blame_cc = use_cc -- cost-centre on which to blame the alloc (same)
 
+      checkTagOnPtr base ((_,offset), bang) | isBanged bang = do
+                lgood <- newBlockId
+                lcall <- newBlockId
+                let p = CmmLoad (cmmOffsetB dflags base offset) (bWord dflags)
+                emit $ mkCbranch (cmmIsTagged dflags p)
+                         lgood lcall Nothing
+                emitLabel lcall
+                emitRtsCall rtsUnitId
+                  (fsLit "checkTagged") [(p, AddrHint)] False
+                emitLabel lgood
+      checkTagOnPtr _ _ = pure ()
+
 
 ---------------------------------------------------------------
 --      Binding constructor arguments



More information about the ghc-commits mailing list