Skip to content
  • Simon Marlow's avatar
    Tag the FUN before making a PAP (#13767) · f9c6d53f
    Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
    Pointers to FUNs are not guaranteed to be tagged in general, because
    the compiler doesn't always know the arity of a FUN when it needs to
    reference it, e.g. with -O0 when the function is in another module.
    
    However, there's one case where we can put the correct tag on a FUN:
    when it is referenced by a PAP, because when building the PAP we know
    the arity and we can tag the pointer correctly.  The AutoApply code
    does this, and the sanity checker checks it, but the interpreter did
    not respect this invariant.  This patch fixes it.
    
    Test Plan:
    ```
    (cd ghc && make 2 GhcDebugged=YES)
    ./inplace/bin/ghc-stage2 --interpreter +RTS -DS
    ```
    
    Reviewers: niteria, bgamari, austin, erikd
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13767
    
    Differential Revision: https://phabricator.haskell.org/D3680
    f9c6d53f