diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-25 17:37:55 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-18 23:08:35 -0400 |
commit | d4a0be758003f32b9d9d89cfd14b9839ac002f4d (patch) | |
tree | 2ced620f7598d9e71882be08b027a7ce9e448be2 /compiler/GHC/StgToCmm | |
parent | 2af0ec9059b94e1fa6b37eda60216e0222e1a53d (diff) | |
download | haskell-d4a0be758003f32b9d9d89cfd14b9839ac002f4d.tar.gz |
Move tablesNextToCode field into Platform
tablesNextToCode is a platform setting and doesn't belong into DynFlags
(#17957). Doing this is also a prerequisite to fix #14335 where we deal
with two platforms (target and host) that may have different platform
settings.
Diffstat (limited to 'compiler/GHC/StgToCmm')
-rw-r--r-- | compiler/GHC/StgToCmm/Bind.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Closure.hs | 33 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Expr.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Layout.hs | 4 |
4 files changed, 26 insertions, 20 deletions
diff --git a/compiler/GHC/StgToCmm/Bind.hs b/compiler/GHC/StgToCmm/Bind.hs index 5402b6239b..2217724922 100644 --- a/compiler/GHC/StgToCmm/Bind.hs +++ b/compiler/GHC/StgToCmm/Bind.hs @@ -552,7 +552,7 @@ mkSlowEntryCode bndr cl_info arg_regs -- function closure is already in `Node' platform <- getPlatform let node = idToReg platform (NonVoid bndr) slow_lbl = closureSlowEntryLabel cl_info - fast_lbl = closureLocalEntryLabel dflags cl_info + fast_lbl = closureLocalEntryLabel platform cl_info -- mkDirectJump does not clobber `Node' containing function closure jump = mkJump dflags NativeNodeCall (mkLblExpr fast_lbl) @@ -727,7 +727,7 @@ link_caf node = do -- see Note [atomic CAF entry] in rts/sm/Storage.c ; updfr <- getUpdFrameOff - ; let target = entryCode dflags (closureInfoPtr dflags (CmmReg (CmmLocal node))) + ; let target = entryCode platform (closureInfoPtr dflags (CmmReg (CmmLocal node))) ; emit =<< mkCmmIfThen (cmmEqWord platform (CmmReg (CmmLocal bh)) (zeroExpr platform)) -- re-enter the CAF diff --git a/compiler/GHC/StgToCmm/Closure.hs b/compiler/GHC/StgToCmm/Closure.hs index 40ff161819..b21277641b 100644 --- a/compiler/GHC/StgToCmm/Closure.hs +++ b/compiler/GHC/StgToCmm/Closure.hs @@ -65,6 +65,7 @@ module GHC.StgToCmm.Closure ( #include "HsVersions.h" import GHC.Prelude +import GHC.Platform import GHC.Stg.Syntax import GHC.Runtime.Heap.Layout @@ -511,7 +512,7 @@ getCallMethod dflags name id (LFReEntrant _ arity _ _) n_args _v_args _cg_loc -- See Note [Evaluating functions with profiling] in rts/Apply.cmm = ASSERT( arity /= 0 ) ReturnIt | n_args < arity = SlowCall -- Not enough args - | otherwise = DirectEntry (enterIdLabel dflags name (idCafInfo id)) arity + | otherwise = DirectEntry (enterIdLabel (targetPlatform dflags) name (idCafInfo id)) arity getCallMethod _ _name _ LFUnlifted n_args _v_args _cg_loc _self_loop_info = ASSERT( n_args == 0 ) ReturnIt @@ -781,10 +782,10 @@ staticClosureLabel = toClosureLbl . closureInfoLabel closureSlowEntryLabel :: ClosureInfo -> CLabel closureSlowEntryLabel = toSlowEntryLbl . closureInfoLabel -closureLocalEntryLabel :: DynFlags -> ClosureInfo -> CLabel -closureLocalEntryLabel dflags - | tablesNextToCode dflags = toInfoLbl . closureInfoLabel - | otherwise = toEntryLbl . closureInfoLabel +closureLocalEntryLabel :: Platform -> ClosureInfo -> CLabel +closureLocalEntryLabel platform + | platformTablesNextToCode platform = toInfoLbl . closureInfoLabel + | otherwise = toEntryLbl . closureInfoLabel mkClosureInfoTableLabel :: DynFlags -> Id -> LambdaFormInfo -> CLabel mkClosureInfoTableLabel dflags id lf_info @@ -821,22 +822,26 @@ thunkEntryLabel dflags _thunk_id _ (ApThunk arity) upd_flag thunkEntryLabel dflags _thunk_id _ (SelectorThunk offset) upd_flag = enterSelectorLabel dflags upd_flag offset thunkEntryLabel dflags thunk_id c _ _ - = enterIdLabel dflags thunk_id c + = enterIdLabel (targetPlatform dflags) thunk_id c enterApLabel :: DynFlags -> Bool -> Arity -> CLabel enterApLabel dflags is_updatable arity - | tablesNextToCode dflags = mkApInfoTableLabel dflags is_updatable arity - | otherwise = mkApEntryLabel dflags is_updatable arity + | platformTablesNextToCode platform = mkApInfoTableLabel dflags is_updatable arity + | otherwise = mkApEntryLabel dflags is_updatable arity + where + platform = targetPlatform dflags enterSelectorLabel :: DynFlags -> Bool -> WordOff -> CLabel enterSelectorLabel dflags upd_flag offset - | tablesNextToCode dflags = mkSelectorInfoLabel dflags upd_flag offset - | otherwise = mkSelectorEntryLabel dflags upd_flag offset + | platformTablesNextToCode platform = mkSelectorInfoLabel dflags upd_flag offset + | otherwise = mkSelectorEntryLabel dflags upd_flag offset + where + platform = targetPlatform dflags -enterIdLabel :: DynFlags -> Name -> CafInfo -> CLabel -enterIdLabel dflags id c - | tablesNextToCode dflags = mkInfoTableLabel id c - | otherwise = mkEntryLabel id c +enterIdLabel :: Platform -> Name -> CafInfo -> CLabel +enterIdLabel platform id c + | platformTablesNextToCode platform = mkInfoTableLabel id c + | otherwise = mkEntryLabel id c -------------------------------------- diff --git a/compiler/GHC/StgToCmm/Expr.hs b/compiler/GHC/StgToCmm/Expr.hs index 164348895d..0ff9db404c 100644 --- a/compiler/GHC/StgToCmm/Expr.hs +++ b/compiler/GHC/StgToCmm/Expr.hs @@ -1007,6 +1007,7 @@ cgIdApp fun_id args = do emitEnter :: CmmExpr -> FCode ReturnKind emitEnter fun = do { dflags <- getDynFlags + ; platform <- getPlatform ; adjustHpBackwards ; sequel <- getSequel ; updfr_off <- getUpdFrameOff @@ -1020,7 +1021,7 @@ emitEnter fun = do -- Right now, we do what the old codegen did, and omit the tag -- test, just generating an enter. Return -> do - { let entry = entryCode dflags $ closureInfoPtr dflags $ CmmReg nodeReg + { let entry = entryCode platform $ closureInfoPtr dflags $ CmmReg nodeReg ; emit $ mkJump dflags NativeNodeCall entry [cmmUntag dflags fun] updfr_off ; return AssignedDirectly @@ -1062,7 +1063,7 @@ emitEnter fun = do -- refer to fun via nodeReg after the copyout, to avoid having -- both live simultaneously; this sometimes enables fun to be -- inlined in the RHS of the R1 assignment. - ; let entry = entryCode dflags (closureInfoPtr dflags (CmmReg nodeReg)) + ; let entry = entryCode platform (closureInfoPtr dflags (CmmReg nodeReg)) the_call = toCall entry (Just lret) updfr_off off outArgs regs ; tscope <- getTickScope ; emit $ diff --git a/compiler/GHC/StgToCmm/Layout.hs b/compiler/GHC/StgToCmm/Layout.hs index ce04371ce2..646f4fa1d9 100644 --- a/compiler/GHC/StgToCmm/Layout.hs +++ b/compiler/GHC/StgToCmm/Layout.hs @@ -86,7 +86,7 @@ emitReturn results Return -> do { adjustHpBackwards ; let e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord platform) - ; emit (mkReturn dflags (entryCode dflags e) results updfr_off) + ; emit (mkReturn dflags (entryCode platform e) results updfr_off) } AssignTo regs adjust -> do { when adjust adjustHpBackwards @@ -222,7 +222,7 @@ slowCall fun stg_args fast_code <- getCode $ emitCall (NativeNodeCall, NativeReturn) - (entryCode dflags fun_iptr) + (entryCode platform fun_iptr) (nonVArgs ((P,Just funv):argsreps)) slow_lbl <- newBlockId |