[Git][ghc/ghc][wip/andreask/spec-pragma] 41 commits: compiler: Add -f[no-]split-sections flags

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Wed Jan 11 13:29:28 UTC 2023



Andreas Klebinger pushed to branch wip/andreask/spec-pragma at Glasgow Haskell Compiler / GHC


Commits:
32255d05 by Matthew Pickering at 2023-01-04T11:58:42+00:00
compiler: Add -f[no-]split-sections flags

Here we add a `-fsplit-sections` flag which may some day replace
`-split-sections`. This has the advantage of automatically providing a
`-fno-split-sections` flag, which is useful for our packaging because we
enable `-split-sections` by default but want to disable it in certain
configurations.

- - - - -
e640940c by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Fix computation of tables_next_to_code for outOfTreeCompiler

This copy-pasto was introduced in de5fb3489f2a9bd6dc75d0cb8925a27fe9b9084b

- - - - -
15bee123 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add test:all_deps to build just testsuite dependencies

Fixes #22534

- - - - -
fec6638e by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add no_split_sections tranformer

This transformer reverts the effect of `split_sections`, which we intend
to use for platforms which don't support split sections.

In order to achieve this we have to modify the implemntation of the
split_sections transformer to store whether we are enabling
split_sections directly in the `Flavour` definition. This is because
otherwise there's no convenient way to turn off split_sections due to
having to pass additional linker scripts when merging objects.

- - - - -
3dc05726 by Matthew Pickering at 2023-01-04T11:58:42+00:00
check-exact: Fix build with -Werror

- - - - -
53a6ae7a by Matthew Pickering at 2023-01-04T11:58:42+00:00
ci: Build all test dependencies with in-tree compiler

This means that these executables will honour flavour transformers such
as "werror".

Fixes #22555

- - - - -
32e264c1 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Document using GHC environment variable to select boot compiler

Fixes #22340

- - - - -
be9dd9b0 by Matthew Pickering at 2023-01-04T11:58:42+00:00
packaging: Build perf builds with -split-sections

In 8f71d958 the make build system was made to use split-sections on
linux systems but it appears this logic never made it to hadrian.
There is the split_sections flavour transformer but this doesn't appear
to be used for perf builds on linux.

This is disbled on deb9 and windows due to #21670

Closes #21135

- - - - -
00dc5106 by Matthew Pickering at 2023-01-04T14:32:45-05:00
sphinx: Use modern syntax for extlinks

This fixes the following build error:

```
  Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273
  ===> Command failed with error code: 2

  Exception occurred:
    File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role
      title = caption % part
              ~~~~~~~~^~~~~~
  TypeError: not all arguments converted during string formatting
```

I tested on Sphinx-5.1.1 and Sphinx-6.0.0

Thanks for sterni for providing instructions about how to test using
sphinx-6.0.0.

Fixes #22690

- - - - -
541aedcd by Krzysztof Gogolewski at 2023-01-05T10:48:34-05:00
Misc cleanup

- Remove unused uniques and hs-boot declarations
- Fix types of seq and unsafeCoerce#
- Remove FastString/String roundtrip in JS
- Use TTG to enforce totality
- Remove enumeration in Heap/Inspect; the 'otherwise' clause
  serves the primitive types well.

- - - - -
22bb8998 by Alan Zimmerman at 2023-01-05T10:49:09-05:00
EPA: Do not collect comments from end of file

In Parser.y semis1 production triggers for the virtual semi at the end
of the file. This is detected by it being zero length.

In this case, do not extend the span being used to gather comments, so
any final comments are allocated at the module level instead.

