Skip to content
Snippets Groups Projects
  1. Mar 19, 2024
    • Hannes Siebenhandl's avatar
      Fix sharing of 'IfaceTyConInfo' during core to iface type translation · 73be65ab
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      During heap analysis, we noticed that during generation of
      'mi_extra_decls' we have lots of duplicates for the instances:
      
      * `IfaceTyConInfo NotPromoted IfaceNormalTyCon`
      * `IfaceTyConInfo IsPromoted IfaceNormalTyCon`
      
      which should be shared instead of duplicated. This duplication increased
      the number of live bytes by around 200MB while loading the agda codebase
      into GHCi.
      
      These instances are created during `CoreToIface` translation, in
      particular `toIfaceTyCon`.
      
      The generated core looks like:
      
          toIfaceTyCon
            = \ tc_sjJw ->
                case $wtoIfaceTyCon tc_sjJw of
                { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) ->
                IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM)
                }
      
      whichs removes causes the sharing to work propery.
      
      Adding explicit sharing, with NOINLINE annotations, changes the core to:
      
          toIfaceTyCon
            = \ tc_sjJq ->
                case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) ->
                IfaceTyCon ww_sjNB ww1_sjNC
                }
      
      which looks much more like sharing is happening.
      We confirmed via ghc-debug that all duplications were eliminated and the
      number of live bytes are noticeably reduced.
      73be65ab
  2. Mar 14, 2024
  3. Mar 12, 2024
  4. Mar 11, 2024
  5. Mar 10, 2024
  6. Mar 09, 2024
Loading