[Git][ghc/ghc][wip/T22459] 52 commits: hadrian: Don't enable TSAN in stage0 build

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Mon Dec 19 09:40:00 UTC 2022



Simon Peyton Jones pushed to branch wip/T22459 at Glasgow Haskell Compiler / GHC


Commits:
75855643 by Ben Gamari at 2022-12-15T03:54:02-05:00
hadrian: Don't enable TSAN in stage0 build

- - - - -
da7b51d8 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm: Introduce blockConcat

- - - - -
34f6b09c by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm: Introduce MemoryOrderings

- - - - -
43beaa7b by Ben Gamari at 2022-12-15T03:54:02-05:00
llvm: Respect memory specified orderings

- - - - -
8faf74fc by Ben Gamari at 2022-12-15T03:54:02-05:00
Codegen/x86: Eliminate barrier for relaxed accesses

- - - - -
6cc3944a by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Reduce some repetition

- - - - -
6c9862c4 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Add syntax for ordered loads and stores

- - - - -
748490d2 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Atomic load syntax

Originally I had thought I would just use the `prim` call syntax instead
of introducing new syntax for atomic loads. However, it turns out that
`prim` call syntax tends to make things quite unreadable. This new
syntax seems quite natural.

- - - - -
28c6781a by Ben Gamari at 2022-12-15T03:54:02-05:00
codeGen: Introduce ThreadSanitizer instrumentation

This introduces a new Cmm pass which instruments the program with
ThreadSanitizer annotations, allowing full tracking of mutator memory
accesses via TSAN.

- - - - -
d97aa311 by Ben Gamari at 2022-12-15T03:54:02-05:00
Hadrian: Drop TSAN_ENABLED define from flavour

This is redundant since the TSANUtils.h already defines it.

- - - - -
86974ef1 by Ben Gamari at 2022-12-15T03:54:02-05:00
hadrian: Enable Cmm instrumentation in TSAN flavour

- - - - -
93723290 by Ben Gamari at 2022-12-15T03:54:02-05:00
rts: Ensure that global regs are never passed as fun call args

This is in general unsafe as they may be clobbered if they are mapped to
caller-saved machine registers. See Note [Register parameter passing].

- - - - -
2eb0fb87 by Matthew Pickering at 2022-12-15T03:54:39-05:00
Package Imports: Get candidate packages also from re-exported modules

Previously we were just looking at the direct imports to try and work
out what a package qualifier could apply to but #22333 pointed out we
also needed to look for reexported modules.

Fixes #22333

- - - - -
552b7908 by Ben Gamari at 2022-12-15T03:55:15-05:00
compiler: Ensure that MutVar operations have necessary barriers

Here we add acquire and release barriers in readMutVar# and
writeMutVar#, which are necessary for soundness.

Fixes #22468.

- - - - -
933d61a4 by Simon Peyton Jones at 2022-12-15T03:55:51-05:00
Fix bogus test in Lint

The Lint check for branch compatiblity within an axiom, in
GHC.Core.Lint.compatible_branches was subtly different to the
check made when contructing an axiom, in
GHC.Core.FamInstEnv.compatibleBranches.

The latter is correct, so I killed the former and am now using the
latter.

On the way I did some improvements to pretty-printing and documentation.

- - - - -
03ed0b95 by Ryan Scott at 2022-12-15T03:56:26-05:00
checkValidInst: Don't expand synonyms when splitting sigma types

Previously, the `checkValidInst` function (used when checking that an instance
declaration is headed by an actual type class, not a type synonym) was using
`tcSplitSigmaTy` to split apart the `forall`s and instance context. This is
incorrect, however, as `tcSplitSigmaTy` expands type synonyms, which can cause
instances headed by quantified constraint type synonyms to be accepted
erroneously.

This patch introduces `splitInstTyForValidity`, a variant of `tcSplitSigmaTy`
specialized for validity checking that does _not_ expand type synonyms, and
uses it in `checkValidInst`.

