Non-updateable thunks

Joachim Breitner breitner at kit.edu
Fri Aug 3 11:29:23 CEST 2012


Hi Simon,

Am Freitag, den 03.08.2012, 09:28 +0100 schrieb Simon Marlow:
> > My question is: Has anybody worked in that direction? And are there any
> > fundamental problems with the current RTS implementation and such
> > closures?
> 
> Long ago GHC used to have an "update analyser" which would detect some 
> thunks that would never be re-entered and omit the update frame on them. 
>   I wrote a paper about this many years ago, and there were other people 
> working on similar ideas, some using types (e.g. linear types) - google 
> for "update avoidance".  As I understand it you want to omit doing some 
> updates in order to avoid space leaks, which is slightly different.

Thanks for the pointers, I will have a look. Why was the update analyser
removed from GHC?

> The StgSyn abstract syntax has an UpdateFlag on each StgRhs which lets 
> you turn off the update, and I believe the code generator will respect 
> it although it isn't actually ever turned off at the moment.

Indeed that works: I added a stg2stg transformation phase that removes
the flag on some thunks (with hard-coded names for now :-)) and the
generated code works as expected. I’m now thinking how I can allow the
programmer to annotate thunks  as non-updateable, and how to carry that
information to the stg phase.

Greetings,
Joachim

-- 
Dipl.-Math. Dipl.-Inform. Joachim Breitner
Wissenschaftlicher Mitarbeiter
http://pp.info.uni-karlsruhe.de/~breitner
-------------- 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/20120803/a71786fc/attachment.pgp>


More information about the Glasgow-haskell-users mailing list