"Extensible interface files" work and ANN pragmas

Zubin Duggal zubin.duggal at gmail.com
Thu Apr 23 10:25:28 UTC 2020


Yes, Matthew is correct, the symbol table for Names used by HIE files is
quite distinct from the usual Iface symbol table for Names. Sharing the HIE
symbol table and the Iface symbol table for names will be quite tricky.

One crucial difference is that we also save information about local names
to the symbol table for HIE files.

Here is how names are stored in the HIE symbol table:

data HieName
  = ExternalName !Module !OccName !SrcSpan
  | LocalName !OccName !SrcSpan
  | KnownKeyName !Unique

And the usual symbol table(KnownKeyNames are implicitly handled as a separate case):

type OnDiskName = (UnitId, ModuleName, OccName)

So the merge of HIE and HI files will have to be careful about preserving these
semantics. For instance, the `Binary` instances for HIE file data structures use
putName_, which will have the wrong semantics after this merge. We could possibly
get around this by having ExtensibleFields be allowed to override the UserData
field of the BinHandle.

Thanks to Matthew for bringing this up this important point.

- Zubin

On 20/04/23 09:06, Matthew Pickering wrote:
> I also looked at this patch briefly now and it's my understanding that
> the intention is to use this for HIE files as well?
> 
> HIE files currently serialises Names differently to normal interface
> files (to also include the SrcSpan) and it wasn't clear to me that the
> current implementation would allow for this.
> 
> Zubin/Josh could you please comment?
> 
> Otherwise looks like a nice patch.
> 
> Cheers,
> 
> Matt
> 
> On Thu, Apr 23, 2020 at 8:57 AM Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
> >
> > The "extensible interface files" [1, 2] work has been discussed at GHC calls a
> > few times and the conclusion was we were going to document why current
> > annotation mechanism (ANN pragmas) are insufficient and we need yet another way
> > to put stuff into interfaces.
> >
> > Unfortunately the MR was merged before that's done and so it's currently
> > undocumented and it's still unclear what's insufficient about ANN pragmas or how
> > the new mechanism differs.
> >
> > I'm currently working on an interface files related patch (#16885) so I have to
> > maintain both of these features now. It'd be good to know why both is necessary.
> > If ANN is no longer useful or needed could we deprecate it in favor of the new
> > mechanism and remove it in a few releases? That's help maintaining the code in
> > the future.
> >
> > Could people involved in this design and patch please document the thought
> > process here?
> >
> > Thanks,
> >
> > Ömer
> >
> > [1]: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2948
> > [2]: https://gitlab.haskell.org/ghc/ghc/-/wikis/Extensible-Interface-Files
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list