diff options
author | Alexis King <lexi.lambda@gmail.com> | 2022-09-11 11:30:32 +0200 |
---|---|---|
committer | Alexis King <lexi.lambda@gmail.com> | 2022-09-11 11:30:32 +0200 |
commit | 04062510806e2a3ccf0ecdb71c704a8e1c548c53 (patch) | |
tree | 23fe7599fa11138695b127581e2f8904ddc9b6d9 /utils/genprimopcode/Main.hs | |
parent | 9c4ea90c6b493eee6df1798c63a6031cc18ae6da (diff) | |
download | haskell-04062510806e2a3ccf0ecdb71c704a8e1c548c53.tar.gz |
Add native delimited continuations to the RTS
This patch implements GHC proposal 313, "Delimited continuation
primops", by adding native support for delimited continuations to the
GHC RTS.
All things considered, the patch is relatively small. It almost
exclusively consists of changes to the RTS; the compiler itself is
essentially unaffected. The primops come with fairly extensive Haddock
documentation, and an overview of the implementation strategy is given
in the Notes in rts/Continuation.c.
This first stab at the implementation prioritizes simplicity over
performance. Most notably, every continuation is always stored as a
single, contiguous chunk of stack. If one of these chunks is
particularly large, it can result in poor performance, as the current
implementation does not attempt to cleverly squeeze a subset of the
stack frames into the existing stack: it must fit all at once. If this
proves to be a performance issue in practice, a cleverer strategy would
be a worthwhile target for future improvements.
Diffstat (limited to 'utils/genprimopcode/Main.hs')
-rw-r--r-- | utils/genprimopcode/Main.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 7fff343188..288ba325fb 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -298,8 +298,7 @@ gen_hs_source (Info defaults entries) = hdr (PrimVecTypeSpec { ty = TyApp (VecTyCon n _) _ }) = wrapOp n ++ "," hdr (PrimVecTypeSpec {}) = error $ "Illegal type spec" - sec s = "\n-- * " ++ title s ++ "\n" - ++ (unlines $ map ("-- " ++ ) $ lines $ "|" ++ desc s) + sec s = "\n{- * " ++ title s ++ "-}\n{-|" ++ desc s ++ "-}" ent (Section {}) = [] @@ -313,7 +312,7 @@ gen_hs_source (Info defaults entries) = -- Doc comments [ case desc o ++ extra (opts o) of "" -> [] - cmmt -> map ("-- " ++) $ lines $ "|" ++ cmmt + cmmt -> lines ("{-|" ++ cmmt ++ "-}") -- Deprecations , [ d | Just n <- [getName o], d <- prim_deprecated (opts o) n ] @@ -804,6 +803,8 @@ ppType (TyApp (TyCon "IOPort#") [x,y]) = "mkIOPortPrimTy " ++ ppType x ++ " " ++ ppType y ppType (TyApp (TyCon "TVar#") [x,y]) = "mkTVarPrimTy " ++ ppType x ++ " " ++ ppType y + +ppType (TyApp (TyCon "PromptTag#") [x]) = "mkPromptTagPrimTy " ++ ppType x ppType (TyApp (VecTyCon _ pptc) []) = pptc ppType (TyUTup ts) = "(mkTupleTy Unboxed " |