Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC

Commits:

7 changed files:

Changes:

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -20,6 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
    20 20
     import qualified Data.Set as S
    
    21 21
     import System.Environment
    
    22 22
     import Data.List
    
    23
    +import Data.Char (isSpace)
    
    23 24
     
    
    24 25
     {-
    
    25 26
     Note [Generating the CI pipeline]
    
    ... ... @@ -893,14 +894,24 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} }
    893 894
               Emulator s       -> "CROSS_EMULATOR" =: s
    
    894 895
               NoEmulatorNeeded -> mempty
    
    895 896
           , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty
    
    896
    -      , let runtestArgs =
    
    897
    +      , let testTimeoutArg =
    
    898
    +                case crossEmulator buildConfig of
    
    899
    +                  -- Emulators are naturally slower than native machines.
    
    900
    +                  -- Triple the default of 300.
    
    901
    +                  Emulator _ -> "-e config.timeout=900" :: String
    
    902
    +                  _ -> mempty
    
    903
    +            runtestArgs =
    
    904
    +                testTimeoutArg :
    
    897 905
                     [ "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity"
    
    898 906
                     | validateNonmovingGc buildConfig
    
    899 907
                     ]
    
    900
    -        in "RUNTEST_ARGS" =: unwords runtestArgs
    
    908
    +        in "RUNTEST_ARGS" =: (trim . unwords) runtestArgs
    
    901 909
           , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty
    
    902 910
           ]
    
    903 911
     
    
    912
    +    trim :: String -> String
    
    913
    +    trim = dropWhileEnd isSpace . dropWhile isSpace
    
    914
    +
    
    904 915
         -- Keep in sync with the exclude list in `function clean()` in
    
    905 916
         -- `.gitlab/ci.sh`!
    
    906 917
         jobArtifacts = Artifacts
    

  • .gitlab/jobs.yaml
    ... ... @@ -389,7 +389,7 @@
    389 389
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    390 390
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    391 391
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    392
    -      "RUNTEST_ARGS": "",
    
    392
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    393 393
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    394 394
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    395 395
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -471,7 +471,7 @@
    471 471
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    472 472
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    473 473
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    474
    -      "RUNTEST_ARGS": "",
    
    474
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    475 475
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    476 476
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    477 477
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1060,7 +1060,7 @@
    1060 1060
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1061 1061
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1062 1062
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1063
    -      "RUNTEST_ARGS": "",
    
    1063
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1064 1064
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1065 1065
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1066 1066
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1143,7 +1143,7 @@
    1143 1143
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1144 1144
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1145 1145
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1146
    -      "RUNTEST_ARGS": "",
    
    1146
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1147 1147
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1148 1148
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1149 1149
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -2055,7 +2055,7 @@
    2055 2055
           "CROSS_STAGE": "2",
    
    2056 2056
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    2057 2057
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2058
    -      "RUNTEST_ARGS": "",
    
    2058
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2059 2059
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
    
    2060 2060
           "XZ_OPT": "-9"
    
    2061 2061
         }
    
    ... ... @@ -2119,9 +2119,10 @@
    2119 2119
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2120 2120
           "CONFIGURE_WRAPPER": "emconfigure",
    
    2121 2121
           "CROSS_EMULATOR": "js-emulator",
    
    2122
    +      "CROSS_STAGE": "2",
    
    2122 2123
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    2123 2124
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2124
    -      "RUNTEST_ARGS": "",
    
    2125
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2125 2126
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    2126 2127
           "XZ_OPT": "-9"
    
    2127 2128
         }
    
    ... ... @@ -2503,7 +2504,7 @@
    2503 2504
           "CROSS_STAGE": "2",
    
    2504 2505
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    2505 2506
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2506
    -      "RUNTEST_ARGS": "",
    
    2507
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2507 2508
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate",
    
    2508 2509
           "XZ_OPT": "-9"
    
    2509 2510
         }
    
    ... ... @@ -3582,7 +3583,7 @@
    3582 3583
           "CROSS_STAGE": "2",
    
    3583 3584
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    3584 3585
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3585
    -      "RUNTEST_ARGS": "",
    
    3586
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    3586 3587
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    3587 3588
           "XZ_OPT": "-9"
    
    3588 3589
         }
    
    ... ... @@ -6229,7 +6230,7 @@
    6229 6230
           "CROSS_STAGE": "2",
    
    6230 6231
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    6231 6232
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6232
    -      "RUNTEST_ARGS": "",
    
    6233
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6233 6234
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate"
    
    6234 6235
         }
    
    6235 6236
       },
    
    ... ... @@ -6292,9 +6293,10 @@
    6292 6293
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    6293 6294
           "CONFIGURE_WRAPPER": "emconfigure",
    
    6294 6295
           "CROSS_EMULATOR": "js-emulator",
    
    6296
    +      "CROSS_STAGE": "2",
    
    6295 6297
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    6296 6298
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6297
    -      "RUNTEST_ARGS": "",
    
    6299
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6298 6300
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate"
    
    6299 6301
         }
    
    6300 6302
       },
    
    ... ... @@ -6671,7 +6673,7 @@
    6671 6673
           "CROSS_STAGE": "2",
    
    6672 6674
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    6673 6675
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6674
    -      "RUNTEST_ARGS": "",
    
    6676
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6675 6677
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate"
    
    6676 6678
         }
    
    6677 6679
       },
    
    ... ... @@ -7734,7 +7736,7 @@
    7734 7736
           "CROSS_STAGE": "2",
    
    7735 7737
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    7736 7738
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7737
    -      "RUNTEST_ARGS": "",
    
    7739
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    7738 7740
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate"
    
    7739 7741
         }
    
    7740 7742
       },
    

  • ghc/GHC/Driver/Session/Mode.hs
    ... ... @@ -132,7 +132,7 @@ isDoEvalMode :: Mode -> Bool
    132 132
     isDoEvalMode (Right (Right (DoEval _))) = True
    
    133 133
     isDoEvalMode _ = False
    
    134 134
     
    
    135
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    135
    +#if defined(HAVE_INTERPRETER)
    
    136 136
     isInteractiveMode :: PostLoadMode -> Bool
    
    137 137
     isInteractiveMode DoInteractive = True
    
    138 138
     isInteractiveMode _             = False
    

  • ghc/GHCi/UI.hs
    ... ... @@ -1900,7 +1900,9 @@ changeDirectory dir = do
    1900 1900
           fhv <- compileGHCiExpr $
    
    1901 1901
             "System.Directory.setCurrentDirectory " ++ show dir'
    
    1902 1902
           liftIO $ evalIO interp fhv
    
    1903
    +#if defined(HAVE_INTERNAL_INTERPRETER)
    
    1903 1904
         _ -> pure ()
    
    1905
    +#endif
    
    1904 1906
     
    
    1905 1907
     trySuccess :: GhciMonad m => m SuccessFlag -> m SuccessFlag
    
    1906 1908
     trySuccess act =
    

  • ghc/Main.hs
    ... ... @@ -35,7 +35,7 @@ import GHC.Driver.Config.Diagnostic
    35 35
     import GHC.Platform
    
    36 36
     import GHC.Platform.Host
    
    37 37
     
    
    38
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    38
    +#if defined(HAVE_INTERPRETER)
    
    39 39
     import GHCi.UI              ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
    
    40 40
     #endif
    
    41 41
     
    
    ... ... @@ -287,7 +287,7 @@ doRun units srcs args = do
    287 287
         args' = drop 1 $ dropWhile (/= "--") $ map unLoc args
    
    288 288
     
    
    289 289
     ghciUI :: [String] -> [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
    
    290
    -#if !defined(HAVE_INTERNAL_INTERPRETER)
    
    290
    +#if !defined(HAVE_INTERPRETER)
    
    291 291
     ghciUI _ _ _ =
    
    292 292
       throwGhcException (CmdLineError "not built for interactive use")
    
    293 293
     #else
    
    ... ... @@ -331,7 +331,7 @@ showBanner :: PostLoadMode -> DynFlags -> IO ()
    331 331
     showBanner _postLoadMode dflags = do
    
    332 332
        let verb = verbosity dflags
    
    333 333
     
    
    334
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    334
    +#if defined(HAVE_INTERPRETER)
    
    335 335
        -- Show the GHCi banner
    
    336 336
        when (isInteractiveMode _postLoadMode && verb >= 1) $ putStrLn ghciWelcomeMsg
    
    337 337
     #endif
    

  • ghc/ghc-bin.cabal.in
    ... ... @@ -22,6 +22,11 @@ Flag internal-interpreter
    22 22
         Default: False
    
    23 23
         Manual: True
    
    24 24
     
    
    25
    +Flag interpreter
    
    26
    +    Description: Build with interpreter support, both internal and external.
    
    27
    +    Default: False
    
    28
    +    Manual: True
    
    29
    +
    
    25 30
     Flag threaded
    
    26 31
         Description: Link the ghc executable against the threaded RTS
    
    27 32
         Default: True
    
    ... ... @@ -56,7 +61,7 @@ Executable ghc
    56 61
                      -rtsopts=all
    
    57 62
                      "-with-rtsopts=-K512M -H -I5 -T"
    
    58 63
     
    
    59
    -    if flag(internal-interpreter)
    
    64
    +    if flag(interpreter)
    
    60 65
             -- NB: this is never built by the bootstrapping GHC+libraries
    
    61 66
             Build-depends:
    
    62 67
                 deepseq        >= 1.4 && < 1.6,
    
    ... ... @@ -65,7 +70,7 @@ Executable ghc
    65 70
                 haskeline      == 0.8.*,
    
    66 71
                 exceptions     == 0.10.*,
    
    67 72
                 time           >= 1.8 && < 1.16
    
    68
    -        CPP-Options: -DHAVE_INTERNAL_INTERPRETER
    
    73
    +        CPP-Options: -DHAVE_INTERPRETER
    
    69 74
             Other-Modules:
    
    70 75
                 GHCi.Leak
    
    71 76
                 GHCi.UI
    
    ... ... @@ -82,6 +87,9 @@ Executable ghc
    82 87
                 UnboxedTuples
    
    83 88
                 ViewPatterns
    
    84 89
     
    
    90
    +    if flag(internal-interpreter)
    
    91
    +       CPP-Options: -DHAVE_INTERNAL_INTERPRETER
    
    92
    +
    
    85 93
         if flag(threaded)
    
    86 94
           ghc-options: -threaded
    
    87 95
     
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -88,11 +88,10 @@ packageArgs = do
    88 88
                 -- 1. ghcWithInterpreter must be True ("Use interpreter" =
    
    89 89
                 --    "YES")
    
    90 90
                 -- 2. For non-cross case it can be enabled
    
    91
    -            -- 3. For cross case, disable for stage0 since that runs
    
    92
    -            --    on the host and must rely on external interpreter to
    
    93
    -            --    load target code, otherwise enable for stage1 since
    
    94
    -            --    that runs on the target and can use target's own
    
    95
    -            --    ghci object linker
    
    91
    +            -- 3. For cross case, disable for stage0 and stage1 since these run
    
    92
    +            --    on the host and must rely on external interpreter to load
    
    93
    +            --    target code, otherwise enable for stage2 since that runs on
    
    94
    +            --    the target and can use target's own ghci object linker
    
    96 95
                 [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter"
    
    97 96
                 , orM [ notM cross, haveCurses ]  `cabalFlag` "terminfo"
    
    98 97
                 , arg "-build-tool-depends"
    
    ... ... @@ -115,7 +114,8 @@ packageArgs = do
    115 114
                  , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ]
    
    116 115
     
    
    117 116
               , builder (Cabal Flags) ? mconcat
    
    118
    -            [ (expr (ghcWithInterpreter stage)) `cabalFlag` "internal-interpreter"
    
    117
    +            [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter"
    
    118
    +            , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter"
    
    119 119
                 , ifM stage0
    
    120 120
                       -- We build a threaded stage 1 if the bootstrapping compiler
    
    121 121
                       -- supports it.