diff options
Diffstat (limited to 'compiler/basicTypes/MkId.hs')
-rw-r--r-- | compiler/basicTypes/MkId.hs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index aa81b929d8..a610579513 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -585,14 +585,16 @@ dataConArgRep , [(Type, StrictnessMark)] -- Rep types , (Unboxer, Boxer) ) -dataConArgRep _ _ arg_ty HsNoBang - = (HsNoBang, [(arg_ty, NotMarkedStrict)], (unitUnboxer, unitBoxer)) +-- TODO: Might need to unpack. +dataConArgRep dflags _ arg_ty HsNoBang + | xopt Opt_StrictData dflags = strict_but_not_unpacked arg_ty + | otherwise = (HsNoBang, [(arg_ty, NotMarkedStrict)], (unitUnboxer, unitBoxer)) -dataConArgRep _ _ arg_ty (HsSrcBang _ False) -- No '!' - = (HsNoBang, [(arg_ty, NotMarkedStrict)], (unitUnboxer, unitBoxer)) +-- dataConArgRep _ _ arg_ty (HsSrcBang _ False) -- No '!' +-- = (HsNoBang, [(arg_ty, NotMarkedStrict)], (unitUnboxer, unitBoxer)) dataConArgRep dflags fam_envs arg_ty - (HsUserBang unpk_prag bang) -- TODO: All constructors + (HsSrcBang unpk_prag bang) -- TODO: All constructors | strict_field_requested , not (gopt Opt_OmitInterfacePragmas dflags) -- Don't unpack if -fomit-iface-pragmas -- Don't unpack if we aren't optimising; rather arbitrarily, @@ -724,13 +726,13 @@ isUnpackableType dflags fam_envs ty -- NB: dataConSrcBangs gives the *user* request; -- We'd get a black hole if we used dataConImplBangs - attempt_unpack (HsUnpack {}) = True - attempt_unpack (HsUserBang (Just unpk) (Just bang)) = bang && unpk - attempt_unpack (HsUserBang (Just unpk) Nothing) = xopt Opt_StrictData dflags && unpk - attempt_unpack (HsUserBang Nothing (Just bang)) = bang -- Be conservative - attempt_unpack (HsUserBang Nothing Nothing) = xopt Opt_StrictData dflags - attempt_unpack HsStrict = False - attempt_unpack HsNoBang = False + attempt_unpack (HsUnpack {}) = True + attempt_unpack (HsSrcBang (Just unpk) (Just bang)) = bang && unpk + attempt_unpack (HsSrcBang (Just unpk) Nothing) = xopt Opt_StrictData dflags && unpk + attempt_unpack (HsSrcBang Nothing (Just bang)) = bang -- Be conservative + attempt_unpack (HsSrcBang Nothing Nothing) = xopt Opt_StrictData dflags + attempt_unpack HsStrict = False + attempt_unpack HsNoBang = False {- Note [Unpack one-wide fields] |