[Git][ghc/ghc][wip/T19629] 63 commits: rts: Fix size of StgOrigThunkInfo frames

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Fri May 31 08:07:31 UTC 2024



Sylvain Henry pushed to branch wip/T19629 at Glasgow Haskell Compiler / GHC


Commits:
6d7e6ad8 by Ben Gamari at 2024-05-22T13:40:05-04:00
rts: Fix size of StgOrigThunkInfo frames

Previously the entry code of the `stg_orig_thunk` frame failed to
account for the size of the profiling header as it hard-coded the frame
size. Fix this.

Fixes #24809.

- - - - -
c645fe40 by Fendor at 2024-05-22T13:40:05-04:00
Add regression test T24809 for stg_orig_thunk_info_frame size

- - - - -
4181aa40 by Andreas Klebinger at 2024-05-22T13:40:42-04:00
bindists: Check for existence of share folder before trying to copy it.

This folder isn't distributed in windows bindists

A lack of doing so resulted us copying loads of files twice.

- - - - -
d216510e by Matthew Pickering at 2024-05-22T13:40:42-04:00
Remove ad-hoc installation of mingw toolchain in relocatable bindists

This reverts 616ac30026e8dd7d2ebb98d92dde071eedf5d951

The choice about whether to install mingw is taken in the installation
makefile.

This is also broken on non-windows systems.

The actual issue was the EnableDistroToolchain variable wasn't declared
in mk/config.mk and therefore the check to install mingw was failing.

- - - - -
7b4c1998 by Cheng Shao at 2024-05-22T21:52:52-04:00
testsuite: fix T17920 for wasm backend

T17920 was marked as fragile on wasm before; it can be trivially fixed
by avoiding calling variadic printf() in cmm.

- - - - -
c739383b by Cheng Shao at 2024-05-22T21:53:29-04:00
testsuite: bump T22744 timeout to 5x

- - - - -
c4c6d714 by Cheng Shao at 2024-05-22T21:54:06-04:00
testsuite: don't attempt to detect host cpu features when testing cross ghc

The testsuite driver CPU feature detection logic only detects host CPU
and only makes sense when we are not testing a cross GHC.

- - - - -
3d9e4ce6 by Simon Peyton Jones at 2024-05-22T21:54:43-04:00
Better skolemisation

As #24810 showed, it is (a little) better to skolemise en-bloc,
so that Note [Let-bound skolems] fires more often.

See Note [Skolemisation en bloc] in GHC.Tc.Utils.Instantiate.

- - - - -
a3cd3a1d by Ryan Scott at 2024-05-22T21:55:19-04:00
Add missing parenthesizePat in cvtp

We need to ensure that the output of `cvtp` is parenthesized (at precedence
`sigPrec`) so that any pattern signatures with a surrounding pattern signature
can parse correctly.

Fixes #24837.

- - - - -
4bb2a7cc by Hécate Moonlight at 2024-05-22T21:55:59-04:00
[base] Document the memory overhead of ByteArray

Add a diagram that shows the constituent parts of a ByteArray and their
memory overhead.

- - - - -
8b2a016a by Hécate Moonlight at 2024-05-22T21:56:38-04:00
Haddock: Add MR template for Haddock

- - - - -
ead75532 by Peter Trommler at 2024-05-23T02:28:05-04:00
PPC: Support ELF v2 on powerpc64 big-endian

Detect ELF v2 on PowerPC 64-bit systems. Check for `_CALL_ELF`
preprocessor macro.

Fixes #21191

- - - - -
9d4c10f2 by Hécate Kleidukos at 2024-05-23T02:28:44-04:00
gitlab: Add @Kleidukos to CODEOWNERS for utils/haddock

- - - - -
28e64170 by Preetham Gujjula at 2024-05-23T07:20:48-04:00
haddock: Add cabal-fmt to tools for `make style`

- - - - -
00126a89 by Andrei Borzenkov at 2024-05-23T07:21:24-04:00
haddock: fix verbosity option parsing

- - - - -
a3e0b68b by Ryan Hendrickson at 2024-05-23T15:52:03-04:00
base: specify tie-breaking behavior of min, max, and related list/Foldable functions

