<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>



<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<h3>
Simon Peyton Jones pushed to branch wip/T18449
at <a href="https://gitlab.haskell.org/ghc/ghc">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/9ad072b487fe528947f817b0417933a6cd1941b7">9ad072b4</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Use dumpStyle when printing inlinings

This just makes debug-printing consistent,
and more informative.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/e78c4efb8735eb97f17e7b4ca35e305b0766f78a">e78c4efb</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Comments only
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/7ccb760b1a8034b28171d7540712fd195f65d1fd">7ccb760b</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Reduce result discount in conSize

Ticket #18282 showed that the result discount given by conSize
was massively too large.  This patch reduces that discount to
a constant 10, which just balances the cost of the constructor
application itself.

Note [Constructor size and result discount] elaborates, as
does the ticket #18282.

Reducing result discount reduces inlining, which affects perf.  I
found that I could increase the unfoldingUseThrehold from 80 to 90 in
compensation; in combination with the result discount change I get
these overall nofib numbers:

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
          boyer          -0.2%     +5.4%     -3.2%     -3.4%      0.0%
       cichelli          -0.1%     +5.9%    -11.2%    -11.7%      0.0%
      compress2          -0.2%     +9.6%     -6.0%     -6.8%      0.0%
   cryptarithm2          -0.1%     -3.9%     -6.0%     -5.7%      0.0%
         gamteb          -0.2%     +2.6%    -13.8%    -14.4%      0.0%
         genfft          -0.1%     -1.6%    -29.5%    -29.9%      0.0%
             gg          -0.0%     -2.2%    -17.2%    -17.8%    -20.0%
           life          -0.1%     -2.2%    -62.3%    -63.4%      0.0%
           mate          +0.0%     +1.4%     -5.1%     -5.1%    -14.3%
         parser          -0.2%     -2.1%     +7.4%     +6.7%      0.0%
      primetest          -0.2%    -12.8%    -14.3%    -14.2%      0.0%
         puzzle          -0.2%     +2.1%    -10.0%    -10.4%      0.0%
            rsa          -0.2%    -11.7%     -3.7%     -3.8%      0.0%
         simple          -0.2%     +2.8%    -36.7%    -38.3%     -2.2%
   wheel-sieve2          -0.1%    -19.2%    -48.8%    -49.2%    -42.9%
--------------------------------------------------------------------------------
            Min          -0.4%    -19.2%    -62.3%    -63.4%    -42.9%
            Max          +0.3%     +9.6%     +7.4%    +11.0%    +16.7%
 Geometric Mean          -0.1%     -0.3%    -17.6%    -18.0%     -0.7%

I'm ok with these numbers, remembering that this change removes
an *exponential* increase in code size in some in-the-wild cases.

I investigated compress2.  The difference is entirely caused by this
function no longer inlining

