1. 24 Oct, 2018 4 commits
    • Ryan Scott's avatar
      Fix #15792 by not reifying invisible arguments in AppTys · bfd93f90
      Ryan Scott authored
      Summary:
      The `reifyType` function in `TcSplice` is carefully designed
      to avoid reifying visible arguments to `TyConApp`s. However, the same
      care was not given towards the `AppTy` case, which lead to #15792.
      
      This patch changes to the `AppTy` case of `reifyType` so that it
      consults the kind of the function type to determine which of the
      argument types are invisible (and therefore should be dropped) during
      reification. This required crafting a variant of `tyConArgFlags`,
      which I dubbed `appTyArgFlags`, that accept an arbitrary function
      `Type` instead of a `TyCon`.
      
      Test Plan: make test TEST=T15792
      
      Reviewers: goldfire, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter
      
      GHC Trac Issues: #15792
      
      Differential Revision: https://phabricator.haskell.org/D5252
      bfd93f90
    • Ryan Scott's avatar
      Keep top-level names in typed TH quotes alive · bb835c96
      Ryan Scott authored
      Summary:
      When renaming untyped TH quotes, some care is taken to
      ensure that uses of top-level names in quotes do not have their
      bindings discarded during desugaring. The same care was not applied
      to typed TH quotes, so this patch brings the two into sync.
      
      Test Plan: make test TEST=T15783
      
      Reviewers: bgamari, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, rwbarton, carter
      
      GHC Trac Issues: #15783
      
      Differential Revision: https://phabricator.haskell.org/D5248
      bb835c96
    • Ryan Scott's avatar
      Fix #15781 by using ktypedocs on type synonym RHSes · 79c641de
      Ryan Scott authored
      Summary:
      This is a follow-up to D5173, which permitted
      unparenthesized kind signatures in certain places. One place that
      appeared to be overlooked was the right-hand sides of type synonyms,
      which this patch addresses by introducing a `ktypedoc` parser
      production (which is to `ctypdoc` as `ktype` is to `ctype`) and
      using it in the right place.
      
      Test Plan: make test TEST="KindSigs T15781"
      
      Reviewers: harpocrates, bgamari
      
      Reviewed By: harpocrates
      
      Subscribers: rwbarton, mpickering, carter
      
      GHC Trac Issues: #15781
      
      Differential Revision: https://phabricator.haskell.org/D5245
      79c641de
    • Alec Theriault's avatar
      Trigger multiline mode in GHCi on '\case' (#13087) · eaf15934
      Alec Theriault authored
      Summary:
      In ALR, 'ITlcase' should expect an opening curly. This is probably a forgotten
      edge case in ALR, since `maybe_layout` (which handles the non-ALR layout)
      already deals with the 'ITlcase' token properly.
      
      Test Plan: make TEST=T10453 && make TEST=T13087
      
      Reviewers: bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, carter
      
      GHC Trac Issues: #10453, #13087
      
      Differential Revision: https://phabricator.haskell.org/D5236
      eaf15934
  2. 23 Oct, 2018 4 commits
  3. 22 Oct, 2018 2 commits
  4. 20 Oct, 2018 2 commits
  5. 19 Oct, 2018 1 commit
    • Ningning Xie's avatar
      Adding almost devoid check for covar in ForAllCo · 879db559
      Ningning Xie authored
      Summary:
      For the sake of consistency of the dependent core, there is a restriction on
      where a coercion variable can appear in ForAllCo: the coercion variable can
      appear nowhere except in coherence coercions.
      
      Currently this restriction is missing in Core. The goal of this patch is to add
      the missing restriction.
      
      After discussion, we decide: coercion variables can appear nowhere except in
      `GRefl` and `Refl`. Relaxing the restriction to include `Refl` should not break
      consistency, we premuse.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15757
      
      Differential Revision: https://phabricator.haskell.org/D5231
      879db559
  6. 17 Oct, 2018 3 commits
  7. 15 Oct, 2018 21 commits
    • Ben Gamari's avatar
      base: Fill in TBAs in changelog · 2e1df7c1
      Ben Gamari authored
      I've added a check in my release script to ensure that this doesn't happen in
      the future.
      2e1df7c1
    • Simon Jakobi's avatar
      Add a strict version of foldMap to Foldable · 172b00c1
      Simon Jakobi authored
      Summary:
      Original proposal by Andrew Martin:
      https://mail.haskell.org/pipermail/libraries/2018-June/028852.html
      
      Reviewers: andrewthad, hvr, bgamari, alpmestan, tdammers
      
      Reviewed By: bgamari, alpmestan, tdammers
      
      Subscribers: alpmestan, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4924
      172b00c1
    • davide's avatar
      Update integer_gmp_gcdext documentation. · 45d5eff8
      davide authored
      Reviewers: hvr, bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15350
      
      Differential Revision: https://phabricator.haskell.org/D5091
      45d5eff8
    • Ömer Sinan Ağacan's avatar
      Fix BLACKHOLE inspection in RtClosureInspect · 45ed4619
      Ömer Sinan Ağacan authored
      When inspecing a BLACKHOLE if the BLACKHOLE points to a TSO or a
      BLOCKING_QUEUE we should return a suspension to the BLACKHOLE itself
      (instead of returning a suspension to the indirectee). The reason is
      because in the debugger when we want to evaluate this term we need to
      enter the BLACKHOLE and not to the TSO or BLOCKING_QUEUE. See the
      runtime panic caused by this in #8316.
      
      Note that while with this patch we do the right thing to evaluate
      thunks in GHCi, evaluating thunks that are owned by the evaluator thread
      in a breakpoint will cause a deadlock as we don't release the breakMVar,
      which is what blocks the evaluator thread from continuing with
      evaluation. So the GHCi thread will enter the BLACKHOLE, but owner of
      the BLACKHOLE is also blocked.
      
      Reviewers: simonmar, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #8316
      
      Differential Revision: https://phabricator.haskell.org/D5179
      45ed4619
    • Zejun Wu's avatar
      Allocate bss section within proper range of other sections · 83061413
      Zejun Wu authored
      Allocate bss section within proper range of other sections:
      
      * when `+RTS -xp` is passed, allocate it contiguously as we did for
        jump islands
      * when we mmap the code to lower 2Gb, we should allocate bss section
        there too
      
      This depends on {D5195}
      
      Test Plan:
      1. `./validate`
      
      2.
      
      with
      
      ```
      DYNAMIC_GHC_PROGRAMS = NO
      DYNAMIC_BY_DEFAULT = NO
      ```
      
      `TEST="T15729" make test` passed in both linux and macos.
      
      3.
      
      Also test in a use case where we used to encouter error like:
      
      ```
      ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) =
      b90282ba
      ```
      
      and now, everything works fine.
      
      Reviewers: simonmar, bgamari, angerman, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15729
      
      Differential Revision: https://phabricator.haskell.org/D5219
      83061413
    • Zejun Wu's avatar
      Add a RTS option -xp to load PIC object anywhere in address space · 104599f3
      Zejun Wu authored
      Add a RTS option -xp to load PIC object anywhere in address space. We do
      this by relaxing the requirement of <0x80000000 result of
      `mmapForLinker` and implying USE_CONTIGUOUS_MMAP.
      
      We also need to change calls to `ocInit` and `ocGetNames` to avoid
      dangling pointers when the address of `oc->image` is changed by
      `ocAllocateSymbolExtra`.
      
      Test Plan:
      ```
      $ uname -a
      Linux localhost 4.18.8-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 15 20:34:48
      UTC 2018 x86_64 GNU/Linux
      $ cat mk/build.mk
      DYNAMIC_GHC_PROGRAMS = NO
      DYNAMIC_BY_DEFAULT = NO
      
      GhcRTSWays += thr_debug
      EXTRA_HC_OPTS += -debug
      WAY_p_HC_OPTS += -fPIC -fexternal-dynamic-refs
      $ inplace/bin/ghc-stage2 --interactive -prof +RTS -xp
      GHCi, version 8.7.20180928: http://www.haskell.org/ghc/  :? for help
      ghc-stage2: R_X86_64_32 relocation out of range:
      ghczmprim_GHCziTypes_ZMZN_closure = 7f690bffab59
      Recompile
      /data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim
      -0.5.3.o with -fPIC -fexternal-dynamic-refs.
      ghc-stage2: unable to load package `ghc-prim-0.5.3'
      $ strace -f -e open,mmap inplace/bin/ghc-stage2 --interactive -prof
      -fexternal-interpreter  -opti+RTS -opti-xp
      ...
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas
      e-4.12.0.0_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84842000
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas
      e-4.12.0.0_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84676000
      ...
      Prelude> System.Posix.Process.getProcessID
      ...
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni
      x-2.7.2.2_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 45056, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d60000
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni
      x-2.7.2.2_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 57344, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d52000
      ...
      ```
      
      ```
      $ uname -a
      Darwin watashis-iMac.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug
      22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
      $ mv
      /Users/watashi/gao/ghc/libraries/integer-gmp/dist-install/build/HSintege
      r-gmp-1.0.2.0.o{,._DISABLE_GHC_ISSUE_15105}
      $ inplace/bin/ghc-stage2 --interactive  +RTS -xp
      GHCi, version 8.7.20181003: http://www.haskell.org/ghc/  :? for help
      Prelude> System.Posix.Process.getProcessID
      42791
      Prelude> Data.Set.fromList [1 .. 10]
      fromList [1,2,3,4,5,6,7,8,9,10]
      Prelude>
      Leaving GHCi.
      $ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
      GHCi, version 8.7.20181003: http://www.haskell.org/ghc/  :? for help
      Prelude> System.Posix.Process.getProcessID
      42806
      Prelude> Data.Set.fromList [1 .. 10]
      fromList [1,2,3,4,5,6,7,8,9,10]
      Prelude>
      Leaving GHCi.
      ```
      
      Also test with something that used to hit the 2Gb limit and it loads
      and runs without problem.
      
      Reviewers: simonmar, bgamari, angerman, Phyx, hvr, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5195
      104599f3
    • Vladislav Zavialov's avatar
      Enable -Wcompat=error in the testsuite · 165d3d5d
      Vladislav Zavialov authored
      Enabling -Werror=compat in the testsuite allows us to easily see the
      impact that a new warning has on code. It also means that in the period
      between adding the warning and making the actual breaking change, all
      new test cases that are being added to the testsuite will be
      forwards-compatible. This is good because it will make the actual
      breaking change contain less irrelevant testsuite updates.
      
      Things that -Wcompat warns about are things that are going to break in
      the future, so we can be proactive and keep our testsuite
      forwards-compatible.
      
      This patch consists of two main changes:
      
      * Add `TEST_HC_OPTS += -Werror=compat` to the testsuite configuration.
      * Fix all broken test cases.
      
      Test Plan: Validate
      
      Reviewers: hvr, goldfire, bgamari, simonpj, RyanGlScott
      
      Reviewed By: goldfire, RyanGlScott
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15278
      
      Differential Revision: https://phabricator.haskell.org/D5200
      165d3d5d
    • Peter Trommler's avatar
      ghc-heap: Fix writing closures on big endian · 058c2813
      Peter Trommler authored
      We need to write the closure type as a HalfWord not
      an Int. On big endian systems the closure type ends up being zero
      (the upper word of the Int) making the closure an invalid object.
      
      Test Plan: validate (preferably on a big endian system)
      
      Reviewers: bgamari, hvr, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5212
      058c2813
    • Zejun Wu's avatar
      Generate correct relocation for external cost centre · 95ec7c88
      Zejun Wu authored
      We used to always generate direct access for cost centre labels.  We
      fixed this by generating indirect data load for cost centre defined in
      external module.
      
      Test Plan:
      The added test used to fail with error message
      ```
      /bin/ld.gold: error: T15723B.o: requires dynamic R_X86_64_PC32 reloc
      against 'T15723A_foo1_EXPR_cc' which may overflow at runtime; recompile
      with -fPIC
      ```
      and now passes.
      
      Also check that `R_X86_64_PC32` is generated for CostCentre from the
      same module and `R_X86_64_GOTPCREL` is generated for CostCentre from
      external module:
      ```
      $ objdump -rdS T15723B.o
      0000000000000028 <T15723B_test_info>:
        28:   48 8d 45 f0             lea    -0x10(%rbp),%rax
        2c:   4c 39 f8                cmp    %r15,%rax
        2f:   72 70                   jb     a1 <T15723B_test_info+0x79>
        31:   48 83 ec 08             sub    $0x8,%rsp
        35:   48 8d 35 00 00 00 00    lea    0x0(%rip),%rsi        # 3c
      <T15723B_test_info+0x14>
                              38: R_X86_64_PC32
      T15723B_test1_EXPR_cc-0x4
        3c:   49 8b bd 60 03 00 00    mov    0x360(%r13),%rdi
        43:   31 c0                   xor    %eax,%eax
        45:   e8 00 00 00 00          callq  4a <T15723B_test_info+0x22>
                              46: R_X86_64_PLT32      pushCostCentre-0x4
        4a:   48 83 c4 08             add    $0x8,%rsp
        4e:   48 ff 40 30             incq   0x30(%rax)
        52:   49 89 85 60 03 00 00    mov    %rax,0x360(%r13)
        59:   48 83 ec 08             sub    $0x8,%rsp
        5d:   49 8b bd 60 03 00 00    mov    0x360(%r13),%rdi
        64:   48 8b 35 00 00 00 00    mov    0x0(%rip),%rsi        # 6b
      <T15723B_test_info+0x43>
                              67: R_X86_64_GOTPCREL   T15723A_foo1_EXPR_cc-0x4
        6b:   31 c0                   xor    %eax,%eax
        6d:   e8 00 00 00 00          callq  72 <T15723B_test_info+0x4a>
                              6e: R_X86_64_PLT32      pushCostCentre-0x4
        72:   48 83 c4 08             add    $0x8,%rsp
        76:   48 ff 40 30             incq   0x30(%rax)
      ```
      
      Reviewers: simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15723
      
      Differential Revision: https://phabricator.haskell.org/D5214
      95ec7c88
    • Ryan Scott's avatar
      Fix #15738 by defining (and using) parenthesizeHsContext · 02b2116e
      Ryan Scott authored
      With `QuantifiedConstraints`, `forall`s can appear in more
      nested positions than they could before, but `Convert` and the TH
      pretty-printer were failing to take this into account. On the
      `Convert` side, this is fixed by using a `parenthesizeHsContext`
      to parenthesize singleton quantified constraints that appear to the
      left of a `=>`. (A similar fix is applied to the TH pretty-printer.)
      
      Test Plan: make test TEST=T15738
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15738
      
      Differential Revision: https://phabricator.haskell.org/D5222
      02b2116e
    • Ömer Sinan Ağacan's avatar
      Fix cardinality change of fields in addDataConStrictness · c5b477c2
      Ömer Sinan Ağacan authored
      Test Plan: This validates
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5225
      c5b477c2
    • Ryan Scott's avatar
      Fix #12430 by expanding type synonyms in injTyVarsOfType · 26e81e90
      Ryan Scott authored
      We weren't expanding type synonyms when determining the
      injective type variables of a type, leading to certain non-injective
      families being mistakenly labeled as injective (#12430). Easily fixed
      with a tactical use of `coreView`.
      
      Test Plan: make test TEST=T12430
      
      Reviewers: bgamari, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: goldfire, rwbarton, carter
      
      GHC Trac Issues: #12430
      
      Differential Revision: https://phabricator.haskell.org/D5228
      26e81e90
    • Sasa Bogicevic's avatar
      Surprising error message with bang pattern · 0b0cb484
      Sasa Bogicevic authored
      Reviewers: bgamari, alanz
      
      Reviewed By: bgamari
      
      Subscribers: sgraf, mpickering, rwbarton, thomie, carter
      
      GHC Trac Issues: #13600
      
      Differential Revision: https://phabricator.haskell.org/D5040
      0b0cb484
    • Ben Gamari's avatar
      Typeable: Only render saturated tuple types with tuple syntax · 846fe904
      Ben Gamari authored
      This isn't as efficient as it could be since it needs to compute the
      kind of the type. However, this is `show` so there shouldn't be any
      particular expectation of speed.
      
      Fixes #14341.
      
      Test Plan: Validate
      
      Reviewers: hvr
      
      Subscribers: monoidal, rwbarton, carter
      
      GHC Trac Issues: #14341
      
      Differential Revision: https://phabricator.haskell.org/D5080
      846fe904
    • Krzysztof Gogolewski's avatar
      Cleanup boot and validate · a816ac48
      Krzysztof Gogolewski authored
      - Remove dph from validate; dph was removed
      - The required-tag argument to boot was used only for dph, remove
      - check_boot_packages() was not called at all, and didn't work.
        I fixed it based on previous Perl version.
      
      Test Plan: Harbormaster
      
      Reviewers: bgamari, thomie
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5129
      a816ac48
    • Tamar Christina's avatar
      Fix plugin tests requirements · 01c3d00a
      Tamar Christina authored
      Unfortunately the implementation has confused the ability to make
      dynamic libraries with dynamic way.
      This constraint is only true for systems that require `-fPIC` for
      shared libraries.
      
      Since the implementation has this implicit assumption, mark the tests
      as requiring dynway.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5174
      01c3d00a
    • Ben Gamari's avatar
      Deprecate -fllvm-pass-vectors-in-regs · 58dffa0a
      Ben Gamari authored
      Summary:
      The behavior previously enabled by this flag is as been the default
      since 8.6.1.
      
      Reviewers: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5193
      58dffa0a
    • Nathan van Doorn's avatar
    • Ondra Pelech's avatar
    • Tobias Dammers's avatar
      Use an accumulator version of tyCoVarsOfType · 08b3db7e
      Tobias Dammers authored
      Summary:
      This is part 1 from #14880: factor out a worker for the tyCoVarsOf... family of
      function, implementing them in terms of VarSet, but with accumulator-style
      (like in `FV`) built in, and with the same kind of pre-insert lookup; this
      has shown to perform better than either FV or plain VarSet in this particular
      scenario.
      
      Original notes from simonpj:
      
      In TyCoRep we now have tyCoVarsOfType implemented
      
      1) Using FV -- this is the baseline version in GHC today
      
      2) Using VarSets via unionVarSet
      
      3) Using VarSets in accumulator-style
      
      In this patch (3) is enabled.
      
      When compiling perf/compiler/T5631 we get
      
               Compiler allocs
         (1)   1,144M
         (2)   1,175M
         (3)   1,142M
      
      The key new insight in (3) is this:
      
        ty_co_vars_of_type (TyVarTy v) is acc
          | v `elemVarSet` is  = acc
          | v `elemVarSet` acc = acc   <---- NB!
          | otherwise          = ty_co_vars_of_type (tyVarKind v) is (extendVarSet acc v)
      
      Notice the second line! If the variable is already in the
      accumulator, don't re-add it.  This makes big difference.
      Without it, allocation is 1,169M or so.
      
      One cause is that we only take the free vars of its kind once;
      that problem will go away when we do the main part of #14088 and
      close over kinds /afterwards/.  But still, another cause is perhaps
      that every insert into a set overwrites the previous item, and so
      allocates a new path to the item; it's not a no-op even if the
      item is there already.
      
      Why use (3) rather than (1)?  Becuase it just /has/ to
      be better;
      
      * FV carries around an InterestingVarFun, which does nothing
        useful here, but is tested at every variable
      
      * FV carries around a [Var] for the deterministic version.
      
      For this very hot operation (finding free vars) I think it
      makes sense to have speical purpose code.
      
      On the way I also simplified the (less used) coVarsOfType/Co family
      to use FV, by making serious use of the InterestingVarFun!
      
      Test Plan: validate, nofib
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14880
      
      Differential Revision: https://phabricator.haskell.org/D5141
      08b3db7e
    • Ryan Scott's avatar
      Fix #15725 with an extra Sym · 48efbc04
      Ryan Scott authored
      Summary:
      We were adding a `Sym` to one argument in the `InstCo`
      case of `optCoercion` but not another, leading to the two arguments
      to misaligned when combined via `Trans`. This fixes the issue with
      a well targeted use of `wrapSym`.
      
      Test Plan: make test TEST=T15725
      
      Reviewers: goldfire, ningning, bgamari
      
      Reviewed By: goldfire, ningning
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15725
      
      Differential Revision: https://phabricator.haskell.org/D5217
      48efbc04
  8. 14 Oct, 2018 3 commits