Fixes #22570.

- - - - -
ed056bc3 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/Messages: Refactor

This doesn't change behavior but makes the code a bit easier to follow.

- - - - -
7356f8e0 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/ThreadPaused: Ordering fixes

- - - - -
914f0025 by Ben Gamari at 2022-12-16T16:12:44-05:00
eventlog: Silence spurious data race

- - - - -
fbc84244 by Ben Gamari at 2022-12-16T16:12:44-05:00
Introduce SET_INFO_RELEASE for Cmm

- - - - -
821b5472 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts: Use fences instead of explicit barriers

- - - - -
2228c999 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/stm: Fix memory ordering in readTVarIO#

See #22421.

- - - - -
99269b9f by Ben Gamari at 2022-12-16T16:12:44-05:00
Improve heap memory barrier Note

Also introduce MUT_FIELD marker in Closures.h to document mutable
fields.

- - - - -
70999283 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts: Introduce getNumCapabilities

And ensure accesses to n_capabilities are atomic (although with relaxed
ordering). This is necessary as RTS API callers may concurrently call
into the RTS without holding a capability.

- - - - -
98689f77 by Ben Gamari at 2022-12-16T16:12:44-05:00
ghc: Fix data race in dump file handling

Previously the dump filename cache would use a non-atomic update which
could potentially result in lost dump contents. Note that this is still
a bit racy since the first writer may lag behind a later appending
writer.

- - - - -
605d9547 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Always use atomics for context_switch and interrupt

Since these are modified by the timer handler.

- - - - -
86f20258 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts/Timer: Always use atomic operations

As noted in #22447, the existence of the pthread-based ITimer
implementation means that we cannot assume that the program is
single-threaded.

- - - - -
f8e901dc by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate recent_activity access

This makes it easier to ensure that it is accessed using the necessary
atomic operations.

- - - - -
e0affaa9 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate access to capabilities array

- - - - -
7ca683e4 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate sched_state

- - - - -
1cf13bd0 by Ben Gamari at 2022-12-16T16:12:45-05:00
PrimOps: Fix benign MutVar race

Relaxed ordering is fine here since the later CAS implies a release.

- - - - -
3d2a7e08 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Style fix

- - - - -
82c62074 by Ben Gamari at 2022-12-16T16:12:45-05:00
compiler: Use release store in eager blackholing

- - - - -
eb1a0136 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Fix ordering of makeStableName

- - - - -
ad0e260a by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Use ordered accesses instead of explicit barriers

- - - - -
a3eccf06 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Statically allocate capabilities

This is a rather simplistic way of solving #17289.

- - - - -
287fa3fb by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Ensure that all accesses to pending_sync are atomic

- - - - -
351eae58 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Note race with wakeBlockingQueue

- - - - -
5acf33dd by Bodigrim at 2022-12-16T16:13:22-05:00
Bump submodule directory to 1.3.8.0 and hpc to HEAD

- - - - -
0dd95421 by Bodigrim at 2022-12-16T16:13:22-05:00
Accept allocations increase on Windows

This is because of `filepath-1.4.100.0` and AFPP, causing increasing round-trips
between lists and ByteArray. See #22625 for discussion.

Metric Increase:
    MultiComponentModules
    MultiComponentModulesRecomp
    MultiLayerModules
    MultiLayerModulesRecomp
    T10421
    T10547
    T12150
    T12227
    T12234
    T12425
    T13035
    T13253
    T13253-spj
    T13701
    T13719
    T15703
    T16875
    T18140
    T18282
    T18304
    T18698a
    T18698b
    T18923
    T20049
    T21839c
    T21839r
    T5837
    T6048
    T9198
    T9961
    TcPlugin_RewritePerf
    hard_hole_fits

- - - - -
ef9ac9d2 by Cheng Shao at 2022-12-16T16:13:59-05:00
testsuite: Mark T9405 as fragile instead of broken on Windows