- - - - -
bdcc0f37 by doyougnu at 2024-05-24T07:51:18-04:00
cmm: add word <-> double/float bitcast

- closes: #25331

This is the last step in the project plan described in #25331. This
commit:

- adds bitcast operands for x86_64, LLVM, aarch64
- For PPC and i386 we resort to using the cmm implementations
- renames conversion MachOps from Conv to Round|Truncate

- - - - -
f0d257f7 by Krzysztof Gogolewski at 2024-05-24T07:51:55-04:00
StgToByteCode: minor refactor

Some functions in StgToByteCode were filtering out void arguments.
However, StgToByteCode is called after unarisation: the void arguments
should have been removed earlier.
Instead of filtering out, we assert that the args are non-void.

- - - - -
03137fd2 by Krzysztof Gogolewski at 2024-05-24T07:51:55-04:00
StgToByteCode: minor refactor

`layoutNativeCall` was always called with a `primRepCmmType platform`
callback. Hence we can put it inside of `layoutNativeCall` rather than
repeat it.

- - - - -
27c430f3 by David Binder at 2024-05-24T07:52:38-04:00
haddock: Remove compatibility shims for GHC < 8.4 from haddock-library

- - - - -
8dd8a076 by Cheng Shao at 2024-05-24T07:53:14-04:00
compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs

This patch makes the STG->Cmm backend avoid saving foreign call target
to local when there are no caller-save GlobalRegs.

Since 321941a8ebe25192cdeece723e1058f2f47809ea, when we lower a
foreign call, we unconditionally save the foreign call target to a
temporary local first, then rely on cmmSink to clean it up later,
which only happens with -fcmm-sink (implied by -O) and not in
unoptimized code.

And this is troublesome for the wasm backend NCG, which needs to infer
a foreign call target symbol's type signature from the Cmm call site.
Previously, the NCG has been emitting incorrect type signatures for
unoptimized code, which happens to work with `wasm-ld` most of the
time, but this is never future-proof against upstream toolchain
updates, and it causes horrible breakages when LTO objects are
included in linker input. Hence this patch.

- - - - -
986df1ab by Cheng Shao at 2024-05-24T07:53:14-04:00
testsuite: add callee-no-local regression test

- - - - -
52d62e2a by Sylvain Henry at 2024-05-24T07:53:57-04:00
Fix HasCallStack leftovers from !12514 / #24726

- - - - -
c5e00c35 by crumbtoo at 2024-05-24T07:54:38-04:00
user_guide: Fix typo in MultiWayIf chapter

Close #24829

- - - - -
bd323b0e by Ben Gamari at 2024-05-24T07:55:15-04:00
base: Ensure that CHANGELOG is included in extra-source-files

This was missed in the `ghc-internal` split.

Closes #24831.

- - - - -
1bfd32e8 by Ben Gamari at 2024-05-24T07:55:15-04:00
base: Fix changelog reference to setBacktraceMechanismState

(cherry picked from commit b63f7ba01fdfd98a01d2f0dec8d9262b3e595c5d)

