[commit: ghc] master: Implement unboxed sum primitive type (714bebf)
git at git.haskell.org
git at git.haskell.org
Thu Jul 21 08:12:27 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/714bebff44076061d0a719c4eda2cfd213b7ac3d/ghc
>---------------------------------------------------------------
commit 714bebff44076061d0a719c4eda2cfd213b7ac3d
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Thu Jul 21 08:07:41 2016 +0000
Implement unboxed sum primitive type
Summary:
This patch implements primitive unboxed sum types, as described in
https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes.
Main changes are:
- Add new syntax for unboxed sums types, terms and patterns. Hidden
behind `-XUnboxedSums`.
- Add unlifted unboxed sum type constructors and data constructors,
extend type and pattern checkers and desugarer.
- Add new RuntimeRep for unboxed sums.
- Extend unarise pass to translate unboxed sums to unboxed tuples right
before code generation.
- Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
code generation when sum values are involved.
- Add user manual section for unboxed sums.
Some other changes:
- Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
`MultiValAlt` to be able to use those with both sums and tuples.
- Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
wrong, given an `Any` `TyCon`, there's no way to tell what its kind
is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.
- Fix some bugs on the way: #12375.
Not included in this patch:
- Update Haddock for new the new unboxed sum syntax.
- `TemplateHaskell` support is left as future work.
For reviewers:
- Front-end code is mostly trivial and adapted from unboxed tuple code
for type checking, pattern checking, renaming, desugaring etc.
- Main translation routines are in `RepType` and `UnariseStg`.
Documentation in `UnariseStg` should be enough for understanding
what's going on.
Credits:
- Johan Tibell wrote the initial front-end and interface file
extensions.
- Simon Peyton Jones reviewed this patch many times, wrote some code,
and helped with debugging.
Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
simonmar, hvr, erikd
Reviewed By: simonpj
Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2259
>---------------------------------------------------------------
714bebff44076061d0a719c4eda2cfd213b7ac3d
compiler/basicTypes/BasicTypes.hs | 28 +-
compiler/basicTypes/DataCon.hs | 12 +-
compiler/basicTypes/Id.hs | 7 +-
compiler/basicTypes/IdInfo.hs | 2 +-
compiler/basicTypes/Unique.hs | 9 +
compiler/cmm/CLabel.hs | 4 +-
compiler/cmm/CmmExpr.hs | 12 +-
compiler/cmm/CmmLayoutStack.hs | 2 +-
compiler/cmm/CmmLive.hs | 4 +-
compiler/cmm/CmmParse.y | 8 +-
compiler/cmm/CmmUtils.hs | 22 +-
compiler/cmm/MkGraph.hs | 74 +-
compiler/cmm/PprCmmExpr.hs | 9 +
compiler/codeGen/StgCmm.hs | 8 +-
compiler/codeGen/StgCmmBind.hs | 6 +-
compiler/codeGen/StgCmmClosure.hs | 5 +-
compiler/codeGen/StgCmmCon.hs | 10 +-
compiler/codeGen/StgCmmEnv.hs | 37 +-
compiler/codeGen/StgCmmExpr.hs | 30 +-
compiler/codeGen/StgCmmForeign.hs | 7 +-
compiler/codeGen/StgCmmHeap.hs | 20 +-
compiler/codeGen/StgCmmLayout.hs | 28 +-
compiler/codeGen/StgCmmMonad.hs | 19 +-
compiler/codeGen/StgCmmPrim.hs | 25 +-
compiler/codeGen/StgCmmUtils.hs | 35 +-
compiler/coreSyn/CoreArity.hs | 3 +
compiler/coreSyn/CoreLint.hs | 12 +-
compiler/deSugar/Check.hs | 5 +
compiler/deSugar/Coverage.hs | 3 +
compiler/deSugar/DsArrows.hs | 1 +
compiler/deSugar/DsExpr.hs | 7 +
compiler/deSugar/DsForeign.hs | 1 +
compiler/deSugar/Match.hs | 7 +
compiler/ghc.cabal.in | 1 +
compiler/ghc.mk | 1 +
compiler/ghci/ByteCodeGen.hs | 148 ++--
compiler/ghci/ByteCodeItbls.hs | 4 +-
compiler/ghci/RtClosureInspect.hs | 33 +-
compiler/hsSyn/HsExpr.hs | 11 +
compiler/hsSyn/HsPat.hs | 19 +-
compiler/hsSyn/HsTypes.hs | 7 +
compiler/hsSyn/HsUtils.hs | 1 +
compiler/iface/BinIface.hs | 139 +++-
compiler/iface/MkIface.hs | 1 +
compiler/main/Constants.hs | 3 +
compiler/main/DynFlags.hs | 1 +
compiler/main/InteractiveEval.hs | 3 +-
compiler/parser/Lexer.x | 11 +-
compiler/parser/Parser.y | 41 +-
compiler/parser/RdrHsSyn.hs | 29 +-
compiler/prelude/PrelNames.hs | 9 +-
compiler/prelude/PrimOp.hs | 5 +-
compiler/prelude/TysWiredIn.hs | 121 ++-
compiler/prelude/TysWiredIn.hs-boot | 2 +
compiler/profiling/SCCfinal.hs | 8 +-
compiler/rename/RnExpr.hs | 4 +
compiler/rename/RnPat.hs | 5 +
compiler/rename/RnTypes.hs | 8 +
compiler/simplStg/RepType.hs | 369 +++++++++
compiler/simplStg/SimplStg.hs | 3 +
compiler/simplStg/StgStats.hs | 2 +-
compiler/simplStg/UnariseStg.hs | 850 ++++++++++++++++-----
compiler/stgSyn/CoreToStg.hs | 28 +-
compiler/stgSyn/StgLint.hs | 32 +-
compiler/stgSyn/StgSyn.hs | 45 +-
compiler/stranal/WwLib.hs | 1 +
compiler/typecheck/TcExpr.hs | 9 +
compiler/typecheck/TcHsSyn.hs | 23 +-
compiler/typecheck/TcHsType.hs | 11 +-
compiler/typecheck/TcPat.hs | 13 +
compiler/typecheck/TcPatSyn.hs | 5 +
compiler/typecheck/TcRnTypes.hs | 1 +
compiler/typecheck/TcType.hs | 25 +-
compiler/types/TyCoRep.hs | 13 +-
compiler/types/TyCon.hs | 76 +-
compiler/types/Type.hs | 136 +---
compiler/types/Type.hs-boot | 1 -
compiler/utils/Outputable.hs | 8 +
compiler/vectorise/Vectorise/Builtins/Base.hs | 2 +-
compiler/vectorise/Vectorise/Type/TyConDecl.hs | 6 +
docs/users_guide/glasgow_exts.rst | 77 ++
includes/stg/MiscClosures.h | 1 +
.../ghc-boot-th/GHC/LanguageExtensions/Type.hs | 1 +
libraries/ghc-prim/GHC/Types.hs | 1 +
rts/StgMiscClosures.cmm | 3 +
testsuite/tests/driver/T4437.hs | 3 +-
testsuite/tests/unboxedsums/Makefile | 10 +
testsuite/tests/unboxedsums/T12375.hs | 17 +
testsuite/tests/unboxedsums/T12375.stdout | 1 +
testsuite/tests/unboxedsums/all.T | 25 +
testsuite/tests/unboxedsums/empty_sum.hs | 20 +
testsuite/tests/unboxedsums/empty_sum.stdout | 3 +
testsuite/tests/unboxedsums/ffi1.hs | 11 +
testsuite/tests/unboxedsums/ffi1.stderr | 23 +
testsuite/tests/unboxedsums/module/Lib.hs | 16 +
testsuite/tests/unboxedsums/module/Main.hs | 11 +
testsuite/tests/unboxedsums/module/Makefile | 16 +
testsuite/tests/unboxedsums/module/all.T | 4 +
testsuite/tests/unboxedsums/module/sum_mod.stdout | 3 +
testsuite/tests/unboxedsums/sum_rr.hs | 8 +
testsuite/tests/unboxedsums/sum_rr.stderr | 7 +
testsuite/tests/unboxedsums/thunk.hs | 8 +
testsuite/tests/unboxedsums/thunk.stdout | 1 +
testsuite/tests/unboxedsums/unarise.hs | 17 +
.../cgrun052.stdout => unboxedsums/unarise.stdout} | 0
testsuite/tests/unboxedsums/unboxedsums1.hs | 81 ++
testsuite/tests/unboxedsums/unboxedsums1.stdout | 14 +
testsuite/tests/unboxedsums/unboxedsums10.hs | 15 +
testsuite/tests/unboxedsums/unboxedsums10.stdout | 2 +
testsuite/tests/unboxedsums/unboxedsums11.hs | 15 +
testsuite/tests/unboxedsums/unboxedsums11.stdout | 2 +
testsuite/tests/unboxedsums/unboxedsums2.hs | 34 +
testsuite/tests/unboxedsums/unboxedsums2.stdin | 2 +
testsuite/tests/unboxedsums/unboxedsums2.stdout | 4 +
testsuite/tests/unboxedsums/unboxedsums3.hs | 33 +
testsuite/tests/unboxedsums/unboxedsums3.stdout | 6 +
testsuite/tests/unboxedsums/unboxedsums4.hs | 3 +
testsuite/tests/unboxedsums/unboxedsums4.stderr | 2 +
testsuite/tests/unboxedsums/unboxedsums5.hs | 12 +
testsuite/tests/unboxedsums/unboxedsums6.hs | 35 +
testsuite/tests/unboxedsums/unboxedsums6.stdout | 2 +
testsuite/tests/unboxedsums/unboxedsums7.hs | 24 +
testsuite/tests/unboxedsums/unboxedsums7.stdout | 1 +
testsuite/tests/unboxedsums/unboxedsums8.hs | 37 +
testsuite/tests/unboxedsums/unboxedsums8.stdout | 3 +
testsuite/tests/unboxedsums/unboxedsums9.hs | 26 +
testsuite/tests/unboxedsums/unboxedsums9.stdout | 4 +
utils/mkUserGuidePart/Options/Language.hs | 6 +
128 files changed, 2685 insertions(+), 701 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 714bebff44076061d0a719c4eda2cfd213b7ac3d
More information about the ghc-commits
mailing list