It's starting to pass again, and the unexpected pass blocks CI.

- - - - -
1f3abd85 by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: remove obsolete commented code in wasm NCG

It was just a temporary hack to workaround a bug in the relooper, that
bug has been fixed long before the wasm backend is merged.

- - - - -
e3104eab by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: add missing export list of GHC.CmmToAsm.Wasm.FromCmm

Also removes some unreachable code here.

- - - - -
1c6930bf by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: change fallback function signature to Cmm function signature in wasm NCG

In the wasm NCG, when handling a `CLabel` of undefined function
without knowing its function signature, we used to fallback to `() ->
()` which is accepted by `wasm-ld`. This patch changes it to the
signature of Cmm functions, which equally works, but would be required
when we emit tail call instructions.

- - - - -
8a81d9d9 by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: add optional tail-call support in wasm NCG

When the `-mtail-call` clang flag is passed at configure time, wasm
tail-call extension is enabled, and the wasm NCG will emit
`return_call`/`return_call_indirect` instructions to take advantage of
it and avoid the `StgRun` trampoline overhead.

Closes #22461.

- - - - -
d1431cc0 by Cheng Shao at 2022-12-17T08:07:15-05:00
base: add missing autoconf checks for waitpid/umask

These are not present in wasi-libc. Required for fixing #22589

- - - - -
da3f1e91 by Cheng Shao at 2022-12-17T08:07:51-05:00
compiler: make .wasm the default executable extension on wasm32

Following convention as in other wasm toolchains. Fixes #22594.

- - - - -
ad21f4ef by Cheng Shao at 2022-12-17T08:07:51-05:00
ci: support hello.wasm in ci.sh cross testing logic

- - - - -
6fe2d778 by amesgen at 2022-12-18T19:33:49-05:00
Correct `exitWith` Haddocks

The `IOError`-specific `catch` in the Prelude is long gone.

- - - - -
b3eacd64 by Ben Gamari at 2022-12-18T19:34:24-05:00
rts: Drop racy assertion

0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in
`dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean.
However, this isn't necessarily the case since another thread may have
raced us to dirty the object.

- - - - -
761c1f49 by Ben Gamari at 2022-12-18T19:35:00-05:00
rts/libdw: Silence uninitialized usage warnings

As noted in #22538, previously some GCC versions warned that various
locals in Libdw.c may be used uninitialized. Although this wasn't
strictly true (since they were initialized in an inline assembler block)
we fix this by providing explicit empty initializers.

Fixes #22538
- - - - -
c45b1d07 by Simon Peyton Jones at 2022-12-19T09:39:19+00:00
Abstract over the right free vars

Fix #22459, in two ways:

(1) Make the Specialiser not create a bogus specialisation if
    it is presented by strangely polymorphic dictionary.
    See Note [Weird special case in SpecDict] in
    GHC.Core.Opt.Specialise

(2) Be more careful in abstractFloats
    See Note [Which type variables to abstract over]
    in GHC.Core.Opt.Simplify.Utils.

So (2) stops creating the excessively polymorphic dictionary in
abstractFloats, while (1) stops crashing if some other pass should
nevertheless create a weirdly polymorphic dictionary.

- - - - -


30 changed files:

- .gitlab/ci.sh
- compiler/GHC/Cmm/Config.hs
- compiler/GHC/Cmm/ContFlowOpt.hs
- compiler/GHC/Cmm/Dataflow/Block.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Pipeline.hs
- + compiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/Wasm.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/Cmm.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Make.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f9ab917f069dc21d668f7905e24c29092a373ef3...c45b1d071e23c9c1a6ba2032fa1bee3a79ff7fa3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f9ab917f069dc21d668f7905e24c29092a373ef3...c45b1d071e23c9c1a6ba2032fa1bee3a79ff7fa3
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/20221219/c8708456/attachment-0001.html>


More information about the ghc-commits mailing list