Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
d59ef6b6
by Hai / @BestYeen at 2025-10-14T21:51:14-04:00
-
c98abb6a
by Hai / @BestYeen at 2025-10-14T21:52:08-04:00
-
70ee825a
by Cheng Shao at 2025-10-14T21:52:50-04:00
-
6145c2e7
by Teo Camarasu at 2025-10-14T22:25:36-04:00
-
21a82639
by Ben Gamari at 2025-10-14T22:25:36-04:00
15 changed files:
- .gitmodules
- docs/users_guide/ghci.rst
- hadrian/src/Packages.hs
- hadrian/src/Settings/Default.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lift.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Quote.hs
- + libraries/template-haskell-lift
- + libraries/template-haskell-quasiquoter
- m4/fptools_alex.m4
- m4/fptools_happy.m4
- rts/Printer.c
- rts/posix/OSMem.c
- testsuite/driver/cpu_features.py
- testsuite/tests/perf/should_run/T3586.hs
- testsuite/tests/perf/should_run/all.T
Changes:
| ... | ... | @@ -118,3 +118,9 @@ |
| 118 | 118 | [submodule "libraries/file-io"]
|
| 119 | 119 | path = libraries/file-io
|
| 120 | 120 | url = https://gitlab.haskell.org/ghc/packages/file-io.git
|
| 121 | +[submodule "libraries/template-haskell-lift"]
|
|
| 122 | + path = libraries/template-haskell-lift
|
|
| 123 | + url = https://gitlab.haskell.org/ghc/template-haskell-lift.git
|
|
| 124 | +[submodule "libraries/template-haskell-quasiquoter"]
|
|
| 125 | + path = libraries/template-haskell-quasiquoter
|
|
| 126 | + url = https://gitlab.haskell.org/ghc/template-haskell-quasiquoter.git |
| ... | ... | @@ -403,7 +403,7 @@ it can be *instantiated* to ``IO a``. For example |
| 403 | 403 | |
| 404 | 404 | .. code-block:: none
|
| 405 | 405 | |
| 406 | - ghci> return True
|
|
| 406 | + ghci> pure True
|
|
| 407 | 407 | True
|
| 408 | 408 | |
| 409 | 409 | Furthermore, GHCi will print the result of the I/O action if (and only
|
| ... | ... | @@ -419,7 +419,7 @@ For example, remembering that ``putStrLn :: String -> IO ()``: |
| 419 | 419 | |
| 420 | 420 | ghci> putStrLn "hello"
|
| 421 | 421 | hello
|
| 422 | - ghci> do { putStrLn "hello"; return "yes" }
|
|
| 422 | + ghci> do { putStrLn "hello"; pure "yes" }
|
|
| 423 | 423 | hello
|
| 424 | 424 | "yes"
|
| 425 | 425 | |
| ... | ... | @@ -443,12 +443,12 @@ prompt must be in the ``IO`` monad. |
| 443 | 443 | |
| 444 | 444 | .. code-block:: none
|
| 445 | 445 | |
| 446 | - ghci> x <- return 42
|
|
| 446 | + ghci> x <- pure 42
|
|
| 447 | 447 | ghci> print x
|
| 448 | 448 | 42
|
| 449 | 449 | ghci>
|
| 450 | 450 | |
| 451 | -The statement ``x <- return 42`` means “execute ``return 42`` in the
|
|
| 451 | +The statement ``x <- pure 42`` means “execute ``pure 42`` in the
|
|
| 452 | 452 | ``IO`` monad, and bind the result to ``x``\ ”. We can then use ``x`` in
|
| 453 | 453 | future statements, for example to print it as we did above.
|
| 454 | 454 | |
| ... | ... | @@ -2389,7 +2389,7 @@ commonly used commands. |
| 2389 | 2389 | |
| 2390 | 2390 | .. code-block:: none
|
| 2391 | 2391 | |
| 2392 | - ghci> let date _ = Data.Time.getZonedTime >>= print >> return ""
|
|
| 2392 | + ghci> let date _ = Data.Time.getZonedTime >>= print >> pure ""
|
|
| 2393 | 2393 | ghci> :def date date
|
| 2394 | 2394 | ghci> :date
|
| 2395 | 2395 | 2017-04-10 12:34:56.93213581 UTC
|
| ... | ... | @@ -2399,16 +2399,16 @@ commonly used commands. |
| 2399 | 2399 | |
| 2400 | 2400 | .. code-block:: none
|
| 2401 | 2401 | |
| 2402 | - ghci> let mycd d = System.Directory.setCurrentDirectory d >> return ""
|
|
| 2402 | + ghci> let mycd d = System.Directory.setCurrentDirectory d >> pure ""
|
|
| 2403 | 2403 | ghci> :def mycd mycd
|
| 2404 | 2404 | ghci> :mycd ..
|
| 2405 | 2405 | |
| 2406 | - Or I could define a simple way to invoke "``ghc --make Main``"
|
|
| 2406 | + Or we could define a simple way to invoke "``ghc --make Main``"
|
|
| 2407 | 2407 | in the current directory:
|
| 2408 | 2408 | |
| 2409 | 2409 | .. code-block:: none
|
| 2410 | 2410 | |
| 2411 | - ghci> :def make (\_ -> return ":! ghc --make Main")
|
|
| 2411 | + ghci> :def make (\_ -> pure ":! ghc --make Main")
|
|
| 2412 | 2412 | |
| 2413 | 2413 | We can define a command that reads GHCi input from a file. This
|
| 2414 | 2414 | might be useful for creating a set of bindings that we want to
|
| ... | ... | @@ -2430,6 +2430,15 @@ commonly used commands. |
| 2430 | 2430 | a double colon (eg ``::load``).
|
| 2431 | 2431 | It's not possible to redefine the commands ``:{``, ``:}`` and ``:!``.
|
| 2432 | 2432 | |
| 2433 | + For historical reasons, ``:m`` in ghci is shorthand for ``:module``.
|
|
| 2434 | + If we want to override that to mean ``:main``, in a way that also
|
|
| 2435 | + works when the implicit Prelude is deactivated, we can do it like
|
|
| 2436 | + this using ``:def!``:
|
|
| 2437 | + |
|
| 2438 | + .. code-block:: none
|
|
| 2439 | + |
|
| 2440 | + ghci> :def! m \_ -> Prelude.pure ":main"
|
|
| 2441 | + |
|
| 2433 | 2442 | .. ghci-cmd:: :delete; * | ⟨num⟩ ...
|
| 2434 | 2443 | |
| 2435 | 2444 | Delete one or more breakpoints by number (use :ghci-cmd:`:show breaks` to
|
| ... | ... | @@ -2912,7 +2921,7 @@ commonly used commands. |
| 2912 | 2921 | |
| 2913 | 2922 | .. code-block:: none
|
| 2914 | 2923 | |
| 2915 | - *ghci> :def cond \expr -> return (":cmd if (" ++ expr ++ ") then return \"\" else return \":continue\"")
|
|
| 2924 | + *ghci> :def cond \expr -> pure (":cmd if (" ++ expr ++ ") then pure \"\" else pure \":continue\"")
|
|
| 2916 | 2925 | *ghci> :set stop 0 :cond (x < 3)
|
| 2917 | 2926 | |
| 2918 | 2927 | To ignore breakpoints for a specified number of iterations use
|
| ... | ... | @@ -9,7 +9,7 @@ module Packages ( |
| 9 | 9 | ghcToolchain, ghcToolchainBin, haddockApi, haddockLibrary, haddock, haskeline,
|
| 10 | 10 | hsc2hs, hp2ps, hpc, hpcBin, integerGmp, iserv, iservProxy,
|
| 11 | 11 | libffi, mtl, osString, parsec, pretty, primitive, process, remoteIserv, rts,
|
| 12 | - runGhc, semaphoreCompat, stm, templateHaskell, terminfo, text, time, timeout,
|
|
| 12 | + runGhc, semaphoreCompat, stm, templateHaskell, thLift, thQuasiquoter, terminfo, text, time, timeout,
|
|
| 13 | 13 | transformers, unlit, unix, win32, xhtml,
|
| 14 | 14 | lintersCommon, lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace,
|
| 15 | 15 | ghcPackages, isGhcPackage,
|
| ... | ... | @@ -39,7 +39,7 @@ ghcPackages = |
| 39 | 39 | , ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghcInternal, ghci, ghciWrapper, ghcPkg, ghcPrim
|
| 40 | 40 | , ghcToolchain, ghcToolchainBin, haddockApi, haddockLibrary, haddock, haskeline, hsc2hs
|
| 41 | 41 | , hp2ps, hpc, hpcBin, integerGmp, iserv, libffi, mtl, osString
|
| 42 | - , parsec, pretty, process, rts, runGhc, stm, semaphoreCompat, templateHaskell
|
|
| 42 | + , parsec, pretty, process, rts, runGhc, stm, semaphoreCompat, templateHaskell, thLift, thQuasiquoter
|
|
| 43 | 43 | , terminfo, text, time, transformers, unlit, unix, win32, xhtml, fileio
|
| 44 | 44 | , timeout
|
| 45 | 45 | , lintersCommon
|
| ... | ... | @@ -56,7 +56,7 @@ array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, count |
| 56 | 56 | ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghci, ghcInternal, ghciWrapper, ghcPkg, ghcPrim,
|
| 57 | 57 | ghcToolchain, ghcToolchainBin, haddockLibrary, haddockApi, haddock, haskeline, hsc2hs,
|
| 58 | 58 | hp2ps, hpc, hpcBin, integerGmp, iserv, iservProxy, remoteIserv, libffi, mtl,
|
| 59 | - osString, parsec, pretty, primitive, process, rts, runGhc, semaphoreCompat, stm, templateHaskell,
|
|
| 59 | + osString, parsec, pretty, primitive, process, rts, runGhc, semaphoreCompat, stm, templateHaskell, thLift, thQuasiquoter,
|
|
| 60 | 60 | terminfo, text, time, transformers, unlit, unix, win32, xhtml,
|
| 61 | 61 | timeout,
|
| 62 | 62 | lintersCommon, lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace
|
| ... | ... | @@ -124,6 +124,8 @@ runGhc = util "runghc" |
| 124 | 124 | semaphoreCompat = lib "semaphore-compat"
|
| 125 | 125 | stm = lib "stm"
|
| 126 | 126 | templateHaskell = lib "template-haskell"
|
| 127 | +thLift = lib "template-haskell-lift"
|
|
| 128 | +thQuasiquoter = lib "template-haskell-quasiquoter"
|
|
| 127 | 129 | terminfo = lib "terminfo"
|
| 128 | 130 | text = lib "text"
|
| 129 | 131 | time = lib "time"
|
| ... | ... | @@ -106,6 +106,8 @@ stage0Packages = do |
| 106 | 106 | , runGhc
|
| 107 | 107 | , semaphoreCompat -- depends on
|
| 108 | 108 | , time -- depends on win32
|
| 109 | + , thLift -- new library not yet present for boot compilers
|
|
| 110 | + , thQuasiquoter -- new library not yet present for boot compilers
|
|
| 109 | 111 | , unlit
|
| 110 | 112 | , if windowsHost then win32 else unix
|
| 111 | 113 | -- We must use the in-tree `Win32` as the version
|
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | -- | This module gives the definition of the 'Lift' class.
|
| 21 | 21 | --
|
| 22 | 22 | -- This is an internal module.
|
| 23 | --- Please import "Language.Haskell.TH" or "Language.Haskell.TH.Syntax" instead!
|
|
| 23 | +-- Please import "Language.Haskell.TH.Lift", "Language.Haskell.TH" or "Language.Haskell.TH.Syntax" instead!
|
|
| 24 | 24 | |
| 25 | 25 | module GHC.Internal.TH.Lift
|
| 26 | 26 | ( Lift(..)
|
| ... | ... | @@ -71,6 +71,9 @@ import GHC.Internal.ForeignPtr |
| 71 | 71 | -- > deriving Lift
|
| 72 | 72 | --
|
| 73 | 73 | -- Representation-polymorphic since /template-haskell-2.16.0.0/.
|
| 74 | +--
|
|
| 75 | +-- This is exposed both from the @template-haskell-lift@ and @template-haskell@ packages.
|
|
| 76 | +-- Consider importing it from the more stable @template-haskell-lift@ if you don't need the full breadth of the @template-haskell@ interface.
|
|
| 74 | 77 | class Lift (t :: TYPE r) where
|
| 75 | 78 | -- | Turn a value into a Template Haskell expression, suitable for use in
|
| 76 | 79 | -- a splice.
|
| ... | ... | @@ -31,6 +31,9 @@ import GHC.Internal.Base hiding (Type) |
| 31 | 31 | -- @QuasiQuoter@ that is only intended to be used in certain splice
|
| 32 | 32 | -- contexts, the unused fields should just 'fail'. This is most easily
|
| 33 | 33 | -- accomplished using 'namedefaultQuasiQuoter' or 'defaultQuasiQuoter'.
|
| 34 | +--
|
|
| 35 | +-- This is exposed both from the @template-haskell-quasiquoter@ and @template-haskell@ packages.
|
|
| 36 | +-- Consider importing it from the more stable @template-haskell-quasiquoter@ if you don't need the full breadth of the @template-haskell@ interface.
|
|
| 34 | 37 | data QuasiQuoter = QuasiQuoter {
|
| 35 | 38 | -- | Quasi-quoter for expressions, invoked by quotes like @lhs = $[q|...]@
|
| 36 | 39 | quoteExp :: String -> Q Exp,
|
| 1 | +Subproject commit e0b2a7eefcd1b7247af63ab4a691d3161eada284 |
| 1 | +Subproject commit a47506eca032b139d9779fb8210d408c81d3fbd6 |
| ... | ... | @@ -23,10 +23,16 @@ changequote([, ])dnl |
| 23 | 23 | ])
|
| 24 | 24 | if test ! -f compiler/GHC/Parser/Lexer.hs || test ! -f compiler/GHC/Cmm/Lexer.hs
|
| 25 | 25 | then
|
| 26 | + if test x"$fptools_cv_alex_version" != x; then
|
|
| 27 | + fptools_cv_alex_version_display="version $fptools_cv_alex_version";
|
|
| 28 | + else
|
|
| 29 | + fptools_cv_alex_version_display="none";
|
|
| 30 | + fi;
|
|
| 31 | + failure_msg="Alex version >= 3.2.6 && < 4 is required to compile GHC. (Found: $fptools_cv_alex_version_display)"
|
|
| 26 | 32 | FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[3.2.6],
|
| 27 | - [AC_MSG_ERROR([Alex >= 3.2.6 && < 4 is required to compile GHC.])])[]
|
|
| 33 | + [AC_MSG_ERROR([$failure_msg])])[]
|
|
| 28 | 34 | FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-ge],[4.0.0],
|
| 29 | - [AC_MSG_ERROR([Alex >= 3.2.6 && < 4 is required to compile GHC.])])[]
|
|
| 35 | + [AC_MSG_ERROR([$failure_msg])])[]
|
|
| 30 | 36 | fi
|
| 31 | 37 | AlexVersion=$fptools_cv_alex_version;
|
| 32 | 38 | AC_SUBST(AlexVersion)
|
| ... | ... | @@ -13,8 +13,7 @@ AC_DEFUN([FPTOOLS_HAPPY], |
| 13 | 13 | AC_SUBST(HappyCmd,$HAPPY)
|
| 14 | 14 | AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
|
| 15 | 15 | changequote(, )dnl
|
| 16 | -[
|
|
| 17 | -if test x"$HappyCmd" != x; then
|
|
| 16 | +[if test x"$HappyCmd" != x; then
|
|
| 18 | 17 | fptools_cv_happy_version=`"$HappyCmd" -v |
|
| 19 | 18 | grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'` ;
|
| 20 | 19 | else
|
| ... | ... | @@ -24,7 +23,12 @@ changequote([, ])dnl |
| 24 | 23 | ])
|
| 25 | 24 | if test ! -f compiler/GHC/Parser.hs || test ! -f compiler/GHC/Cmm/Parser.hs
|
| 26 | 25 | then
|
| 27 | - failure_msg="Happy version == 1.20.* || >= 2.0.2 && < 2.2 is required to compile GHC"
|
|
| 26 | + if test x"$fptools_cv_happy_version" != x; then
|
|
| 27 | + fptools_cv_happy_version_display="version $fptools_cv_happy_version";
|
|
| 28 | + else
|
|
| 29 | + fptools_cv_happy_version_display="none";
|
|
| 30 | + fi;
|
|
| 31 | + failure_msg="Happy version == 1.20.* || >= 2.0.2 && < 2.2 is required to compile GHC. (Found: $fptools_cv_happy_version_display)"
|
|
| 28 | 32 | FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.20.0],
|
| 29 | 33 | [AC_MSG_ERROR([$failure_msg])])[]
|
| 30 | 34 | FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-ge],[1.21.0],
|
| ... | ... | @@ -32,7 +36,6 @@ then |
| 32 | 36 | [AC_MSG_ERROR([$failure_msg])])[])[]
|
| 33 | 37 | FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-ge],[2.2.0],
|
| 34 | 38 | [AC_MSG_ERROR([$failure_msg])])[]
|
| 35 | - |
|
| 36 | 39 | fi
|
| 37 | 40 | HappyVersion=$fptools_cv_happy_version;
|
| 38 | 41 | AC_SUBST(HappyVersion)
|
| ... | ... | @@ -1033,8 +1033,8 @@ findPtr(P_ p, int follow) |
| 1033 | 1033 | {
|
| 1034 | 1034 | uint32_t g, n;
|
| 1035 | 1035 | bdescr *bd;
|
| 1036 | - const int arr_size = 1024;
|
|
| 1037 | - StgPtr arr[arr_size];
|
|
| 1036 | +#define ARR_SIZE 1024
|
|
| 1037 | + StgPtr arr[ARR_SIZE];
|
|
| 1038 | 1038 | int i = 0;
|
| 1039 | 1039 | searched = 0;
|
| 1040 | 1040 | |
| ... | ... | @@ -1044,24 +1044,24 @@ findPtr(P_ p, int follow) |
| 1044 | 1044 | // just before a block is used.
|
| 1045 | 1045 | for (n = 0; n < getNumCapabilities(); n++) {
|
| 1046 | 1046 | bd = nurseries[i].blocks;
|
| 1047 | - i = findPtrBlocks(p,bd,arr,arr_size,i);
|
|
| 1048 | - if (i >= arr_size) return;
|
|
| 1047 | + i = findPtrBlocks(p,bd,arr,ARR_SIZE,i);
|
|
| 1048 | + if (i >= ARR_SIZE) return;
|
|
| 1049 | 1049 | }
|
| 1050 | 1050 | #endif
|
| 1051 | 1051 | |
| 1052 | 1052 | for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
|
| 1053 | 1053 | bd = generations[g].blocks;
|
| 1054 | - i = findPtrBlocks(p,bd,arr,arr_size,i);
|
|
| 1054 | + i = findPtrBlocks(p,bd,arr,ARR_SIZE,i);
|
|
| 1055 | 1055 | bd = generations[g].large_objects;
|
| 1056 | - i = findPtrBlocks(p,bd,arr,arr_size,i);
|
|
| 1057 | - if (i >= arr_size) return;
|
|
| 1056 | + i = findPtrBlocks(p,bd,arr,ARR_SIZE,i);
|
|
| 1057 | + if (i >= ARR_SIZE) return;
|
|
| 1058 | 1058 | for (n = 0; n < getNumCapabilities(); n++) {
|
| 1059 | 1059 | i = findPtrBlocks(p, gc_threads[n]->gens[g].part_list,
|
| 1060 | - arr, arr_size, i);
|
|
| 1060 | + arr, ARR_SIZE, i);
|
|
| 1061 | 1061 | i = findPtrBlocks(p, gc_threads[n]->gens[g].todo_bd,
|
| 1062 | - arr, arr_size, i);
|
|
| 1062 | + arr, ARR_SIZE, i);
|
|
| 1063 | 1063 | }
|
| 1064 | - if (i >= arr_size) return;
|
|
| 1064 | + if (i >= ARR_SIZE) return;
|
|
| 1065 | 1065 | }
|
| 1066 | 1066 | if (follow && i == 1) {
|
| 1067 | 1067 | debugBelch("-->\n");
|
| ... | ... | @@ -585,7 +585,7 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) |
| 585 | 585 | }
|
| 586 | 586 | #endif
|
| 587 | 587 | |
| 588 | - const int MAX_ATTEMPTS = 256;
|
|
| 588 | +#define MAX_ATTEMPTS 256
|
|
| 589 | 589 | void *bad_allocs[MAX_ATTEMPTS];
|
| 590 | 590 | size_t bad_alloc_lens[MAX_ATTEMPTS];
|
| 591 | 591 | memset(bad_allocs, 0, sizeof(void*) * MAX_ATTEMPTS);
|
| ... | ... | @@ -8,7 +8,7 @@ SUPPORTED_CPU_FEATURES = { |
| 8 | 8 | # These aren't comprehensive; they are only CPU features that we care about
|
| 9 | 9 | |
| 10 | 10 | # x86:
|
| 11 | - 'sse', 'sse2', 'sse3', 'ssse3', 'sse4_1', 'sse4_2',
|
|
| 11 | + 'sse', 'sse2', 'sse3', 'pni', 'ssse3', 'sse4_1', 'sse4_2',
|
|
| 12 | 12 | 'avx', 'avx2', 'avx512f',
|
| 13 | 13 | 'fma',
|
| 14 | 14 | 'popcnt', 'bmi1', 'bmi2'
|
| 1 | 1 | {-# LANGUAGE BangPatterns #-}
|
| 2 | -{-# OPTIONS -fvia-C -optc-O3 -fexcess-precision -optc-msse3 #-}
|
|
| 2 | +{-# OPTIONS -optc-O3 -fexcess-precision #-}
|
|
| 3 | 3 | |
| 4 | 4 | import Control.Monad.ST
|
| 5 | 5 | import Data.Array.ST
|
| ... | ... | @@ -43,6 +43,7 @@ test('T3586', |
| 43 | 43 | [collect_runtime_residency(2),
|
| 44 | 44 | collect_stats('bytes allocated', 5),
|
| 45 | 45 | only_ways(['normal']),
|
| 46 | + when(have_cpu_feature('pni') or have_cpu_feature('sse3'), extra_hc_opts('-optc-msse3')),
|
|
| 46 | 47 | ],
|
| 47 | 48 | compile_and_run,
|
| 48 | 49 | ['-O'])
|