- - - - -
43e8e4f3 by Sylvain Henry at 2024-05-24T12:16:43-04:00
Float/double unboxed literal support for HexFloatLiterals (fix #22155)

- - - - -
4a7f4713 by Fendor at 2024-05-24T12:17:19-04:00
Improve test labels for binary interface file size tests

Test labels for binary interface file sizes are hard to read and overly
verbose at the same time. Extend the name for the metric title, but
shorten it in the actual comparison table.

- - - - -
14e554cf by Zubin Duggal at 2024-05-24T12:17:55-04:00
Revert "Fix haskell/haddock#783 Don't show button if --quickjump not present"

This reverts commit 7776566531e72c415f66dd3b13da9041c52076aa.

- - - - -
f56838c3 by Ben Gamari at 2024-05-24T12:17:55-04:00
Fix default hyperlinked sources pattern

Previously this didn't include the `%M` token which manifested as broken
links to the hyperlinked sources of reexports of declarations defined
in other packages.

Fixes haddock#1628.

(cherry picked from commit 1432bcc943d41736eca491ecec4eb9a6304dab36)

- - - - -
42efa62c by Ben Gamari at 2024-05-24T12:17:55-04:00
Make DocPaths a proper data type

(cherry picked from commit 7f3a5c4da0023ae47b4c376c9b1ea2d706c94d8c)

- - - - -
53d9ceb3 by Ben Gamari at 2024-05-24T12:17:55-04:00
haddock: Bump version to 2.30

(cherry picked from commit 994989ed3d535177e57b778629726aeabe8c7602)

- - - - -
e4db1112 by Zubin Duggal at 2024-05-24T12:17:55-04:00
haddock-api: allow base 4.20 and ghc 9.11

- - - - -
e294f7a2 by PHO at 2024-05-24T12:17:55-04:00
Add a flag "threaded" for building haddock with the threaded RTS

GHC isn't guaranteed to have a threaded RTS. There should be a way to build
it with the vanilla one.

(cherry picked from commit 75a94e010fb5b0236c670d22b04f5472397dc15d)

- - - - -
51165bc9 by Andreas Klebinger at 2024-05-25T10:58:03-04:00
Update ticky counter event docs.

Add the info about the info table address and json fields.

Fixes #23200

- - - - -
98597ad5 by Sylvain Henry at 2024-05-25T10:58:45-04:00
Export extractPromotedList (#24866)

This can be useful in plugins.

- - - - -
228dcae6 by Teo Camarasu at 2024-05-28T13:12:24+00:00
template-haskell: Move wired-ins to ghc-internal

Thus we make `template-haskell` reinstallable and keep it as the public
API for Template Haskell.
All of the wired-in identifiers are moved to `ghc-internal`.
This necessitates also moving much of `ghc-boot-th` into `ghc-internal`.
These modules are then re-exported from `ghc-boot-th` and
`template-haskell`.
To avoid a dependency on `template-haskell` from `lib:ghc`, we instead
depend on the TH ASTs via `ghc-boot-th`.

As `template-haskell` no longer has special status, we can drop the
logic adding an implicit dependency on `template-haskell` when using TH.
We can also drop the `template-haskell-next` package, which was
previously used when bootstrapping.

When bootstrapping, we need to vendor the TH AST modules from
`ghc-internal` into `ghc-boot-th`. This is controlled by the `bootstrap`
cabal flag as before. See Note [Bootstrapping Template Haskell].

We split out a GHC.Internal.TH.Lift module resolving #24752.
This module is only built when not bootstrapping.

Resolves #24703

-------------------------
Metric Increase:
    ghc_boot_th_dir
    ghc_boot_th_so
-------------------------

- - - - -
62dded28 by Teo Camarasu at 2024-05-28T13:12:24+00:00
testsuite: mark tests broken by #24886

Now that `template-haskell` is no longer wired-in.
These tests are triggering #24886, and so need to be marked broken.

- - - - -
3ca72ad9 by Cheng Shao at 2024-05-30T02:57:06-04:00
rts: fix missing function prototypes in ClosureMacros.h

- - - - -
e0029e3d by Andreas Klebinger at 2024-05-30T02:57:43-04:00
UnliftedFFITypes: Allow `(# #)` as argument when it's the only argument.

This allows representing functions like:

    int foo(void);

to be imported like this:

    foreign import ccall "a_number_c"
      c_number :: (# #) -> Int64#

Which can be useful when the imported function isn't implicitly
stateful.

- - - - -
d0401335 by Matthew Pickering at 2024-05-30T02:58:19-04:00
ci: Update ci-images commit for fedora38 image

The fedora38 nightly job has been failing for quite a while because
`diff` was no longer installed. The ci-images bump explicitly installs
`diffutils` into these images so hopefully they now pass again.

- - - - -
3c97c74a by Jan Hrček at 2024-05-30T02:58:58-04:00
Update exactprint docs

- - - - -
77760cd7 by Jan Hrček at 2024-05-30T02:58:58-04:00
Incorporate review feedback

- - - - -
87591368 by Jan Hrček at 2024-05-30T02:58:58-04:00
Remove no longer relevant reference to comments

- - - - -
05f4f142 by Jan Hrček at 2024-05-30T02:58:59-04:00
Replace outdated code example

- - - - -
45a4a5f3 by Andreas Klebinger at 2024-05-30T02:59:34-04:00
Reword error resulting from missing -XBangPatterns.

It can be the result of either a bang pattern or strict binding,
so now we say so instead of claiming it must be a bang pattern.

Fixes #21032

- - - - -
e17f2df9 by Cheng Shao at 2024-05-30T03:00:10-04:00
testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x

- - - - -
7a660042 by Cheng Shao at 2024-05-30T14:42:29-04:00
rts: ensure gc_thread/gen_workspace is allocated with proper alignment

gc_thread/gen_workspace are required to be aligned by 64 bytes.
However, this property has not been properly enforced before, and
numerous alignment violations at runtime has been caught by
UndefinedBehaviorSanitizer that look like:

```
rts/sm/GC.c:1167:8: runtime error: member access within misaligned address 0x0000027a3390 for type 'gc_thread' (aka 'struct gc_thread_'), which requires 64 byte alignment
0x0000027a3390: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1167:8

rts/sm/GC.c:1184:13: runtime error: member access within misaligned address 0x0000027a3450 for type 'gen_workspace' (aka 'struct gen_workspace_'), which requires 64 byte alignment
0x0000027a3450: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1184:13
```

This patch fixes the gc_thread/gen_workspace misalignment issue by
explicitly allocating them with alignment constraint.

- - - - -
c77a48af by Cheng Shao at 2024-05-30T14:42:29-04:00
rts: fix an unaligned load in nonmoving gc

This patch fixes an unaligned load in nonmoving gc by ensuring the
closure address is properly untagged first before attempting to
prefetch its header. The unaligned load is reported by
UndefinedBehaviorSanitizer:

```
rts/sm/NonMovingMark.c:921:9: runtime error: member access within misaligned address 0x0042005f3a71 for type 'StgClosure' (aka 'struct StgClosure_'), which requires 8 byte alignment
0x0042005f3a71: note: pointer points here
 00 00 00  98 43 13 8e 12 7f 00 00  50 3c 5f 00 42 00 00 00  58 17 b7 92 12 7f 00 00  89 cb 5e 00 42
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/NonMovingMark.c:921:9
```

This issue had previously gone unnoticed since it didn't really harm
runtime correctness, the invalid header address directly loaded from a
tagged pointer is only used as prefetch address and will not cause
segfaults. However, it still should be corrected because the prefetch
would be rendered useless by this issue, and untagging only involves a
single bitwise operation without memory access so it's cheap enough to
add.

- - - - -
05c4fafb by Cheng Shao at 2024-05-30T14:42:29-04:00
rts: use __builtin_offsetof to implement STG_FIELD_OFFSET

This patch fixes the STG_FIELD_OFFSET macro definition by using
__builtin_offsetof, which is what gcc/clang uses to implement offsetof
in standard C. The previous definition that uses NULL pointer involves
subtle undefined behavior in C and thus reported by
UndefinedBehaviorSanitizer as well:

```
rts/Capability.h:243:58: runtime error: member access within null pointer of type 'Capability' (aka 'struct Capability_')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Capability.h:243:58
```

- - - - -
5ff83bfc by Sylvain Henry at 2024-05-30T14:43:10-04:00
JS: remove useless h$CLOCK_REALTIME (#23202)

- - - - -
95ef2d58 by Matthew Pickering at 2024-05-30T14:43:47-04:00
ghcup-metadata: Fix metadata generation

There were some syntax errors in the generation script which were
preventing it from running.

I have tested this with:

```
nix shell --extra-experimental-features nix-command -f .gitlab/rel_eng -c ghcup-metadata --metadata ghcup-0.0.7.yaml --date="2024-05-27" --pipeline-id=95534 --version=9.11.20240525
```

which completed successfully.

- - - - -
1bc66ee4 by Jakob Bruenker at 2024-05-30T14:44:22-04:00
Add diagrams to Arrows documentation

This adds diagrams to the documentation of Arrows, similar to the ones found on
https://www.haskell.org/arrows/.

It does not add diagrams for ArrowChoice for the time being, mainly because it's
not clear to me how to visually distinguish them from the ones for Arrow. Ideally,
you might want to do something like highlight the arrows belonging to the same
tuple or same Either in common colors, but that's not really possible with unicode.

- - - - -
d10a1c65 by Matthew Craven at 2024-05-30T23:35:48-04:00
Make UnsafeSNat et al. into pattern synonyms

...so that they do not cause coerce to bypass the nominal
role on the corresponding singleton types when they are imported.
See Note [Preventing unsafe coercions for singleton types] and
the discussion at #23478.

This also introduces unsafeWithSNatCo (and analogues for Char
and Symbol) so that users can still access the dangerous coercions
that importing the real constructors would allow, but only in a
very localized way.

- - - - -
0958937e by Cheng Shao at 2024-05-30T23:36:25-04:00
hadrian: build C/C++ with split sections when enabled

When split sections is enabled, ensure -fsplit-sections is passed to
GHC as well when invoking GHC to compile C/C++; and pass
-ffunction-sections -fdata-sections to gcc/clang when compiling C/C++
with the hadrian Cc builder. Fixes #23381.

- - - - -
02b1f91e by Cheng Shao at 2024-05-30T23:36:25-04:00
driver: build C/C++ with -ffunction-sections -fdata-sections when split sections is enabled

When -fsplit-sections is passed to GHC, pass -ffunction-sections
-fdata-sections to gcc/clang when building C/C++. Previously,
-fsplit-sections was only respected by the NCG/LLVM backends, but not
the unregisterised backend; the GHC driver did not pass
-fdata-sections and -ffunction-sections to the C compiler, which
resulted in excessive executable sizes.

Fixes #23381.

-------------------------
Metric Decrease:
    size_hello_artifact
    size_hello_unicode
-------------------------

- - - - -
fd47e2e3 by Cheng Shao at 2024-05-30T23:37:00-04:00
testsuite: mark process005 as fragile on JS

- - - - -
572e5e91 by Sylvain Henry at 2024-05-31T10:04:42+02:00
Bump array submodule

- - - - -
816c4ff6 by Sylvain Henry at 2024-05-31T10:04:42+02:00
GHCi: Don't use deprecated sizeofMutableByteArray#

- - - - -
83005204 by Ben Gamari at 2024-05-31T10:04:42+02:00
Primops: Make documentation generation more efficient

Previously we would do a linear search through all primop names, doing a
String comparison on the name of each when preparing the HsDocStringMap.
Fix this.

- - - - -
26f02117 by Ben Gamari at 2024-05-31T10:04:42+02:00
primops: Ensure that deprecations are properly tracked

We previously failed to insert DEPRECATION pragmas into GHC.Prim's
ModIface, meaning that they would appear in the Haddock documentation
but not issue warnings. Fix this.

See #19629. Haddock also needs to be fixed: https://github.com/haskell/haddock/issues/223

Co-authored-by: Sylvain Henry <sylvain at haskus.fr>

- - - - -
2b40dbd6 by Ben Gamari at 2024-05-31T10:04:42+02:00
primops: Undeprecate addr2Int# and int2Addr#

addr2Int# and int2Addr# were marked as deprecated with the introduction
of the OCaml code generator (1dfaee318171836b32f6b33a14231c69adfdef2f)
due to its use of tagged integers. However, this backend has long
vanished and `base` has all along been using `addr2Int#` in the Show
instance for Ptr.

While it's unlikely that we will have another backend which has tagged
integers, we may indeed support platforms which have tagged pointers.
Consequently we undeprecate the operations but warn the user that the
operations may not be portable.

- - - - -
c496da48 by Sylvain Henry at 2024-05-31T10:04:42+02:00
primops: Undeprecate par#

par# is still used in base and it's not clear how to replace it with
spark# (see #24825)

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- + .gitlab/merge_request_templates/Haddock.md
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- CODEOWNERS
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/Pipeline/Execute.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3bf8860bb1f9b17d8e96879058e4e05f2121a492...c496da48ff69fad105a60328606a18d610be897c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3bf8860bb1f9b17d8e96879058e4e05f2121a492...c496da48ff69fad105a60328606a18d610be897c
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/20240531/f1d49d25/attachment-0001.html>


More information about the ghc-commits mailing list