Permalink
Switch branches/tags
Commits on Dec 17, 2014
  1. Update Haddock submodule

    hvr committed Dec 17, 2014
    This pulls in the fix for the broken `@since`-rendering
  2. Generate DWARF unwind information

    scpmw authored and thoughtpolice committed Dec 10, 2014
    This tells debuggers such as GDB how to "unwind" a program state,
    which allows them to walk the stack up.
    
    Notes:
    
    * The code is quite general, perhaps unnecessarily so. Unless we get
      more unwind information, only the first case of pprSetUnwind will
      get used - and pprUnwindExpr and pprUndefUnwind will never be
      called. It just so happens that this is a point where we can get a
      lot of features cheaply, even if we don't use them.
    
    * When determining what location to show for a return address, most
      debuggers check the map for "rip-1", assuming that's where the
      "call" instruction is. For tables-next-to-code, that happens to
      always be the end of an info table. We therefore cheat a bit here by
      shifting .debug_frame information so it covers the end of the info
      table, as well as generating a .loc directive for the info table
      data.
    
      Debuggers will still show the wrong label for the return address,
      though.  Haven't found a way around that one yet.
    
    (From Phabricator D396)
  3. Generate DWARF info section

    scpmw authored and thoughtpolice committed Dec 9, 2014
    This is where we actually make GHC emit DWARF code. The info section
    contains all the general meta information bits as well as an entry for
    every block of native code.
    
    Notes:
    
    * We need quite a few new labels in order to properly address starts
      and ends of blocks.
    
    * Thanks to Nathan Howell for taking the iniative to get our own Haskell
      language ID for DWARF!
    
    (From Phabricator D396)
  4. Generate .loc/.file directives from source ticks

    scpmw authored and thoughtpolice committed Dec 8, 2014
    This generates DWARF, albeit indirectly using the assembler. This is
    the easiest (and, apparently, quite standard) method of generating the
    .debug_line DWARF section.
    
    Notes:
    
    * Note we have to make sure that .file directives appear correctly
      before the respective .loc. Right now we ppr them manually, which makes
      them absent from dumps. Fixing this would require .file to become a
      native instruction.
    
    * We have to pass a lot of things around the native code generator. I
      know Ian did quite a bit of refactoring already, but having one common
      monad could *really* simplify things here...
    
    * To support SplitObjcs, we need to emit/reset all DWARF data at every
      split. We use the occassion to move split marker generation to
      cmmNativeGenStream as well, so debug data extraction doesn't have to
      choke on it.
    
    (From Phabricator D396)
