Help with debugging a batch mode (or type checker) bug
Hi, In !1304 I'm currently having a bug where I get correct IdInfos for imported Ids in one-shot mode (-c), but not when I use batch mode (--make). If I add a few prints I can see that in hscIncrementalCompile right before hscIncrementalFrontend the hsc_HPT has the correct IdInfos for the imported Ids, but somehow in the desugarer output the IdInfo is lost. Can anyone point me to the right places in the typechecker or the desugarer for me to look at? Thanks, Ömer
In --make mode, after compiling module M, rather than serialising M.hi and the deserialising and typechecking it, we simply use the type environment generated by compiling M and put it into M's entry of the Home Package Table (HPT). But we have to take care to ensure that the IdInfo in that type-env matches the IdInfo that would be obtained by reading M.hi. This is the tidy_type_env returned by TidyPgm.tidyPgm. Now, in your cafInfo work you are working out the CAFFy-ness of Ids later, and popping this info into M's ModIface. But of course, in --make mode, you must _also_ put that same info into M's md_types type envt in the ModDetails returned by tidyPgm. I bet that omitting that step is the problem. Simon | -----Original Message----- | From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Ömer Sinan | Agacan | Sent: 14 October 2019 20:31 | To: ghc-devs <ghc-devs@haskell.org> | Subject: Help with debugging a batch mode (or type checker) bug | | Hi, | | In !1304 I'm currently having a bug where I get correct IdInfos for | imported Ids in one-shot mode (-c), but not when I use batch mode (-- | make). If I add a few prints I can see that in hscIncrementalCompile | right before hscIncrementalFrontend the hsc_HPT has the correct IdInfos | for the imported Ids, but somehow in the desugarer output the IdInfo is | lost. Can anyone point me to the right places in the typechecker or the | desugarer for me to look at? | | Thanks, | | Ömer | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153 | &sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&reserve | d=0
Thanks Simon, I can't confirm just yet, because it's impossible to print the Id details in the TypeEnv (probably because of some know-tying somewhere?), but looking at the code I can't see where we update ModDetails returned by hscIncrementalCompile in compileOne' (used by batch mode but not by one-shot mode), so I think you're right about this being the problem. Ömer Simon Peyton Jones <simonpj@microsoft.com>, 15 Eki 2019 Sal, 00:35 tarihinde şunu yazdı:
In --make mode, after compiling module M, rather than serialising M.hi and the deserialising and typechecking it, we simply use the type environment generated by compiling M and put it into M's entry of the Home Package Table (HPT).
But we have to take care to ensure that the IdInfo in that type-env matches the IdInfo that would be obtained by reading M.hi. This is the tidy_type_env returned by TidyPgm.tidyPgm.
Now, in your cafInfo work you are working out the CAFFy-ness of Ids later, and popping this info into M's ModIface. But of course, in --make mode, you must _also_ put that same info into M's md_types type envt in the ModDetails returned by tidyPgm.
I bet that omitting that step is the problem.
Simon
| -----Original Message----- | From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Ömer Sinan | Agacan | Sent: 14 October 2019 20:31 | To: ghc-devs <ghc-devs@haskell.org> | Subject: Help with debugging a batch mode (or type checker) bug | | Hi, | | In !1304 I'm currently having a bug where I get correct IdInfos for | imported Ids in one-shot mode (-c), but not when I use batch mode (-- | make). If I add a few prints I can see that in hscIncrementalCompile | right before hscIncrementalFrontend the hsc_HPT has the correct IdInfos | for the imported Ids, but somehow in the desugarer output the IdInfo is | lost. Can anyone point me to the right places in the typechecker or the | desugarer for me to look at? | | Thanks, | | Ömer | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153 | &sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&reserve | d=0
Just confirmed that this is the problem -- thanks again. Ömer Ömer Sinan Ağacan <omeragacan@gmail.com>, 15 Eki 2019 Sal, 10:04 tarihinde şunu yazdı:
Thanks Simon,
I can't confirm just yet, because it's impossible to print the Id details in the TypeEnv (probably because of some know-tying somewhere?), but looking at the code I can't see where we update ModDetails returned by hscIncrementalCompile in compileOne' (used by batch mode but not by one-shot mode), so I think you're right about this being the problem.
Ömer
Simon Peyton Jones <simonpj@microsoft.com>, 15 Eki 2019 Sal, 00:35 tarihinde şunu yazdı:
In --make mode, after compiling module M, rather than serialising M.hi and the deserialising and typechecking it, we simply use the type environment generated by compiling M and put it into M's entry of the Home Package Table (HPT).
But we have to take care to ensure that the IdInfo in that type-env matches the IdInfo that would be obtained by reading M.hi. This is the tidy_type_env returned by TidyPgm.tidyPgm.
Now, in your cafInfo work you are working out the CAFFy-ness of Ids later, and popping this info into M's ModIface. But of course, in --make mode, you must _also_ put that same info into M's md_types type envt in the ModDetails returned by tidyPgm.
I bet that omitting that step is the problem.
Simon
| -----Original Message----- | From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Ömer Sinan | Agacan | Sent: 14 October 2019 20:31 | To: ghc-devs <ghc-devs@haskell.org> | Subject: Help with debugging a batch mode (or type checker) bug | | Hi, | | In !1304 I'm currently having a bug where I get correct IdInfos for | imported Ids in one-shot mode (-c), but not when I use batch mode (-- | make). If I add a few prints I can see that in hscIncrementalCompile | right before hscIncrementalFrontend the hsc_HPT has the correct IdInfos | for the imported Ids, but somehow in the desugarer output the IdInfo is | lost. Can anyone point me to the right places in the typechecker or the | desugarer for me to look at? | | Thanks, | | Ömer | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153 | &sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&reserve | d=0
Great. Before you are done with this patch, let's make sure there is an overview Note to explain the big picture. Simon | -----Original Message----- | From: Ömer Sinan Ağacan <omeragacan@gmail.com> | Sent: 15 October 2019 08:31 | To: Simon Peyton Jones <simonpj@microsoft.com> | Cc: ghc-devs <ghc-devs@haskell.org> | Subject: Re: Help with debugging a batch mode (or type checker) bug | | Just confirmed that this is the problem -- thanks again. | | Ömer | | | Ömer Sinan Ağacan <omeragacan@gmail.com>, 15 Eki 2019 Sal, 10:04 | tarihinde şunu yazdı: | > | > Thanks Simon, | > | > I can't confirm just yet, because it's impossible to print the Id | details in the | > TypeEnv (probably because of some know-tying somewhere?), but looking at | the | > code I can't see where we update ModDetails returned by | hscIncrementalCompile in | > compileOne' (used by batch mode but not by one-shot mode), so I think | you're | > right about this being the problem. | > | > Ömer | > | > Simon Peyton Jones <simonpj@microsoft.com>, 15 Eki 2019 Sal, 00:35 | > tarihinde şunu yazdı: | > > | > > In --make mode, after compiling module M, rather than serialising M.hi | and the deserialising and typechecking it, we simply use the type | environment generated by compiling M and put it into M's entry of the Home | Package Table (HPT). | > > | > > But we have to take care to ensure that the IdInfo in that type-env | matches the IdInfo that would be obtained by reading M.hi. This is the | tidy_type_env returned by TidyPgm.tidyPgm. | > > | > > Now, in your cafInfo work you are working out the CAFFy-ness of Ids | later, and popping this info into M's ModIface. But of course, in --make | mode, you must _also_ put that same info into M's md_types type envt in | the ModDetails returned by tidyPgm. | > > | > > I bet that omitting that step is the problem. | > > | > > Simon | > > | > > | -----Original Message----- | > > | From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Ömer | Sinan | > > | Agacan | > > | Sent: 14 October 2019 20:31 | > > | To: ghc-devs <ghc-devs@haskell.org> | > > | Subject: Help with debugging a batch mode (or type checker) bug | > > | | > > | Hi, | > > | | > > | In !1304 I'm currently having a bug where I get correct IdInfos for | > > | imported Ids in one-shot mode (-c), but not when I use batch mode (- | - | > > | make). If I add a few prints I can see that in hscIncrementalCompile | > > | right before hscIncrementalFrontend the hsc_HPT has the correct | IdInfos | > > | for the imported Ids, but somehow in the desugarer output the IdInfo | is | > > | lost. Can anyone point me to the right places in the typechecker or | the | > > | desugarer for me to look at? | > > | | > > | Thanks, | > > | | > > | Ömer | > > | _______________________________________________ | > > | ghc-devs mailing list | > > | ghc-devs@haskell.org | > > | | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has | > > | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | > > | | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d | > > | | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153 | > > | | &sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&reserve | > > | d=0
participants (2)
-
Simon Peyton Jones -
Ömer Sinan Ağacan