Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
66d1a5d5
by fendor at 2026-07-07T16:57:56-04:00
-
74f1071d
by fendor at 2026-07-07T16:57:56-04:00
-
28d63bca
by mangoiv at 2026-07-07T16:59:16-04:00
-
8bd69b38
by Simon Peyton Jones at 2026-07-07T17:34:36-04:00
-
55184981
by Simon Peyton Jones at 2026-07-07T17:34:37-04:00
-
1a45bfe9
by Facundo Domínguez at 2026-07-07T17:34:40-04:00
24 changed files:
- .gitlab-ci.yml
- .gitlab/merge_request_templates/Default.md
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Main/Compile.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Session.hs
- testsuite/tests/codeGen/should_compile/T25177.stderr
- testsuite/tests/deSugar/should_fail/all.T
- testsuite/tests/ghci/scripts/all.T
- + testsuite/tests/ghci/scripts/bytecodeIPE.hs
- + testsuite/tests/ghci/scripts/bytecodeIPE.script
- + testsuite/tests/ghci/scripts/bytecodeIPE.stdout
- testsuite/tests/numeric/should_compile/T15547.stderr
- testsuite/tests/simplCore/should_compile/DataToTagFamilyScrut.stderr
- testsuite/tests/simplCore/should_compile/T14978.stdout
- testsuite/tests/simplCore/should_compile/T18013.stderr
- testsuite/tests/simplCore/should_compile/T24229a.stderr
- testsuite/tests/simplCore/should_compile/T24229b.stderr
Changes:
| ... | ... | @@ -1307,7 +1307,8 @@ ghcup-metadata-nightly-push: |
| 1307 | 1307 | - git config user.name "GHC GitLab CI"
|
| 1308 | 1308 | - git remote add gitlab_origin https://oauth2:$PROJECT_PUSH_TOKEN@gitlab.haskell.org/ghc/ghcup-metadata.git
|
| 1309 | 1309 | - git add .
|
| 1310 | - - git commit -m "Update metadata"
|
|
| 1310 | + # a metadata nightly run may result in no changes. We reflect that in the commit message.
|
|
| 1311 | + - git diff --cached --quiet && git commit --allow-empty -m "Updated metadata - no changes" || git commit -m "Update metadata"
|
|
| 1311 | 1312 | - git push gitlab_origin HEAD:updates
|
| 1312 | 1313 | rules:
|
| 1313 | 1314 | # Only run the update on scheduled nightly pipelines, ie once a day
|
| ... | ... | @@ -27,6 +27,7 @@ https://gitlab.haskell.org/ghc/ghc/-/wikis/Contributing-a-Patch |
| 27 | 27 | - [ ] If this MR has the potential to break user programs, the ~"user-facing" label was applied to
|
| 28 | 28 | test against head.hackage.
|
| 29 | 29 | - [ ] All commits are either individually buildable or squashed.
|
| 30 | +- [ ] After all approvals and before landing: all fixup commits are squashed with their originating commits.
|
|
| 30 | 31 | - [ ] Commit messages describe *what they do*, referring to tickets using `#NNNNN` syntax.
|
| 31 | 32 | - [ ] Source comments describing the change were added. For larger changes [notes][notes] and
|
| 32 | 33 | cross-references from the relevant places were added (as applicable).
|
| ... | ... | @@ -352,7 +352,10 @@ def main() -> None: |
| 352 | 352 | with open(args.metadata, 'r') as file:
|
| 353 | 353 | ghcup_metadata = yaml.safe_load(file)
|
| 354 | 354 | if args.version in ghcup_metadata['ghcupDownloads']['GHC']:
|
| 355 | - raise RuntimeError("Refusing to override existing version in metadata")
|
|
| 355 | + # if there are days without a commit, then the nightly metadata
|
|
| 356 | + # is up to date by default, no need to fail, no need to upload anything
|
|
| 357 | + print("Refusing to override existing version in metadata, exiting")
|
|
| 358 | + sys.exit()
|
|
| 356 | 359 | setNightlyTags(ghcup_metadata)
|
| 357 | 360 | ghcup_metadata['ghcupDownloads']['GHC'][args.version] = new_yaml
|
| 358 | 361 | print(yaml.dump(ghcup_metadata))
|
| ... | ... | @@ -1002,26 +1002,29 @@ doublePrimTyCon = pcPrimTyCon0 doublePrimTyConName doubleRepDataConTy |
| 1002 | 1002 | |
| 1003 | 1003 | Note [The equality types story]
|
| 1004 | 1004 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 1005 | -GHC sports a veritable menagerie of equality types:
|
|
| 1006 | - |
|
| 1007 | - Type or Lifted? Hetero? Role Built in Defining module
|
|
| 1008 | - class? L/U TyCon
|
|
| 1009 | ------------------------------------------------------------------------------------------
|
|
| 1010 | -~# T U hetero nominal eqPrimTyCon GHC.Prim
|
|
| 1011 | -~~ C L hetero nominal heqTyCon GHC.Types
|
|
| 1012 | -~ C L homo nominal eqTyCon GHC.Types
|
|
| 1013 | -:~: T L homo nominal (not built-in) Data.Type.Equality
|
|
| 1014 | -:~~: T L hetero nominal (not built-in) Data.Type.Equality
|
|
| 1015 | - |
|
| 1016 | -~R# T U hetero repr eqReprPrimTy GHC.Prim
|
|
| 1017 | -Coercible C L homo repr coercibleTyCon GHC.Types
|
|
| 1018 | -Coercion T L homo repr (not built-in) Data.Type.Coercion
|
|
| 1019 | -~P# T U hetero phantom eqPhantPrimTyCon GHC.Prim
|
|
| 1005 | +GHC sports a veritable menagerie of equality types.
|
|
| 1006 | + |
|
| 1007 | + Result kind Hetero? Role Built in Defining module
|
|
| 1008 | +---------------------------------------------------------------------------------
|
|
| 1009 | +~# Constraint# hetero nominal eqPrimTyCon GHC.Prim
|
|
| 1010 | +~~ Constraint hetero nominal heqTyCon GHC.Types
|
|
| 1011 | +~ Constraint homo nominal eqTyCon GHC.Types
|
|
| 1012 | +:~: Type homo nominal (not built-in) Data.Type.Equality
|
|
| 1013 | +:~~: Type hetero nominal (not built-in) Data.Type.Equality
|
|
| 1014 | + |
|
| 1015 | +~R# Constraint# hetero repr eqReprPrimTy GHC.Prim
|
|
| 1016 | +Coercible Constraint homo repr coercibleTyCon GHC.Types
|
|
| 1017 | +Coercion Type homo repr (not built-in) Data.Type.Coercion
|
|
| 1018 | +~P# Constraint# hetero phantom eqPhantPrimTyCon GHC.Prim
|
|
| 1019 | + |
|
| 1020 | +Here `Constraint#` means `CONSTRAINT (TupleRep [])`, a constraint kind that is
|
|
| 1021 | +represented by a zero-width tuple.
|
|
| 1020 | 1022 | |
| 1021 | 1023 | Recall that "hetero" means the equality can related types of different
|
| 1022 | 1024 | kinds. Knowing that (t1 ~# t2) or (t1 ~R# t2) or even that (t1 ~P# t2)
|
| 1023 | 1025 | also means that (k1 ~# k2), where (t1 :: k1) and (t2 :: k2).
|
| 1024 | 1026 | |
| 1027 | + |
|
| 1025 | 1028 | To produce less confusion for end users, when not dumping and without
|
| 1026 | 1029 | -fprint-equality-relations, each of these groups is printed as the bottommost
|
| 1027 | 1030 | listed equality. That is, (~#) and (~~) are both rendered as (~) in
|
| ... | ... | @@ -1030,7 +1033,7 @@ error messages, and (~R#) is rendered as Coercible. |
| 1030 | 1033 | Let's take these one at a time:
|
| 1031 | 1034 | |
| 1032 | 1035 | --------------------------
|
| 1033 | - (~#) :: forall k1 k2. k1 -> k2 -> TYPE (TupleRep '[])
|
|
| 1036 | + (~#) :: forall k1 k2. k1 -> k2 -> CONSTRAINT (TupleRep '[])
|
|
| 1034 | 1037 | --------------------------
|
| 1035 | 1038 | This is The Type Of Equality in GHC. It classifies nominal coercions.
|
| 1036 | 1039 | This type is used in the solver for recording equality constraints.
|
| ... | ... | @@ -1054,8 +1057,6 @@ This is (almost) an ordinary class, defined as if by |
| 1054 | 1057 | Here's what's unusual about it:
|
| 1055 | 1058 | |
| 1056 | 1059 | * We can't actually declare it that way because we don't have syntax for ~#.
|
| 1057 | - And ~# isn't a constraint, so even if we could write it, it wouldn't kind
|
|
| 1058 | - check.
|
|
| 1059 | 1060 | |
| 1060 | 1061 | * Users cannot write instances of it.
|
| 1061 | 1062 | |
| ... | ... | @@ -1112,7 +1113,7 @@ They are not defined within GHC at all. |
| 1112 | 1113 | |
| 1113 | 1114 | |
| 1114 | 1115 | --------------------------
|
| 1115 | - (~R#) :: forall k1 k2. k1 -> k2 -> TYPE (TupleRep '[])
|
|
| 1116 | + (~R#) :: forall k1 k2. k1 -> k2 -> CONSTRAINT (TupleRep '[])
|
|
| 1116 | 1117 | --------------------------
|
| 1117 | 1118 | The is the representational analogue of ~#. This is the type of representational
|
| 1118 | 1119 | equalities that the solver works on. All wanted constraints of this type are
|
| ... | ... | @@ -1147,7 +1148,7 @@ within GHC at all. |
| 1147 | 1148 | |
| 1148 | 1149 | |
| 1149 | 1150 | --------------------------
|
| 1150 | - (~P#) :: forall k1 k2. k1 -> k2 -> TYPE (TupleRep '[])
|
|
| 1151 | + (~P#) :: forall k1 k2. k1 -> k2 -> CONSTRAINT (TupleRep '[])
|
|
| 1151 | 1152 | --------------------------
|
| 1152 | 1153 | This is the phantom analogue of ~# and it is barely used at all.
|
| 1153 | 1154 | (The solver has no idea about this one.) Here is the motivation:
|
| ... | ... | @@ -292,14 +292,14 @@ noParens :: SDoc -> SDoc |
| 292 | 292 | noParens pp = pp
|
| 293 | 293 | |
| 294 | 294 | pprOptCo :: Coercion -> SDoc
|
| 295 | --- Print a coercion optionally; i.e. honouring -dsuppress-coercions
|
|
| 296 | -pprOptCo co = sdocOption sdocSuppressCoercions $ \case
|
|
| 297 | - True -> angleBrackets (text "Co:" <> int (coercionSize co)) <+> dcolon <+> co_type
|
|
| 298 | - False -> parens $ sep [ppr co, dcolon <+> co_type]
|
|
| 299 | - where
|
|
| 300 | - co_type = sdocOption sdocSuppressCoercionTypes $ \case
|
|
| 301 | - True -> ellipsis
|
|
| 302 | - False -> ppr (coercionType co)
|
|
| 295 | +-- Print a coercion with its type (unless suppressed by -dsuppress-coercion-types)
|
|
| 296 | +-- Honour -dsuppress-coercions
|
|
| 297 | +-- Placed here because it needs GHC.Core.Coercion.coercionType
|
|
| 298 | +pprOptCo co = sdocOption sdocSuppressCoercionTypes $ \case
|
|
| 299 | + True -> pprParendCo co
|
|
| 300 | + False -> parens (sep [pprCo co, dcolon <+> pp_co_type])
|
|
| 301 | + where
|
|
| 302 | + pp_co_type = ppr (coercionType co)
|
|
| 303 | 303 | |
| 304 | 304 | ppr_id_occ :: (SDoc -> SDoc) -> Id -> SDoc
|
| 305 | 305 | ppr_id_occ add_par id
|
| ... | ... | @@ -132,8 +132,14 @@ tidyToIfaceTypeX env ty = toIfaceTypeX (mkVarSet free_tcvs) (tidyType env' ty) |
| 132 | 132 | |
| 133 | 133 | ------------
|
| 134 | 134 | pprCo, pprParendCo :: Coercion -> SDoc
|
| 135 | -pprCo co = getPprStyle $ \ sty -> pprIfaceCoercion (tidyToIfaceCoSty co sty)
|
|
| 136 | -pprParendCo co = getPprStyle $ \ sty -> pprParendIfaceCoercion (tidyToIfaceCoSty co sty)
|
|
| 135 | +-- Print a coercion without its type
|
|
| 136 | +-- Honour -dsuppress-coercions
|
|
| 137 | +pprCo co = sdocOption sdocSuppressCoercions $ \case
|
|
| 138 | + True -> angleBrackets (text "Co:" <> int (coercionSize co))
|
|
| 139 | + False -> getPprStyle $ \ sty -> pprIfaceCoercion (tidyToIfaceCoSty co sty)
|
|
| 140 | +pprParendCo co = sdocOption sdocSuppressCoercions $ \case
|
|
| 141 | + True -> angleBrackets (text "Co:" <> int (coercionSize co))
|
|
| 142 | + False -> getPprStyle $ \ sty -> pprParendIfaceCoercion (tidyToIfaceCoSty co sty)
|
|
| 137 | 143 | |
| 138 | 144 | tidyToIfaceCoSty :: Coercion -> PprStyle -> IfaceCoercion
|
| 139 | 145 | tidyToIfaceCoSty co sty
|
| ... | ... | @@ -1640,7 +1640,7 @@ Here, |
| 1640 | 1640 | co3 = UnivCo ProofIrrelProv Nominal (CoercionTy co1) (CoercionTy co2) [co5]
|
| 1641 | 1641 | where
|
| 1642 | 1642 | co5 :: (a1 ~# Bool) ~# (a2 ~# Bool)
|
| 1643 | - co5 = TyConAppCo Nominal (~#) [<Consraint#>, <Constraint#>, co4, <Bool>]
|
|
| 1643 | + co5 = TyConAppCo Nominal (~#) [<Constraint#>, <Constraint#>, co4, <Bool>]
|
|
| 1644 | 1644 | |
| 1645 | 1645 | |
| 1646 | 1646 | Note [The importance of tracking UnivCo dependencies]
|
| ... | ... | @@ -99,6 +99,7 @@ module GHC.Driver.Backend |
| 99 | 99 | , backendPostHscPipeline
|
| 100 | 100 | , backendNormalSuccessorPhase
|
| 101 | 101 | , backendName
|
| 102 | + , backendInfoTableMapValidity
|
|
| 102 | 103 | , backendValidityOfCImport
|
| 103 | 104 | , backendValidityOfCExport
|
| 104 | 105 | |
| ... | ... | @@ -117,7 +118,6 @@ import GHC.Driver.Phases |
| 117 | 118 | |
| 118 | 119 | |
| 119 | 120 | import GHC.Utils.Error
|
| 120 | -import GHC.Utils.Panic
|
|
| 121 | 121 | |
| 122 | 122 | import GHC.Driver.Pipeline.Monad
|
| 123 | 123 | import GHC.Platform
|
| ... | ... | @@ -368,7 +368,8 @@ data PrimitiveImplementation |
| 368 | 368 | -- We expect one function per back end—or more precisely, one function
|
| 369 | 369 | -- for each back end that writes code to a file. (The interpreter
|
| 370 | 370 | -- does not write to files; its output lives only in memory.)
|
| 371 | - |
|
| 371 | +--
|
|
| 372 | +-- See Note [Backend Defunctionalization]
|
|
| 372 | 373 | data DefunctionalizedCodeOutput
|
| 373 | 374 | = NcgCodeOutput
|
| 374 | 375 | | ViaCCodeOutput
|
| ... | ... | @@ -680,6 +681,18 @@ backendSupportsBreakpoints = \case |
| 680 | 681 | Named Bytecode -> True
|
| 681 | 682 | Named NoBackend -> False
|
| 682 | 683 | |
| 684 | +-- | Return is 'IsValid' if the backend supports @-finfo-table-map@.
|
|
| 685 | +-- If 'backendInfoTableMapValidity' returns 'NotValid', then the driver ignores
|
|
| 686 | +-- the flag @-finfo-table-map@, since the backend doesn't support generating
|
|
| 687 | +-- the info table map.
|
|
| 688 | +backendInfoTableMapValidity :: Backend -> Validity' String
|
|
| 689 | +backendInfoTableMapValidity (Named NCG) = IsValid
|
|
| 690 | +backendInfoTableMapValidity (Named LLVM) = NotValid "-finfo-table-map is incompatible with -fllvm and is disabled (See #26435)"
|
|
| 691 | +backendInfoTableMapValidity (Named ViaC) = IsValid
|
|
| 692 | +backendInfoTableMapValidity (Named JavaScript) = NotValid "-finfo-table-map is incompatible with the javascript backend"
|
|
| 693 | +backendInfoTableMapValidity (Named Bytecode) = IsValid -- We are not generating any objects, so @-finfo-table-map@ is not expected to work. Avoid warning for GHCi.
|
|
| 694 | +backendInfoTableMapValidity (Named NoBackend) = IsValid -- We are not generating code, so we ignore it any way
|
|
| 695 | + |
|
| 683 | 696 | -- | If this flag is set, then the driver forces the
|
| 684 | 697 | -- optimization level to 0, issuing a warning message if
|
| 685 | 698 | -- the command line requested a higher optimization level.
|
| ... | ... | @@ -768,20 +781,33 @@ backendCDefs (Named NoBackend) = NoCDefs |
| 768 | 781 | -- > -> Set UnitId -- ^ dependencies
|
| 769 | 782 | -- > -> Stream IO RawCmmGroup a -- results from `StgToCmm`
|
| 770 | 783 | -- > -> IO a
|
| 771 | -backendCodeOutput :: Backend -> DefunctionalizedCodeOutput
|
|
| 772 | -backendCodeOutput (Named NCG) = NcgCodeOutput
|
|
| 773 | -backendCodeOutput (Named LLVM) = LlvmCodeOutput
|
|
| 774 | -backendCodeOutput (Named ViaC) = ViaCCodeOutput
|
|
| 775 | -backendCodeOutput (Named JavaScript) = JSCodeOutput
|
|
| 776 | -backendCodeOutput (Named Bytecode) = panic "backendCodeOutput: bytecodeBackend"
|
|
| 777 | -backendCodeOutput (Named NoBackend) = panic "backendCodeOutput: noBackend"
|
|
| 784 | +--
|
|
| 785 | +-- See Note [Backend Defunctionalization]
|
|
| 786 | +--
|
|
| 787 | +-- === __WARNING__
|
|
| 788 | +--
|
|
| 789 | +-- Do NOT use 'backendCodeOutput' (or other functions in this module) as a
|
|
| 790 | +-- proxy for the 'Backend', which is __abstract by design__.
|
|
| 791 | +--
|
|
| 792 | +-- If you need to determine some property of the backend, do NOT match on
|
|
| 793 | +-- 'DefunctionalizedCodeOutput'; Instead, write a new property predicate in
|
|
| 794 | +-- this module. This makes it easier to add new backends because essentially
|
|
| 795 | +-- all backend properties depended upon throughout the compiler are all found
|
|
| 796 | +-- here.
|
|
| 797 | +backendCodeOutput :: Backend -> Maybe DefunctionalizedCodeOutput
|
|
| 798 | +backendCodeOutput (Named NCG) = Just NcgCodeOutput
|
|
| 799 | +backendCodeOutput (Named LLVM) = Just LlvmCodeOutput
|
|
| 800 | +backendCodeOutput (Named ViaC) = Just ViaCCodeOutput
|
|
| 801 | +backendCodeOutput (Named JavaScript) = Just JSCodeOutput
|
|
| 802 | +backendCodeOutput (Named Bytecode) = Nothing
|
|
| 803 | +backendCodeOutput (Named NoBackend) = Nothing
|
|
| 778 | 804 | |
| 779 | 805 | backendUseJSLinker :: Backend -> Bool
|
| 780 | 806 | backendUseJSLinker (Named NCG) = False
|
| 781 | 807 | backendUseJSLinker (Named LLVM) = False
|
| 782 | 808 | backendUseJSLinker (Named ViaC) = False
|
| 783 | 809 | backendUseJSLinker (Named JavaScript) = True
|
| 784 | -backendUseJSLinker (Named Bytecode) = False
|
|
| 810 | +backendUseJSLinker (Named Bytecode) = False
|
|
| 785 | 811 | backendUseJSLinker (Named NoBackend) = False
|
| 786 | 812 | |
| 787 | 813 | -- | This (defunctionalized) function tells the compiler
|
| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | \section{Code output phase}
|
| 5 | 5 | -}
|
| 6 | 6 | |
| 7 | - |
|
| 8 | 7 | module GHC.Driver.CodeOutput
|
| 9 | 8 | ( codeOutput
|
| 10 | 9 | , outputForeignStubs
|
| ... | ... | @@ -50,7 +49,7 @@ import GHC.Utils.Outputable |
| 50 | 49 | import GHC.Utils.Logger
|
| 51 | 50 | import GHC.Utils.Exception ( bracket )
|
| 52 | 51 | import GHC.Utils.Ppr (Mode(..))
|
| 53 | -import GHC.Utils.Panic.Plain ( pgmError )
|
|
| 52 | +import GHC.Utils.Panic.Plain ( panic, pgmError )
|
|
| 54 | 53 | |
| 55 | 54 | import GHC.Unit
|
| 56 | 55 | import GHC.Unit.Finder ( mkStubPaths )
|
| ... | ... | @@ -124,11 +123,12 @@ codeOutput logger tmpfs llvm_config dflags unit_state this_mod filenm location g |
| 124 | 123 | |
| 125 | 124 | ; let dus1 = newTagDUniqSupply CodeGenTag dus0
|
| 126 | 125 | ; (stubs, a) <- case backendCodeOutput (backend dflags) of
|
| 127 | - NcgCodeOutput -> outputAsm logger dflags this_mod location filenm dus1
|
|
| 128 | - final_stream
|
|
| 129 | - ViaCCodeOutput -> outputC logger dflags filenm dus1 final_stream pkg_deps
|
|
| 130 | - LlvmCodeOutput -> outputLlvm logger llvm_config dflags filenm dus1 final_stream
|
|
| 131 | - JSCodeOutput -> outputJS logger llvm_config dflags filenm final_stream
|
|
| 126 | + Just NcgCodeOutput -> outputAsm logger dflags this_mod location filenm dus1
|
|
| 127 | + final_stream
|
|
| 128 | + Just ViaCCodeOutput -> outputC logger dflags filenm dus1 final_stream pkg_deps
|
|
| 129 | + Just LlvmCodeOutput -> outputLlvm logger llvm_config dflags filenm dus1 final_stream
|
|
| 130 | + Just JSCodeOutput -> outputJS logger llvm_config dflags filenm final_stream
|
|
| 131 | + Nothing -> panic $ "backendCodeOutput: " ++ show (backend dflags) ++ " doesn't support code output"
|
|
| 132 | 132 | ; stubs_exist <- outputForeignStubs logger tmpfs dflags unit_state this_mod location stubs
|
| 133 | 133 | ; return (filenm, stubs_exist, foreign_fps, a)
|
| 134 | 134 | }
|
| ... | ... | @@ -670,7 +670,7 @@ hscGenHardCode hsc_env cgguts mod_loc output_filename = do |
| 670 | 670 | -- next withTiming after this will be "Assembler" (hard code only).
|
| 671 | 671 | withTiming logger (text "CodeGen"<+>brackets (ppr this_mod)) (const ())
|
| 672 | 672 | $ case backendCodeOutput (backend dflags) of
|
| 673 | - JSCodeOutput ->
|
|
| 673 | + Just JSCodeOutput ->
|
|
| 674 | 674 | do
|
| 675 | 675 | let js_config = initStgToJSConfig dflags
|
| 676 | 676 | |
| ... | ... | @@ -696,7 +696,7 @@ hscGenHardCode hsc_env cgguts mod_loc output_filename = do |
| 696 | 696 | stgToJS logger js_config stg_binds this_mod spt_entries foreign_stubs0 cost_centre_info output_filename
|
| 697 | 697 | return (output_filename, stub_c_exists, foreign_fps, Just stg_cg_infos, Just cmm_cg_infos)
|
| 698 | 698 | |
| 699 | - _ ->
|
|
| 699 | + Just _ ->
|
|
| 700 | 700 | do
|
| 701 | 701 | cmms <- {-# SCC "StgToCmm" #-}
|
| 702 | 702 | doCodeGen hsc_env this_mod denv tycons
|
| ... | ... | @@ -724,6 +724,7 @@ hscGenHardCode hsc_env cgguts mod_loc output_filename = do |
| 724 | 724 | foreign_stubs foreign_files dependencies (initDUniqSupply 'n' 0) rawcmms1
|
| 725 | 725 | return ( output_filename, stub_c_exists, foreign_fps
|
| 726 | 726 | , Just stg_cg_infos, Just cmm_cg_infos)
|
| 727 | + Nothing -> panic $ "backendCodeOutput: " ++ show (backend dflags) ++ " doesn't support code output"
|
|
| 727 | 728 | |
| 728 | 729 | |
| 729 | 730 | -- The part of CgGuts that we need for HscInteractive
|
| ... | ... | @@ -741,7 +741,7 @@ compileEmptyStub dflags hsc_env basename location mod_name = do |
| 741 | 741 | let home_unit = hsc_home_unit hsc_env
|
| 742 | 742 | |
| 743 | 743 | case backendCodeOutput (backend dflags) of
|
| 744 | - JSCodeOutput -> do
|
|
| 744 | + Just JSCodeOutput -> do
|
|
| 745 | 745 | empty_stub <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "js"
|
| 746 | 746 | let src = ppr (mkHomeModule home_unit mod_name) <+> text "= 0;"
|
| 747 | 747 | writeFile empty_stub (showSDoc dflags (pprCode src))
|
| ... | ... | @@ -750,7 +750,7 @@ compileEmptyStub dflags hsc_env basename location mod_name = do |
| 750 | 750 | _ <- runPipeline (hsc_hooks hsc_env) pipeline
|
| 751 | 751 | pure ()
|
| 752 | 752 | |
| 753 | - _ -> do
|
|
| 753 | + Just _ -> do
|
|
| 754 | 754 | empty_stub <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "c"
|
| 755 | 755 | let src = text "int" <+> ppr (mkHomeModule home_unit mod_name) <+> text "= 0;"
|
| 756 | 756 | writeFile empty_stub (showSDoc dflags (pprCode src))
|
| ... | ... | @@ -758,6 +758,7 @@ compileEmptyStub dflags hsc_env basename location mod_name = do |
| 758 | 758 | pipeline = viaCPipeline HCc pipe_env hsc_env (Just location) empty_stub
|
| 759 | 759 | _ <- runPipeline (hsc_hooks hsc_env) pipeline
|
| 760 | 760 | pure ()
|
| 761 | + Nothing -> panic $ "backendCodeOutput: " ++ show (backend dflags) ++ " doesn't support code output"
|
|
| 761 | 762 | |
| 762 | 763 | |
| 763 | 764 |
| ... | ... | @@ -276,7 +276,7 @@ import GHC.Data.FastString |
| 276 | 276 | import GHC.Utils.TmpFs
|
| 277 | 277 | import GHC.Utils.Fingerprint
|
| 278 | 278 | import GHC.Utils.Outputable
|
| 279 | -import GHC.Utils.Error (emptyDiagOpts, logInfo)
|
|
| 279 | +import GHC.Utils.Error (emptyDiagOpts, logInfo, Validity'(..))
|
|
| 280 | 280 | import GHC.Settings
|
| 281 | 281 | import GHC.CmmToAsm.CFG.Weight
|
| 282 | 282 | import GHC.Core.Opt.CallerCC
|
| ... | ... | @@ -3855,8 +3855,8 @@ makeDynFlagsConsistent dflags |
| 3855 | 3855 | && os == OSMinGW32
|
| 3856 | 3856 | && arch == ArchAArch64
|
| 3857 | 3857 | = case backendCodeOutput (backend dflags) of
|
| 3858 | - LlvmCodeOutput -> pgmError "-fllvm is incompatible with enabled TablesNextToCode at Windows Aarch64"
|
|
| 3859 | - NcgCodeOutput -> pgmError "-fasm is incompatible with enabled TablesNextToCode at Windows Aarch64"
|
|
| 3858 | + Just LlvmCodeOutput -> pgmError "-fllvm is incompatible with enabled TablesNextToCode at Windows Aarch64"
|
|
| 3859 | + Just NcgCodeOutput -> pgmError "-fasm is incompatible with enabled TablesNextToCode at Windows Aarch64"
|
|
| 3860 | 3860 | _ -> (dflags, mempty, mempty)
|
| 3861 | 3861 | |
| 3862 | 3862 | -- When we do ghci, force using dyn ways if the target RTS linker
|
| ... | ... | @@ -3902,9 +3902,8 @@ makeDynFlagsConsistent dflags |
| 3902 | 3902 | in dflags_c
|
| 3903 | 3903 | |
| 3904 | 3904 | | gopt Opt_InfoTableMap dflags
|
| 3905 | - , LlvmCodeOutput <- backendCodeOutput (backend dflags)
|
|
| 3906 | - = loop (gopt_unset dflags Opt_InfoTableMap)
|
|
| 3907 | - "-finfo-table-map is incompatible with -fllvm and is disabled (See #26435)"
|
|
| 3905 | + , NotValid msg <- backendInfoTableMapValidity (backend dflags)
|
|
| 3906 | + = loop (gopt_unset dflags Opt_InfoTableMap) msg
|
|
| 3908 | 3907 | |
| 3909 | 3908 | | otherwise = (dflags, mempty, mempty)
|
| 3910 | 3909 | where loc = mkGeneralSrcSpan (fsLit "when making flags consistent")
|
| ... | ... | @@ -11,7 +11,7 @@ lvl = foo d |
| 11 | 11 | |
| 12 | 12 | bar1 = \ x eta -> case lvl of { W# ipv -> (# eta, () #) }
|
| 13 | 13 | |
| 14 | -bar = bar1 `cast` <Co:6> :: ...
|
|
| 14 | +bar = bar1 `cast` <Co:6>
|
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 |
| ... | ... | @@ -6,7 +6,9 @@ |
| 6 | 6 | test('DsStrictFail', exit_code(1), compile_and_run, [''])
|
| 7 | 7 | test(
|
| 8 | 8 | 'T21701',
|
| 9 | - [omit_ways(llvm_ways)], # -finfo-table-map does not work with -fllvm (#26435)
|
|
| 9 | + [ omit_ways(llvm_ways), # -finfo-table-map does not work with -fllvm (#26435)
|
|
| 10 | + when(js_arch(), skip) # javascript doesn't support -finfo-table-map yet and yields a warning we don't want to handle here
|
|
| 11 | + ],
|
|
| 10 | 12 | compile,
|
| 11 | 13 | ['-Wall -finfo-table-map']
|
| 12 | 14 | ) |
| ... | ... | @@ -385,6 +385,14 @@ test('ListTuplePunsPpr', normal, ghci_script, ['ListTuplePunsPpr.script']) |
| 385 | 385 | test('ListTuplePunsPprNoAbbrevTuple', [limit_stdout_lines(14)], ghci_script, ['ListTuplePunsPprNoAbbrevTuple.script'])
|
| 386 | 386 | test('T24459', normal, ghci_script, ['T24459.script'])
|
| 387 | 387 | test('T24632', normal, ghci_script, ['T24632.script'])
|
| 388 | +# bytecode backend doesn't support '-finfo-table-map' (#27039)
|
|
| 389 | +test('bytecodeIPE',
|
|
| 390 | + [ extra_hc_opts('-finfo-table-map')
|
|
| 391 | + , extra_files(['bytecodeIPE.hs'])
|
|
| 392 | + , req_rts_linker
|
|
| 393 | + , when(arch('wasm32') or arch('javascript'), skip)
|
|
| 394 | + ],
|
|
| 395 | + ghci_script, ['bytecodeIPE.script'])
|
|
| 388 | 396 | |
| 389 | 397 | # Test package renaming in GHCi session
|
| 390 | 398 | test('GhciPackageRename',
|
| 1 | +module BytecodeIPE where
|
|
| 2 | + |
|
| 3 | +import Data.Maybe (isJust)
|
|
| 4 | +import GHC.InfoProv (whereFrom)
|
|
| 5 | + |
|
| 6 | +marker :: String
|
|
| 7 | +marker = id "bytecode-stub-init"
|
|
| 8 | +{-# NOINLINE marker #-}
|
|
| 9 | + |
|
| 10 | +-- `whereFrom` only succeeds if the module's IPE initializer ran.
|
|
| 11 | +probe :: IO Bool
|
|
| 12 | +probe = isJust <$> whereFrom marker |
| 1 | +:load bytecodeIPE.hs
|
|
| 2 | +probe |
| 1 | +False |
| ... | ... | @@ -5,25 +5,25 @@ Result size of Tidy Core |
| 5 | 5 | |
| 6 | 6 | nat2Word#
|
| 7 | 7 | = \ @n $dKnownNat p1 ->
|
| 8 | - naturalToWord# ((natSing $dKnownNat) `cast` <Co:2> :: ...)
|
|
| 8 | + naturalToWord# ((natSing $dKnownNat) `cast` <Co:2>)
|
|
| 9 | 9 | |
| 10 | 10 | foo = \ ds -> 18##
|
| 11 | 11 | |
| 12 | 12 | fd
|
| 13 | 13 | = \ @n $dKnownNat ds ->
|
| 14 | - naturalToWord# ((natSing $dKnownNat) `cast` <Co:6> :: ...)
|
|
| 14 | + naturalToWord# ((natSing $dKnownNat) `cast` <Co:6>)
|
|
| 15 | 15 | |
| 16 | 16 | d = \ ds -> 3##
|
| 17 | 17 | |
| 18 | 18 | fm
|
| 19 | 19 | = \ @n $dKnownNat ds ->
|
| 20 | - naturalToWord# ((natSing $dKnownNat) `cast` <Co:8> :: ...)
|
|
| 20 | + naturalToWord# ((natSing $dKnownNat) `cast` <Co:8>)
|
|
| 21 | 21 | |
| 22 | 22 | m = \ ds -> 9##
|
| 23 | 23 | |
| 24 | 24 | fp
|
| 25 | 25 | = \ @n $dKnownNat ds ->
|
| 26 | - naturalToWord# ((natSing $dKnownNat) `cast` <Co:10> :: ...)
|
|
| 26 | + naturalToWord# ((natSing $dKnownNat) `cast` <Co:10>)
|
|
| 27 | 27 | |
| 28 | 28 | p = \ ds -> 512##
|
| 29 | 29 |
| ... | ... | @@ -5,7 +5,7 @@ Result size of Tidy Core |
| 5 | 5 | |
| 6 | 6 | testFun
|
| 7 | 7 | = \ @x v ->
|
| 8 | - case v `cast` <Co:2> :: ... of {
|
|
| 8 | + case v `cast` <Co:2> of {
|
|
| 9 | 9 | __DEFAULT -> 47#;
|
| 10 | 10 | C0 ipv -> -3#;
|
| 11 | 11 | C2 -> 13#;
|
| 1 | 1 | foo :: Goof Int
|
| 2 | -foo = T14978.Goof @Int @~<Co:1> :: Int GHC.Internal.Prim.~# Int |
|
| 2 | +foo = T14978.Goof @Int @~(<Co:1> :: Int GHC.Internal.Prim.~# Int) |
| ... | ... | @@ -161,11 +161,11 @@ T18013.$wmapMaybeRule |
| 161 | 161 | @s @(Maybe b) ww2 (GHC.Internal.Maybe.Nothing @b) #);
|
| 162 | 162 | Just x ->
|
| 163 | 163 | case ((wild s2 x)
|
| 164 | - `cast` <Co:4> :: IO (Result s b)
|
|
| 165 | - ~R# (GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld
|
|
| 166 | - -> (# GHC.Internal.Prim.State#
|
|
| 167 | - GHC.Internal.Prim.RealWorld,
|
|
| 168 | - Result s b #)))
|
|
| 164 | + `cast` (<Co:4>
|
|
| 165 | + :: IO (Result s b)
|
|
| 166 | + ~R# (GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld
|
|
| 167 | + -> (# GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld,
|
|
| 168 | + Result s b #))))
|
|
| 169 | 169 | s1
|
| 170 | 170 | of
|
| 171 | 171 | { (# ipv, ipv1 #) ->
|
| ... | ... | @@ -175,12 +175,13 @@ T18013.$wmapMaybeRule |
| 175 | 175 | }
|
| 176 | 176 | }
|
| 177 | 177 | })
|
| 178 | - `cast` <Co:13> :: (s
|
|
| 179 | - -> Maybe a
|
|
| 180 | - -> GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld
|
|
| 181 | - -> (# GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld,
|
|
| 182 | - Result s (Maybe b) #))
|
|
| 183 | - ~R# (s -> Maybe a -> IO (Result s (Maybe b))))
|
|
| 178 | + `cast` (<Co:13>
|
|
| 179 | + :: (s
|
|
| 180 | + -> Maybe a
|
|
| 181 | + -> GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld
|
|
| 182 | + -> (# GHC.Internal.Prim.State# GHC.Internal.Prim.RealWorld,
|
|
| 183 | + Result s (Maybe b) #))
|
|
| 184 | + ~R# (s -> Maybe a -> IO (Result s (Maybe b)))))
|
|
| 184 | 185 | }
|
| 185 | 186 | }
|
| 186 | 187 |
| ... | ... | @@ -15,8 +15,8 @@ foo |
| 15 | 15 | = \ @a ds ds1 ->
|
| 16 | 16 | case ds of { I# ww ->
|
| 17 | 17 | case ww of ds2 {
|
| 18 | - __DEFAULT -> case ds1 `cast` <Co:4> :: ... of { (x, y) -> case foo_$s$wfoo (-# ds2 1#) y x of { (# ww1 #) -> Just ww1 } };
|
|
| 19 | - 0# -> Just (ds1 `cast` <Co:4> :: ...)
|
|
| 18 | + __DEFAULT -> case ds1 `cast` <Co:4> of { (x, y) -> case foo_$s$wfoo (-# ds2 1#) y x of { (# ww1 #) -> Just ww1 } };
|
|
| 19 | + 0# -> Just (ds1 `cast` <Co:4>)
|
|
| 20 | 20 | }
|
| 21 | 21 | }
|
| 22 | 22 |
| ... | ... | @@ -15,8 +15,8 @@ foo |
| 15 | 15 | = \ @a ds ds1 ->
|
| 16 | 16 | case ds of { I# ww ->
|
| 17 | 17 | case ww of ds2 {
|
| 18 | - __DEFAULT -> case ds1 `cast` <Co:4> :: ... of { (x, y) -> case foo_$s$wfoo (-# ds2 1#) y x of { (# ww1 #) -> Just ww1 } };
|
|
| 19 | - 0# -> Just (ds1 `cast` <Co:4> :: ...)
|
|
| 18 | + __DEFAULT -> case ds1 `cast` <Co:4> of { (x, y) -> case foo_$s$wfoo (-# ds2 1#) y x of { (# ww1 #) -> Just ww1 } };
|
|
| 19 | + 0# -> Just (ds1 `cast` <Co:4>)
|
|
| 20 | 20 | }
|
| 21 | 21 | }
|
| 22 | 22 |