WriteRoutines.$woutputCodes
  = \ (w :: [CodeEvent]) ->
      let result_s1Sr
            = case WriteRoutines.outputCodes_$s$woutput w 0# 0# 8# 9# of
                (# ww1, ww2 #) -> (ww1, ww2)
      in (# case result_s1Sr of (x, _) ->
              map @Int @Char WriteRoutines.outputCodes1 x
         , case result_s1Sr of { (_, y) -> y } #)

It was right on the cusp before, driven by the excessive result
discount.  Too bad!

Happily, the compiler/perf tests show a number of improvements:
    T12227     compiler bytes-alloc  -6.6%
    T12545     compiler bytes-alloc  -4.7%
    T13056     compiler bytes-alloc  -3.3%
    T15263     runtime  bytes-alloc -13.1%
    T17499     runtime  bytes-alloc -14.3%
    T3294      compiler bytes-alloc  -1.1%
    T5030      compiler bytes-alloc -11.7%
    T9872a     compiler bytes-alloc  -2.0%
    T9872b     compiler bytes-alloc  -1.2%
    T9872c     compiler bytes-alloc  -1.5%

Metric Decrease:
    T12227
    T12545
    T13056
    T15263
    T17499
    T3294
    T5030
    T9872a
    T9872b
    T9872c
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/7f0b671ee8a65913891c07f157b21d77d6c63036">7f0b671e</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite: Widen acceptance threshold on T5837

This test is positively tiny and consequently the bytes allocated
measurement will be relatively noisy. Consequently I have seen this
fail spuriously quite often.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/118e1c3da622f17c67b4e0fbc12ed7c7084055dc">118e1c3d</a></strong>
<div>
<span>by Alp Mestanogullari</span>
<i>at 2020-07-14T21:30:52-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">compiler: re-engineer the treatment of rebindable if

Executing on the plan described in #17582, this patch changes the way if expressions
are handled in the compiler in the presence of rebindable syntax. We get rid of the
SyntaxExpr field of HsIf and instead, when rebindable syntax is on, we rewrite the HsIf
node to the appropriate sequence of applications of the local `ifThenElse` function.

In order to be able to report good error messages, with expressions as they were
written by the user (and not as desugared by the renamer), we make use of TTG
extensions to extend GhcRn expression ASTs with an `HsExpansion` construct, which
keeps track of a source (GhcPs) expression and the desugared (GhcRn) expression that
it gives rise to. This way, we can typecheck the latter while reporting the former in
error messages.

In order to discard the error context lines that arise from typechecking the desugared
expressions (because they talk about expressions that the user has not written), we
carefully give a special treatment to the nodes fabricated by this new renaming-time
transformation when typechecking them. See Note [Rebindable syntax and HsExpansion]
for more details. The note also includes a recipe to apply the same treatment to
other rebindable constructs.

Tests 'rebindable11' and 'rebindable12' have been added to make sure we report
identical error messages as before this patch under various circumstances.

We also now disable rebindable syntax when processing untyped TH quotes, as per
the discussion in #18102 and document the interaction of rebindable syntax and
Template Haskell, both in Note [Template Haskell quotes and Rebindable Syntax]
and in the user guide, adding a test to make sure that we do not regress in
that regard.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/64c774b043a2d9be3b98e445990c795f070dab3f">64c774b0</a></strong>
<div>
<span>by Andreas Klebinger</span>
<i>at 2020-07-14T21:31:27-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Explain why keeping DynFlags in AnalEnv saves allocation.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/254245d01e3c1d4f9072abc4372fd3fb0a6ece9f">254245d0</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2020-07-14T21:32:03-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">docs/users-guide: Update default -funfolding-use-threshold value

This was changed in 3d2991f8 but I neglected to update the
documentation. Fixes #18419.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/4c259f86938f4016f4bd4fde7a300fa83591036f">4c259f86</a></strong>
<div>
<span>by Andreas Klebinger</span>
<i>at 2020-07-14T21:32:41-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Escape backslashes in json profiling reports properly.

I also took the liberty to do away the fixed buffer size for escaping.
Using a fixed size here can only lead to issues down the line.

Fixes #18438.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/2379722438cb551210c4899119ade05989c17166">23797224</a></strong>
<div>
<span>by Sergei Trofimovich</span>
<i>at 2020-07-14T21:33:19-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">.gitlab: re-enable integer-simple substitute (BIGNUM_BACKEND)

Recently build system migrated from INTEGER_LIBRARY to BIGNUM_BACKEND.
But gitlab CI was never updated. Let's enable BIGNUM_BACKEND=native.

Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/e0db878a789e58c2a1aba2e73d42857008174124">e0db878a</a></strong>
<div>
<span>by Sergei Trofimovich</span>
<i>at 2020-07-14T21:33:19-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">ghc-bignum: bring in sync .hs-boot files with module declarations

Before this change `BIGNUM_BACKEND=native` build was failing as:

```
libraries/ghc-bignum/src/GHC/Num/BigNat/Native.hs:708:16: error:
    * Variable not in scope: naturalFromBigNat# :: WordArray# -> t
    * Perhaps you meant one of these:
        `naturalFromBigNat' (imported from GHC.Num.Natural),
        `naturalToBigNat' (imported from GHC.Num.Natural)
    |
708 |           m' = naturalFromBigNat# m
    |
```

This happens because `.hs-boot` files are slightly out of date.
This change brings in data and function types in sync.

Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/c9f65c369a60467dcaf2b37d5f41f00565b4fe25">c9f65c36</a></strong>
<div>
<span>by Stefan Schulze Frielinghaus</span>
<i>at 2020-07-14T21:33:57-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/Disassembler.c: Use FMT_HexWord for printing values in hex format
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/58ae62ebb5750e4dfbdb171efde8e3064b7afea8">58ae62eb</a></strong>
<div>
<span>by Matthias Andreas Benkard</span>
<i>at 2020-07-14T21:34:35-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">macOS: Load frameworks without stating them first.

macOS Big Sur makes the following change to how frameworks are shipped
with the OS:

> New in macOS Big Sur 11 beta, the system ships with a built-in
> dynamic linker cache of all system-provided libraries. As part of
> this change, copies of dynamic libraries are no longer present on
> the filesystem. Code that attempts to check for dynamic library
> presence by looking for a file at a path or enumerating a directory
> will fail. Instead, check for library presence by attempting to
> dlopen() the path, which will correctly check for the library in the
> cache. (62986286)

https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes/

Therefore, the previous method of checking whether a library exists
before attempting to load it makes GHC.Runtime.Linker.loadFramework
fail to find frameworks installed at /System/Library/Frameworks.

GHC.Runtime.Linker.loadFramework now opportunistically loads the
framework libraries without checking for their existence first,
failing only if all attempts to load a given framework from any of the
various possible locations fail.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/cdc4a6b0f71bbd16a11f23e455b28c0c15720b38">cdc4a6b0</a></strong>
<div>
<span>by Matthias Andreas Benkard</span>
<i>at 2020-07-14T21:34:35-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">loadFramework: Output the errors collected in all loading attempts.

With the recent change away from first finding and then loading a
framework, loadFramework had no way of communicating the real reason
why loadDLL failed if it was any reason other than the framework
missing from the file system.  It now collects all loading attempt
errors into a list and concatenates them into a string to return to
the caller.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/51dbfa52df483822b99bb191d2ffc0943954e1d3">51dbfa52</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2020-07-15T04:05:34-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">StgToCmm: Use CmmRegOff smart constructor

Previously we would generate expressions of the form
`CmmRegOff BaseReg 0`. This should do no harm (and really should be
handled by the NCG anyways) but it's better to just generate a plain
`CmmReg`.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/ae11bdfd98a10266bfc7de9e16b500be220307ac">ae11bdfd</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2020-07-15T04:06:08-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite: Add regression test for #17744

Test due to @monoidal.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/45af3f080462c297eb3c186303040e21a880d2d2">45af3f08</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-16T15:27:20+01:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Refactor the simplification of join binders

This MR (for #18449) refactors the Simplifier's treatment
of join-point binders.

Specifically, it puts together, into
     GHC.Core.Opt.Simplify.Env.adjustJoinPointType
two currently-separate ways in which we adjust the type of
a join point. As the comment says:

-- (adjustJoinPointType mult new_res_ty join_id) does two things:
--
--   1. Set the return type of the join_id to new_res_ty
--      See Note [Return type for join points]
--
--   2. Adjust the multiplicity of arrows in join_id's type, as
--      directed by 'mult'. See Note [Scaling join point arguments]

I think this actually fixes a latent bug, by ensuring that the
seIdSubst and seInScope have the right multiplicity on the type
of join points.

I did some tidying up while I was at it.  No more
setJoinResTy, or modifyJoinResTy: instead it's done locally in
Simplify.Env.adjustJoinPointType
</pre>
</li>
</ul>
<h4>30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#587d266bb27a4dc3022bbed44dfa19849df3044c">
.gitlab-ci.yml
</a>
</li>
<li class="file-stats">
<a href="#157f7634c25bc6366cb7c9c9edb48e819dce38db">
.gitlab/ci.sh
</a>
</li>
<li class="file-stats">
<a href="#5f4b3cf094f6e2fc46805a6c447613ae13a08942">
<span class="new-file">
+
compiler/GHC/Builtin/RebindableNames.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#182d6a315e784018aa9c8b2ad736036b97bd5d48">
compiler/GHC/Core.hs
</a>
</li>
<li class="file-stats">
<a href="#8104fa1b71db6cfc4eb90cd769463d9eb9004619">
compiler/GHC/Core/Opt/DmdAnal.hs
</a>
</li>
<li class="file-stats">
<a href="#f168a93cde5e2aec2441d6331dfe500172df4af3">
compiler/GHC/Core/Opt/Simplify.hs
</a>
</li>
<li class="file-stats">
<a href="#2f46b19cb85e3f7b4e72305644bc50015628c41d">
compiler/GHC/Core/Opt/Simplify/Env.hs
</a>
</li>
<li class="file-stats">
<a href="#84c9d3ba34173297e7d7747e02caa2e004b164fc">
compiler/GHC/Core/Type.hs
</a>
</li>
<li class="file-stats">
<a href="#2811a7297b8aa206197ac1f5dabd0818e3c7ec5a">
compiler/GHC/Core/Unfold.hs
</a>
</li>
<li class="file-stats">
<a href="#774d88050336ef660c7a219fb06c480c2fc639bc">
compiler/GHC/Driver/Session.hs
</a>
</li>
<li class="file-stats">
<a href="#cc97d81e7223ad4a3a5e801156ca632f9fa75654">
compiler/GHC/Hs/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#9f00edfedb0f969865b049a78de3866545b4a60b">
compiler/GHC/Hs/Instances.hs
</a>
</li>
<li class="file-stats">
<a href="#7a1af22e4c32b9aa6ec708d9d3788e1c4db5da9a">
compiler/GHC/Hs/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#e011edcbdb6414ff00022ab5c1eeee88906a53ab">
compiler/GHC/HsToCore/Coverage.hs
</a>
</li>
<li class="file-stats">
<a href="#6bdd5abc649727f2a802bc96ce5c276de19d3726">
compiler/GHC/HsToCore/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#085703923f9c18f6ac9f926ac9a4c7c7e6d9d9ed">
compiler/GHC/HsToCore/Match.hs
</a>
</li>
<li class="file-stats">
<a href="#3c19c0be465f9a28d7b69f89c55648080fcc37eb">
compiler/GHC/HsToCore/Quote.hs
</a>
</li>
<li class="file-stats">
<a href="#649144a78135a23cabfc90dd83c4aabf448eb6ab">
compiler/GHC/Iface/Ext/Ast.hs
</a>
</li>
<li class="file-stats">
<a href="#86d694037d496c511e28b2c09c8410f67dc19596">
compiler/GHC/Rename/Env.hs
</a>
</li>
<li class="file-stats">
<a href="#b47ece2bbb8303a5792c2fdc52394c8ed336e8a2">
compiler/GHC/Rename/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#16b273b96a1c03d4261e2ac6de4cc456ba2dd014">
compiler/GHC/Rename/Splice.hs
</a>
</li>
<li class="file-stats">
<a href="#3556223cd3ef45d787321b5290bf33535a361873">
compiler/GHC/Runtime/Linker.hs
</a>
</li>
<li class="file-stats">
<a href="#a7fcc734b34b00498cf1eb5792d2f328ca3696ea">
compiler/GHC/StgToCmm/CgUtils.hs
</a>
</li>
<li class="file-stats">
<a href="#902811828741e6bcd64702935bbb54edbbd070ef">
compiler/GHC/Tc/Gen/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#81707f1fe21087531cefd70879aa09c2be5c1d22">
compiler/GHC/Tc/Solver/Flatten.hs
</a>
</li>
<li class="file-stats">
<a href="#7dcf5b567a6cd3c9d98cf8d57323fbca1b1536e9">
compiler/GHC/Tc/Types.hs
</a>
</li>
<li class="file-stats">
<a href="#93bba9b9e0195db135fec54160523a427ea042fd">
compiler/GHC/Tc/Types/Origin.hs
</a>
</li>
<li class="file-stats">
<a href="#c6e4263ee64c68e57b7525127d98243fce38b1ea">
compiler/GHC/Tc/Utils/Monad.hs
</a>
</li>
<li class="file-stats">
<a href="#6a120b0673f8920127d8fffdaa16f01b90cc92d7">
compiler/GHC/Tc/Utils/Zonk.hs
</a>
</li>
<li class="file-stats">
<a href="#9b5f1671f007d547cf3b5ec40babeafdffb99b1a">
compiler/GHC/Types/SrcLoc.hs
</a>
</li>
</ul>
<h5>The diff was not included because it is too large.</h5>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/compare/f956dd21af022123e43fa8cd74f15a715c65a93a...45af3f080462c297eb3c186303040e21a880d2d2">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.haskell.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.



</p>
</div>
</body>
</html>