Properly tag fun field of PAPs generated by ap_0_fast
authorÖmer Sinan Ağacan <omeragacan@gmail.com>
Tue, 21 Aug 2018 20:06:29 +0000 (16:06 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 21 Aug 2018 22:56:12 +0000 (18:56 -0400)
commit2693eb11f55f2001701c90c24183e21c794a8be1
tree4dc837aaa892c3b442c1d9693f69139989cf6387
parent68a1fc29b4bb3eae54e4d96c9aec20e700040f34
Properly tag fun field of PAPs generated by ap_0_fast

Currently ap_0_fast doesn't maintain the invariant for PAP fun fields
which says if the closure can be tagged, it should be. This is checked
by `Sanity.c:checkPAP` and correctly implemented by `genautoapply`.

This causes sanity check failures when we have a profiling code like

    f = {-# SCC scc #-} g

where g is a PAP or a FUN, and `scc` is different than the current cost
centre.

Test Plan: Slow validate (not done yet)

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15508

Differential Revision: https://phabricator.haskell.org/D5051
rts/Apply.cmm