1. 12 Mar, 2019 9 commits
    • Simon Peyton Jones's avatar
      Use transSuperClasses in TcErrors · 50249a9f
      Simon Peyton Jones authored
      Code in TcErrors was recursively using immSuperClasses,
      which loops in the presence of UndecidableSuperClasses.
      Better to use transSuperClasses instead, which has a loop-breaker
      mechanism built in.
      Fixes issue #16414.
    • Matthew Pickering's avatar
      Remove trailing whitespace · 5165378d
      Matthew Pickering authored
    • Matthew Pickering's avatar
      CI: Add ghc-in-ghci build job · 72c455a4
      Matthew Pickering authored
      This is a separate build job to the other hadrian jobs as it only takes
      about 2-3 minutes to run from cold. The CI tests that the
      `./hadrian/ghci` script loads `ghc/Main.hs` successfully.
    • Matthew Pickering's avatar
      Remove training whitespace · bb684e65
      Matthew Pickering authored
    • Matthew Pickering's avatar
      Hadrian: Add ./hadrian/ghci.sh script for fast development feedback · 2d7dd028
      Matthew Pickering authored
      Running the `./hadrian/ghci` target will load the main compiler into
      a ghci session. This is intended for fast development feedback, modules are only
      typechecked so it isn't possible to run any functions in the repl.
      You can also use this target with `ghcid`.
      The first time this command is run hadrian will need to compile a few dependencies
      which will take 1-2 minutes. Loading GHC into GHCi itself takes about 30 seconds.
      Internally this works by calling a new hadrian target called `tool-args`.
      This target prints out the package and include flags which are necessary
      to load files into ghci. The same target is intended to be used by other
      tooling which uses the GHC API in order to set up the correct GHC API
      session. For example, using this target it is also possible to use HIE
      when developing on GHC.
    • Matthew Pickering's avatar
      Hadrian: Fix rpath so shared objects work after being copied · 4cf2160a
      Matthew Pickering authored
      After being copied all the shared objects end up in the same directory.
      Therefore the correct rpath is `$ORIGIN` rather than the computed
      path which is relative to the directory where it is built.
    • Matthew Pickering's avatar
      Hadrian: Make makeRelativeNoSysLink total · 705fa21d
      Matthew Pickering authored
      makeRelativeNoSysLink would previously crash for no reason if the first
      argument as `./` due to the call to `head`. This refactoring keeps the
      behaviour the same but doesn't crash in this corner case.
    • Matthew Pickering's avatar
      Hadrian: Make libsuf and distDir stage aware · 61264556
      Matthew Pickering authored
      The version suffix needs to be the version of the stage 0 compiler
      when building shared libraries with the stage 0 compiler.
    • Matthew Pickering's avatar
      Hadrian: Allow passing CABFLAGS into build.cabal.sh · b2322310
      Matthew Pickering authored
      Setting `CABFLAGS=args` will pass the additional arguments to cabal
      when it is invoked.
  2. 11 Mar, 2019 3 commits
  3. 09 Mar, 2019 8 commits
    • Ben Gamari's avatar
      Drop utils/count_lines · 0cd98957
      Ben Gamari authored
      This doesn't appear to be used anywhere in the build system and it
      relies on perl. Drop it.
    • Ben Gamari's avatar
      Rip out perl dependency · b760269c
      Ben Gamari authored
      The object splitter was the last major user of perl. There remain a few
      uses in nofib but we can just rely on the system's perl for this since
      it's not critical to the build.
    • Sylvain Henry's avatar
      NCG: correctly escape path strings on Windows (#16389) · 6b2f0991
      Sylvain Henry authored
      GHC native code generator generates .incbin and .file directives. We
      need to escape those strings correctly on Windows (see #16389).
    • Edward Z. Yang's avatar
      Make bkpcabal01 test compatible with new ordering requirements. · 6e3e537e
      Edward Z. Yang authored
      Previously, our test did something like this:
      1. Typecheck p
      2. Typecheck q (which made use of an instantiated p)
      3. Build instantiated p
      4. Build instantiated q
      Cabal previously permitted this, under the reasoning that during
      typechecking there's no harm in using the instantiated p even if we
      haven't build it yet; we'll just instantiate it on the fly with p.
      However, this is not true!  If q makes use of a Template Haskell
      splice from p, we absolutely must have built the instantiated p
      before we typecheck q, since this typechecking will need to
      run some splices.  Cabal now complains that you haven't done
      it correctly, which we indeed have not!
      Reordering so that we do this:
      1. Typecheck p
      3. Build instantiated p
      2. Typecheck q (which made use of an instantiated p)
      4. Build instantiated q
      Fixes the problem.  If Cabal had managed the ordering itself, it would
      have gotten it right.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@fb.com>
    • Ben Gamari's avatar
      rts: Factor out large bitmap walking · e76ee675
      Ben Gamari authored
      This will be needed by the mark phase of the non-moving collector
      so let's factor it out.
    • Niklas Hambüchen's avatar
    • Niklas Hambüchen's avatar
      compiler: Write .o files atomically. See #14533 · cfbedf17
      Niklas Hambüchen authored
      This issue was reproduced with, and the fix confirmed with,
      the `hatrace` tool for syscall-based fault injection:
      The concrete test case for GHC is at
      A previous, nondeterministic reproducer for the issue was provided by
      Alexey Kuleshevich in
          https://github.com/lehins/exec-kill-loopSigned-off-by: default avatarNiklas Hambüchen <niklas@fpcomplete.com>
      Reviewed-by: default avatarAlexey Kuleshevich <alexey@fpcomplete.com>
    • Simon Peyton Jones's avatar
      Stop inferring over-polymorphic kinds · 1f5cc9dc
      Simon Peyton Jones authored
      Before this patch GHC was trying to be too clever
      (Trac #16344); it succeeded in kind-checking this
      polymorphic-recursive declaration
          data T ka (a::ka) b
            = MkT (T Type           Int   Bool)
                  (T (Type -> Type) Maybe Bool)
      As Note [No polymorphic recursion] discusses, the "solution" was
      horribly fragile.  So this patch deletes the key lines in
      TcHsType, and a wodge of supporting stuff in the renamer.
      There were two regressions, both the same: a closed type family
      decl like this (T12785b) does not have a CUSK:
        type family Payload (n :: Peano) (s :: HTree n x) where
          Payload Z (Point a) = a
          Payload (S n) (a `Branch` stru) = a
      To kind-check the equations we need a dependent kind for
      Payload, and we don't get that any more.  Solution: make it
      a CUSK by giving the result kind -- probably a good thing anyway.
      The other case (T12442) was very similar: a close type family
      declaration without a CUSK.
  4. 08 Mar, 2019 7 commits
    • Roland Senn's avatar
    • Sylvain Henry's avatar
      TH: support raw bytes literals (#14741) · 224a6b86
      Sylvain Henry authored
      GHC represents String literals as ByteString internally for efficiency
      reasons. However, until now it wasn't possible to efficiently create
      large string literals with TH (e.g. to embed a file in a binary, cf #14741):
      TH code had to unpack the bytes into a [Word8] that GHC then had to re-pack
      into a ByteString.
      This patch adds the possibility to efficiently create a "string" literal
      from raw bytes. We get the following compile times for different sizes
      of TH created literals:
      || Size || Before || After  || Gain ||
      || 30K  || 2.307s || 2.299  || 0%   ||
      || 3M   || 3.073s || 2.400s || 21%  ||
      || 30M  || 8.517s || 3.390s || 60%  ||
      Ticket #14741 can be fixed if the original code uses this new TH feature.
    • Simon Peyton Jones's avatar
      Use captureTopConstraints in TcRnDriver calls · 5be7ad78
      Simon Peyton Jones authored
      Trac #16376 showed the danger of failing to report an error
      that exists only in the unsolved constraints, if an exception
      is raised (via failM).
      Well, the commit 5c1f268e (Fail fast in solveLocalEqualities)
      did just that -- i.e. it found errors in the constraints, and
      called failM to avoid a misleading cascade.
      So we need to be sure to call captureTopConstraints to report
      those insolubles.  This was wrong in TcRnDriver.tcRnExpr and
      in TcRnDriver.tcRnType.
      As a result the error messages from test T13466 improved slightly,
      a happy outcome.
    • Vladislav Zavialov's avatar
      Testsuite: use 'fragile' instead of 'skip' for T3424, T14697 · 82628254
      Vladislav Zavialov authored
      Also, replace some tabs with spaces to avoid a "mixed indent" warning that vim
      gives me.
    • Andrey Mokhov's avatar
      Hadrian: Drop remaining symlink traversal code from build scripts · 5d744143
      Andrey Mokhov authored
      This partly resolves #16325 (https://ghc.haskell.org/trac/ghc/ticket/16325).
      As previously discussed in https://github.com/snowleopard/hadrian/issues/667,
      we do not need the symlink traversal code in build scripts. However, it
      appears we forgot to delete this code from our Stack-based build scripts,
      which led to placing all build artefacts in an unexpected location when
      using Hadrian in combination with symlink trees. This commit fixes this.
    • Alp Mestanogullari's avatar
      Hadrian: various improvements around the 'test' rule · 48927a9a
      Alp Mestanogullari authored
      - introduce a -k/--keep-test-files flag to prevent cleanup
      - add -dstg-lint to the options that are always passed to tests
      - infer library ways from the compiler to be tested instead of getting them
        from the flavour (like make)
      - likewise for figuring out whether the compiler to be tested is "debugged"
      - specify config.exeext
      - correctly specify config.in_tree_compiler, instead of always passing True
      - fix formatting of how we pass a few test options
      - add (potential) extensions to check-* program names
      - build check-* programs with the compiler to be tested
      - set TEST_HC_OPTS_INTERACTIVE and PYTHON env vars when running tests
    • Sebastian Graf's avatar
      Always do the worker/wrapper split for NOINLINEs · 1675d40a
      Sebastian Graf authored
      Trac #10069 revealed that small NOINLINE functions didn't get split
      into worker and wrapper. This was due to `certainlyWillInline`
      saying that any unfoldings with a guidance of `UnfWhen` inline
      unconditionally. That isn't the case for NOINLINE functions, so we
      catch this case earlier now.
      Nofib results:
              Program         Allocs    Instrs
       fannkuch-redux          -0.3%      0.0%
                   gg          +0.0%     +0.1%
             maillist          -0.2%     -0.2%
              minimax           0.0%     -0.8%
                  Min          -0.3%     -0.8%
                  Max          +0.0%     +0.1%
       Geometric Mean          -0.0%     -0.0%
      Fixes #10069.
      Metric Increase:
  5. 07 Mar, 2019 8 commits
  6. 06 Mar, 2019 5 commits
    • Zejun Wu's avatar
      Move reifyGHCi function into GhciMonad type class · 3caeb443
      Zejun Wu authored
      This was the suggested change in !176 but missed the batch merge (!263).
    • Ryan Scott's avatar
      Fix #16385 by appending _maybe to a use of lookupGlobalOcc · 78dd04f9
      Ryan Scott authored
      `instance forall c. c` claimed that `c` was out of scope because the
      renamer was invoking `lookupGlobalOcc` on `c` (in
      `RnNames.getLocalNonValBinders`) without binding `c` first. To avoid
      this, this patch changes GHC to invoke `lookupGlobalOcc_maybe` on `c`
      instead, and if that returns `Nothing`, then bail out, resulting
      in a better error message.
    • Ben Gamari's avatar
      Fix it · a4944d8d
      Ben Gamari authored
    • Ömer Sinan Ağacan's avatar
      rts: Unglobalize dead_weak_ptr_list and resurrected_threads · 5aab1d9c
      Ömer Sinan Ağacan authored
      In the concurrent nonmoving collector we will need the ability to call
      `traverseWeakPtrList` concurrently with minor generation collections.
      This global state stands in the way of this. However, refactoring it
      away is straightforward since this list only persists the length of a
      single GC.
    • P.C. Shyamshankar's avatar
      Handle absolute paths to build roots in Hadrian. · 2ff77b98
      P.C. Shyamshankar authored
      Fixes #16187.
      This patch fixes various path concatenation issues to allow functioning
      builds with hadrian when the build root location is specified with an
      absolute path.
      - The path concatenation operator (-/-) now handles absolute second operands
        appropriately. Its behavior should match that of POSIX (</>) in this
      - The `getDirectoryFiles*` family of functions only searches for matches
        under the directory tree rooted by its first argument; all of the
        results are also relative to this root. If the first argument is the
        empty string, the current working directory is used.
        This patch passes the appropriate directory (almost always either `top`
        or `root`), and subsequently attaches that directory prefix so that
        the paths refer to the appropriate files.
      - Windows `tar` does not like colons (':') in paths to archive files, it
        tries to resolve them as remote paths. The `--force-local` option
        remedies this, and is applied on windows builds.