[Git][ghc/ghc][wip/az/epa-hslet-tokens] 9 commits: Late plugins

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Wed Dec 20 17:23:54 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-hslet-tokens at Glasgow Haskell Compiler / GHC


Commits:
1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00
Late plugins

- - - - -
000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00
withTiming on LateCCs and late plugins

- - - - -
be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00
add test for late plugins

- - - - -
7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00
Document late plugins

- - - - -
9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00
Fix thunk update ordering

Previously we attempted to ensure soundness of concurrent thunk update
by synchronizing on the access of the thunk's info table pointer field.
This was believed to be sufficient since the indirectee (which may
expose a closure allocated by another core) would not be examined
until the info table pointer update is complete.

However, it turns out that this can result in data races in the presence
of multiple threads racing a update a single thunk. For instance,
consider this interleaving under the old scheme:

            Thread A                             Thread B
            ---------                            ---------
    t=0     Enter t
      1     Push update frame
      2     Begin evaluation

      4     Pause thread
      5     t.indirectee=tso
      6     Release t.info=BLACKHOLE

      7     ... (e.g. GC)

      8     Resume thread
      9     Finish evaluation
      10    Relaxed t.indirectee=x

      11                                         Load t.info
      12                                         Acquire fence
      13                                         Inspect t.indirectee

      14    Release t.info=BLACKHOLE

Here Thread A enters thunk `t` but is soon paused, resulting in `t`
being lazily blackholed at t=6. Then, at t=10 Thread A finishes
evaluation and updates `t.indirectee` with a relaxed store.

Meanwhile, Thread B enters the blackhole. Under the old scheme this
would introduce an acquire-fence but this would only synchronize with
Thread A at t=6. Consequently, the result of the evaluation, `x`, is not
visible to Thread B, introducing a data race.

We fix this by treating the `indirectee` field as we do all other
mutable fields. This means we must always access this field with
acquire-loads and release-stores.

See #23185.

- - - - -
f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00
docs: Fix link to 051-ghc-base-libraries.rst

The proposal is no longer available at the previous URL.

- - - - -
cb8295e7 by Alan Zimmerman at 2023-12-20T16:15:33+00:00
EPA: Move EpAnn out of extension points

Leaving a few that are too tricky, maybe some other time.

Updates haddock submodule

- - - - -
9d0d5953 by Alan Zimmerman at 2023-12-20T17:20:10+00:00
EPA: Remove some unneeded helpers from Parser.y

info: patch template saved to `-`

- - - - -
68b81ce3 by Alan Zimmerman at 2023-12-20T17:20:10+00:00
EPA: Tackling extra parser allocations stats fail

- make all getCommentsFor results strict.
- adding `seq` to various Parser.y helper functions

This metric increases 2.6% (6% before the mitigations in this commit)
I think the balance are inherent to the change in GhcPs structure, it
is a pathological case with HsAppTy repeating thousands of times.

Metric Increase:
    parsing001

- - - - -


12 changed files:

- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/148c3bbff805fcffc7561b51be6c9e2daa112e85...68b81ce36fccec5297b6abccb4535ba11e17ca23

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/148c3bbff805fcffc7561b51be6c9e2daa112e85...68b81ce36fccec5297b6abccb4535ba11e17ca23
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/20231220/393794c3/attachment.html>


More information about the ghc-commits mailing list