X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcodeGen%2FClosureInfo.lhs;h=d2c63b3be30a601fae3ba0511af093326ebbc924;hp=9598233d4015affa1e87223034b3600d0d54bd1f;hb=HEAD;hpb=b01702b5d417de416cd9cff2f730112e08ce00d9 diff --git a/compiler/codeGen/ClosureInfo.lhs b/compiler/codeGen/ClosureInfo.lhs index 9598233..d2c63b3 100644 --- a/compiler/codeGen/ClosureInfo.lhs +++ b/compiler/codeGen/ClosureInfo.lhs @@ -72,7 +72,6 @@ import Id import IdInfo import DataCon import Name -import OccName import Type import TypeRep import TcType @@ -598,22 +597,21 @@ getCallMethod _ name caf (LFReEntrant _ arity _ _) n_args | otherwise = DirectEntry (enterIdLabel name caf) arity getCallMethod _ _ _ (LFCon con) n_args + | opt_SccProfilingOn -- when profiling, we must always enter + = EnterIt -- a closure when we use it, so that the closure + -- can be recorded as used for LDV profiling. + | otherwise = ASSERT( n_args == 0 ) ReturnCon con -getCallMethod dflags name caf (LFThunk _ _ updatable std_form_info is_fun) n_args +getCallMethod _dflags _name _caf (LFThunk _ _ _updatable _std_form_info is_fun) _n_args | is_fun -- it *might* be a function, so we must "call" it (which is -- always safe) = SlowCall -- We cannot just enter it [in eval/apply, the entry code -- is the fast-entry code] -- Since is_fun is False, we are *definitely* looking at a data value - | updatable || doingTickyProfiling dflags -- to catch double entry - {- OLD: || opt_SMP - I decided to remove this, because in SMP mode it doesn't matter - if we enter the same thunk multiple times, so the optimisation - of jumping directly to the entry code is still valid. --SDM - -} + | otherwise = EnterIt -- We used to have ASSERT( n_args == 0 ), but actually it is -- possible for the optimiser to generate @@ -622,9 +620,16 @@ getCallMethod dflags name caf (LFThunk _ _ updatable std_form_info is_fun) n_arg -- This happens as a result of the case-of-error transformation -- So the right thing to do is just to enter the thing - | otherwise -- Jump direct to code for single-entry thunks - = ASSERT( n_args == 0 ) - JumpToIt (thunkEntryLabel name caf std_form_info updatable) +-- Old version: +-- | updatable || doingTickyProfiling dflags -- to catch double entry +-- = EnterIt +-- | otherwise -- Jump direct to code for single-entry thunks +-- = JumpToIt (thunkEntryLabel name caf std_form_info updatable) +-- +-- Now we never use JumpToIt, even if the thunk is single-entry, since +-- the thunk may have already been entered and blackholed by another +-- processor. + getCallMethod _ _ _ (LFUnknown True) _ = SlowCall -- Might be a function @@ -943,6 +948,7 @@ closureLabelFromCI _ _ = panic "closureLabelFromCI" -- thunkEntryLabel is a local help function, not exported. It's used from both -- entryLabelFromCI and getCallMethod. +{- UNUSED: thunkEntryLabel :: Name -> CafInfo -> StandardFormInfo -> Bool -> CLabel thunkEntryLabel _thunk_id _ (ApThunk arity) is_updatable = enterApLabel is_updatable arity @@ -950,16 +956,21 @@ thunkEntryLabel _thunk_id _ (SelectorThunk offset) upd_flag = enterSelectorLabel upd_flag offset thunkEntryLabel thunk_id caf _ _is_updatable = enterIdLabel thunk_id caf +-} +{- UNUSED: enterApLabel :: Bool -> Int -> CLabel enterApLabel is_updatable arity | tablesNextToCode = mkApInfoTableLabel is_updatable arity | otherwise = mkApEntryLabel is_updatable arity +-} +{- UNUSED: enterSelectorLabel :: Bool -> Int -> CLabel enterSelectorLabel upd_flag offset | tablesNextToCode = mkSelectorInfoLabel upd_flag offset | otherwise = mkSelectorEntryLabel upd_flag offset +-} enterIdLabel :: Name -> CafInfo -> CLabel enterIdLabel id