1. 07 Oct, 2019 2 commits
    • Ben Gamari's avatar
      Refactor, document, and optimize LLVM configuration loading · b2577081
      Ben Gamari authored
      As described in the new Note [LLVM Configuration] in SysTools, we now
      load llvm-targets and llvm-passes lazily to avoid the overhead of doing
      so when -fllvm isn't used (also known as "the common case").
      
      Noticed in #17003.
      
      Metric Decrease:
          T12234
          T12150
      b2577081
    • Ryan Scott's avatar
      Only flatten up to type family arity in coreFlattenTyFamApp (#16995) · 825c108b
      Ryan Scott authored
      Among other uses, `coreFlattenTyFamApp` is used by Core Lint as a
      part of its check to ensure that each type family axiom reduces
      according to the way it is defined in the source code. Unfortunately,
      the logic that `coreFlattenTyFamApp` uses to flatten type family
      applications disagreed with the logic in `TcFlatten`, which caused
      it to spuriously complain this program:
      
      ```hs
      type family Param :: Type -> Type
      
      type family LookupParam (a :: Type) :: Type where
        LookupParam (f Char) = Bool
        LookupParam x        = Int
      
      foo :: LookupParam (Param ())
      foo = 42
      ```
      
      This is because `coreFlattenTyFamApp` tries to flatten the `Param ()`
      in `LookupParam (Param ())` to `alpha` (where `alpha` is a flattening
      skolem), and GHC is unable to conclude that `alpha` is apart from
      `f Char`. This patch spruces up `coreFlattenTyFamApp` so that it
      instead flattens `Param ()` to `alpha ()`, which GHC _can_ know for
      sure is apart from `f Char`. See
      `Note [Flatten], wrinkle 3` in `FamInstEnv`.
      825c108b
  2. 05 Oct, 2019 13 commits
    • Ben Gamari's avatar
      rts: Fix CNF dirtying logic · 241921a0
      Ben Gamari authored
      Previously due to a silly implementation bug CNFs would never have their
      dirty flag set, resulting in their being added again and again to the
      `mut_list`. Fix this.
      
      Fixes #17297.
      241921a0
    • John Ericson's avatar
      Clean up `#include`s in the compiler · ee8118ca
      John Ericson authored
       - Remove unneeded ones
      
       - Use <..> for inter-package.
         Besides general clean up, helps distinguish between the RTS we link
         against vs the RTS we compile for.
      ee8118ca
    • matthewbauer's avatar
      Add musl systems to llvm-targets · 8039b625
      matthewbauer authored
      This was done in Nixpkgs, but never upstreamed. Musl is pretty much
      the same as gnu, but with a different libc. I’ve used the same values
      for everything.
      8039b625
    • Roland Senn's avatar
      New fix for #11647. Avoid side effects like #17171 · 93f02b62
      Roland Senn authored
      If a main module doesn't contain a header, we omit the check whether the main module is exported.
      With this patch GHC, GHCi and runghc use the same code.
      93f02b62
    • Artem Pyanykh's avatar
      [linker, macho] Don't map/allocate zero size sections and segments · 0d31ccdd
      Artem Pyanykh authored
      Zero size sections are common even during regular build on MacOS. For
      instance:
      
      ```
      $ ar -xv libHSghc-prim-0.6.1.a longlong.o
      $ otool -l longlong.o
      longlong.o:
      Mach header
            magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
       0xfeedfacf 16777223          3  0x00           1     2        176 0x00002000
      Load command 0
            cmd LC_SEGMENT_64
        cmdsize 152
        segname
         vmaddr 0x0000000000000000
         vmsize 0x0000000000000000 <-- segment size = 0
        fileoff 208
       filesize 0
        maxprot 0x00000007
       initprot 0x00000007
         nsects 1
          flags 0x0
      Section
        sectname __text
         segname __TEXT
            addr 0x0000000000000000
            size 0x0000000000000000 <-- section size = 0
          offset 208
           align 2^0 (1)
          reloff 0
          nreloc 0
           flags 0x80000000
       reserved1 0
       reserved2 0
             cmd LC_BUILD_VERSION
         cmdsize 24
        platform macos
             sdk 10.14
           minos 10.14
          ntools 0
      ```
      
      The issue of `mmap`ing 0 bytes was resolved in !1050, but the problem
      remained. These 0 size segments and sections were still allocated in
      object code, which lead to failed `ASSERT(size > 0)` in
      `addProddableBlock` further down the road.
      
      With this change zero size segments **and** sections are not
      mapped/allocated at all.
      
      Test plan:
      
      1. Build statically linked GHC.
      
      2. Run `ghc --interactive`. Observe that REPL loads
      successfully (which was not the case before).
      
      3. Load several more compiled hs files into repl. No failures.
      0d31ccdd
    • John Ericson's avatar
      Always enable the external interpreter · 0dded5ec
      John Ericson authored
      You can always just not use or even build `iserv`. I don't think the
      maintenance cost of the CPP is worth...I can't even tell what the
      benefit is.
      0dded5ec
    • John Ericson's avatar
      eb892b28
    • John Ericson's avatar
      Pull out the settings file parsing code into it's own module. · d15b44d6
      John Ericson authored
      This has two benefits:
      
      1. One less hunk of code dependent on DynFlags
      
      2. Add a little bit of error granularity to distrinugish between missing
         data and bad data. This could someday be shared with ghc-pkg which
         aims to work even with a missing file. I also am about to to make
         --supported-extensions use this too.
      d15b44d6
    • John Ericson's avatar
      dd8f76b2
    • Daroc Alden's avatar
      Deprecate -fwarn-hi-shadowing, because it was never implemented and is · b538476b
      Daroc Alden authored
      not used.
      
      This fixes #10913.
      b538476b
    • John Ericson's avatar
      Remove {Build,Host}Platform_NAME from header · 75a5dd8e
      John Ericson authored
      They are only used in a file we construct directly, so just skip CPP.
      75a5dd8e
    • John Ericson's avatar
      Per stage headers, ghc_boot_platform.h -> stage 0 ghcplatform.h · 05419e55
      John Ericson authored
      The generated headers are now generated per stage, which means we can
      skip hacks like `ghc_boot_platform.h` and just have that be the stage 0
      header as proper. In general, stages are to be embraced: freely generate
      everything in each stage but then just build what you depend on, and
      everything is symmetrical and efficient. Trying to avoid stages because
      bootstrapping is a mind bender just creates tons of bespoke
      mini-mind-benders that add up to something far crazier.
      
      Hadrian was pretty close to this "stage-major" approach already, and so
      was fairly easy to fix. Make needed more work, however: it did know
      about stages so at least there was a scaffold, but few packages except
      for the compiler cared, and the compiler used its own counting system.
      That said, make and Hadrian now work more similarly, which is good for
      the transition to Hadrian. The merits of embracing stage aside, the
      change may be worthy for easing that transition alone.
      05419e55
    • Fumiaki Kinoshita's avatar
      ec93d2a9
  3. 03 Oct, 2019 15 commits
  4. 01 Oct, 2019 10 commits
    • Ömer Sinan Ağacan's avatar
      Make small INLINE functions behave properly · 8924224e
      Ömer Sinan Ağacan authored
      Simon writes:
      
      Currently we check for a type arg rather than isTyCoArg.   This in turn
      makes INLINE things look bigger than they should be, and stops them
      being inlined into boring contexts when they perfectly well could be.
      E.g.
      
          f x = g <refl> x
          {-# INLINE g #-}
      
          ... (map (f x) xs) ...
      
      The context is boring, so don't inline unconditionally.  But f's RHS is
      no bigger than its call, provided you realise that the coercion argument
      is ultimately cost-free.
      
      This happens in practice for $WHRefl. It's not a big deal: at most it
      means we have an extra function call overhead.  But it's untidy, and
      actually worse than what happens without an INLINE pragma.
      
      Fixes #17182
      
      This makes 0.0% change in nofib binary sizes.
      8924224e
    • David Eichmann's avatar
      Hadrian: do not cache GHC configure rule · 0956c194
      David Eichmann authored
      0956c194
    • David Eichmann's avatar
    • Ryan Scott's avatar
      Refactor some cruft in TcDeriv · 9c002177
      Ryan Scott authored
      * `mk_eqn_stock`, `mk_eqn_anyclass`, and `mk_eqn_no_mechanism` all
        took a continuation of type
        `DerivSpecMechanism -> DerivM EarlyDerivSpec` to represent its
        primary control flow. However, in practice this continuation was
        always instantiated with the `mk_originative_eqn` function, so
        there's not much point in making this be a continuation in the
        first place.
      
        This patch removes these continuations in favor of invoking
        `mk_originative_eqn` directly, which is simpler.
      * There were several parts of `TcDeriv` that took different code
        paths if compiling an `.hs-boot` file. But this is silly, because
        ever since 101a8c77 we simply error
        eagerly whenever attempting to derive any instances in an
        `.hs-boot` file.
      
        This patch removes all of the unnecessary `.hs-boot` code paths,
        leaving only one (which errors out).
      * Remove various error continuation arguments from `mk_eqn_stock`
        and related functions.
      9c002177
    • Sebastian Graf's avatar
      Add testcases inspired by Luke Maranget's pattern match series · 58013220
      Sebastian Graf authored
      In his paper "Warnings for Pattern Matching", Luke Maranget describes
      three series in his appendix for which GHC's pattern match checker
      scaled very badly. We mostly avoid this now with !1752. This commit adds
      regression tests for each of the series.
      
      Fixes #17264.
      58013220
    • Sebastian Graf's avatar
      Add a bunch of testcases for the pattern match checker · 6548b7b0
      Sebastian Graf authored
      Adds regression tests for tickets #17207, #17208, #17215, #17216,
       #17218, #17219, #17248
      6548b7b0
    • Ben Gamari's avatar
      Bump process submodule · 822481d5
      Ben Gamari authored
      Marks process003 as fragile, as noted in #17245.
      822481d5
    • Ben Gamari's avatar
      testsuite: Mark T3389 as broken in hpc way on i386 · dbdf6a3d
      Ben Gamari authored
      See #17256.
      dbdf6a3d
    • Vladislav Zavialov's avatar
      Do not rely on CUSKs in 'base' · bdba6ac2
      Vladislav Zavialov authored
      Use standalone kind signatures instead of complete user-specified kinds
      in Data.Type.Equality and Data.Typeable
      bdba6ac2
    • Takenobu Tani's avatar
      testsuite: Add minimal test for :doc command · b36dd49b
      Takenobu Tani authored
      Currently, there are no testcases for GHCi `:doc` command.
      Perhaps because it was experimental. And it could be changed in the future.
      
      But `:doc` command is already useful, so I add a minimal regression test
      to keep current behavior.
      
      See also 85309a3c for implementation of `:doc` command.
      b36dd49b