1. 27 Nov, 2019 1 commit
    • Sebastian Graf's avatar
      Make warnings for TH splices opt-in · 5a08f7d4
      Sebastian Graf authored
      In #17270 we have the pattern-match checker emit incorrect warnings. The
      reason for that behavior is ultimately an inconsistency in whether we
      treat TH splices as written by the user (`FromSource :: Origin`) or as
      generated code (`Generated`). This was first reported in #14838.
      The current solution is to TH splices as `Generated` by default and only
      treat them as `FromSource` when the user requests so
      (-fenable-th-splice-warnings). There are multiple reasons for opt-in
      rather than opt-out:
        * It's not clear that the user that compiles a splice is the author of the code
          that produces the warning. Think of the situation where she just splices in
          code from a third-party library that produces incomplete pattern matches.
          In this scenario, the user isn't even able to fix that warning.
        * Gathering information for producing the warnings (pattern-match check
          warnings in particular) is costly. There's no point in doing so if the user
          is not interested in those warnings.
      Fixes #17270, but not #14838, because the proper solution needs a GHC
      proposal extending the TH AST syntax.
  2. 24 Nov, 2019 1 commit
  3. 23 Nov, 2019 1 commit
  4. 17 Nov, 2019 1 commit
  5. 15 Nov, 2019 1 commit
  6. 13 Nov, 2019 1 commit
  7. 10 Nov, 2019 1 commit
  8. 09 Nov, 2019 1 commit
  9. 08 Nov, 2019 1 commit
  10. 07 Nov, 2019 1 commit
    • Ryan Scott's avatar
      Clean up TH's treatment of unary tuples (or, #16881 part two) · 708c60aa
      Ryan Scott authored
      !1906 left some loose ends in regards to Template Haskell's treatment
      of unary tuples. This patch ends to tie up those loose ends:
      * In addition to having `TupleT 1` produce unary tuples, `TupE [exp]`
        and `TupP [pat]` also now produce unary tuples.
      * I have added various special cases in GHC's pretty-printers to
        ensure that explicit 1-tuples are printed using the `Unit` type.
        See `testsuite/tests/th/T17380`.
      * The GHC 8.10.1 release notes entry has been tidied up a little.
      Fixes #16881. Fixes #17371. Fixes #17380.
  11. 05 Nov, 2019 1 commit
    • Takenobu Tani's avatar
      users-guide: Improve documentaion of CPP extension · 7c28087a
      Takenobu Tani authored
      Currently, the description of CPP extension is given in the section of
      command-line options.
      Therefore, it is a little difficult to understand that it is a language
      This commit explicitly adds a description for it.
      [skip ci]
  12. 04 Nov, 2019 2 commits
    • Ben Gamari's avatar
      rts/linker: Ensure that code isn't writable · 120f2e53
      Ben Gamari authored
      For many years the linker would simply map all of its memory with
      PROT_READ|PROT_WRITE|PROT_EXEC. However operating systems have been
      becoming increasingly reluctant to accept this practice (e.g. #17353
      and #12657) and for good reason: writable code is ripe for exploitation.
      Consequently mmapForLinker now maps its memory with
      PROT_READ|PROT_WRITE.  After the linker has finished filling/relocating
      the mapping it must then call mmapForLinkerMarkExecutable on the
      sections of the mapping which contain executable code.
      Moreover, to make all of this possible it was necessary to redesign the
      m32 allocator. First, we gave (in an earlier commit) each ObjectCode its
      own m32_allocator. This was necessary since code loading and symbol
      resolution/relocation are currently interleaved, meaning that it is not
      possible to enforce W^X when symbols from different objects reside in
      the same page.
      We then redesigned the m32 allocator to take advantage of the fact that
      all of the pages allocated with the allocator die at the same time
      (namely, when the owning ObjectCode is unloaded). This makes a number of
      things simpler (e.g. no more page reference counting; the interface
      provided by the allocator for freeing is simpler). See
      Note [M32 Allocator] for details.
    • Leif Metcalf's avatar
      Rephrase note on full-laziness · 5d4f16ee
      Leif Metcalf authored
  13. 02 Nov, 2019 2 commits
  14. 29 Oct, 2019 2 commits
  15. 27 Oct, 2019 3 commits
  16. 26 Oct, 2019 1 commit
    • Roland Senn's avatar
      Fix #14690 - :steplocal panics after break-on-error · 1be9c35c
      Roland Senn authored
      `:steplocal` enables only breakpoints in the current top-level binding.
      When a normal breakpoint is hit, then the module name and the break id from the `BRK_FUN` byte code
      allow us to access the corresponding entry in a ModBreak table. From this entry we then get the SrcSpan
      (see compiler/main/InteractiveEval.hs:bindLocalsAtBreakpoint).
      With this source-span we can then determine the current top-level binding, needed for the steplocal command.
      However, if we break at an exception or at an error, we don't have an BRK_FUN byte-code, so we don't have any source information.
      The function `bindLocalsAtBreakpoint` creates an `UnhelpfulSpan`, which doesn't allow us to determine the current top-level binding.
      To avoid a `panic`, we have to check for `UnhelpfulSpan` in the function `ghc/GHCi/UI.hs:stepLocalCmd`.
      Hence a :steplocal command after a break-on-exception or a break-on-error is not possible.
  17. 23 Oct, 2019 5 commits
    • Ömer Sinan Ağacan's avatar
      Add new flag for unarised STG dumps · 266435a7
      Ömer Sinan Ağacan authored
      Previously -ddump-stg would dump pre and post-unarise STGs. Now we have
      a new flag for post-unarise STG and -ddump-stg only dumps coreToStg
      STG dump flags after this commit:
      - -ddump-stg: Dumps CoreToStg output
      - -ddump-stg-unarised: Unarise output
      - -ddump-stg-final: STG right before code gen (includes CSE and lambda
    • Ben Gamari's avatar
      users-guide: Fix :since: for -Wunused-packages · 4af20bbc
      Ben Gamari authored
      Fixes #17382.
    • Matthew Pickering's avatar
      eventlog: Dump cost centre stack on each sample · 17987a4b
      Matthew Pickering authored
      With this change it is possible to reconstruct the timing portion of a
      `.prof` file after the fact. By logging the stacks at each time point
      a more precise executation trace of the program can be observed rather
      than all identical cost centres being identified in the report.
      There are two new events:
      1. `EVENT_PROF_BEGIN` - emitted at the start of profiling to communicate
      the tick interval
      2. `EVENT_PROF_SAMPLE_COST_CENTRE` - emitted on each tick to communicate the
      current call stack.
      Fixes #17322
    • Alp Mestanogullari's avatar
      compiler: introduce DynFlags plugins · 900cf195
      Alp Mestanogullari authored
      They have type '[CommandLineOpts] -> Maybe (DynFlags -> IO DynFlags)'.
      All plugins that supply a non-Nothing 'dynflagsPlugin' will see their
      updates applied to the current DynFlags right after the plugins are
      One use case for this is to superseede !1580 for registering hooks
      from a plugin. Frontend/parser plugins were considered to achieve this
      but they respectively conflict with how this plugin is going to be used
      and don't allow overriding/modifying the DynFlags, which is how hooks have
      to be registered.
      This commit comes with a test, 'test-hook-plugin', that registers a "fake"
      meta hook that replaces TH expressions with the 0 integer literal.
    • Richard Eisenberg's avatar
      Implement a coverage checker for injectivity · 1cd3fa29
      Richard Eisenberg authored
      This fixes #16512.
      There are lots of parts of this patch:
      * The main payload is in FamInst. See
      Note [Coverage condition for injective type families] there
      for the overview. But it doesn't fix the bug.
      * We now bump the reduction depth every time we discharge
      a CFunEqCan. See Note [Flatten when discharging CFunEqCan]
      in TcInteract.
      * Exploration of this revealed a new, easy to maintain invariant
      for CTyEqCans. See Note [Almost function-free] in TcRnTypes.
      * We also realized that type inference for injectivity was a
      bit incomplete. This means we exchanged lookupFlattenTyVar for
      rewriteTyVar. See Note [rewriteTyVar] in TcFlatten. The new
      function is monadic while the previous one was pure, necessitating
      some faff in TcInteract. Nothing too bad.
      * zonkCt did not maintain invariants on CTyEqCan. It's not worth
      the bother doing so, so we just transmute CTyEqCans to
      * The pure unifier was finding the fixpoint of the returned
      substitution, even when doing one-way matching (in tcUnifyTysWithTFs).
      Fixed now.
      Test cases: typecheck/should_fail/T16512{a,b}
  18. 21 Oct, 2019 1 commit
  19. 20 Oct, 2019 1 commit
  20. 16 Oct, 2019 1 commit
  21. 14 Oct, 2019 1 commit
    • Ryan Scott's avatar
      Mention changes from #16980, #17213 in 8.10.1 release notes · 4aba72d6
      Ryan Scott authored
      The fixes for these issues both have user-facing consequences, so it
      would be good to mention them in the release notes for GHC 8.10.1.
      While I'm in town, also mention `UnboxedSums` in the release notes
      entry related to `-fobject-code`.
  22. 13 Oct, 2019 2 commits
  23. 08 Oct, 2019 8 commits