[GHC] #5218: Add unpackCStringLen# to create Strings from string literals

GHC ghc-devs at haskell.org
Fri Apr 7 02:43:14 UTC 2017


#5218: Add unpackCStringLen# to create Strings from string literals
-------------------------------------+-------------------------------------
        Reporter:  tibbe             |                Owner:  thoughtpolice
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.0.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #5877 #10064      |  Differential Rev(s):  Phab:D2443
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by winter):

 > Fair enough, but why not just poke a hole in the `ByteArray#`
 abstraction in that case? Namely, provide a `unsafeMkByteArray# :: Addr#
 -> Int -> ByteArray#`.

 > Although, thinking about this for a tad longer it's not necessarily
 clear that this is a direction which we'd want to go. Afterall, it would
 require the introduction of another closure type since the current
 representation requires that the bytes directly follow the closure header.
 I suspect this would introduce quite a bit of complexity in the RTS.

 Yes, that is a more expensive design IMO. I read about the notes on
 unpointed heap object(maybe somewhere in `infoTable.h`), it says that they
 shouldn't be entered. But i fail to understand how can we provide
 `unsafeMkByteArray#` in an obvious way.

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


More information about the ghc-tickets mailing list