diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-06-02 11:48:39 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-02 19:04:52 -0400 |
commit | a122d4fdd0a5858e44f9d3be90a258903e0288b2 (patch) | |
tree | 731c1a7954d5347d2b6195527cfdf344a083d9bc /libraries | |
parent | 9ea45963ad2ef2051ca3689562607eb4916d65e8 (diff) | |
download | haskell-a122d4fdd0a5858e44f9d3be90a258903e0288b2.tar.gz |
rts: Rip out support for STM invariants
This feature has some very serious correctness issues (#14310),
introduces a great deal of complexity, and hasn't seen wide usage.
Consequently we are removing it, as proposed in Proposal #77 [1]. This
is heavily based on a patch from fryguybob.
Updates stm submodule.
[1] https://github.com/ghc-proposals/ghc-proposals/pull/77
Test Plan: Validate
Reviewers: erikd, simonmar, hvr
Reviewed By: simonmar
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14310
Differential Revision: https://phabricator.haskell.org/D4760
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Conc.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Conc/Sync.hs | 39 | ||||
-rw-r--r-- | libraries/base/changelog.md | 11 | ||||
m--------- | libraries/stm | 0 |
4 files changed, 11 insertions, 41 deletions
diff --git a/libraries/base/GHC/Conc.hs b/libraries/base/GHC/Conc.hs index 8c5c1536d9..15397422a5 100644 --- a/libraries/base/GHC/Conc.hs +++ b/libraries/base/GHC/Conc.hs @@ -74,8 +74,6 @@ module GHC.Conc , orElse , throwSTM , catchSTM - , alwaysSucceeds - , always , TVar(..) , newTVar , newTVarIO diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs index 94601f356d..33709d4341 100644 --- a/libraries/base/GHC/Conc/Sync.hs +++ b/libraries/base/GHC/Conc/Sync.hs @@ -74,8 +74,6 @@ module GHC.Conc.Sync , orElse , throwSTM , catchSTM - , alwaysSucceeds - , always , TVar(..) , newTVar , newTVarIO @@ -777,43 +775,6 @@ catchSTM (STM m) handler = STM $ catchSTM# m handler' Just e' -> unSTM (handler e') Nothing -> raiseIO# e --- Invariant checking has been removed. See #14324 and --- https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0011-deprecate-stm-invariants.rst -{-# DEPRECATED checkInv, always, alwaysSucceeds - [ "The STM invariant-checking mechanism is deprecated in GHC 8.4" - , "and will be removed in GHC 8.10. See " - , "<https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0011-deprecate-stm-invariants.rst>." - , "" - , "Existing users are encouraged to encapsulate their STM" - , "operations in safe abstractions which can perform the invariant" - , "checking without help from the runtime system." - ] #-} - --- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built. --- 'checkInv' differs from these in that, --- --- 1. the invariant is not checked when 'checkInv' is called, only at the end of --- this and subsequent transactions --- 2. the invariant failure is indicated by raising an exception. -checkInv :: STM a -> STM () -checkInv (STM m) = STM (\s -> case (check# m) s of s' -> (# s', () #)) - --- | 'alwaysSucceeds' adds a new invariant that must be true when passed --- to 'alwaysSucceeds', at the end of the current transaction, and at --- the end of every subsequent transaction. If it fails at any --- of those points then the transaction violating it is aborted --- and the exception raised by the invariant is propagated. -alwaysSucceeds :: STM a -> STM () -alwaysSucceeds i = do ( i >> retry ) `orElse` ( return () ) - checkInv i - --- | 'always' is a variant of 'alwaysSucceeds' in which the invariant is --- expressed as an @STM Bool@ action that must return @True@. Returning --- @False@ or raising an exception are both treated as invariant failures. -always :: STM Bool -> STM () -always i = alwaysSucceeds ( do v <- i - if (v) then return () else ( errorWithoutStackTrace "Transactional invariant violation" ) ) - -- |Shared memory locations that support atomic memory transactions. data TVar a = TVar (TVar# RealWorld a) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 7411aad56e..c588b21487 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -3,6 +3,17 @@ ## 4.12.0.0 *TBA* * Bundled with GHC *TBA* + * The STM invariant-checking mechanism (`always` and `alwaysSucceeds`), which + was deprecated in GHC 8.4, has been removed (as proposed in + <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0011-deprecate-stm-invariants.rst>). + This is a bit earlier than proposed in the deprecation pragma included in + GHC 8.4, but due to community feedback we decided to move ahead with the + early removal. + + Existing users are encouraged to encapsulate their STM operations in safe + abstractions which can perform the invariant checking without help from the + runtime system. + * Add a new module `GHC.ResponseFile` (previously defined in the `haddock` package). (#13896) diff --git a/libraries/stm b/libraries/stm -Subproject 33a36c33de150f562a98803e2fc332f07bb2945 +Subproject 8c4d0fabb15ad00beb1e15d027825c78b2c3988 |