Cheng Shao pushed to branch wip/fix-ci-clean at Glasgow Haskell Compiler / GHC Commits: 3bfe7aa2 by Matthew Pickering at 2025-12-07T12:18:57-05:00 ci: Try using multi repl in ghc-in-ghci test This should be quite a bit faster than the ./hadrian/ghci command as it doesn't properly build all the dependencies. - - - - - 2ef1601a by Rodrigo Mesquita at 2025-12-07T12:19:38-05:00 Stack.Decode: Don't error on bitmap size 0 A RET_BCO may have a bitmap with no payload. In that case, the bitmap = 0. One can observe this by using -ddump-bcos and interpreting ``` main = pure () ``` Observe, for instance, that the BCO for this main function has size 0: ``` ProtoBCO Main.main#0: \u [] breakmain:Main,0() GHC.Internal.Base.pure GHC.Internal.Base.$fApplicativeIO GHC.Internal.Tuple.() bitmap: 0 [] BRK_FUN <breakarray> main:Main 0 <cc> PACK () 0 PUSH_G GHC.Internal.Base.$fApplicativeIO PUSH_APPLY_PP PUSH_G GHC.Internal.Base.pure ENTER ``` Perhaps we never tried to decode a stack in which a BCO like this was present. However, for the debugger, we want to decode stacks of threads stopped at breakpoints, and these kind of BCOs do get on a stack under e.g. `stg_apply_interp_info` frames. See the accompanying test in the next commit for an example to trigger the bug this commit fixes. Fixes #26640 - - - - - 747153d2 by Rodrigo Mesquita at 2025-12-07T12:19:38-05:00 Add test for #26640 - - - - - 70f76c29 by Cheng Shao at 2025-12-08T10:37:39+01:00 ci: fix "ci.sh clean" to address frequent out of space error on windows runners This patch fixes the `ci.sh clean` logic to address frequent out of space error on windows runners; previously it didn't clean up the inplace mingw blobs, which is the largest source of space leak on windows runners. See added comment for detailed explanation. - - - - - 8 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs - + testsuite/tests/bytecode/T26640.hs - + testsuite/tests/bytecode/T26640.script - + testsuite/tests/bytecode/T26640.stdout - testsuite/tests/bytecode/all.T Changes: ===================================== .gitlab-ci.yml ===================================== @@ -416,7 +416,7 @@ hadrian-ghc-in-ghci: # workaround for docker permissions - sudo chown ghc:ghc -R . variables: - GHC_FLAGS: -Werror + GHC_FLAGS: -Werror -Wwarn=unused-imports tags: - x86_64-linux script: @@ -428,7 +428,7 @@ hadrian-ghc-in-ghci: - "echo ' ghc-options: -Werror' >> hadrian/cabal.project.local" # Load ghc-in-ghci then immediately exit and check the modules loaded - export CORES="$(mk/detect-cpu-count.sh)" - - echo ":q" | HADRIAN_ARGS=-j$CORES hadrian/ghci -j$CORES | tail -n2 | grep "Ok," + - echo ":q" | HADRIAN_ARGS=-j$CORES hadrian/ghci-multi -j$CORES | tail -n2 | grep "Ok," after_script: - .gitlab/ci.sh save_cache - cat ci_timings.txt ===================================== .gitlab/ci.sh ===================================== @@ -275,7 +275,7 @@ function setup() { function fetch_ghc() { local should_fetch=false - + if [ ! -e "$GHC" ]; then if [ -z "${FETCH_GHC_VERSION:-}" ]; then fail "GHC not found at '$GHC' and FETCH_GHC_VERSION is not set" @@ -292,7 +292,7 @@ function fetch_ghc() { fi fi fi - + if [ "$should_fetch" = true ]; then local v="$FETCH_GHC_VERSION" @@ -887,8 +887,28 @@ function save_cache () { } function clean() { - rm -R tmp - run rm -Rf _build + # When CI_DISPOSABLE_ENVIRONMENT is not true (e.g. using shell + # executor on windows/macos), the project directory is not removed + # by gitlab runner automatically after each job. To mitigate the + # space leak, other than periodic cleaning on the runner host, we + # also must aggressively cleanup build products, otherwise we run + # into out of space errors too frequently. + # + # When CI_DISPOSABLE_ENVIRONMENT is true (using docker executor on + # linux), the runner will do proper cleanup, so no need to do + # anything here. + # + # The exclude list are the artifacts that we do expect to be + # uploaded. Keep in sync with `jobArtifacts` in + # `.gitlab/generate-ci/gen_ci.hs`! + if [[ "${CI_DISPOSABLE_ENVIRONMENT:-}" != true ]]; then + git submodule foreach --recursive git clean -xdf + git clean -xdf \ + --exclude=ci_timings.txt \ + --exclude=ghc-*.tar.xz \ + --exclude=junit.xml \ + --exclude=unexpected-test-output.tar.gz + fi } function run_hadrian() { ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -889,6 +889,8 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} } , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty ] + -- Keep in sync with the exclude list in `function clean()` in + -- `.gitlab/ci.sh`! jobArtifacts = Artifacts { junitReport = "junit.xml" , expireIn = "2 weeks" ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs ===================================== @@ -269,7 +269,7 @@ decodeLargeBitmap getterFun# stackSnapshot# index relativePayloadOffset = do cWordArrayToList ptr size = mapM (peekElemOff ptr) [0 .. (size - 1)] usedBitmapWords :: Int -> Int - usedBitmapWords 0 = error "Invalid large bitmap size 0." + usedBitmapWords 0 = 0 usedBitmapWords size = (size `div` fromIntegral wORD_SIZE_IN_BITS) + 1 bitmapWordsPointerness :: Word -> [Word] -> [Pointerness] ===================================== testsuite/tests/bytecode/T26640.hs ===================================== @@ -0,0 +1,4 @@ +-- Main.hs +module Main where +main = pure () + ===================================== testsuite/tests/bytecode/T26640.script ===================================== @@ -0,0 +1,6 @@ +:l T26640 +:break 3 +main +import GHC.Conc +import GHC.Stack.CloneStack +() <- mapM_ (\ix -> do !_ <- decode =<< cloneThreadStack ix; return ()) =<< listThreads ===================================== testsuite/tests/bytecode/T26640.stdout ===================================== @@ -0,0 +1,3 @@ +Breakpoint 0 activated at T26640.hs:3:8-14 +Stopped in Main.main, T26640.hs:3:8-14 +_result :: IO () = _ ===================================== testsuite/tests/bytecode/all.T ===================================== @@ -8,6 +8,7 @@ test('T25975', extra_ways(ghci_ways), compile_and_run, test('T26565', extra_files(["T26565.hs"]), ghci_script, ['T26565.script']) test('T23973', extra_files(["T23973.hs"]), ghci_script, ['T23973.script']) +test('T26640', extra_files(["T26640.hs"]), ghci_script, ['T26640.script']) # Nullary data constructors test('T26216', extra_files(["T26216_aux.hs"]), ghci_script, ['T26216.script']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/72eab1d557a0c17d931156a244188fc... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/72eab1d557a0c17d931156a244188fc... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Cheng Shao (@TerrorJack)