Loopification jump between stack and heap checks
authorJan Stolarek <jan.stolarek@p.lodz.pl>
Sat, 1 Feb 2014 10:32:25 +0000 (11:32 +0100)
committerJan Stolarek <jan.stolarek@p.lodz.pl>
Sat, 1 Feb 2014 13:37:09 +0000 (14:37 +0100)
commitea584ab634b17b499138bc44dbec777de7357c19
treeaf63e9004cd5219febd48e7e7ec70b5c9e2180ce
parenta2269bf81c8e95ad9a1bc3c32e425fdba7c3686a
Loopification jump between stack and heap checks

Fixes #8585

When emmiting label of a self-recursive tail call (ie. when
performing loopification optimization) we emit the loop header
label after a stack check but before the heap check. The reason is
that tail-recursive functions use constant amount of stack space
so we don't need to repeat the check in every loop. But they can
grow the heap so heap check must be repeated in every call.
See Note [Self-recursive tail calls] and [Self-recursive loop header].
compiler/codeGen/StgCmmBind.hs
compiler/codeGen/StgCmmExpr.hs
compiler/codeGen/StgCmmHeap.hs