[Git][ghc/ghc][wip/andreask/enable_ghci_opt] Turn -fno-unoptimied-core-for-interpreter off by default.
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 Turn -fno-unoptimied-core-for-interpreter off by default. Fixes #25955. - - - - - 4 changed files: - compiler/GHC/Driver/Backend.hs - compiler/GHC/Driver/DynFlags.hs - docs/users_guide/debugging.rst - docs/users_guide/ghci.rst Changes: ===================================== compiler/GHC/Driver/Backend.hs ===================================== @@ -688,7 +688,7 @@ backendForcesOptimization0 (Named NCG) = False backendForcesOptimization0 (Named LLVM) = False backendForcesOptimization0 (Named ViaC) = False backendForcesOptimization0 (Named JavaScript) = False -backendForcesOptimization0 (Named Bytecode) = True +backendForcesOptimization0 (Named Bytecode) = False backendForcesOptimization0 (Named NoBackend) = False -- | I don't understand exactly how this works. But if ===================================== compiler/GHC/Driver/DynFlags.hs ===================================== @@ -1229,7 +1229,6 @@ defaultFlags settings Opt_CompactUnwind, Opt_ShowErrorContext, Opt_SuppressStgReps, - Opt_UnoptimizedCoreForInterpreter, Opt_SpecialiseIncoherents, Opt_WriteSelfRecompInfo ] ===================================== docs/users_guide/debugging.rst ===================================== @@ -1252,19 +1252,18 @@ Other :type: dynamic :since: 9.8.1 - :default: enabled + :default: disabled - At the moment, ghci disables optimizations, because not all passes - are compatible with the interpreter. - This option can be used to override this check, e.g. - ``ghci -O2 -fno-unoptimized-core-for-interpreter``. - It is not recommended for normal use and can cause a compiler panic. + At the moment, optimizations are used with the interpreter are on by default. + In case this causes errors or compatibility issues this option can be used to override + the behaviour, e.g. + ``ghci -O2 -funoptimized-core-for-interpreter``. Note that this has an effect on the debugger interface: With optimizations in play, free variables in breakpoints may now be substituted with complex - expressions. - Those cannot be stored in breakpoints, so any free variable that refers to - optimized code will not be inspectable when this flag is enabled. + expressions. This means disabling optimizations can improve the debugging experience. + As otherwise those variables cannot be stored in breakpoints, so any free variable that refers to + optimized code will not be inspectable when this flag is disabled. .. ghc-flag:: -fadd-bco-name :shortdesc: Add ``BCO_NAME`` instructions in generated bytecode. ===================================== docs/users_guide/ghci.rst ===================================== @@ -3678,7 +3678,7 @@ The interpreter can't load modules with foreign export declarations! Unfortunately not. We haven't implemented it yet. Please compile any offending modules by hand before loading them into GHCi. -:ghc-flag:`-O` is ineffective in GHCi! +:ghc-flag:`-O` is experimental in GHCi! .. index:: single: optimization; and GHCi @@ -3686,11 +3686,12 @@ The interpreter can't load modules with foreign export declarations! Before GHC 9.8, optimizations were considered too unstable to be used with the bytecode interpreter. This restriction has been lifted, but is still regarded as experimental and - guarded by :ghc-flag:`-funoptimized-core-for-interpreter`, which is enabled - by default. - In order to use optimizations, run: :: + guarded by :ghc-flag:`-funoptimized-core-for-interpreter`. Starting with + 10.0 it is enabled by default. - ghci -fno-unoptimized-core-for-interpreter -O + If this causes issue you can disable it by using: :: + + ghci -funoptimized-core-for-interpreter -O Concurrent threads don't carry on running when GHCi is waiting for input. This should work, as long as your GHCi was built with the View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1b5c5dc356bc5c446e2cbadb6d0bda47... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1b5c5dc356bc5c446e2cbadb6d0bda47... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Andreas Klebinger (@AndreasK)