Skip to content
Snippets Groups Projects
  1. May 22, 2020
  2. May 21, 2020
    • Sylvain Henry's avatar
      Move isDynLinkName into GHC.Types.Name · 566cc73f
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      It doesn't belong into GHC.Unit.State
      566cc73f
    • Krzysztof Gogolewski's avatar
      Sort deterministically metric output · 8a816e5f
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Previously, we sorted according to the test name and way,
      but the metrics (max_bytes_used/peak_megabytes_allocated etc.)
      were appearing in nondeterministic order.
      8a816e5f
    • Krzysztof Gogolewski's avatar
      Add a regression test for #11506 · a1275081
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      The testcase works now.
      See explanation in ghc/ghc#11506 (comment 273202)
      a1275081
    • Andreas Klebinger's avatar
      Don't variable-length encode magic iface constant. · 4ca0c8a1
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      We changed to use variable length encodings for many types by default,
      including Word32. This makes sense for numbers but not when Word32 is
      meant to represent four bytes.
      
      I added a FixedLengthEncoding newtype to Binary who's instances
      interpret their argument as a collection of bytes instead of a number.
      
      We then use this when writing/reading magic numbers to the iface file.
      
      I also took the libery to remove the dummy iface field.
      
      This fixes #18180.
      4ca0c8a1
    • Alexey Kuleshevich's avatar
      Fix wording in primops documentation to reflect the correct reasoning: · 1b508a9e
      Alexey Kuleshevich authored and Marge Bot's avatar Marge Bot committed
      * Besides resizing functions, shrinking ones also mutate the
        size of a mutable array and because of those two `sizeofMutabeByteArray`
        and `sizeofSmallMutableArray` are now deprecated
      * Change reference in documentation to the newer functions `getSizeof*`
        instead of `sizeof*` for shrinking functions
      * Fix incorrect mention of "byte" instead of "small"
      1b508a9e
    • Galen Huntington's avatar
      Clarify pitfalls of NegativeLiterals; see #18022. · d3d055b8
      Galen Huntington authored and Marge Bot's avatar Marge Bot committed
      d3d055b8
    • Sebastian Graf's avatar
      Make `Int`'s `mod` and `rem` strict in their first arguments · a95bbd0b
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      They used to be strict until 4d2ac2d4 (9 years ago).
      
      It's obviously better to be strict for performance reasons.
      It also blocks #18067.
      
      NoFib results:
      
      ```
      --------------------------------------------------------------------------------
              Program         Allocs    Instrs
      --------------------------------------------------------------------------------
              integer          -1.1%     +0.4%
         wheel-sieve2         +21.2%    +20.7%
      --------------------------------------------------------------------------------
                  Min          -1.1%     -0.0%
                  Max         +21.2%    +20.7%
       Geometric Mean          +0.2%     +0.2%
      ```
      
      The regression in `wheel-sieve2` is due to reboxing that likely will go
      away with the resolution of #18067. See !3282 for details.
      
      Fixes #18187.
      a95bbd0b
    • Richard Eisenberg's avatar
      MR template should ask for key part · 2b363ebb
      Richard Eisenberg authored and Marge Bot's avatar Marge Bot committed
      2b363ebb
    • Vilem-Benjamin Liepelt's avatar
      Document INLINE(ABLE) pragmas that enable fusion · 892b0c41
      Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
      892b0c41
    • Vilem-Benjamin Liepelt's avatar
      Piggyback on Enum Word methods for Word64 · e7480063
      Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
      If we are on a 64 bit platform, we can use the efficient Enum Word
      methods for the Enum Word64 instance.
      e7480063
    • Vilem-Benjamin Liepelt's avatar
      Add INLINABLE pragmas to Enum list producers · b552e531
      Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
      The INLINABLE pragmas ensure that we export stable (unoptimised) unfoldings in
      the interface file so we can do list fusion at usage sites.
      
      Related tickets: #15185, #8763, #18178.
      b552e531
    • Vilem-Benjamin Liepelt's avatar
      Fix spelling mistakes and typos · 3451584f
      Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
      3451584f
    • John Ericson's avatar
      Use braces with do in `SplicePat` case for consistency · 6890c38d
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      6890c38d
    • John Ericson's avatar
      Tiny cleaup eta-reduce away a function argument · cb4231db
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      In GHC, not in the code being compiled!
      cb4231db
    • John Ericson's avatar
      Put `PatEnv` first in `GHC.Tc.Gen.Pat.Checker` · 510e0451
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      510e0451
    • John Ericson's avatar
      More judiciously panic in `ts_pat` · 5108e84a
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      5108e84a
    • John Ericson's avatar
      Use `Checker` for `tc_lpat` and `tc_lpats` · b797aa42
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      b797aa42
    • John Ericson's avatar
      Use `Checker` for `tc_pat` · 964d3ea2
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      964d3ea2
    • Tuan Le's avatar
      llvmGen: Consider Relocatable read-only data as not constantReferences: #18137 · 0004ccb8
      Tuan Le authored and Marge Bot's avatar Marge Bot committed
      0004ccb8
    • Stefan Holdermans's avatar
      Update documentation for GHCi :script · cf566330
      Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
      This patch adds the fixes that allow for file names containing spaces to
      be passed to GHCi's ':script' command to the release notes for 8.12 and
      expands the user-guide documentation for ':script' by mentioning how
      such file names can be passed.
      
      Related to #18027.
      cf566330
    • Stefan Holdermans's avatar
      Allow GHCi :script file names in double quotes · a0b79e1b
      Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
      This patch updates the user interface of GHCi so that file names passed
      to the ':script' command can be wrapped in double quotes.
      
      For example:
      
        :script "foo bar.script"
      
      The implementation uses a modified version of 'words' that treats
      character sequences enclosed in double quotes as single words.
      
      Fixes #18027.
      a0b79e1b
    • Stefan Holdermans's avatar
      Add extra tests for GHCi :script syntax checks · 82663959
      Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
      The syntax for GHCi's ":script" command allows for only a single file
      name to be passed as an argument. This patch adds a test for the cases
      in which a file name is missing or multiple file names are passed.
      
      Related to #T18027.
      82663959
    • Stefan Holdermans's avatar
      Allow spaces in GHCi :script file names · a8c27cf6
      Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
      This patch updates the user interface of GHCi so that file names passed
      to the ':script' command may contain spaces escaped with a backslash.
      
      For example:
      
        :script foo\ bar.script
      
      The implementation uses a modified version of 'words' that does not
      break on escaped spaces.
      
      Fixes #18027.
      a8c27cf6
    • Gleb Popov's avatar
      gitlab-ci: Set locale to C.UTF-8. · b7a6b2f4
      Gleb Popov authored and Marge Bot's avatar Marge Bot committed
      b7a6b2f4
    • Andreas Klebinger's avatar
      NCG: Codelayout: Distinguish conditional and other branches. · edc2cc58
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      In #18053 we ended up with a suboptimal code layout because
      the code layout algorithm didn't distinguish between conditional
      and unconditional control flow.
      
      We can completely eliminate unconditional control flow instructions
      by placing blocks next to each other, not so much for conditionals.
      
      In terms of implementation we simply give conditional branches less
      weight before computing the layout.
      
      Fixes #18053
      edc2cc58
    • Andreas Klebinger's avatar
      Refactor linear reg alloc to remember past assignments. · 13f6c9d0
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      When assigning registers we now first try registers we
      assigned to in the past, instead of picking the "first"
      one.
      
      This is in extremely helpful when dealing with loops for
      which variables are dead for part of the loop.
      
      This is important for patterns like this:
      
              foo = arg1
          loop:
              use(foo)
              ...
              foo = getVal()
              goto loop;
      
      There we:
      * assign foo to the register of arg1.
      * use foo, it's dead after this use as it's overwritten after.
      * do other things.
      * look for a register to put foo in.
      
      If we pick an arbitrary one it might differ from the register the
      start of the loop expect's foo to be in.
      To fix this we simply look for past register assignments for
      the given variable. If we find one and the register is free we
      use that register.
      
      This reduces the need for fixup blocks which match the register
      assignment between blocks. In the example above between the end
      and the head of the loop.
      
      This patch also moves branch weight estimation ahead of register
      allocation and adds a flag to control it (cmm-static-pred).
      * It means the linear allocator is more likely to assign the hotter
        code paths first.
      * If it assign these first we are:
        + Less likely to spill on the hot path.
        + Less likely to introduce fixup blocks on the hot path.
      
      These two measure combined are surprisingly effective. Based on nofib
      we get in the mean:
      
      * -0.9% instructions executed
      * -0.1% reads/writes
      * -0.2% code size.
      * -0.1% compiler allocations.
      * -0.9% compile time.
      * -0.8% runtime.
      
      Most of the benefits are simply a result of removing redundant moves
      and spills.
      
      Reduced compiler allocations likely are the result of less code being
      generated. (The added lookup is mostly non-allocating).
      13f6c9d0
    • Ben Gamari's avatar
      nonmoving: Optimise the write barrier · 78c6523c
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      78c6523c
    • Ben Price's avatar
      Lint should say when it is checking a rule · 24e61aad
      Ben Price authored and Marge Bot's avatar Marge Bot committed
      It is rather confusing that when lint finds an error in a rule attached
      to a binder, it reports the error as in the RHS, not the rule:
        ...
        In the RHS of foo
      
      We add a clarifying line:
        ...
        In the RHS of foo
        In a rule attached to foo
      
      The implication that the rule lives inside the RHS is a bit odd, but
      this niggle is already present for unfoldings, whose pattern we are
      following.
      24e61aad
    • Gert-Jan Bottu's avatar
      Explicit Specificity · a9311cd5
      Gert-Jan Bottu authored and Marge Bot's avatar Marge Bot committed
      Implementation for Ticket #16393.
      Explicit specificity allows users to manually create inferred type variables,
      by marking them with braces.
      This way, the user determines which variables can be instantiated through
      visible type application.
      
      The additional syntax is included in the parser, allowing users to write
      braces in type variable binders (type signatures, data constructors etc).
      This information is passed along through the renamer and verified in the
      type checker.
      The AST for type variable binders, data constructors, pattern synonyms,
      partial signatures and Template Haskell has been updated to include the
      specificity of type variables.
      
      Minor notes:
      - Bumps haddock submodule
      - Disables pattern match checking in GHC.Iface.Type with GHC 8.8
      a9311cd5
    • Fumiaki Kinoshita's avatar
      base: Add Generic instances to various datatypes under GHC.* · 55f0e783
      Fumiaki Kinoshita authored and Marge Bot's avatar Marge Bot committed
      * GHC.Fingerprint.Types: Fingerprint
      * GHC.RTS.Flags: GiveGCStats, GCFlags, ConcFlags, DebugFlags, CCFlags, DoHeapProfile, ProfFlags, DoTrace, TraceFlags, TickyFlags, ParFlags and RTSFlags
      * GHC.Stats: RTSStats and GCStats
      * GHC.ByteOrder: ByteOrder
      * GHC.Unicode: GeneralCategory
      * GHC.Stack.Types: SrcLoc
      
      Metric Increase:
          haddock.base
      55f0e783
  3. May 17, 2020
    • Ryan Scott's avatar
      Remove duplicate Note [When to print foralls] in GHC.Core.TyCo.Ppr · 5bcf8606
      Ryan Scott authored
      There are two different Notes named `[When to print foralls]`. The
      most up-to-date one is in `GHC.Iface.Type`, but there is a second
      one in `GHC.Core.TyCo.Ppr`. The latter is less up-to-date, as it was
      written before GHC switched over to using ifaces to pretty-print
      types. I decided to just remove the latter and replace it with a
      reference to the former.
      
      [ci skip]
      5bcf8606
  4. May 15, 2020
    • Ben Gamari's avatar
      GHC.Cmm.Opt: Handle MO_XX_Conv · 568d7279
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      This MachOp was introduced by 2c959a18
      but a wildcard match in cmmMachOpFoldM hid the fact that it wasn't
      handled. Ideally we would eliminate the match but this appears to be a
      larger task.
      
      Fixes #18141.
      568d7279
    • Sebastian Graf's avatar
      DmdAnal: Improve handling of precise exceptions · 9bd20e83
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      This patch does two things: Fix possible unsoundness in what was called
      the "IO hack" and implement part 2.1 of the "fixing precise exceptions"
      plan in
      https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions,
      which, in combination with !2956, supersedes !3014 and !2525.
      
      **IO hack**
      
      The "IO hack" (which is a fallback to preserve precise exceptions
      semantics and thus soundness, rather than some smart thing that
      increases precision) is called `exprMayThrowPreciseException` now.
      I came up with two testcases exemplifying possible unsoundness (if
      twisted enough) in the old approach:
      
      - `T13380d`: Demonstrating unsoundness of the "IO hack" when resorting
                   to manual state token threading and direct use of primops.
                   More details below.
      - `T13380e`: Demonstrating unsoundness of the "IO hack" when we have
                   Nested CPR. Not currently relevant, as we don't have Nested
                   CPR yet.
      - `T13380f`: Demonstrating unsoundness of the "IO hack" for safe FFI
                   calls.
      
      Basically, the IO hack assumed that precise exceptions can only be
      thrown from a case scrutinee of type `(# State# RealWorld, _ #)`. I
      couldn't come up with a program using the `IO` abstraction that violates
      this assumption. But it's easy to do so via manual state token threading
      and direct use of primops, see `T13380d`. Also similar code might be
      generated by Nested CPR in the (hopefully not too) distant future, see
      `T13380e`. Hence, we now have a more careful test in `forcesRealWorld`
      that passes `T13380{d,e}` (and will hopefully be robust to Nested CPR).
      
      **Precise exceptions**
      
      In #13380 and #17676 we saw that we didn't preserve precise exception
      semantics in demand analysis. We fixed that with minimal changes in
      !2956, but that was terribly unprincipled.
      
      That unprincipledness resulted in a loss of precision, which is tracked
      by these new test cases:
      
      - `T13380b`: Regression in dead code elimination, because !2956 was too
                   syntactic about `raiseIO#`
      - `T13380c`: No need to apply the "IO hack" when the IO action may not
                   throw a precise exception (and the existing IO hack doesn't
                   detect that)
      
      Fixing both issues in !3014 turned out to be too complicated and had
      the potential to regress in the future. Hence we decided to only fix
      `T13380b` and augment the `Divergence` lattice with a new middle-layer
      element, `ExnOrDiv`, which means either `Diverges` (, throws an
      imprecise exception) or throws a *precise* exception.
      
      See the wiki page on Step 2.1 for more implementational details:
      https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions#dead-code-elimination-for-raiseio-with-isdeadenddiv-introducing-exnordiv-step-21
      9bd20e83
  5. May 14, 2020
    • Ben Gamari's avatar
      e9c0110c
    • Simon Jakobi's avatar
      Use Data.IntMap.disjoint · 477f13bb
      Simon Jakobi authored and Marge Bot's avatar Marge Bot committed
      Data.IntMap gained a dedicated `disjoint` function in containers-0.6.2.1.
      
      This patch applies this function where appropriate in hopes of modest
      compiler performance improvements.
      
      Closes #16806.
      477f13bb
    • Simon Jakobi's avatar
      Improve some folds over Uniq[D]FM · c05c0659
      Simon Jakobi authored and Marge Bot's avatar Marge Bot committed
      * Replace some non-deterministic lazy folds with
        strict folds.
      * Replace some O(n log n) folds in deterministic order
        with O(n) non-deterministic folds.
      * Replace some folds with set-operations on the underlying
        IntMaps.
      
      This reduces max residency when compiling
      `nofib/spectral/simple/Main.hs` with -O0 by about 1%.
      
      Maximum residency when compiling Cabal also seems reduced on the
      order of 3-9%.
      c05c0659
Loading