Help with debugging a batch mode (or type checker) bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with debugging a batch mode (or type checker) bug

Ömer Sinan Ağacan
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

RE: Help with debugging a batch mode (or type checker) bug

GHC - devs mailing list
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 <[hidden email]> On Behalf Of Ömer Sinan
| Agacan
| Sent: 14 October 2019 20:31
| To: ghc-devs <[hidden email]>
| 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
| [hidden email]
| https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has
| kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| devs&amp;data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d
| 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153
| &amp;sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&amp;reserve
| d=0
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Help with debugging a batch mode (or type checker) bug

Ömer Sinan Ağacan
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 <[hidden email]>, 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 <[hidden email]> On Behalf Of Ömer Sinan
> | Agacan
> | Sent: 14 October 2019 20:31
> | To: ghc-devs <[hidden email]>
> | 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
> | [hidden email]
> | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has
> | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
> | devs&amp;data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d
> | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153
> | &amp;sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&amp;reserve
> | d=0
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Help with debugging a batch mode (or type checker) bug

Ömer Sinan Ağacan
Just confirmed that this is the problem -- thanks again.

Ömer


Ömer Sinan Ağacan <[hidden email]>, 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 <[hidden email]>, 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 <[hidden email]> On Behalf Of Ömer Sinan
> > | Agacan
> > | Sent: 14 October 2019 20:31
> > | To: ghc-devs <[hidden email]>
> > | 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
> > | [hidden email]
> > | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has
> > | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
> > | devs&amp;data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d
> > | 750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153
> > | &amp;sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&amp;reserve
> > | d=0
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

RE: Help with debugging a batch mode (or type checker) bug

GHC - devs mailing list
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 <[hidden email]>
|  Sent: 15 October 2019 08:31
|  To: Simon Peyton Jones <[hidden email]>
|  Cc: ghc-devs <[hidden email]>
|  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 <[hidden email]>, 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 <[hidden email]>, 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 <[hidden email]> On Behalf Of Ömer
|  Sinan
|  > > | Agacan
|  > > | Sent: 14 October 2019 20:31
|  > > | To: ghc-devs <[hidden email]>
|  > > | 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
|  > > | [hidden email]
|  > > |
|  https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.has
|  > > | kell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
|  > > |
|  devs&amp;data=02%7C01%7Csimonpj%40microsoft.com%7C82e14cca4ab94038a05208d
|  > > |
|  750dd31e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637066783278881153
|  > > |
|  &amp;sdata=grXCcgzashiOYGOLafr%2F32Q%2BYr5X1tonSavQ5pVlx0M%3D&amp;reserve
|  > > | d=0
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs