Hannes Siebenhandl pushed to branch wip/fendor/no-code-output-constr at Glasgow Haskell Compiler / GHC
Commits:
-
046418ca
by fendor at 2026-06-24T16:16:50+02:00
-
61d935d3
by Matthew Pickering at 2026-06-24T16:16:50+02:00
7 changed files:
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Session.hs
- testsuite/tests/ghci/scripts/all.T
- + testsuite/tests/ghci/scripts/bytecodeIPE.hs
- + testsuite/tests/ghci/scripts/bytecodeIPE.script
- + testsuite/tests/ghci/scripts/bytecodeIPE.stdout
Changes:
| ... | ... | @@ -99,6 +99,7 @@ module GHC.Driver.Backend |
| 99 | 99 | , backendPostHscPipeline
|
| 100 | 100 | , backendNormalSuccessorPhase
|
| 101 | 101 | , backendName
|
| 102 | + , backendSupportsInfoTableMap
|
|
| 102 | 103 | , backendValidityOfCImport
|
| 103 | 104 | , backendValidityOfCExport
|
| 104 | 105 | |
| ... | ... | @@ -680,6 +681,16 @@ backendSupportsBreakpoints = \case |
| 680 | 681 | Named Bytecode -> True
|
| 681 | 682 | Named NoBackend -> False
|
| 682 | 683 | |
| 684 | +-- | If this flag is unset, then the driver ignores the flag @-finfo-table-map@,
|
|
| 685 | +-- since the backend doesn't support generating the info table map.
|
|
| 686 | +backendSupportsInfoTableMap :: Backend -> Bool
|
|
| 687 | +backendSupportsInfoTableMap (Named NCG) = True
|
|
| 688 | +backendSupportsInfoTableMap (Named LLVM) = False
|
|
| 689 | +backendSupportsInfoTableMap (Named ViaC) = True
|
|
| 690 | +backendSupportsInfoTableMap (Named JavaScript) = False
|
|
| 691 | +backendSupportsInfoTableMap (Named Bytecode) = False
|
|
| 692 | +backendSupportsInfoTableMap (Named NoBackend) = True -- We are not generating code, so we ignore it any way
|
|
| 693 | + |
|
| 683 | 694 | -- | If this flag is set, then the driver forces the
|
| 684 | 695 | -- optimization level to 0, issuing a warning message if
|
| 685 | 696 | -- the command line requested a higher optimization level.
|
| ... | ... | @@ -63,6 +63,7 @@ import GHC.Types.Unique.Supply ( UniqueTag(..) ) |
| 63 | 63 | import System.IO
|
| 64 | 64 | import Data.Set (Set)
|
| 65 | 65 | import qualified Data.Set as Set
|
| 66 | +import GHC.Plugins (panic)
|
|
| 66 | 67 | |
| 67 | 68 | {-
|
| 68 | 69 | ************************************************************************
|
| ... | ... | @@ -3903,9 +3903,9 @@ makeDynFlagsConsistent dflags |
| 3903 | 3903 | in dflags_c
|
| 3904 | 3904 | |
| 3905 | 3905 | | gopt Opt_InfoTableMap dflags
|
| 3906 | - , LlvmCodeOutput <- backendCodeOutput (backend dflags)
|
|
| 3906 | + , backendSupportsInfoTableMap (backend dflags)
|
|
| 3907 | 3907 | = loop (gopt_unset dflags Opt_InfoTableMap)
|
| 3908 | - "-finfo-table-map is incompatible with -fllvm and is disabled (See #26435)"
|
|
| 3908 | + $ "-finfo-table-map is incompatible with " ++ show (backend dflags) ++ " and is disabled (See #26435)"
|
|
| 3909 | 3909 | |
| 3910 | 3910 | | otherwise = (dflags, mempty, mempty)
|
| 3911 | 3911 | where loc = mkGeneralSrcSpan (fsLit "when making flags consistent")
|
| ... | ... | @@ -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 |