From c85f4928d4dbb2eb2cf906d08bfe7620d6f04ca5 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Mon, 7 Sep 2020 19:48:03 +0200 Subject: Refactor -dynamic-too handling 1) Don't modify DynFlags (too much) for -dynamic-too: now when we generate dynamic outputs for "-dynamic-too", we only set "dynamicNow" boolean field in DynFlags instead of modifying several other fields. These fields now have accessors that take dynamicNow into account. 2) Use DynamicTooState ADT to represent -dynamic-too state. It's much clearer than the undocumented "DynamicTooConditional" that was used before. As a result, we can finally remove the hscs_iface_dflags field in HscRecomp. There was a comment on this field saying: "FIXME (osa): I don't understand why this is necessary, but I spent almost two days trying to figure this out and I couldn't .. perhaps someone who understands this code better will remove this later." I don't fully understand the details, but it was needed because of the changes made to the DynFlags for -dynamic-too. There is still something very dubious in GHC.Iface.Recomp: we have to disable the "dynamicNow" flag at some point for some Backpack's "heinous hack" to continue to work. It may be because interfaces for indefinite units are always non-dynamic, or because we mix and match dynamic and non-dynamic interfaces (#9176), or something else, who knows? --- compiler/GHC/Unit/Module/Status.hs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'compiler/GHC/Unit/Module') diff --git a/compiler/GHC/Unit/Module/Status.hs b/compiler/GHC/Unit/Module/Status.hs index d7fb83e582..539158fdb1 100644 --- a/compiler/GHC/Unit/Module/Status.hs +++ b/compiler/GHC/Unit/Module/Status.hs @@ -5,8 +5,6 @@ where import GHC.Prelude -import GHC.Driver.Session - import GHC.Unit import GHC.Unit.Module.ModGuts import GHC.Unit.Module.ModIface @@ -38,9 +36,4 @@ data HscStatus -- exists. Pass to `hscMaybeWriteIface` when writing the interface to -- avoid updating the existing interface when the interface isn't -- changed. - , hscs_iface_dflags :: !DynFlags - -- ^ Generate final iface using this DynFlags. - -- FIXME (osa): I don't understand why this is necessary, but I spent - -- almost two days trying to figure this out and I couldn't .. perhaps - -- someone who understands this code better will remove this later. } -- cgit v1.2.1