summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2019-11-13 11:20:05 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-23 13:37:01 -0400
commit49301ad6226d9a83d110bee8c419615dd94f5ded (patch)
tree907c00e2c81d1f2025ad569cedf2bc39833bcb07 /docs
parentd830bbc9921bcc59164a0a18f0e0874ae4ce226e (diff)
downloadhaskell-49301ad6226d9a83d110bee8c419615dd94f5ded.tar.gz
Implement cstringLength# and FinalPtr
This function and its accompanying rule resolve issue #5218. A future PR to the bytestring library will make the internal Data.ByteString.Internal.unsafePackAddress compute string length with cstringLength#. This will improve the status quo because it is eligible for constant folding. Additionally, introduce a new data constructor to ForeignPtrContents named FinalPtr. This additional data constructor, when used in the IsString instance for ByteString, leads to more Core-to-Core optimization opportunities, fewer runtime allocations, and smaller binaries. Also, this commit re-exports all the functions from GHC.CString (including cstringLength#) in GHC.Exts. It also adds a new test driver. This test driver is used to perform substring matches on Core that is dumped after all the simplifier passes. In this commit, it is used to check that constant folding of cstringLength# works.
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/8.12.1-notes.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/users_guide/8.12.1-notes.rst b/docs/users_guide/8.12.1-notes.rst
index b98b1f283b..dc666f8064 100644
--- a/docs/users_guide/8.12.1-notes.rst
+++ b/docs/users_guide/8.12.1-notes.rst
@@ -144,6 +144,9 @@ Arrow notation
``ghc-prim`` library
~~~~~~~~~~~~~~~~~~~~
+- Add a known-key ``cstringLength#`` to ``GHC.CString`` that is eligible
+ for constant folding by a built-in rule.
+
``ghc`` library
~~~~~~~~~~~~~~~
@@ -181,6 +184,15 @@ Arrow notation
``base`` library
~~~~~~~~~~~~~~~~
+- ``ForeignPtrContents`` has a new nullary data constructor ``FinalPtr``.
+ ``FinalPtr`` is intended for turning a primitive string literal into a
+ ``ForeignPtr``. Unlike ``PlainForeignPtr``, ``FinalPtr`` does not have
+ a finalizer. Replacing ``PlainForeignPtr`` that has ``NoFinalizers`` with
+ ``FinalPtr`` reduces allocations, reduces the size of compiled binaries,
+ and unlocks important Core-to-Core optimizations. ``FinalPtr`` will be used
+ in an upcoming ``bytestring`` release to improve the performance of
+ ``ByteString`` literals created with ``OverloadedStrings``.
+
Build system
~~~~~~~~~~~~