Generate straightline code for inline array allocation

Authored by michalt on Mar 30 2019, 12:36 PM.

Description

Generate straightline code for inline array allocation

GHC has an optimization for allocating arrays when the size is
statically known -- it'll generate the code allocating and initializing
the array inline (instead of a call to a procedure from
rts/PrimOps.cmm).

However, the generated code uses a loop to do the initialization. Since
we already check that the requested size is small (we check against
maxInlineAllocSize), we can generate faster straightline code instead.
This brings about 15% improvement for newSmallArray# in my testing and
slightly simplifies the code in GHC.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Details

Committed
Marge Bot <ben+marge-bot@smart-cactus.org>Apr 8 2019, 1:29 PM
Parents
rGHC3a38ea448717: Fix #16282.
Branches
Unknown
Tags
Unknown
Marge Bot <ben+marge-bot@smart-cactus.org> committed rGHC63b7d5fb9d69: Generate straightline code for inline array allocation (authored by michalt).Apr 8 2019, 1:29 PM