1. 16 Feb, 2017 3 commits
    • Simon Peyton Jones's avatar
      Use the correct origin in SectionL and Section R · b8c29bc9
      Simon Peyton Jones authored
      This fixes Trac #13285.
      The CallStack stuff is all driven by a CtOrigin of (OccurenceOf f),
      and we were instead using SectionOrigin.  Boo!
      Easily fixed; and I did a little refactoring as usual.
    • Simon Peyton Jones's avatar
      Improve checking of joins in Core Lint · 6bab649b
      Simon Peyton Jones authored
      This patch addresses the rather expensive treatment of join points,
      identified in Trac #13220 comment:17
      Before we were tracking the "bad joins".  Now we track the good ones.
      That is easier to think about, and much more efficient; see CoreLint
      Note [Join points].
      On the way I did some other modest refactoring, among other things
      removing a duplicated call of lintIdBndr for let-bindings.
      On teh
    • Simon Peyton Jones's avatar
      Comments and tiny refactor only · fc9d152b
      Simon Peyton Jones authored
  2. 15 Feb, 2017 1 commit
  3. 14 Feb, 2017 12 commits
    • Edward Z. Yang's avatar
      Don't warn about missing methods for instances in signatures. · 93e65c8a
      Edward Z. Yang authored
      Test Plan: validate
      Reviewers: bgamari, austin, dfeuer
      Reviewed By: dfeuer
      Subscribers: dfeuer, thomie
      Differential Revision: https://phabricator.haskell.org/D3134
    • rwbarton's avatar
      Make deSugarExpr use runTcInteractive · f90e61ad
      rwbarton authored
      Preparation for #13102, which needs to add more logic to
      runTcInteractive, which would need to be duplicated in deSugarExpr.
      In order to break an import cycle, I had to move
      "Dependency/fingerprinting code" to a new module
      DsUsage; which seems sensible anyways.
      Test Plan: validate
      Reviewers: simonpj, austin, bgamari
      Reviewed By: bgamari
      Subscribers: thomie, snowleopard
      Differential Revision: https://phabricator.haskell.org/D3125
    • rwbarton's avatar
      Check local type family instances against all imported ones · bedcb716
      rwbarton authored
      We previously checked type family instance declarations
      in a module for consistency with all instances that we happened
      to have read into the EPS or HPT. It was possible to arrange that
      an imported type family instance (used by an imported function)
      was in a module whose interface file was never read during
      compilation; then we wouldn't check consistency of local instances
      with this imported instance and as a result type safety was lost.
      With this patch, we still check consistency of local type family
      instances with all type family instances that we have loaded; but
      we make sure to load the interface files of all our imports that
      define family instances first. More selective consistency checking
      is left to #13102.
      On the other hand, we can now safely assume when we import a module
      that it has been checked for consistency with its imports. So we
      can save checking in checkFamInstConsistency, and overall we should
      have less work to do now.
      This patch also adds a note describing the Plan for ensuring type
      family consistency.
      Test Plan: Two new tests added; harbormaster
      Reviewers: austin, simonpj, bgamari
      Reviewed By: simonpj, bgamari
      Subscribers: ggreif, thomie
      Differential Revision: https://phabricator.haskell.org/D2992
    • Matthew Pickering's avatar
      Update .mailmap [skip ci] · 392cec4d
      Matthew Pickering authored
    • Adam Gundry's avatar
      Implement HasField constraint solving and modify OverloadedLabels · da493897
      Adam Gundry authored
      This implements automatic constraint solving for the new HasField class
      and modifies the existing OverloadedLabels extension, as described in
      the GHC proposal
      (https://github.com/ghc-proposals/ghc-proposals/pull/6). Per the current
      form of the proposal, it does *not* currently introduce a separate
      `OverloadedRecordFields` extension.
      This replaces D1687.
      The users guide documentation still needs to be written, but I'll do
      that after the implementation is merged, in case there are further
      design changes.
      Test Plan: new and modified tests in overloadedrecflds
      Reviewers: simonpj, goldfire, dfeuer, bgamari, austin, hvr
      Reviewed By: bgamari
      Subscribers: maninalift, dfeuer, ysangkok, thomie, mpickering
      Differential Revision: https://phabricator.haskell.org/D2708
    • vivid-synth's avatar
      Allow type defaulting for multi-param type classes with ExtendedDefaultRules · c3bbd1af
      vivid-synth authored
      Expressions like the following will now typecheck:
          data A x = A deriving Show
          class ToA a x where
             toA :: a -> A x
          instance ToA Integer x where
             toA _ = A
          main = print (toA 5 :: A Bool)
      The new defaulting rules are
      Find all the unsolved constraints. Then:
      * Find those that have exactly one free type variable, and partition
        that subset into groups that share a common type variable `a`.
      * Now default `a` (to one of the types in the default list) if at least
        one of the classes `Ci` is an interactive class
      Reviewers: goldfire, bgamari, austin, mpickering, simonpj
      Reviewed By: bgamari, simonpj
      Subscribers: mpickering, simonpj, goldfire, thomie
      Differential Revision: https://phabricator.haskell.org/D2822
    • Tamar Christina's avatar
      Fix ExtraSymbols jump table on Windows. · 2f1017b9
      Tamar Christina authored
      This corrects the `jump islands` calculations for Windows.  The code was
      incorrectly creating a new entry for every `usage` of a symbol instead
      of every used symbol. e.g. if a symbol is used 5 times it used to create
      5 jump islands. This is incorrect and not in line with what the `ELF`
      and `Mach-O` linkers do. Also since we allocate `n` spaces where `n` is
      number of symbols, we would quickly run out of space and abort.
      Test Plan: ./validate
      Reviewers: simonmar, hvr, erikd, bgamari, austin
      Reviewed By: bgamari
      Subscribers: thomie, #ghc_windows_task_force
      Differential Revision: https://phabricator.haskell.org/D3026
    • Tamar Christina's avatar
      Expand list of always loaded Windows shared libs · 04f67c99
      Tamar Christina authored
      When the `GCC` driver envokes the pipeline a `SPEC` is used to determine
      how to configure the compiler and which libraries to pass along.
      For Windows/mingw, this specfile is
      This expands the list of base DLLs with the ones that GCC always links,
      and adds extra sibling dlls of `stdc++` in case it is linked in.
      Following D3028 this patch only needs to load the always load only the
      top level individual shared libs.
      Test Plan: ./validate
      Reviewers: RyanGlScott, austin, bgamari, erikd, simonmar
      Reviewed By: bgamari
      Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
      Differential Revision: https://phabricator.haskell.org/D3029
    • Adam Gundry's avatar
      Refactor renaming of operators/sections to fix DuplicateRecordFields bugs · 2484d4da
      Adam Gundry authored
      A variety of panics were possible because the get_op function in
      RnTypes didn't handle the possibility that its argument might be an
      ambiguous record field. I've made its return type more informative to
      correctly handle occurrences of record fields.  Fixes Trac #13132.
      Test Plan: new test
      Reviewers: bgamari, simonpj, austin
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3126
    • Ben Gamari's avatar
      TcUnify: Assert precondition of matchExpectedTyConApp · 6626242b
      Ben Gamari authored
      Test Plan: Validate
      Reviewers: simonpj, austin
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3128
    • Siddharth's avatar
      Typecast covers entire expression to fix format warning. · 60c49861
      Siddharth authored
      - Fixes (#12636).
      - changes all the typecasts to _unsinged long long_ to
        have the format specifiers work.
      Reviewers: austin, bgamari, erikd, simonmar, Phyx
      Reviewed By: erikd, Phyx
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3129
    • Ben Gamari's avatar
      Debug: Use local symbols for unwind points (#13278) · 2d6e91ea
      Ben Gamari authored
      While this apparently didn't matter on Linux, the OS X toolchain seems
      to treat local and external symbols differently during linking. Namely,
      the linker assumes that an external symbol marks the beginning of a new,
      unused procedure, and consequently drops it.
      Fixes regression introduced in D2741.
      Test Plan: `debug` testcase on OS X
      Reviewers: austin, simonmar, rwbarton
      Reviewed By: rwbarton
      Subscribers: rwbarton, thomie
      Differential Revision: https://phabricator.haskell.org/D3135
  4. 13 Feb, 2017 6 commits
  5. 12 Feb, 2017 15 commits
    • Ben Gamari's avatar
      Bump hoopl submodule to · e46a2e16
      Ben Gamari authored
    • alexbiehl's avatar
      Binary: Correct endian issue when cross-compiling · d3ea38ef
      alexbiehl authored
      Using `WORDS_BIGENDIAN` wasn't such a great idea after all!
      When cross compiling host and target endianess may differ and
      `WORDS_BIGENDIAN` refers to host endianess.
      Reviewers: austin, bgamari, trofi
      Reviewed By: bgamari, trofi
      Subscribers: rwbarton, trofi, thomie
      Differential Revision: https://phabricator.haskell.org/D3122
    • olsner's avatar
      Apply SplitSections to all C compilations · a50082c1
      olsner authored
      Previously this was added only to the RTS's C files (those are the bulk
      of it though), but there are C bits in ghc-prim, integer-gmp and base
      Followup for #8405, allows the large table of character properties in
      base to be stripped when not used.
      Test Plan: validate
      Reviewers: austin, bgamari, simonmar
      Reviewed By: bgamari
      Subscribers: thomie, snowleopard
      Differential Revision: https://phabricator.haskell.org/D3121
    • Niklas Hambüchen's avatar
      bufWrite: Save extra syscall when data fills handle buffer completely. · 6b4e46a1
      Niklas Hambüchen authored
      The bug is that the check `if (size - w > count)` should be
      `if (size - w >= count)` instead (`>=` instead of `>`),
      because we can do the write all fine if it fits exactly.
      This allows us to do 1 instead of 2 write syscalls the case it fits.
      An example of when this matters is when an application writes output
      in chunks that are a fraction of the handle buffer size.
      For example, assume the buffer size is 8 KB, and the application writes
      four 2 KB chunks.
      Until now, this would result in 3 copies to the handle buffer, but
      the 4th one would not be allowed in by `size - w > count`
      (because `size - w == count` is the case), so we'd end up with a write
      syscall of only 6 KB data instead of 8 KB, thus creating more syscalls
      Implementing this fix (switching to `size - w >= count`), we also have
      to flush the buffer if we fill it completely.
      If we made only the changes described so far, that would have the
      unintended side effect that writes of the size equal to the handle
      buffer size (`count == size`) suddenly also go to the handle buffer
      first: The data would first be copied to the handle buffer, and then
      immediately get flushed to the underlying FD.  We don't want that extra
      `memcpy`, because it'd be unnecessary: The point of handle buffering is
      to coalesce smaller writes, and there are no smaller writes in this
      case.  For example, if you specify 8 KB buffers (which menas you want
      your data to be written out in 8 KB blocks), and you get data that's
      already 8 KB in size, you can write that out as an 8 KB straight away,
      zero-copy fashion.  For this reason, adding to the handle buffer now got
      an additional condition `count < size`.  That way, writes equal to the
      buffer size go straight to the FD, as they did before this commit.
      Reviewers: simonmar, austin, hvr, bgamari
      Reviewed By: simonmar
      Subscribers: mpickering, thomie
      Differential Revision: https://phabricator.haskell.org/D3117
    • Niklas Hambüchen's avatar
      Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) · 805db965
      Niklas Hambüchen authored
      Until now, any `hPutBuf` that wrote `>= the handle buffer size` would
      trigger an unnecessary `write("")` system call before the actual write
      system call.
      This is fixed by making sure that we never flush an empty handle buffer:
      Only flush `when (w > 0)`.
      Reviewers: simonmar, austin, hvr, bgamari
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3119
    • Niklas Hambüchen's avatar
      Fix: Default FD buffer size is not a power of 2 (#13245) · 4e2e9b73
      Niklas Hambüchen authored
      Reviewers: simonmar, austin, hvr, bgamari
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3115
    • David Feuer's avatar
      Avoid repeated list elem checks · 7938ef23
      David Feuer authored
      Convert a list to a set before testing membership multiple times.
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      Differential Revision: https://phabricator.haskell.org/D3111
    • alexbiehl's avatar
      Binary: Only allocate un-interned FastStrings · 64da671a
      alexbiehl authored
      Test Plan: Validate
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3109
    • Christiaan Baaij's avatar
      zonkCt tries to maintain the canonical form of a Ct. · 07292e95
      Christiaan Baaij authored
      For example,
       - a CDictCan should stay a CDictCan;
       - a CTyEqCan should stay a CTyEqCan (if the LHS stays as a variable.).
       - a CHoleCan should stay a CHoleCan
      Why?  For CDicteqCan see Trac #11525.
      Test Plan: Validate
      Reviewers: austin, adamgundry, simonpj, goldfire, bgamari
      Reviewed By: simonpj, bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3105
    • Ben Gamari's avatar
      rts/Profiling: Factor out report generation · 56c9bb39
      Ben Gamari authored
      Here we move the actual report generation logic to
      `rts/ProfilerReport.c`. This break is actually quite clean,
          void writeCCSReport( FILE *prof_file, CostCentreStack const *ccs,
                               ProfilerTotals totals );
      This is more profiler refactoring in preparation for machine-readable
      Test Plan: Validate
      Reviewers: austin, erikd, simonmar
      Reviewed By: simonmar
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3097
    • Ben Gamari's avatar
      rts/Profiling: Kill a few globals and add consts · 1a14d384
      Ben Gamari authored
      Previously it was quite difficult to follow the dataflow through this
      file due to global mutation and rather non-descriptive types.
      This is a cleanup in preparation for factoring out the report-generating
      logic, which is itself in preparation for somedayteaching the profiler
      to produce more machine-readable reports (JSON perhaps?).
      Test Plan: Validate
      Reviewers: austin, erikd, simonmar
      Reviewed By: simonmar
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3096
    • Edward Z. Yang's avatar
      Fix #13214 by correctly setting up dep_orphs for signatures. · 26eaa7ec
      Edward Z. Yang authored
      Prior to this, I hadn't thought about orphan handling at all.
      This commit implements the semantics that if a signature
      (transitively) imports an orphan instance, that instance
      is considered in scope no matter what the implementing module
      is.  (As it turns out, this is the semantics that falls out
      when orphans are recorded transitively.)
      This patch fixes a few bugs:
      1. Put semantic modules in dep_orphs rather than identity
      2. Don't put the implementing module in dep_orphs when
         merging signatures (this is a silly bug that happened
         because we were reusing calculateAvails, which is
         designed for imports. It mostly works for signature
         merging, except this case.)
      3. When renaming a signature, blast in the orphans of the
         implementing module inside Dependencies.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      Test Plan: validate
      Reviewers: bgamari, austin
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3095
    • Joachim Breitner's avatar
      Improve the Occurrence Analyzer’s handling of one-shot functions · a1980ecb
      Joachim Breitner authored
      When determining whether an expression is used saturatedly, count the
      number of value arguments that the occurrence analyser sees, and add
      the number of one-shot arguments that we know (from the strictness
      analyser) are passed from the context.
      perf results suggest no noticable change in allocations, reduction of
      code sizes, and performance regression possibliy due to loss of join
      Test Plan: perf.haskell.org
      Reviewers: simonpj, austin, bgamari
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3089
    • rwbarton's avatar
      Mark orphan instances and rules in --show-iface output · 17b1e0ba
      rwbarton authored
      Test Plan: new test Orphans
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D3086
    • Ben Gamari's avatar
      Dwarf.Types: Use DW_CFA_same_value encoding when possible · 7fac7cdc
      Ben Gamari authored
      This is a bit smaller than the alternative, DW_CFA_val_expression. Also
      a bit of refactoring.
      Test Plan: Validate
      Reviewers: scpmw, simonmar, austin
      Reviewed By: simonmar
      Subscribers: thomie
      Differential Revision: https://phabricator.haskell.org/D2745
  6. 11 Feb, 2017 1 commit
  7. 10 Feb, 2017 2 commits
    • Ryan Scott's avatar
      Refactor DeriveAnyClass's instance context inference · 639e702b
      Ryan Scott authored
      Currently, `DeriveAnyClass` has two glaring flaws:
      * It only works on classes whose argument is of kind `*` or `* -> *` (#9821).
      * The way it infers constraints makes no sense. It basically co-opts the
        algorithms used to infer contexts for `Eq` (for `*`-kinded arguments) or
        `Functor` (for `(* -> *)`-kinded arguments). This tends to produce overly
        constrained instances, which in extreme cases can lead to legitimate things
        failing to typecheck (#12594). Or even worse, it can trigger GHC panics
        (#12144 and #12423).
      This completely reworks the way `DeriveAnyClass` infers constraints to fix
      these two issues. It now uses the type signatures of the derived class's
      methods to infer constraints (and to simplify them). A high-level description
      of how this works is included in the GHC users' guide, and more technical notes
      on what is going on can be found as comments (and a Note) in `TcDerivInfer`.
      Fixes #9821, #12144, #12423, #12594.
      Test Plan: ./validate
      Reviewers: dfeuer, goldfire, simonpj, austin, bgamari
      Subscribers: dfeuer, thomie
      Differential Revision: https://phabricator.haskell.org/D2961
    • Facundo Domínguez's avatar
      Relax test TH_addCStub2 so it succeeds on travis. · e79ef75d
      Facundo Domínguez authored
      Test Plan: ./validate
      Reviewers: bgamari, nomeata, austin, mpickering
      Reviewed By: mpickering
      Subscribers: mpickering, rwbarton, mboes, thomie
      Differential Revision: https://phabricator.haskell.org/D3124