Small Int and Char closures in GHCi

Joachim Breitner mail at joachim-breitner.de
Fri Aug 31 16:10:09 CEST 2012


Hi,

Am Freitag, den 31.08.2012, 13:14 +0100 schrieb Simon Marlow:
> > Note that the GC does evacuate the closures, as the pointers change. Why
> > are these not replaced by the static ones here?
> 
> Probably because GHCi has a dynamically loaded copy of the base package, 
> so the pointer comparisons that the GC is doing do not match the 
> dynamically-loaded I# and C# constructors.

could be; I could not find a way to verify it. I tried comparing the
info pointers of a "1::Int" that I generated in ghci and one that comes
from a statically compiled module loaded into ghci, but that is probably
also linked against GHHi’s dynamically loaded base.

But if it is really the case that the RTS has different copies of base,
wouldn’t code like this then break?

          if (i == &stg_TSO_info
              || i == &stg_WHITEHOLE_info 
              || i == &stg_BLOCKING_QUEUE_CLEAN_info
              || i == &stg_BLOCKING_QUEUE_DIRTY_info) {
              copy(p,info,q,sizeofW(StgInd),gen_no);
              return;
          }
        (http://hackage.haskell.org/trac/ghc/browser/rts/sm/Evac.c#L635)

Or is it, by accident or careful design, the case that all the instances
where the RTS compares info pointers with well known pointers are not
relevant when running in GHCi?

Thanks,
Joachim

-- 
Joachim "nomeata" Breitner
  mail at joachim-breitner.de  |  nomeata at debian.org  |  GPG: 0x4743206C
  xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120831/8fc524e5/attachment.pgp>


More information about the Glasgow-haskell-users mailing list