[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Update comments on `OptKind` to reflect the code reality
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 33868d5b by Simon Hengel at 2025-07-30T06:51:52-04:00 Update comments on `OptKind` to reflect the code reality - - - - - cf95af8b by Wen Kokke at 2025-07-30T06:51:55-04:00 rts: Disable --eventlog-flush-interval unless compiled with -threaded. This commit fixes issue #26222: Using --eventlog-flush-interval with the non-threaded RTS leads to eventlog corruption. https://gitlab.haskell.org/ghc/ghc/-/issues/26222 This commit makes three changes when code is compiled against the non-threaded RTS: 1. It disables the --eventlog-flush-interval flag. 2. It disables the documentation for the --eventlog-flush-interval flag. 3. It disables the relevant state from RtsConfig and code from Timer. 4. It updates the entry for --eventlog-flush-interval in the users guide. - - - - - 22e8f74b by Wen Kokke at 2025-07-30T06:51:55-04:00 rts: Split T20006 into tests with and without -threaded - - - - - 605491ce by Simon Hengel at 2025-07-30T06:51:56-04:00 docs/users_guide/win32-dlls.rst: Remove references to `readline` - - - - - 7 changed files: - compiler/GHC/Driver/CmdLine.hs - docs/users_guide/runtime_control.rst - docs/users_guide/win32-dlls.rst - rts/RtsFlags.c - rts/Timer.c - rts/include/rts/Flags.h - testsuite/tests/rts/flags/all.T Changes: ===================================== compiler/GHC/Driver/CmdLine.hs ===================================== @@ -92,14 +92,14 @@ data GhcFlagMode data OptKind m -- Suppose the flag is -f = NoArg (EwM m ()) -- -f all by itself - | HasArg (String -> EwM m ()) -- -farg or -f arg + | HasArg (String -> EwM m ()) -- -farg or -f=arg or -f arg | SepArg (String -> EwM m ()) -- -f arg - | Prefix (String -> EwM m ()) -- -farg - | OptPrefix (String -> EwM m ()) -- -f or -farg (i.e. the arg is optional) - | OptIntSuffix (Maybe Int -> EwM m ()) -- -f or -f=n; pass n to fn - | IntSuffix (Int -> EwM m ()) -- -f or -f=n; pass n to fn - | Word64Suffix (Word64 -> EwM m ()) -- -f or -f=n; pass n to fn - | FloatSuffix (Float -> EwM m ()) -- -f or -f=n; pass n to fn + | Prefix (String -> EwM m ()) -- -farg or -f=arg + | OptPrefix (String -> EwM m ()) -- -f or -farg or -f=arg (i.e. the arg is optional) + | OptIntSuffix (Maybe Int -> EwM m ()) -- -f or -fn or -f=n; pass n to fn + | IntSuffix (Int -> EwM m ()) -- -fn or -f=n; pass n to fn + | Word64Suffix (Word64 -> EwM m ()) -- -fn or -f=n; pass n to fn + | FloatSuffix (Float -> EwM m ()) -- -fn or -f=n; pass n to fn | PassFlag (String -> EwM m ()) -- -f; pass "-f" fn | AnySuffix (String -> EwM m ()) -- -f or -farg; pass entire "-farg" to fn ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -1361,7 +1361,8 @@ When the program is linked with the :ghc-flag:`-eventlog` option :since: 9.2 When enabled, the eventlog will be flushed periodically every - ⟨seconds⟩. This can be useful in live-monitoring situations where the + ⟨seconds⟩ (only available with :ghc-flag:`-threaded`). + This can be useful in live-monitoring situations where the eventlog is consumed in real-time by another process. .. rts-flag:: -v [⟨flags⟩] ===================================== docs/users_guide/win32-dlls.rst ===================================== @@ -76,11 +76,6 @@ window, use the flag ``-optl-mwindows`` in the link step. However using Debug.Trace.trace is alright because it uses Windows debugging output support rather than ``stderr``. -For some reason, Mingw ships with the ``readline`` library, but not with -the ``readline`` headers. As a result, GHC (like Hugs) does not use -``readline`` for interactive input on Windows. You can get a close -simulation by using an emacs shell buffer! - .. _library-differences: Differences in library behaviour ===================================== rts/RtsFlags.c ===================================== @@ -248,7 +248,9 @@ void initRtsFlagsDefaults(void) RtsFlags.TraceFlags.user = false; RtsFlags.TraceFlags.ticky = false; RtsFlags.TraceFlags.trace_output = NULL; +# if defined(THREADED_RTS) RtsFlags.TraceFlags.eventlogFlushTime = 0; +# endif RtsFlags.TraceFlags.nullWriter = false; #endif @@ -448,8 +450,10 @@ usage_text[] = { # endif " -x disable an event class, for any flag above", " the initial enabled event classes are 'sgpu'", +# if defined(THREADED_RTS) " --eventlog-flush-interval=<secs>", " Periodically flush the eventlog at the specified interval.", +# endif #endif "", @@ -1052,12 +1056,14 @@ error = true; else if (!strncmp("eventlog-flush-interval=", &rts_argv[arg][2], 24)) { OPTION_SAFE; + THREADED_BUILD_ONLY( double intervalSeconds = parseDouble(rts_argv[arg]+26, &error); if (error) { errorBelch("bad value for --eventlog-flush-interval"); } RtsFlags.TraceFlags.eventlogFlushTime = fsecondsToTime(intervalSeconds); + ) break; } else if (strequal("copying-gc", &rts_argv[arg][2])) { @@ -1963,6 +1969,7 @@ static void normaliseRtsOpts (void) RtsFlags.ProfFlags.heapProfileIntervalTicks = 0; } +#if defined(THREADED_RTS) if (RtsFlags.TraceFlags.eventlogFlushTime > 0 && RtsFlags.MiscFlags.tickInterval != 0) { RtsFlags.TraceFlags.eventlogFlushTicks = RtsFlags.TraceFlags.eventlogFlushTime / @@ -1970,6 +1977,7 @@ static void normaliseRtsOpts (void) } else { RtsFlags.TraceFlags.eventlogFlushTicks = 0; } +#endif if (RtsFlags.GcFlags.stkChunkBufferSize > RtsFlags.GcFlags.stkChunkSize / 2) { ===================================== rts/Timer.c ===================================== @@ -43,8 +43,10 @@ static StgWord timer_disabled; /* ticks left before next pre-emptive context switch */ static int ticks_to_ctxt_switch = 0; +#if defined(THREADED_RTS) /* ticks left before next next forced eventlog flush */ static int ticks_to_eventlog_flush = 0; +#endif /* @@ -118,7 +120,7 @@ handle_tick(int unused STG_UNUSED) contextSwitchAllCapabilities(); /* schedule a context switch */ } } - +#if defined(THREADED_RTS) if (eventLogStatus() == EVENTLOG_RUNNING && RtsFlags.TraceFlags.eventlogFlushTicks > 0) { ticks_to_eventlog_flush--; @@ -127,6 +129,7 @@ handle_tick(int unused STG_UNUSED) flushEventLog(NULL); } } +#endif /* * If we've been inactive for idleGCDelayTime (set by +RTS ===================================== rts/include/rts/Flags.h ===================================== @@ -188,8 +188,11 @@ typedef struct _TRACE_FLAGS { bool sparks_full; /* trace spark events 100% accurately */ bool ticky; /* trace ticky-ticky samples */ bool user; /* trace user events (emitted from Haskell code) */ - Time eventlogFlushTime; /* Time between force eventlog flushes (or 0 if disabled) */ +#if defined(THREADED_RTS) + /* Time between force eventlog flushes (or 0 if disabled) */ + Time eventlogFlushTime; int eventlogFlushTicks; +#endif char *trace_output; /* output filename for eventlog */ bool nullWriter; /* use null writer instead of file writer */ } TRACE_FLAGS; ===================================== testsuite/tests/rts/flags/all.T ===================================== @@ -57,6 +57,14 @@ test('T12870h', multimod_compile_and_run, ['T12870g', '-rtsopts=ignoreAll -with-rtsopts="-G3"']) -test('T20006', [extra_run_opts('+RTS --eventlog-flush-interval=1')], - compile_and_run, - ['']) +test('T20006a', + [extra_files(['T20006.hs']), extra_run_opts('+RTS --eventlog-flush-interval=1'), + only_ways(['threaded1', 'threaded2'])], + multimod_compile_and_run, + ['T20006', '']) + +test('T20006b', + [extra_files(['T20006.hs']), extra_run_opts('+RTS --eventlog-flush-interval=1'), + expect_fail_for(['normal'])], + multimod_compile_and_run, + ['T20006', '']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/aeb9536cf194659aa9b21451e5b7e32... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/aeb9536cf194659aa9b21451e5b7e32... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)