[GHC] #7307: Share top-level code for strings

GHC ghc-devs at haskell.org
Wed Dec 4 19:27:02 UTC 2013


#7307: Share top-level code for strings
-------------------------------------+------------------------------------
        Reporter:  simonpj           |            Owner:  parcs
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:  7.8.1
       Component:  Compiler          |          Version:  7.6.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by parcs):

 Here's an experimental patch that achieves what's described in the ticket.
 It creates a new closure type, `StgTopUnpack` along with a new info table
 `stg_TOP_UNPACK_info`. All top-level strings are emitted as 4-word thunks
 (all thunks need to have the same closure representation), with the
 address of the static string being stored in the 2nd word.

 Miraculously, the code works. Binary sizes drop a further ~(2-3)% (on top
 of size reduction from #8590) and GHC can still bootstrap itself. But
 there are a few issues that I am having trouble with:

 1. I am not sure what closure flags `TOP_UNPACK` should have.
 2. I do not think entry code for `TOP_UNPACK` is correct. For starters, I
 mixed high-level Cmm (argument lists) with low-level Cmm (use of `Sp`).
 But the whole thing is likely wrong.

 Could somebody take a quick look?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7307#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list