1. 21 Sep, 2019 1 commit
  2. 17 Sep, 2019 2 commits
    • John Ericson's avatar
      Deduplicate `HaskellMachRegs.h` and `RtsMachRegs.h` headers · c77fc3b2
      John Ericson authored
      Until 0472f0f6 there was a meaningful
      host vs target distinction (though it wasn't used right, in genapply).
      After that, they did not differ in meaningful ways, so it's best to just
      only keep one.
      c77fc3b2
    • Matthew Pickering's avatar
      eventlog: Add biographical and retainer profiling traces · ae4415b9
      Matthew Pickering authored
      This patch adds a new eventlog event which indicates the start of
      a biographical profiler sample. These are different to normal events as
      they also include the timestamp of when the census took place. This is
      because the LDV profiler only emits samples at the end of the run.
      
      Now all the different profiling modes emit consumable events to the
      eventlog.
      ae4415b9
  3. 09 Sep, 2019 1 commit
    • Sylvain Henry's avatar
      Module hierarchy: StgToCmm (#13009) · 447864a9
      Sylvain Henry authored
      Add StgToCmm module hierarchy. Platform modules that are used in several
      other places (NCG, LLVM codegen, Cmm transformations) are put into
      GHC.Platform.
      447864a9
  4. 05 Sep, 2019 1 commit
    • John Ericson's avatar
      Make sure all boolean settings entries use `YES` / `NO` · b55ee979
      John Ericson authored
      Some where using `True` / `False`, a legacy of when they were in
      `Config.hs`. See #16914 / d238d306 for a similar problem.
      
      Also clean up the configure variables names for consistency and clarity
      while we're at it. "Target" makes clear we are talking about outputted
      code, not where GHC itself runs.
      b55ee979
  5. 10 Aug, 2019 1 commit
    • Joachim Breitner's avatar
      Consolidate `TablesNextToCode` and `GhcUnreigsterised` in configure (#15548) · 81860281
      Joachim Breitner authored
      `TablesNextToCode` is now a substituted by configure, where it has the
      correct defaults and error handling. Nowhere else needs to duplicate
      that, though we may want the compiler to to guard against bogus settings
      files.
      
      I renamed it from `GhcEnableTablesNextToCode` to `TablesNextToCode` to:
      
       - Help me guard against any unfixed usages
      
       - Remove any lingering connotation that this flag needs to be combined
         with `GhcUnreigsterised`.
      
      Original reviewers:
      
      Original subscribers: TerrorJack, rwbarton, carter
      
      Original Differential Revision: https://phabricator.haskell.org/D5082
      81860281
  6. 30 Jul, 2019 1 commit
    • Andreas Klebinger's avatar
      Expand the preallocated Int range to [-16,255] · 9c8a211a
      Andreas Klebinger authored
      Effects as I measured them:
      
      RTS Size: +0.1%
      Compile times: -0.5%
      Runtine nofib: -1.1%
      
      Nofib runtime result seems to mostly come from the `CS` benchmark
      which is very sensible to alignment changes so this is likely over
      represented.
      
      However the compile time changes are realistic.
      
      This is related to #16961.
      9c8a211a
  7. 24 Jul, 2019 1 commit
  8. 16 Jul, 2019 1 commit
  9. 14 Jul, 2019 1 commit
  10. 10 Jul, 2019 1 commit
    • John Ericson's avatar
      Remove most uses of TARGET platform macros · 0472f0f6
      John Ericson authored
      These prevent multi-target builds. They were gotten rid of in 3 ways:
      
      1. In the compiler itself, replacing `#if` with runtime `if`. In these
      cases, we care about the target platform still, but the target platform
      is dynamic so we must delay the elimination to run time.
      
      2. In the compiler itself, replacing `TARGET` with `HOST`. There was
      just one bit of this, in some code splitting strings representing lists
      of paths. These paths are used by GHC itself, and not by the compiled
      binary. (They are compiler lookup paths, rather than RPATHS or something
      that does matter to the compiled binary, and thus would legitamentally
      be target-sensative.) As such, the path-splitting method only depends on
      where GHC runs and not where code it produces runs. This should have
      been `HOST` all along.
      
      3. Changing the RTS. The RTS doesn't care about the target platform,
      full stop.
      
      4. `includes/stg/HaskellMachRegs.h` This file is also included in the
      genapply executable. This is tricky because the RTS's host platform
      really is that utility's target platform. so that utility really really
      isn't multi-target either. But at least it isn't an installed part of
      GHC, but just a one-off tool when building the RTS. Lying with the
      `HOST` to a one-off program (genapply) that isn't installed doesn't seem so bad.
      It's certainly better than the other way around of lying to the RTS
      though not to genapply. The RTS is more important, and it is installed,
      *and* this header is installed as part of the RTS.
      0472f0f6
  11. 03 Jul, 2019 1 commit
  12. 28 Jun, 2019 1 commit
    • Travis Whitaker's avatar
      Correct closure observation, construction, and mutation on weak memory machines. · 11bac115
      Travis Whitaker authored
      Here the following changes are introduced:
          - A read barrier machine op is added to Cmm.
          - The order in which a closure's fields are read and written is changed.
          - Memory barriers are added to RTS code to ensure correctness on
            out-or-order machines with weak memory ordering.
      
      Cmm has a new CallishMachOp called MO_ReadBarrier. On weak memory machines, this
      is lowered to an instruction that ensures memory reads that occur after said
      instruction in program order are not performed before reads coming before said
      instruction in program order. On machines with strong memory ordering properties
      (e.g. X86, SPARC in TSO mode) no such instruction is necessary, so
      MO_ReadBarrier is simply erased. However, such an instruction is necessary on
      weakly ordered machines, e.g. ARM and PowerPC.
      
      Weam memory ordering has consequences for how closures are observed and mutated.
      For example, consider a closure that needs to be updated to an indirection. In
      order for the indirection to be safe for concurrent observers to enter, said
      observers must read the indirection's info table before they read the
      indirectee. Furthermore, the entering observer makes assumptions about the
      closure based on its info table contents, e.g. an INFO_TYPE of IND imples the
      closure has an indirectee pointer that is safe to follow.
      
      When a closure is updated with an indirection, both its info table and its
      indirectee must be written. With weak memory ordering, these two writes can be
      arbitrarily reordered, and perhaps even interleaved with other threads' reads
      and writes (in the absence of memory barrier instructions). Consider this
      example of a bad reordering:
      
      - An updater writes to a closure's info table (INFO_TYPE is now IND).
      - A concurrent observer branches upon reading the closure's INFO_TYPE as IND.
      - A concurrent observer reads the closure's indirectee and enters it. (!!!)
      - An updater writes the closure's indirectee.
      
      Here the update to the indirectee comes too late and the concurrent observer has
      jumped off into the abyss. Speculative execution can also cause us issues,
      consider:
      
      - An observer is about to case on a value in closure's info table.
      - The observer speculatively reads one or more of closure's fields.
      - An updater writes to closure's info table.
      - The observer takes a branch based on the new info table value, but with the
        old closure fields!
      - The updater writes to the closure's other fields, but its too late.
      
      Because of these effects, reads and writes to a closure's info table must be
      ordered carefully with respect to reads and writes to the closure's other
      fields, and memory barriers must be placed to ensure that reads and writes occur
      in program order. Specifically, updates to a closure must follow the following
      pattern:
      
      - Update the closure's (non-info table) fields.
      - Write barrier.
      - Update the closure's info table.
      
      Observing a closure's fields must follow the following pattern:
      
      - Read the closure's info pointer.
      - Read barrier.
      - Read the closure's (non-info table) fields.
      
      This patch updates RTS code to obey this pattern. This should fix long-standing
      SMP bugs on ARM (specifically newer aarch64 microarchitectures supporting
      out-of-order execution) and PowerPC. This fixes issue #15449.
      Co-Authored-By: Ben Gamari's avatarBen Gamari <ben@well-typed.com>
      11bac115
  13. 27 Jun, 2019 1 commit
    • Matthew Pickering's avatar
      rts: Correct handling of LARGE ARR_WORDS in LDV profiler · a586b33f
      Matthew Pickering authored
      This implements the correct fix for #11627 by skipping over the slop
      (which is zeroed) rather than adding special case logic for LARGE
      ARR_WORDS which runs the risk of not performing a correct census by
      ignoring any subsequent blocks.
      
      This approach implements similar logic to that in Sanity.c
      a586b33f
  14. 14 Jun, 2019 1 commit
    • Ben Gamari's avatar
      Maintain separate flags for C++ compiler invocations · 7bc5d6c6
      Ben Gamari authored
      Previously we would pass flags intended for the C compiler to the C++
      compiler (see #16738). This would cause, for instance, `-std=gnu99` to
      be passed to the C++ compiler, causing spurious test failures. Fix this
      by maintaining a separate set of flags for C++ compilation invocations.
      7bc5d6c6
  15. 12 Jun, 2019 1 commit
  16. 11 Jun, 2019 1 commit
    • Alp Mestanogullari's avatar
      Hadrian: teach the RTS that PROFILING implies TRACING · 457fe789
      Alp Mestanogullari authored
      As discussed in #16744, both the Make and Hadrian build systems
      have special code to always pass -eventlog whenever -prof or -debug
      are passed. However, there is some similar logic in the RTS itself only
      for defining TRACING when the DEBUG macro is defined, but no such logic
      is implemented to define TRACING when the PROFILING macro is defined.
      This patch adds such a logic and therefore fixes #16744.
      457fe789
  17. 07 Jun, 2019 1 commit
  18. 29 May, 2019 1 commit
    • John Ericson's avatar
      Inline `Settings` into `DynFlags` · bfccd832
      John Ericson authored
      After the previous commit, `Settings` is just a thin wrapper around
      other groups of settings. While `Settings` is used by GHC-the-executable
      to initalize `DynFlags`, in principle another consumer of
      GHC-the-library could initialize `DynFlags` a different way. It
      therefore doesn't make sense for `DynFlags` itself (library code) to
      separate the settings that typically come from `Settings` from the
      settings that typically don't.
      bfccd832
  19. 24 May, 2019 1 commit
    • Michael Sloan's avatar
      Add PlainPanic for throwing exceptions without depending on pprint · d9dfbde3
      Michael Sloan authored
      This commit splits out a subset of GhcException which do not depend on
      pretty printing (SDoc), as a new datatype called
      PlainGhcException. These exceptions can be caught as GhcException,
      because 'fromException' will convert them.
      
      The motivation for this change is that that the Panic module
      transitively depends on many modules, primarily due to pretty printing
      code.  It's on the order of about 130 modules.  This large set of
      dependencies has a few implications:
      
      1. To avoid cycles / use of boot files, these dependencies cannot
      throw GhcException.
      
      2. There are some utility modules that use UnboxedTuples and also use
      `panic`. This means that when loading GHC into GHCi, about 130
      additional modules would need to be compiled instead of
      interpreted. Splitting the non-pprint exception throwing into a new
      module resolves this issue. See #13101
      d9dfbde3
  20. 16 May, 2019 1 commit
  21. 14 May, 2019 1 commit
    • John Ericson's avatar
      Remove all target-specific portions of Config.hs · e529c65e
      John Ericson authored
      1. If GHC is to be multi-target, these cannot be baked in at compile
         time.
      
      2. Compile-time flags have a higher maintenance than run-time flags.
      
      3. The old way makes build system implementation (various bootstrapping
         details) with the thing being built. E.g. GHC doesn't need to care
         about which integer library *will* be used---this is purely a crutch
         so the build system doesn't need to pass flags later when using that
         library.
      
      4. Experience with cross compilation in Nixpkgs has shown things work
         nicer when compiler's can *optionally* delegate the bootstrapping the
         package manager. The package manager knows the entire end-goal build
         plan, and thus can make top-down decisions on bootstrapping. GHC can
         just worry about GHC, not even core library like base and ghc-prim!
      e529c65e
  22. 08 May, 2019 2 commits
  23. 06 May, 2019 1 commit
  24. 01 May, 2019 2 commits
    • John Ericson's avatar
      Move cGHC_UNLIT_PGM to be "unlit command" in settings · 2988ef5e
      John Ericson authored
      The bulk of the work was done in #712, making settings be make/Hadrian
      controlled. This commit then just moves the unlit command rules in
      make/Hadrian from the `Config.hs` generator to the `settings` generator
      in each build system.
      
      I think this is a good change because the crucial benefit is *settings*
      don't affect the build: ghc gets one baby step closer to being a regular
      cabal executable, and make/Hadrian just maintains settings as part of
      bootstrapping.
      2988ef5e
    • John Ericson's avatar
      Generate settings by make/hadrian instead of configure · d37d91e9
      John Ericson authored
      This allows it to eventually become stage-specific
      d37d91e9
  25. 25 Apr, 2019 1 commit
  26. 11 Apr, 2019 1 commit
    • Carter Schonwald's avatar
      removing x87 register support from native code gen · 42504f4a
      Carter Schonwald authored
      * simplifies registers to have GPR, Float and Double, by removing the SSE2 and X87 Constructors
      * makes -msse2 assumed/default for x86 platforms, fixing a long standing nondeterminism in rounding
      behavior in 32bit haskell code
      * removes the 80bit floating point representation from the supported float sizes
      * theres still 1 tiny bit of x87 support needed,
      for handling float and double return values in FFI calls  wrt the C ABI on x86_32,
      but this one piece does not leak into the rest of NCG.
      * Lots of code thats not been touched in a long time got deleted as a
      consequence of all of this
      
      all in all, this change paves the way towards a lot of future further
      improvements in how GHC handles floating point computations, along with
      making the native code gen more accessible to a larger pool of contributors.
      42504f4a
  27. 02 Apr, 2019 1 commit
    • Michal Terepeta's avatar
      Improve performance of newSmallArray# · 7cf5ba3d
      Michal Terepeta authored
      This:
      - Hoists part of the condition outside of the initialization loop in
        `stg_newSmallArrayzh`.
      - Annotates one of the unlikely branches as unlikely, also in
        `stg_newSmallArrayzh`.
      - Adds a couple of annotations to `allocateMightFail` indicating which
        branches are likely to be taken.
      
      Together this gives about 5% improvement.
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      7cf5ba3d
  28. 01 Apr, 2019 1 commit
  29. 25 Mar, 2019 1 commit
    • Takenobu Tani's avatar
      Update Wiki URLs to point to GitLab · 3769e3a8
      Takenobu Tani authored
      This moves all URL references to Trac Wiki to their corresponding
      GitLab counterparts.
      
      This substitution is classified as follows:
      
      1. Automated substitution using sed with Ben's mapping rule [1]
          Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...
          New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...
      
      2. Manual substitution for URLs containing `#` index
          Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...#Zzz
          New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...#zzz
      
      3. Manual substitution for strings starting with `Commentary`
          Old: Commentary/XxxYyy...
          New: commentary/xxx-yyy...
      
      See also !539
      
      [1]: https://gitlab.haskell.org/bgamari/gitlab-migration/blob/master/wiki-mapping.json
      3769e3a8
  30. 21 Mar, 2019 1 commit
  31. 17 Mar, 2019 1 commit
    • Ben Gamari's avatar
      ghc-heap: Introduce closureSize · cb61371e
      Ben Gamari authored
      This function allows the user to compute the (non-transitive) size of a
      heap object in words. The "closure" in the name is admittedly confusing
      but we are stuck with this nomenclature at this point.
      cb61371e
  32. 15 Mar, 2019 2 commits
    • Peter Trommler's avatar
      PPC NCG: Use liveness information in CmmCall · 83e09d3c
      Peter Trommler authored
      We make liveness information for global registers
      available on `JMP` and `BCTR`, which were the last instructions
      missing. With complete liveness information we do not need to
      reserve global registers in `freeReg` anymore. Moreover we
      assign R9 and R10 to callee saves registers.
      
      Cleanup by removing `Reg_Su`, which was unused, from `freeReg`
      and removing unused register definitions.
      
      The calculation of the number of floating point registers is too
      conservative. Just follow X86 and specify the constants directly.
      
      Overall on PowerPC this results in 0.3 % smaller code size in nofib
      while runtime is slightly better in some tests.
      83e09d3c
    • Ryan Scott's avatar
      Update Trac ticket URLs to point to GitLab · 610ec224
      Ryan Scott authored
      This moves all URL references to Trac tickets to their corresponding
      GitLab counterparts.
      610ec224
  33. 30 Jan, 2019 3 commits
    • Zejun Wu's avatar
      Add a RTS option -xp to load PIC object anywhere in address space · e29b1ee7
      Zejun Wu authored
      Summary:
      This re-applies {D5195} with fixes for i386:
      * Fix unused label warnings, see {D5230} or {D5273}
      * Fix a silly bug introduced by moving `#if`
      
      {P190}
      
      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:
      See {D5195}, also test under i386:
      
      ```
      $ uname -a
      Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
      20:45:30 CEST 2018 i686 GNU/Linux
      $ cd testsuite/tests/th/ && make test
      ...
      ```
      
      will run `./validate` on stacked diff.
      
      Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5289
      e29b1ee7
    • Ben Gamari's avatar
      Revert "Batch merge" · 172a5933
      Ben Gamari authored
      This reverts commit 76c8fd67.
      172a5933
    • Ben Gamari's avatar
      Batch merge · 76c8fd67
      Ben Gamari authored
      76c8fd67
  34. 16 Jan, 2019 1 commit