Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
e10dcd65
by Sven Tennie at 2025-10-12T10:24:56+00:00
-
14040f51
by Hai / @BestYeen at 2025-10-14T15:29:49-04:00
-
1defb8b3
by Hai / @BestYeen at 2025-10-14T15:29:55-04:00
-
27731704
by Cheng Shao at 2025-10-14T15:29:56-04:00
7 changed files:
- docs/users_guide/ghci.rst
- m4/fptools_alex.m4
- m4/fptools_happy.m4
- testsuite/driver/cpu_features.py
- testsuite/tests/perf/should_run/T3586.hs
- testsuite/tests/perf/should_run/all.T
- testsuite/tests/rts/T22859.hs
Changes:
| ... | ... | @@ -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
|
| ... | ... | @@ -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)
|
| ... | ... | @@ -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'])
|
| ... | ... | @@ -42,7 +42,7 @@ main = do |
| 42 | 42 | takeMVar started
|
| 43 | 43 | readMVar done
|
| 44 | 44 | hFlush stderr
|
| 45 | - threadDelay 1000
|
|
| 45 | + threadDelay 50000
|
|
| 46 | 46 | -- default behaviour:
|
| 47 | 47 | -- kill it after the limit is exceeded
|
| 48 | 48 | hPutStrLn stderr "default behaviour"
|
| ... | ... | @@ -68,5 +68,5 @@ main = do |
| 68 | 68 | hPutStrLn stderr "kill and log"
|
| 69 | 69 | setGlobalAllocationLimitHandler KillOnAllocationLimit (Just $ \_ -> hPutStrLn stderr "allocation limit triggered 3")
|
| 70 | 70 | runWorker
|
| 71 | - threadDelay 1000
|
|
| 71 | + threadDelay 50000
|
|
| 72 | 72 | hPutStrLn stderr "done" |