<div dir="ltr"><div dir="ltr">On Thu, 23 Apr 2020 at 09:17, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com">omeragacan@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks Simon,<br>
<br>
> We don't want to include the *definitions* of things that are re-exported,<br>
> because that would bloat interface files a lot.<br>
<br>
I think by definition you mean unfoldings, pragmas, annotations, and rules,<br>
right?<br></blockquote><div><br></div><div>And the types of bindings, and the definitions of types. Everything that is not the name, basically.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I'm a bit surprised by this, because this would require tracking transitive<br>
dependencies, which is opposite of what we want to do in #16885.<br></blockquote><div><br></div><div>Not really. It's just a tradeoff between copying all the definitions (recursively) of things we need into the current module vs. leaving the definitions in the interface of the original module where the entity was defined.<br></div><div><br></div><div>Even if we were to copy the definitions of things we depend on into the current module's interface, we still have to know where they came from, and to know when the original definition changes so that we can recompile. So I don't think there would be any difference in which modules we have to list in the current module's interface file usage list. <br></div><div><br></div><div>Note: the "usages" in the interface file is different from the "dependencies". We're not proposing to change how "usages" work. The difference is explained in <a href="https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/recompilation-avoidance#deciding-whether-to-recompile">https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/recompilation-avoidance#deciding-whether-to-recompile</a></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If M1 re-exports something from M2 and M0 imports M1 then I think we could<br>
consider M2 a direct import, but that complicates the story a little bit. I<br>
think we don't have to track *all* transitive deps though, only tracking<br>
re-export paths should be enough. So maybe this is not too bad.<br></blockquote><div><br></div><div>I think we already arrived at a reasonable design on #16885, what do you think of it? Also, David already listed all the places that would potentially need to change if we no longer include transitive dependencies in `dep_mods`: <a href="https://gitlab.haskell.org/ghc/ghc/issues/16885#note_215715">https://gitlab.haskell.org/ghc/ghc/issues/16885#note_215715</a></div><div><br></div><div>And a useful summary of the background is <a href="https://gitlab.haskell.org/ghc/ghc/-/merge_requests/931#note_208414">https://gitlab.haskell.org/ghc/ghc/-/merge_requests/931#note_208414</a><br></div><div><br></div><div>There was some subsequent discussion on #16885 about how to handle boot modules, and a proposal to fix that. Aside from that, the idea is to just remove transitive dependencies from `dep_mods` and fix up the places that used it, which David listed in that comment.</div><div><br></div><div>Cheers</div><div>Simon<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Ömer<br>
<br>
Simon Marlow <<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>>, 22 Nis 2020 Çar, 12:02 tarihinde şunu yazdı:<br>
><br>
> On Tue, 21 Apr 2020 at 11:38, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> I'm currently reading the "recompilation avoidance" wiki page [1], and I have a<br>
>> few questions about the current design.<br>
>><br>
>> The wiki page says (in the paragraph "Suppose the change to D ...") if a module<br>
>> B re-exports x from module D, changing x in D does not cause any changes in B's<br>
>> interface.<br>
>><br>
>> I'm wondering why this is the case. To me this doesn't make sense. Anything that<br>
>> can potentially effect users of B should be a part of B's interface. This<br>
>> includes re-exports. I don't understand why there is a difference between normal<br>
>> exports and re-exports. As far as users of the module concerned there's no<br>
>> difference. So I'd expect any changes in re-exports to make a difference in B's<br>
>> interface.<br>
><br>
><br>
> Yes, that's already the case. Under "Deciding whether to recompile", we say:<br>
><br>
> * If anything else has changed in a way that would affect the results of compiling this module, we must recompile.<br>
><br>
> so that's the basic requirement.<br>
><br>
> We don't want to include the *definitions* of things that are re-exported, because that would bloat interface files a lot. Consider that an interface would have to contain the unfoldings for every exported identifier, and the unfoldings of anything referred to by those unfoldings, and so on. Imagine the size of Prelude.hi! (historical note: it did work this way a long time ago, I think GHC 2.x was when it changed)<br>
><br>
>> The wiki page says (in "Why not do (1)", where (1) refers to making D.x part of<br>
>> B's interface)<br>
><br>
><br>
> here (1) refers to<br>
><br>
> 1. arrange that make knows about the dependency of A on D.<br>
><br>
> which is not the same as making D.x part of B's interface.<br>
><br>
> This section of the wiki page is about "make", incidentally.<br>
><br>
>><br>
>> that this is because sometimes changes in D.x should not cause<br>
>> recompiling B's users. I don't understand why (1) would cause this problem. If<br>
>> we make x a part of B, as if it's defined in B, similar to how we can avoid<br>
>> recompilation of users of B when a definition of B changes but the interface is<br>
>> the same, we could avoid recompiling users when D.x changes.<br>
>><br>
>> For example,<br>
>><br>
>>     -- B.hs<br>
>>     module B where<br>
>><br>
>>     b = 123123<br>
>><br>
>>     -- Main.hs<br>
>>     import B<br>
>><br>
>>     main = print b<br>
>><br>
>><br>
>>     $ ghc-stage1 Main.hs<br>
>>     [1 of 2] Compiling B                ( B.hs, B.o )<br>
>>     [2 of 2] Compiling Main             ( Main.hs, Main.o )<br>
>>     Linking Main ...<br>
>><br>
>> Now if I update B and recompile I'll only link Main, won't recompile it:<br>
>><br>
>>     -- B.hs<br>
>>     module B where<br>
>><br>
>>     b = 123123 + 12308<br>
>><br>
>>     $ ghc-stage1 Main.hs<br>
>>     [1 of 2] Compiling B                ( B.hs, B.o )<br>
>>     Linking Main ...<br>
>><br>
>> Now suppose B.b was a re-export from D. I don't understand why changing it in D<br>
>> would cause recompiling Main if we make b a part of B's interface. I think what<br>
>> would happen is: because D's interface hash won't change we won't recompile B.<br>
>> No problems at all.<br>
><br>
><br>
> I think this all stems from the confusion above.<br>
><br>
>><br>
>><br>
>> Finally, I'm a bit confused about this part<br>
>><br>
>> > To ensure that A is recompiled, we therefore have two options:<br>
>> > ...<br>
>> > (2) arrange to touch B.hi and C.hi even if they haven't changed.<br>
>><br>
>> I don't understand how touching is relevant, as far as I understand touching<br>
>> can't force recompilation. Example:<br>
>><br>
>>     $ ghc-stage1 Main.hs<br>
>>     [1 of 3] Compiling A                ( A.hs, A.o )<br>
>>     [2 of 3] Compiling B                ( B.hs, B.o )<br>
>>     [3 of 3] Compiling Main             ( Main.hs, Main.o )<br>
>>     Linking Main ...<br>
>>     $ touch A.hi<br>
>>     $ ghc-stage1 Main.hs<br>
>>     $ touch B.hi<br>
>>     $ ghc-stage1 Main.hs<br>
>><br>
>> Am I missing anything?<br>
><br>
><br>
> Touching is relevant to "make" only, not ghc --make.  Under " Why do we need recompilation avoidance?" there are two sections: "GHCi and --make" and "make", but the formatting doesn't make the structure very clear here. Perhaps this got worse when we migrated to gitlab?. Maybe adding an outline would help make the structure clearer?<br>
><br>
> Cheers<br>
> Simon<br>
><br>
>><br>
>><br>
>> Thanks,<br>
>><br>
>> Ömer<br>
>><br>
>> [1]: <a href="https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/recompilation-avoidance" rel="noreferrer" target="_blank">https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/recompilation-avoidance</a><br>
>> _______________________________________________<br>
>> ghc-devs mailing list<br>
>> <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div>