[Git][ghc/ghc][wip/expansions-appdo] 56 commits: Suppresses spurious warnings generated for do-body statements that

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Mon May 27 05:06:49 UTC 2024



Apoorv Ingle pushed to branch wip/expansions-appdo at Glasgow Haskell Compiler / GHC


Commits:
39794569 by Apoorv Ingle at 2024-04-18T16:07:22-05:00
Suppresses spurious warnings generated for do-body statements that
in really do not discard anything. This improves usability of RebindableSyntax and Qualified Do.

Fixes: #8671

- - - - -
ceee05f8 by Matthew Pickering at 2024-05-27T00:06:07-05:00
testsuite: Rename isCross() predicate to needsTargetWrapper()

isCross() was a misnamed because it assumed that all cross targets would
provide a target wrapper, but the two most common cross targets
(javascript, wasm) don't need a target wrapper.

Therefore we rename this predicate to `needsTargetWrapper()` so
situations in the testsuite where we can check whether running
executables requires a target wrapper or not.

- - - - -
06302be9 by Simon Peyton Jones at 2024-05-27T00:06:07-05:00
Do not float HNFs out of lambdas

This MR adjusts SetLevels so that it is less eager to float a
HNF (lambda or constructor application) out of a lambda, unless
it gets to top level.

Data suggests that this change is a small net win:
 * nofib bytes-allocated falls by -0.09% (but a couple go up)
 * perf/should_compile bytes-allocated falls by -0.5%
 * perf/should_run bytes-allocated falls by -0.1%
See !12410 for more detail.

When fiddling elsewhere, I also found that this patch had a huge
positive effect on the (very delicate) test
  perf/should_run/T21839r
But that improvement doesn't show up in this MR by itself.

Metric Decrease:
    MultiLayerModulesRecomp
    T15703
    parsing001

- - - - -
5f677db9 by Alan Zimmerman at 2024-05-27T00:06:07-05:00
EPA: Fix comments in mkListSyntaxTy0

Also extend the test to confirm.

Addresses #24669, 1 of 4

- - - - -
6838a72a by Serge S. Gulin at 2024-05-27T00:06:07-05:00
JS: set image `x86_64-linux-deb11-emsdk-closure` for build

- - - - -
e4d93a08 by Alan Zimmerman at 2024-05-27T00:06:07-05:00
EPA: Provide correct span for PatBind

And remove unused parameter in checkPatBind

Contributes to #24669

- - - - -
d444fda2 by Alan Zimmerman at 2024-05-27T00:06:08-05:00
EPA: Fix span for PatBuilderAppType

Include the location of the prefix @ in the span for InVisPat.

Also removes unnecessary annotations from HsTP.

Contributes to #24669

- - - - -
cd63f099 by Matthew Craven at 2024-05-27T00:06:08-05:00
testsuite: Give the pre_cmd for mhu-perf more time

- - - - -
bb04cbe7 by Krzysztof Gogolewski at 2024-05-27T00:06:08-05:00
Fix quantification order for a `op` b and a %m -> b

Fixes #23764

Implements https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0640-tyop-quantification-order.rst

Updates haddock submodule.