Commits on Dec 16, 2014
  1. Parser: use 'error' token in error reporting rules

    trofi committed Dec 16, 2014
    Summary:
    It exempts us from 11 reduce/reduce conflicts and
    12 shift/reduce conflicts.
    
    Signed-off-by: Sergei Trofimovich <siarheit@google.com>
    
    Reviewers: simonpj, mikeizbicki, austin, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: carter, thomie
    
    Differential Revision: https://phabricator.haskell.org/D571
  2. Debug test case and test suite way

    scpmw authored and thoughtpolice committed Dec 7, 2014
    Adds a test way for debug (-g -dannot-lint) as well as a test covering
    basic source tick functionality.
    
    The debug way fails for a number of test cases because of annotation
    linting: Tracing simplification (e.g. rule firings) will see
    duplicated output, and sometimes expression matching might take so
    long that the test case timeouts. We blacklist these tests.
    
    (From Phabricator D169)
  3. Debug data extraction (NCG support)

    scpmw authored and thoughtpolice committed Nov 28, 2014
    The purpose of the Debug module is to collect all required information
    to generate debug information (DWARF etc.) in the back-ends. Our main
    data structure is the "debug block", which carries all information we have
    about a block of code that is going to get produced.
    
    Notes:
    
    * Debug blocks are arranged into a tree according to tick scopes. This
      makes it easier to reason about inheritance rules. Note however that
      tick scopes are not guaranteed to form a tree, which requires us to
      "copy" ticks to not lose them.
    
    * This is also where we decide what source location we regard as
      representing a code block the "best". The heuristic is basically that
      we want the most specific source reference that comes from the same file
      we are currently compiling. This seems to be the most useful choice in
      my experience.
    
    * We are careful to not be too lazy so we don't end up breaking streaming.
      Debug data will be kept alive until the end of codegen, after all.
    
    * We change native assembler dumps to happen right away for every Cmm group.
      This simplifies the code somewhat and is consistent with how pretty much
      all of GHC handles dumps with respect to streamed code.
    
    (From Phabricator D169)
  4. Add unwind information to Cmm

    scpmw authored and thoughtpolice committed Oct 13, 2014
    Unwind information allows the debugger to discover more information
    about a program state, by allowing it to "reconstruct" other states of
    the program. In practice, this means that we explain to the debugger
    how to unravel stack frames, which comes down mostly to explaining how
    to find their Sp and Ip register values.
    
    * We declare yet another new constructor for CmmNode - and this time
      there's actually little choice, as unwind information can and will
      change mid-block. We don't actually make use of these capabilities,
      and back-end support would be tricky (generate new labels?), but it
      feels like the right way to do it.
    
    * Even though we only use it for Sp so far, we allow CmmUnwind to specify
      unwind information for any register. This is pretty cheap and could
      come in useful in future.
    
    * We allow full CmmExpr expressions for specifying unwind values. The
      advantage here is that we don't have to make up new syntax, and can e.g.
      use the WDS macro directly. On the other hand, the back-end will now
      have to simplify the expression until it can sensibly be converted
      into DWARF byte code - a process which might fail, yielding NCG panics.
      On the other hand, when you're writing Cmm by hand you really ought to
      know what you're doing.
    
    (From Phabricator D169)
  5. Tick scopes

    scpmw authored and thoughtpolice committed Dec 6, 2014
    This patch solves the scoping problem of CmmTick nodes: If we just put
    CmmTicks into blocks we have no idea what exactly they are meant to
    cover.  Here we introduce tick scopes, which allow us to create
    sub-scopes and merged scopes easily.
    
    Notes:
    
    * Given that the code often passes Cmm around "head-less", we have to
      make sure that its intended scope does not get lost. To keep the amount
      of passing-around to a minimum we define a CmmAGraphScoped type synonym
      here that just bundles the scope with a portion of Cmm to be assembled
      later.
    
    * We introduce new scopes at somewhat random places, aligning with
      getCode calls. This works surprisingly well, but we might have to
      add new scopes into the mix later on if we find things too be too
      coarse-grained.
    
    (From Phabricator D169)
  6. Source notes (Cmm support)

    scpmw authored and thoughtpolice committed Oct 14, 2014
    This patch adds CmmTick nodes to Cmm code. This is relatively
    straight-forward, but also not very useful, as many blocks will simply
    end up with no annotations whatosever.
    
    Notes:
    
    * We use this design over, say, putting ticks into the entry node of all
      blocks, as it seems to work better alongside existing optimisations.
      Now granted, the reason for this is that currently GHC's main Cmm
      optimisations seem to mainly reorganize and merge code, so this might
      change in the future.
    
    * We have the Cmm parser generate a few source notes as well. This is
      relatively easy to do - worst part is that it complicates the CmmParse
      implementation a bit.
    
    (From Phabricator D169)
  7. Strip source ticks from iface code if DWARF is disabled

    scpmw authored and thoughtpolice committed Oct 22, 2013
    They would be unneeded at minimum. Not completely sure this is the right
    place to do this.
    
    (From Phabricator D169)
  8. Source notes (CorePrep and Stg support)

    scpmw authored and thoughtpolice committed Jan 14, 2014
    This is basically just about continuing maintaining source notes after
    the Core stage. Unfortunately, this is more involved as it might seem,
    as there are more restrictions on where ticks are allowed to show up.
    
    Notes:
    
    * We replace the StgTick / StgSCC constructors with a unified StgTick
      that can carry any tickish.
    
    * For handling constructor or lambda applications, we generally float
      ticks out.
    
    * Note that thanks to the NonLam placement, we know that source notes
      can never appear on lambdas. This means that as long as we are
      careful to always use mkTick, we will never violate CorePrep
      invariants.
    
    * This is however not automatically true for eta expansion, which
      needs to somewhat awkwardly strip, then re-tick the expression in
      question.
    
    * Where CorePrep floats out lets, we make sure to wrap them in the
      same spirit as FloatOut.
    
    * Detecting selector thunks becomes a bit more involved, as we can run
      into ticks at multiple points.
    
    (From Phabricator D169)
  9. Annotation linting

    scpmw authored and thoughtpolice committed Oct 13, 2014
    This adds a way by which we can make sure that the Core passes treat
    annotations right: We run them twice and compare the results.
    
    The main problem here is that Core equivalence is awkward: We do not
    want the comparison to care about the order of, say, top-level or
    recursive bindings. This is important even if GHC generally generates
    the bindings in the right order - after all, if something goes wrong
    we don't want linting to dump out the whole program as the offense.
    
    So instead we do some heuristic matching - first greedily match
    everything that's easy, then match the rest by label order. This
    should work as long as GHC generates the labels in roughly the same
    order for both pass runs.  In practice it seems to work alright.
    
    We also check that IdInfos match, as this might cause hard-to-spot
    bugs down the line (I had at least one bug because unfolding guidance
    didn't match!). We especially check unfoldings up until the point
    where it might get us into an infinite loop.
    
    (From Phabricator D169)
  10. Generalized Coverage pass to allow adding multiple types of Tickishs

    scpmw authored and thoughtpolice committed Jan 9, 2014
    This allows having, say, HPC ticks, automatic cost centres and source
    notes active at the same time. We especially take care to un-tangle the
    infrastructure involved in generating them.
    
    (From Phabricator D169)
  11. Source notes (Core support)

    scpmw authored and thoughtpolice committed Dec 1, 2014
    This patch introduces "SourceNote" tickishs that link Core to the
    source code that generated it. The idea is to retain these source code
    links throughout code transformations so we can eventually relate
    object code all the way back to the original source (which we can,
    say, encode as DWARF information to allow debugging).  We generate
    these SourceNotes like other tickshs in the desugaring phase. The
    activating command line flag is "-g", consistent with the flag other
    compilers use to decide DWARF generation.
    
    Keeping ticks from getting into the way of Core transformations is
    tricky, but doable. The changes in this patch produce identical Core
    in all cases I tested -- which at this point is GHC, all libraries and
    nofib. Also note that this pass creates *lots* of tick nodes, which we
    reduce somewhat by removing duplicated and overlapping source
    ticks. This will still cause significant Tick "clumps" - a possible
    future optimization could be to make Tick carry a list of Tickishs
    instead of one at a time.
    
    (From Phabricator D169)
  12. Convert `/Since: .../` to new `@since ...` syntax

    hvr committed Dec 16, 2014
    Starting with Haddock 2.16 there's a new built-in support for since-annotations
    
    Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
  13. Use llvm-3.5 on Travis

    nomeata committed Dec 16, 2014
    to avoid a build failure with T5681(optllvm). According to Ben Gamari,
    llvm-3.4 is known to be not working with GHC HEAD.
  14. *Really* Re-Update Haddock submodule

    hvr committed Dec 16, 2014
    The actual gitlink update got lost in 0c9c2d8
  15. Typo in feature description

    ggreif committed Dec 16, 2014
Commits on Dec 15, 2014
  1. comments

    simonmar committed Dec 13, 2013
  2. Fix comments (#8254)

    simonmar committed Oct 1, 2013
  3. stm: Update submodule (again) to fix build breakage

    thoughtpolice committed Dec 15, 2014
    Signed-off-by: Austin Seipp <austin@well-typed.com>
  4. Improve documentation of syntax for promoted lists

    simonpj committed Dec 15, 2014
    THe documentation in 7.9.4 of promoted list and tuple types was
    misleading, which led to Trac #9882.  This patch makes explicit
    that only type-level with two or more elements can have the
    quote omitted.
  5. Fix dll-split problem with patch 'Make Core Lint check for locally-bo…

    simonpj committed Dec 15, 2014
    …und GlobalId'
    
    The trouble was that my changes made a lot more files transitively link with
    DynFlags, which is the root module for the revolting Windows dll-split stuff.
    
    Anyway this patch fixes it, in a good way:
    
     - Make GHC/Hooks *not* import DsMonad, because DsMonad imports too
       much other stuff (notably tcLookup variants).  Really, Hooks depends
       only on *types* not *code*.
    
     - To do this I need the DsM type, and the types it depends on,
       not to be part of DsMonad.  So I moved it to TcRnTypes, which is
       where the similar pieces for the TcM and IfM monads live.
    
     - We can then delete DsMonad.hs-boot
    
     - There are a bunch of knock-on change, of no great significance
  6. Fix panic on [t| _ |] (Trac #9879)

    mrBliss authored and thoughtpolice committed Dec 15, 2014
    Summary:
    Type brackets containing a wildcard, e.g. `[t| _ |]`, caused a panic.
    Fix it by disallowing wildcards in type brackets.
    
    Together with D572, this fixes #9879.
    
    Test Plan: new test WildcardInTypeBrackets should pass
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: carter, thomie, monoidal
    
    Differential Revision: https://phabricator.haskell.org/D573
    
    GHC Trac Issues: #9879
  7. Write release notes for -XStaticPointers.

    facundominguez authored and thoughtpolice committed Dec 15, 2014
    Test Plan: ./validate
    
    Reviewers: goldfire, austin
    
    Reviewed By: austin
    
    Subscribers: mboes, carter, thomie
    
    Differential Revision: https://phabricator.haskell.org/D568
    
    GHC Trac Issues: #7015
  8. Changing prefetch primops to have a `seq`-like interface

    cartazio authored and thoughtpolice committed Dec 15, 2014
    Summary:
    The current primops for prefetching do not properly work in pure code;
    namely, the primops are not 'hoisted' into the correct call sites based
    on when arguments are evaluated. Instead, they should use a `seq`-like
    interface, which will cause it to be evaluated when the needed term is.
    
    See #9353 for the full discussion.
    
    Test Plan: updated tests for pure prefetch in T8256 to reflect the design changes in #9353
    
    Reviewers: simonmar, hvr, ekmett, austin
    
    Reviewed By: ekmett, austin
    
    Subscribers: merijn, thomie, carter, simonmar
    
    Differential Revision: https://phabricator.haskell.org/D350
    
    GHC Trac Issues: #9353