base: Make Foreign.Marshal.Alloc.allocBytes[Aligned] NOINLINE
authorBen Gamari <ben@smart-cactus.org>
Tue, 24 Oct 2017 16:19:08 +0000 (12:19 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 30 Jul 2018 21:58:42 +0000 (17:58 -0400)
commit56590db07a776ce81eb89d4a4d86bd0f953fb44e
treec691444111b78ea86bd79ccfec147c6ba2c3e477
parenta698bbfe47c4ae5c93fc54c033072d1bbd7abf17
base: Make Foreign.Marshal.Alloc.allocBytes[Aligned] NOINLINE

As noted in #14346, touch# may be optimized away when the simplifier can see
that the continuation passed to allocaBytes will not return. Marking CPS-style
functions with NOINLINE ensures that the simplier can't draw any unsound
conclusions.

Ultimately the right solution here will be to do away with touch# and instead
introduce a scoped primitive as is suggested in #14375.

Note: This was present in 8.2 but was never merged to 8.4 in hopes that
we would have #14375 implemented in time. This meant that the issue
regressed again in 8.4. Thankfully we caught it in time to fix it for
8.6.

(cherry picked from commit 404bf05ed3193e918875cd2f6c95ae0da5989be2)
libraries/base/Foreign/Marshal/Alloc.hs
testsuite/tests/perf/should_run/all.T