- - - - -
e23b52f6 by Sebastian Graf at 2024-05-27T00:06:08-05:00
Make `seq#` a magic Id and inline it in CorePrep (#24124)

We can save much code and explanation in Tag Inference and StgToCmm by making
`seq#` a known-key Magic Id in `GHC.Internal.IO` and inline this definition in
CorePrep. See the updated `Note [seq# magic]`.
I also implemented a new `Note [Flatten case-bind]` to get better code for
otherwise nested case scrutinees.

I renamed the contructors of `ArgInfo` to use an `AI` prefix in order to
resolve the clash between `type CpeApp = CoreExpr` and the data constructor of
`ArgInfo`, as well as fixed typos in `Note [CorePrep invariants]`.

Fixes #24252 and #24124.

- - - - -
dbb6fb99 by Jade at 2024-05-27T00:06:08-05:00
Put the newline after errors instead of before them

This mainly has consequences for GHCi but also slightly alters how the
output of GHC on the commandline looks.

Fixes: #22499

- - - - -
4548973c by Teo Camarasu at 2024-05-27T00:06:08-05:00
Remove unecessary stage0 packages

Historically quite a few packages had to be stage0 as they depended on
`template-haskell` and that was stage0. In #23536 we made it so that was
no longer the case. This allows us to remove a bunch of packages from
this list.

A few still remain. A new version of `Win32` is required by
`semaphore-compat`. Including `Win32` in the stage0 set requires also
including `filepath` because otherwise Hadrian's dependency logic gets
confused. Once our boot compiler has a newer version of `Win32` all of
these will be able to be dropped.

Resolves #24652

- - - - -
9c81f224 by Alan Zimmerman at 2024-05-27T00:06:08-05:00
EPA: Avoid duplicated comments in splice decls

Contributes to #24669

- - - - -
db533c12 by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: fix typos and namings (fixes #24602)

You may noted that I've also changed term of

```
, global "h$vt_double" ||= toJExpr IntV
```

See "IntV"

and

```
  WaitReadOp  -> \[] [fd] -> pure $ PRPrimCall $ returnS (app
"h$waidRead" [fd])
```

See "h$waidRead"

- - - - -
42aed43e by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: trivial checks for variable presence (fixes #24602)

- - - - -
27ed7e85 by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: fs module imported twice (by emscripten and by ghc-internal). ghc-internal import wrapped
in a closure to prevent conflict with emscripten (fixes #24602)

Better solution is to use some JavaScript module system like AMD, CommonJS or even UMD. It will be investigated at other issues.
At first glance we should try UMD (See https://github.com/umdjs/umd)

- - - - -
209f2770 by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: thread.js requires h$fds and h$fdReady to be declared for static code analysis, minimal
code copied from GHCJS (fixes #24602)

I've just copied some old pieces of GHCJS from publicly available sources (See https://github.com/Taneb/shims/blob/a6dd0202dcdb86ad63201495b8b5d9763483eb35/src/io.js#L607).
Also I didn't put details to h$fds. I took minimal and left only its object initialization: `var h$fds = {};`

- - - - -
bf73d79a by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: heap and stack overflows reporting defined as js hard failure (fixes #24602)

These errors were treated as a hard failure for browser application. The fix is trivial: just throw error.

- - - - -
8ad0b591 by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: Stubs for code without actual implementation detected by Google Closure Compiler (fixes #24602)

These errors were fixed just by introducing stubbed functions with throw for further implementation.

- - - - -
8eb5902d by Serge S. Gulin at 2024-05-27T00:06:08-05:00
JS: Add externs to linker (fixes #24602)

After enabling jsdoc and built-in google closure compiler types I was needed to deal with the following:

1. Define NodeJS-environment types. I've just copied minimal set of externs from semi-official repo (see https://github.com/externs/nodejs/blob/6c6882c73efcdceecf42e7ba11f1e3e5c9c041f0/v8/nodejs.js#L8).
2. Define Emscripten-environment types: `HEAP8`. Emscripten already provides some externs in our code but it supposed to be run in some module system. And its definitions do not work well in plain bundle.
3. We have some functions which purpose is to add to functions some contextual information via function properties. These functions should be marked as `modifies` to let google closure compiler remove calls if these functions are not used actually by call graph. Such functions are: `h$o`, `h$sti`, `h$init_closure`, `h$setObjInfo`.
4. STG primitives such as registries and stuff from `GHC.StgToJS`. `dXX` properties were already present at externs generator function but they are started from `7`, not from `1`. This message is related: `// fixme does closure compiler bite us here?`

- - - - -
c4011066 by Serge S. Gulin at 2024-05-27T00:06:09-05:00
JS: added both tests: for size and for correctness (fixes #24602)

By some reason MacOS builds add to stderr messages like:

    Ignoring unexpected archive entry:
    __.SYMDEF
    ...

However I left stderr to `/dev/null` for compatibility with linux CI builds.

- - - - -
d5dde551 by Serge S. Gulin at 2024-05-27T00:06:09-05:00
JS: Disable js linker warning for empty symbol table to make js tests running consistent across environments

- - - - -
0efa0c42 by Serge S. Gulin at 2024-05-27T00:06:09-05:00
JS: Add special preprocessor for js files due of needing to keep jsdoc comments (fixes #24602)

Our js files have defined google closure compiler types at jsdoc entries but these jsdoc entries are removed by cpp preprocessor. I considered that reusing them in javascript-backend would be a nice thing. Right now haskell processor uses `-traditional` option to deal with comments and `//` operators.
But now there are following compiler options: `-C` and `-CC`.
You can read about them at GCC (see https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-CC) and CLang (see https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-CC).
It seems that `-CC` works better for javascript jsdoc than `-traditional`.
At least it leaves `/* ... */` comments w/o changes.

- - - - -
49f2a442 by brandon s allbery kf8nh at 2024-05-27T00:06:09-05:00
fix link in CODEOWNERS

It seems that our local Gitlab no longer has documentation for the
`CODEOWNERS` file, but the master documentation still does. Use
that instead.

- - - - -
8308d104 by Fendor at 2024-05-27T00:06:09-05:00
Add performance regression test for '-fwrite-simplified-core'

- - - - -
4f29808d by Fendor at 2024-05-27T00:06:09-05:00
Typecheck corebindings lazily during bytecode generation

This delays typechecking the corebindings until the bytecode generation
happens.

We also avoid allocating a thunk that is retained by `unsafeInterleaveIO`.
In general, we shouldn't retain values of the hydrated `Type`, as not evaluating
the bytecode object keeps it alive.

It is better if we retain the unhydrated `IfaceType`.

See Note [Hydrating Modules]

- - - - -
ac2b3548 by Alan Zimmerman at 2024-05-27T00:06:09-05:00
EPA: Keep comments in a CaseAlt match

The comments now live in the surrounding location, not inside the
Match. Make sure we keep them.

Closes #24707

- - - - -
b1a05216 by Cheng Shao at 2024-05-27T00:06:09-05:00
driver: force merge objects when building dynamic objects

This patch forces the driver to always merge objects when building
dynamic objects even when ar -L is supported. It is an oversight of
!8887: original rationale of that patch is favoring the relatively
cheap ar -L operation over object merging when ar -L is supported,
which makes sense but only if we are building static objects! Omitting
check for whether we are building dynamic objects will result in
broken .so files with undefined reference errors at executable link
time when building GHC with llvm-ar. Fixes #22210.

- - - - -
c67bcce1 by Julian Ospald at 2024-05-27T00:06:09-05:00
Allow non-absolute values for bootstrap GHC variable

Fixes #24682

- - - - -
7959fb42 by Matthew Pickering at 2024-05-27T00:06:09-05:00
Don't depend on registerPackage function in Cabal

More recent versions of Cabal modify the behaviour of libAbiHash which
breaks our usage of registerPackage.

It is simpler to inline the part of registerPackage that we need and
avoid any additional dependency and complication using the higher-level
function introduces.

- - - - -
118dd9cf by Cheng Shao at 2024-05-27T00:06:09-05:00
ghc-bignum: remove obsolete ln script

This commit removes an obsolete ln script in ghc-bignum/gmp. See
060251c24ad160264ae8553efecbb8bed2f06360 for its original intention,
but it's been obsolete for a long time, especially since the removal
of the make build system. Hence the house cleaning.

- - - - -
534ee706 by Cheng Shao at 2024-05-27T00:06:09-05:00
ghc-bignum: update gmp to 6.3.0

This patch bumps the gmp-tarballs submodule and updates gmp to 6.3.0.
The tarball format is now xz, and gmpsrc.patch has been patched into
the tarball so hadrian no longer needs to deal with patching logic
when building in-tree GMP.

- - - - -
8a5e0ead by Cheng Shao at 2024-05-27T00:06:09-05:00
hadrian: remove obsolete Patch logic

This commit removes obsolete Patch logic from hadrian, given we no
longer need to patch the gmp tarball when building in-tree GMP.

- - - - -
d909d09a by Cheng Shao at 2024-05-27T00:06:09-05:00
autoconf: remove obsolete patch detection

This commit removes obsolete deletection logic of the patch command
from autoconf scripts, given we no longer need to patch anything in
the GHC build process.

- - - - -
b81d532c by Sylvain Henry at 2024-05-27T00:06:09-05:00
JS: correctly handle RUBBISH literals (#24664)

- - - - -
0fdc1ced by Matthew Pickering at 2024-05-27T00:06:09-05:00
Linearise ghc-internal and base build

This is achieved by requesting the final package database for
ghc-internal, which mandates it is fully built as a dependency of
configuring the `base` package. This is at the expense of cross-package
parrallelism between ghc-internal and the base package.

Fixes #24436

- - - - -
66c6c71d by Andrei Borzenkov at 2024-05-27T00:06:09-05:00
Fix tuple puns renaming (24702)

Move tuple renaming short cutter from `isBuiltInOcc_maybe` to `isPunOcc_maybe`, so we consider incoming module.

I also fixed some hidden bugs that raised after the change was done.

- - - - -
2b4a32a7 by Fendor at 2024-05-27T00:06:09-05:00
Refactor the Binary serialisation interface

The goal is simplifiy adding deduplication tables to `ModIface`
interface serialisation.

We identify two main points of interest that make this difficult:

1. UserData hardcodes what `Binary` instances can have deduplication
   tables. Moreover, it heavily uses partial functions.
2. GHC.Iface.Binary hardcodes the deduplication tables for 'Name' and
   'FastString', making it difficult to add more deduplication.

Instead of having a single `UserData` record with fields for all the
types that can have deduplication tables, we allow to provide custom
serialisers for any `Typeable`.
These are wrapped in existentials and stored in a `Map` indexed by their
respective `TypeRep`.
The `Binary` instance of the type to deduplicate still needs to
explicitly look up the decoder via `findUserDataReader` and
`findUserDataWriter`, which is no worse than the status-quo.

`Map` was chosen as microbenchmarks indicate it is the fastest for a
small number of keys (< 10).

To generalise the deduplication table serialisation mechanism, we
introduce the types `ReaderTable` and `WriterTable` which provide a
simple interface that is sufficient to implement a general purpose
deduplication mechanism for `writeBinIface` and `readBinIface`.

This allows us to provide a list of deduplication tables for
serialisation that can be extended more easily, for example for
`IfaceTyCon`, see the issue https://gitlab.haskell.org/ghc/ghc/-/issues/24540
for more motivation.

In addition to this refactoring, we split `UserData` into `ReaderUserData`
and `WriterUserData`, to avoid partial functions and reduce overall
memory usage, as we need fewer mutable variables.

Bump haddock submodule to accomodate for `UserData` split.

-------------------------
Metric Increase:
    MultiLayerModulesTH_Make
    MultiLayerModulesRecomp
    T21839c
-------------------------

- - - - -
78f3de9d by Fendor at 2024-05-27T00:06:09-05:00
Split `BinHandle` into `ReadBinHandle` and `WriteBinHandle`

A `BinHandle` contains too much information for reading data.
For example, it needs to keep a `FastMutInt` and a `IORef BinData`,
when the non-mutable variants would suffice.

Additionally, this change has the benefit that anyone can immediately
tell whether the `BinHandle` is used for reading or writing.

Bump haddock submodule BinHandle split.

- - - - -
684528fa by Simon Peyton Jones at 2024-05-27T00:06:09-05:00
Fix missing escaping-kind check in tcPatSynSig

Note [Escaping kind in type signatures] explains how we deal
with escaping kinds in type signatures, e.g.
    f :: forall r (a :: TYPE r). a
where the kind of the body is (TYPE r), but `r` is not in
scope outside the forall-type.

I had missed this subtlety in tcPatSynSig, leading to #24686.
This MR fixes it; and a similar bug in tc_top_lhs_type. (The
latter is tested by T24686a.)

- - - - -
2c836e25 by Alan Zimmerman at 2024-05-27T00:06:09-05:00
EPA: check-exact: check that the roundtrip reproduces the source

Closes #24670

- - - - -
cf6b141c by Andrew Lelechenko at 2024-05-27T00:06:09-05:00
Document that setEnv is not thread-safe

- - - - -
05211afa by Bryan Richter at 2024-05-27T00:06:10-05:00
CI: Work around frequent Signal 9 errors

- - - - -
83bcebee by Naïm Favier at 2024-05-27T00:06:10-05:00
ghc-internal: add MonadFix instance for (,)

Closes https://gitlab.haskell.org/ghc/ghc/-/issues/24288, implements CLC
proposal https://github.com/haskell/core-libraries-committee/issues/238.

Adds a MonadFix instance for tuples, permitting value recursion in the
"native" writer monad and bringing consistency with the existing
instance for transformers's WriterT (and, to a lesser extent, for Solo).

- - - - -
8383cd61 by Rodrigo Mesquita at 2024-05-27T00:06:10-05:00
bindist: Fix xattr cleaning

The original fix (725343aa) was incorrect because it used the shell
bracket syntax which is the quoting syntax in autoconf, making the test
for existence be incorrect and therefore `xattr` was never run.

Fixes #24554

- - - - -
e9966b57 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
make applicative do work with expansions, possibly badly

Fixes: #24406

enable the flow

renaming do_or_lc to doFlavour and debugging error contexts

testcases

- - - - -
59d13562 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
make sure app do expression statements location is mapped correctly

- - - - -
a0548096 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
add flavour into OrigStmt to guide better error messages about qualified do.

- - - - -
f0549e88 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
add stmt and do flav info in OrigPat to improve error messages

- - - - -
243a394c by Apoorv Ingle at 2024-05-27T00:06:10-05:00
accepting some test cases ado003 and ado002 also fix for #16135

- - - - -
be88f75e by Apoorv Ingle at 2024-05-27T00:06:10-05:00
make applicative breakpoint work

- - - - -
d9047e8b by Apoorv Ingle at 2024-05-27T00:06:10-05:00
make join unlocated

- - - - -
c45f7844 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
fix rebase conflicts

- - - - -
f48e0b4c by Apoorv Ingle at 2024-05-27T00:06:10-05:00
in GHC.Tc.Gen.Do.mk_apps pull out the XExpr annotation outside the op application

- - - - -
588b8a73 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
some pesky appdo testcases remain

- - - - -
9edfd015 by Apoorv Ingle at 2024-05-27T00:06:10-05:00
fix for 1 failing testcase 4 remain

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- CODEOWNERS
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Binary.hs
- compiler/GHC/Iface/Ext/Binary.hs
- compiler/GHC/Iface/Ext/Fields.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Iface/Recomp/Binary.hs
- compiler/GHC/Iface/Recomp/Flags.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Parser.y


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c2ea7768df91c5374d8e08d0a408d82c079682a...9edfd015c0d38649bee711b8b6643cbbb371cbe3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c2ea7768df91c5374d8e08d0a408d82c079682a...9edfd015c0d38649bee711b8b6643cbbb371cbe3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240527/ab7703db/attachment-0001.html>


More information about the ghc-commits mailing list