Andreas Klebinger pushed to branch wip/andreask/enable_ghci_opt at Glasgow Haskell Compiler / GHC
Commits:
-
1b5c5dc3
by Andreas Klebinger at 2026-03-23T14:57:08+01:00
4 changed files:
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/DynFlags.hs
- docs/users_guide/debugging.rst
- docs/users_guide/ghci.rst
Changes:
| ... | ... | @@ -688,7 +688,7 @@ backendForcesOptimization0 (Named NCG) = False |
| 688 | 688 | backendForcesOptimization0 (Named LLVM) = False
|
| 689 | 689 | backendForcesOptimization0 (Named ViaC) = False
|
| 690 | 690 | backendForcesOptimization0 (Named JavaScript) = False
|
| 691 | -backendForcesOptimization0 (Named Bytecode) = True
|
|
| 691 | +backendForcesOptimization0 (Named Bytecode) = False
|
|
| 692 | 692 | backendForcesOptimization0 (Named NoBackend) = False
|
| 693 | 693 | |
| 694 | 694 | -- | I don't understand exactly how this works. But if
|
| ... | ... | @@ -1229,7 +1229,6 @@ defaultFlags settings |
| 1229 | 1229 | Opt_CompactUnwind,
|
| 1230 | 1230 | Opt_ShowErrorContext,
|
| 1231 | 1231 | Opt_SuppressStgReps,
|
| 1232 | - Opt_UnoptimizedCoreForInterpreter,
|
|
| 1233 | 1232 | Opt_SpecialiseIncoherents,
|
| 1234 | 1233 | Opt_WriteSelfRecompInfo
|
| 1235 | 1234 | ]
|
| ... | ... | @@ -1252,19 +1252,18 @@ Other |
| 1252 | 1252 | :type: dynamic
|
| 1253 | 1253 | |
| 1254 | 1254 | :since: 9.8.1
|
| 1255 | - :default: enabled
|
|
| 1255 | + :default: disabled
|
|
| 1256 | 1256 | |
| 1257 | - At the moment, ghci disables optimizations, because not all passes
|
|
| 1258 | - are compatible with the interpreter.
|
|
| 1259 | - This option can be used to override this check, e.g.
|
|
| 1260 | - ``ghci -O2 -fno-unoptimized-core-for-interpreter``.
|
|
| 1261 | - It is not recommended for normal use and can cause a compiler panic.
|
|
| 1257 | + At the moment, optimizations are used with the interpreter are on by default.
|
|
| 1258 | + In case this causes errors or compatibility issues this option can be used to override
|
|
| 1259 | + the behaviour, e.g.
|
|
| 1260 | + ``ghci -O2 -funoptimized-core-for-interpreter``.
|
|
| 1262 | 1261 | |
| 1263 | 1262 | Note that this has an effect on the debugger interface: With optimizations
|
| 1264 | 1263 | in play, free variables in breakpoints may now be substituted with complex
|
| 1265 | - expressions.
|
|
| 1266 | - Those cannot be stored in breakpoints, so any free variable that refers to
|
|
| 1267 | - optimized code will not be inspectable when this flag is enabled.
|
|
| 1264 | + expressions. This means disabling optimizations can improve the debugging experience.
|
|
| 1265 | + As otherwise those variables cannot be stored in breakpoints, so any free variable that refers to
|
|
| 1266 | + optimized code will not be inspectable when this flag is disabled.
|
|
| 1268 | 1267 | |
| 1269 | 1268 | .. ghc-flag:: -fadd-bco-name
|
| 1270 | 1269 | :shortdesc: Add ``BCO_NAME`` instructions in generated bytecode.
|
| ... | ... | @@ -3678,7 +3678,7 @@ The interpreter can't load modules with foreign export declarations! |
| 3678 | 3678 | Unfortunately not. We haven't implemented it yet. Please compile any
|
| 3679 | 3679 | offending modules by hand before loading them into GHCi.
|
| 3680 | 3680 | |
| 3681 | -:ghc-flag:`-O` is ineffective in GHCi!
|
|
| 3681 | +:ghc-flag:`-O` is experimental in GHCi!
|
|
| 3682 | 3682 | |
| 3683 | 3683 | .. index::
|
| 3684 | 3684 | single: optimization; and GHCi
|
| ... | ... | @@ -3686,11 +3686,12 @@ The interpreter can't load modules with foreign export declarations! |
| 3686 | 3686 | Before GHC 9.8, optimizations were considered too unstable to be used with
|
| 3687 | 3687 | the bytecode interpreter.
|
| 3688 | 3688 | This restriction has been lifted, but is still regarded as experimental and
|
| 3689 | - guarded by :ghc-flag:`-funoptimized-core-for-interpreter`, which is enabled
|
|
| 3690 | - by default.
|
|
| 3691 | - In order to use optimizations, run: ::
|
|
| 3689 | + guarded by :ghc-flag:`-funoptimized-core-for-interpreter`. Starting with
|
|
| 3690 | + 10.0 it is enabled by default.
|
|
| 3692 | 3691 | |
| 3693 | - ghci -fno-unoptimized-core-for-interpreter -O
|
|
| 3692 | + If this causes issue you can disable it by using: ::
|
|
| 3693 | + |
|
| 3694 | + ghci -funoptimized-core-for-interpreter -O
|
|
| 3694 | 3695 | |
| 3695 | 3696 | Concurrent threads don't carry on running when GHCi is waiting for input.
|
| 3696 | 3697 | This should work, as long as your GHCi was built with the
|