- - - - -
9e077999 by Vladislav Zavialov at 2023-01-05T23:01:55-05:00
HsToken in TypeArg (#19623)

Updates the haddock submodule.

- - - - -
b2a2db04 by Matthew Pickering at 2023-01-05T23:02:30-05:00
Revert "configure: Drop uses of AC_PROG_CC_C99"

This reverts commit 7c6de18dd3151ead954c210336728e8686c91de6.

Centos7 using a very old version of the toolchain (autotools-2.69) where
the behaviour of these macros has not yet changed. I am reverting this
without haste as it is blocking the 9.6 branch.

Fixes #22704

- - - - -
28f8c0eb by Luite Stegeman at 2023-01-06T18:16:24+09:00
Add support for sized literals in the bytecode interpreter.

The bytecode interpreter only has branching instructions for
word-sized values. These are used for pattern matching.
Branching instructions for other types (e.g. Int16# or Word8#)
weren't needed, since unoptimized Core or STG never requires
branching on types like this.

It's now possible for optimized STG to reach the bytecode
generator (e.g. fat interface files or certain compiler flag
combinations), which requires dealing with various sized
literals in branches.

This patch improves support for generating bytecode from
optimized STG by adding the following new bytecode
instructions:

    TESTLT_I64
    TESTEQ_I64
    TESTLT_I32
    TESTEQ_I32
    TESTLT_I16
    TESTEQ_I16
    TESTLT_I8
    TESTEQ_I8
    TESTLT_W64
    TESTEQ_W64
    TESTLT_W32
    TESTEQ_W32
    TESTLT_W16
    TESTEQ_W16
    TESTLT_W8
    TESTEQ_W8

Fixes #21945

- - - - -
ac39e8e9 by Matthew Pickering at 2023-01-06T13:47:00-05:00
Only store Name in FunRhs rather than Id with knot-tied fields

All the issues here have been caused by #18758.
The goal of the ticket is to be able to talk about things like
`LTyClDecl GhcTc`. In the case of HsMatchContext,
the correct "context" is whatever we want, and in fact storing just a
`Name` is sufficient and correct context, even if the rest of the AST is
storing typechecker Ids.

So this reverts (#20415, !5579) which intended to get closed to #18758 but
didn't really and introduced a few subtle bugs.

Printing of an error message in #22695 would just hang, because we would
attempt to print the `Id` in debug mode to assertain whether it was
empty or not. Printing the Name is fine for the error message.

Another consequence is that when `-dppr-debug` was enabled the compiler would
hang because the debug printing of the Id would try and print fields
which were not populated yet.

This also led to 32070e6c2e1b4b7c32530a9566fe14543791f9a6 having to add
a workaround for the `checkArgs` function which was probably a very
similar bug to #22695.

Fixes #22695

- - - - -
c306d939 by Matthew Pickering at 2023-01-06T22:08:53-05:00
ci: Upgrade darwin, windows and freebsd CI to use GHC-9.4.3

Fixes #22599

- - - - -
0db496ff by Matthew Pickering at 2023-01-06T22:08:53-05:00
darwin ci: Explicitly pass desired build triple to configure

On the zw3rk machines for some reason the build machine was inferred to
be arm64. Setting the build triple appropiately resolve this confusion
and we produce x86 binaries.

- - - - -
2459c358 by Ben Gamari at 2023-01-06T22:09:29-05:00
rts: MUT_VAR is not a StgMutArrPtrs

There was previously a comment claiming that the MUT_VAR closure type
had the layout of StgMutArrPtrs.
- - - - -
6206cb92 by Simon Peyton Jones at 2023-01-07T12:14:40-05:00
Make FloatIn robust to shadowing

This MR fixes #22622. See the new
  Note [Shadowing and name capture]

I did a bit of refactoring in sepBindsByDropPoint too.

The bug doesn't manifest in HEAD, but it did show up in 9.4,
so we should backport this patch to 9.4

- - - - -
a960ca81 by Matthew Pickering at 2023-01-07T12:15:15-05:00
T10955: Set DYLD_LIBRARY_PATH for darwin

The correct path to direct the dynamic linker on darwin is
DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH. On recent versions of OSX
using LD_LIBRARY_PATH seems to have stopped working.

For more reading see:

https://stackoverflow.com/questions/3146274/is-it-ok-to-use-dyld-library-path-on-mac-os-x-and-whats-the-dynamic-library-s

- - - - -
73484710 by Matthew Pickering at 2023-01-07T12:15:15-05:00
Skip T18623 on darwin (to add to the long list of OSs)

On recent versions of OSX, running `ulimit -v` results in

```
ulimit: setrlimit failed: invalid argument
```

Time is too short to work out what random stuff Apple has been doing
with ulimit, so just skip the test like we do for other platforms.

- - - - -
8c0ea25f by Matthew Pickering at 2023-01-07T12:15:15-05:00
Pass -Wl,-no_fixup_chains to ld64 when appropiate

Recent versions of MacOS use a version of ld where `-fixup_chains` is on by default.
This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
explicitly disable `fixup-chains` by passing `-no_fixup_chains` to the linker on
darwin. This results in a warning of the form:

ld: warning: -undefined dynamic_lookup may not work with chained fixups

The manual explains the incompatible nature of these two flags:

     -undefined treatment
             Specifies how undefined symbols are to be treated. Options are: error, warning,
             suppress, or dynamic_lookup.  The default is error. Note: dynamic_lookup that
             depends on lazy binding will not work with chained fixups.

A relevant ticket is #22429

Here are also a few other links which are relevant to the issue:

Official comment: https://developer.apple.com/forums/thread/719961

More relevant links:

https://openradar.appspot.com/radar?id=5536824084660224

https://github.com/python/cpython/issues/97524

Note in release notes: https://developer.apple.com/documentation/xcode-release-notes/xcode-13-releas    e-notes

- - - - -
365b3045 by Matthew Pickering at 2023-01-09T02:36:20-05:00
Disable split sections on aarch64-deb10 build

See #22722

Failure on this job:

https://gitlab.haskell.org/ghc/ghc/-/jobs/1287852

```
Unexpected failures:
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T10828.run  T10828 [exit code non-0] (ext-interp)
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T13123.run  T13123 [exit code non-0] (ext-interp)
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T20590.run  T20590 [exit code non-0] (ext-interp)
Appending 232 stats to file: /builds/ghc/ghc/performance-metrics.tsv
```

```
Compile failed (exit code 1) errors were:
data family D_0 a_1 :: * -> *
data instance D_0 GHC.Types.Int GHC.Types.Bool :: * where
    DInt_2 :: D_0 GHC.Types.Int GHC.Types.Bool
data E_3 where MkE_4 :: a_5 -> E_3
data Foo_6 a_7 b_8 where
    MkFoo_9, MkFoo'_10 :: a_11 -> Foo_6 a_11 b_12
newtype Bar_13 :: * -> GHC.Types.Bool -> * where
    MkBar_14 :: a_15 -> Bar_13 a_15 b_16
data T10828.T (a_0 :: *) where
    T10828.MkT :: forall (a_1 :: *) . a_1 -> a_1 -> T10828.T a_1
    T10828.MkC :: forall (a_2 :: *) (b_3 :: *) . (GHC.Types.~) a_2
                                                               GHC.Types.Int => {T10828.foo :: a_2,
                                                                                 T10828.bar :: b_3} -> T10828.T GHC.Types.Int
T10828.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: (do TyConI dec <- runQ $ reify (mkName "T")
              runIO $ putStrLn (pprint dec) >> hFlush stdout
              d <- runQ
                     $ [d| data T' a :: Type
                             where
                               MkT' :: a -> a -> T' a
                               MkC' :: forall a b. (a ~ Int) => {foo :: a, bar :: b} -> T' Int |]
              runIO $ putStrLn (pprint d) >> hFlush stdout
              ....)
*** unexpected failure for T10828(ext-interp)
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
Compile failed (exit code 1) errors were:
T13123.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: ([d| data GADT
                 where MkGADT :: forall k proxy (a :: k). proxy a -> GADT |])
*** unexpected failure for T13123(ext-interp)
=====> 7100 of 9215 [0, 2, 0]
=====> 7100 of 9215 [0, 2, 0]
=====> 7200 of 9215 [0, 2, 0]
Compile failed (exit code 1) errors were:
T20590.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: ([d| data T where MkT :: forall a. a -> T |])
*** unexpected failure for T20590(ext-interp)
```

Looks fairly worrying to me.

- - - - -
965a2735 by Alan Zimmerman at 2023-01-09T02:36:20-05:00
EPA: exact print HsDocTy

To match ghc-exactprint
https://github.com/alanz/ghc-exactprint/pull/121

- - - - -
5d65773e by John Ericson at 2023-01-09T20:39:27-05:00
Remove RTS hack for configuring

See the brand new Note [Undefined symbols in the RTS] for additional
details.

- - - - -
e3fff751 by Sebastian Graf at 2023-01-09T20:40:02-05:00
Handle shadowing in DmdAnal (#22718)

Previously, when we had a shadowing situation like
```hs
f x = ... -- demand signature <1L><1L>

main = ... \f -> f 1 ...
```
we'd happily use the shadowed demand signature at the call site inside the
lambda. Of course, that's wrong and solution is simply to remove the demand
signature from the `AnalEnv` when we enter the lambda.
This patch does so for all binding constructs Core.

In #22718 the issue was caused by LetUp not shadowing away the existing demand
signature for the let binder in the let body. The resulting absent error is
fickle to reproduce; hence no reproduction test case. #17478 would help.

Fixes #22718.

It appears that TcPlugin_Rewrite regresses by ~40% on Darwin. It is likely that
DmdAnal was exploiting ill-scoped analysis results.

Metric increase ['bytes allocated'] (test_env=x86_64-darwin-validate):
    TcPlugin_Rewrite

- - - - -
d53f6f4d by Oleg Grenrus at 2023-01-09T21:11:02-05:00
Add safe list indexing operator: !?

With Joachim's amendments.

Implements https://github.com/haskell/core-libraries-committee/issues/110

- - - - -
cfaf1ad7 by Nicolas Trangez at 2023-01-09T21:11:03-05:00
rts, tests: limit thread name length to 15 bytes

On Linux, `pthread_setname_np` (or rather, the kernel) only allows for
thread names up to 16 bytes, including the terminating null byte.

This commit adds a note pointing this out in `createOSThread`, and fixes
up two instances where a thread name of more than 15 characters long was
used (in the RTS, and in a test-case).

Fixes: #22366
Fixes: https://gitlab.haskell.org/ghc/ghc/-/issues/22366
See: https://gitlab.haskell.org/ghc/ghc/-/issues/22366#note_460796

- - - - -
64286132 by Matthew Pickering at 2023-01-09T21:11:03-05:00
Store bootstrap_llvm_target and use it to set LlvmTarget in bindists

This mirrors some existing logic for the bootstrap_target which
influences how TargetPlatform is set.

As described on #21970 not storing this led to `LlvmTarget` being set incorrectly
and hence the wrong `--target` flag being passed to the C compiler.

Towards #21970

- - - - -
4724e8d1 by Matthew Pickering at 2023-01-09T21:11:04-05:00
Check for FP_LD_NO_FIXUP_CHAINS in installation configure script

Otherwise, when installing from a bindist the C flag isn't passed to the
C compiler.

This completes the fix for #22429

- - - - -
2e926b88 by Georgi Lyubenov at 2023-01-09T21:11:07-05:00
Fix outdated link to Happy section on sequences

- - - - -
146a1458 by Matthew Pickering at 2023-01-09T21:11:07-05:00
Revert "NCG(x86): Compile add+shift as lea if possible."

This reverts commit 20457d775885d6c3df020d204da9a7acfb3c2e5a.

See #22666 and #21777

- - - - -
6e6adbe3 by Jade Lovelace at 2023-01-11T00:55:30-05:00
Fix tcPluginRewrite example

- - - - -
faa57138 by Jade Lovelace at 2023-01-11T00:55:31-05:00
fix missing haddock pipe

- - - - -
0470ea7c by Florian Weimer at 2023-01-11T00:56:10-05:00
m4/fp_leading_underscore.m4: Avoid implicit exit function declaration

And switch to a new-style function definition.

Fixes build issues with compilers that do not accept implicit function
declarations.

- - - - -
b2857df4 by HaskellMouse at 2023-01-11T00:56:52-05:00
Added a new warning about compatibility with RequiredTypeArguments

This commit introduces a new warning
that indicates code incompatible with
future extension: RequiredTypeArguments.

Enabling this extension may break some code and the warning
will help to make it compatible in advance.

- - - - -
5f17e21a by Ben Gamari at 2023-01-11T00:57:27-05:00
testsuite: Drop testheapalloced.c

As noted in #22414, this file (which appears to be a benchmark for
characterising the one-step allocator's MBlock cache) is currently 
unreferenced. Remove it.

Closes #22414. 
- - - - -
bc125775 by Vladislav Zavialov at 2023-01-11T00:58:03-05:00
Introduce the TypeAbstractions language flag

GHC Proposals #448 "Modern scoped type variables"
and #425 "Invisible binders in type declarations"
introduce a new language extension flag: TypeAbstractions.

Part of the functionality guarded by this flag has already been
implemented, namely type abstractions in constructor patterns, but it
was guarded by a combination of TypeApplications and ScopedTypeVariables
instead of a dedicated language extension flag.

This patch does the following:

* introduces a new language extension flag TypeAbstractions
* requires TypeAbstractions for @a-syntax in constructor patterns
  instead of TypeApplications and ScopedTypeVariables
* creates a User's Guide page for TypeAbstractions and
  moves the "Type Applications in Patterns" section there

To avoid a breaking change, the new flag is implied by
ScopedTypeVariables and is retroactively added to GHC2021.

Metric Decrease:
    MultiLayerModulesTH_OneShot

- - - - -
083f7015 by Krzysztof Gogolewski at 2023-01-11T00:58:38-05:00
Misc cleanup

- Remove unused mkWildEvBinder
- Use typeTypeOrConstraint - more symmetric and asserts that
  that the type is Type or Constraint
- Fix escape sequences in Python; they raise a deprecation warning
  with -Wdefault

- - - - -
6c8a2b5a by Andreas Klebinger at 2023-01-11T14:28:14+01:00
Allow combination of NOINLINE/INLINEABLE.

We do this by also tracking INLINEABLE outside of the Unfolding data
type as it's own flag.

In the proccess of this I made a few other smaller changes.

* Allow NOINLINE bindings to specialise with -fspecialise-aggressively.
  Fixes #21036
* Made rule source a proper type instead of Bool.

-------------------------
Metric Decrease:
    T14766
    T18304
Metric Increase:
    T10359
    T13386
    T15263
-------------------------

- - - - -
a7d95cee by Andreas Klebinger at 2023-01-11T14:28:24+01:00
Allow specialization of elem, notElem and lookup

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/toolchain.nix
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unfold/Make.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3f827d1c0600c30332be112188e7f32631ceb49f...a7d95ceede691b0b603a7d72c177c15cf3d57874

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3f827d1c0600c30332be112188e7f32631ceb49f...a7d95ceede691b0b603a7d72c177c15cf3d57874
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/20230111/b0008267/attachment-0001.html>


More information about the ghc-commits mailing list