[commit: ghc] master: Generalize CmmUnwind and pass unwind information through NCG (3eb737e)

git at git.haskell.org git at git.haskell.org
Wed Feb 8 15:26:19 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3eb737ee3f900f256a7474b199a4ab40178a8cac/ghc

>---------------------------------------------------------------

commit 3eb737ee3f900f256a7474b199a4ab40178a8cac
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Feb 7 22:49:06 2017 -0500

    Generalize CmmUnwind and pass unwind information through NCG
    
    As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack
    unwinding information produced by GHC is currently quite approximate.
    Essentially we assume that register values do not change at all within a
    basic block. While this is somewhat true in normal Haskell code, blocks
    containing foreign calls often break this assumption. This results in
    unreliable call stacks, especially in the code containing foreign calls.
    This is worse than it sounds as unreliable unwinding information can at
    times result in segmentation faults.
    
    This patch set attempts to improve this situation by tracking unwinding
    information with finer granularity. By dispensing with the assumption of
    one unwinding table per block, we allow the compiler to accurately
    represent the areas surrounding foreign calls.
    
    Towards this end we generalize the representation of unwind information
    in the backend in three ways,
    
     * Multiple CmmUnwind nodes can occur per block
    
     * CmmUnwind nodes can now carry unwind information for multiple
       registers (while not strictly necessary; this makes emitting
       unwinding information a bit more convenient in the compiler)
    
     * The NCG backend is given an opportunity to modify the unwinding
       records since it may need to make adjustments due to, for instance,
       native calling convention requirements for foreign calls (see
       #11353).
    
    This sets the stage for resolving #11337 and #11338.
    
    Test Plan: Validate
    
    Reviewers: scpmw, simonmar, austin, erikd
    
    Subscribers: qnikst, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2741


>---------------------------------------------------------------

3eb737ee3f900f256a7474b199a4ab40178a8cac
 compiler/cmm/CmmLayoutStack.hs                  |  32 ++--
 compiler/cmm/CmmNode.hs                         |  10 +-
 compiler/cmm/CmmParse.y                         |  11 +-
 compiler/cmm/Debug.hs                           | 222 +++++++++++++++++++-----
 compiler/cmm/MkGraph.hs                         |   3 +
 compiler/cmm/PprCmm.hs                          |   4 +-
 compiler/codeGen/CgUtils.hs                     |  16 +-
 compiler/codeGen/StgCmmMonad.hs                 |   8 +-
 compiler/codeGen/StgCmmUtils.hs                 |   2 +-
 compiler/nativeGen/AsmCodeGen.hs                |  96 +++++++++-
 compiler/nativeGen/Dwarf.hs                     |  43 +++--
 compiler/nativeGen/Dwarf/Types.hs               |  60 ++++---
 compiler/nativeGen/NCGMonad.hs                  |   1 -
 compiler/nativeGen/X86/CodeGen.hs               |  39 ++++-
 compiler/nativeGen/X86/Instr.hs                 |  14 +-
 compiler/nativeGen/X86/Ppr.hs                   |  14 +-
 rts/StgStartup.cmm                              |   4 +-
 testsuite/tests/regalloc/regalloc_unit_tests.hs |   2 +-
 18 files changed, 450 insertions(+), 131 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3eb737ee3f900f256a7474b199a4ab40178a8cac


More information about the ghc-commits mailing list