Add long-form names for RTS options (#19626)
Add long-form names for RTS options (#19626)
Summary
RTS options like -H2G -A32M -xc are cryptic and hard to remember. This adds long-form aliases for all short-form RTS options so users can write self-documenting command lines:
Before:
+RTS -H2G -A32M -xc -RTS
After (both forms accepted):
+RTS --suggested-heap-size=2G --allocation-area-size=32M --show-cost-centre-on-exception -RTS
Short-form options remain unchanged for backward compatibility.
Where is the key part of this patch?
Reviewers should start with rts/RtsFlags.c, specifically the new block of else if branches between the comments Long-form aliases (see #19626) and End long-form aliases in the case '-': block of procRtsOpts. Each branch mirrors the behavior of the corresponding short-form case. The usage_text[] updates in the same file are also worth a look.
Approach
This takes the minimal approach: add else if branches to the existing case '-': block in procRtsOpts, following the pattern already used by options like --nonmoving-gc and --io-manager=.
A more comprehensive table-driven refactor was proposed in !9556 (also tracked as #4243) but has been stalled since 2022. This patch is intentionally non-invasive and does not conflict with that effort. The long-form names chosen here can be reused directly in a future table-driven parser.
For the -D debug flags, a single --debug-<name> handler maps from the long name to the corresponding debug flag rather than duplicating 20+ individual branches.
For the -h heap profiling modes, a --heap-profile=<mode> handler maps mode strings (e.g. cost-centre, closure-type) to the existing read_heap_profiling_flag logic.
Long-form aliases added
| Category | Flags |
|---|---|
| GC |
--allocation-area-size, --large-allocation-area-size, --nursery-chunk-size, --gc-bell, --compact-gc, --mark-region-gc, --old-gen-factor, --return-decay-factor, --max-stack-size, --stack-initial-size, --stack-chunk-size, --stack-chunk-buffer-size, --max-heap-size, --heap-limit-grace, --min-free-heap-percent, --generations, --suggested-heap-size, --min-old-gen-size, --idle-gc-delay, --idle-gc-min-wait, --no-squeeze-update-frames
|
| Statistics |
--collect-stats, --oneline-stats, --summary-stats, --verbose-stats
|
| Profiling |
--cost-centre-summary, --cost-centre-verbose, --cost-centre-all, --cost-centre-json, --profile-output, --max-retainer-set-size, --max-ccs-length, --heap-profile-interval, --show-cost-centre-on-exception
|
| Heap profiling | --heap-profile=<mode> |
| Concurrency |
--context-switch-interval, --tick-interval
|
| Parallelism |
--capabilities, --max-capabilities, --parallel-gc-gen, --gc-load-balancing-gen, --gc-no-sync-idle, --parallel-gc-threads, --set-affinity, --no-migrate, --max-local-sparks
|
| Debug |
--debug-scheduler, --debug-interpreter, --debug-ipe, --debug-weak, --debug-gccafs, --debug-gc, --debug-nonmoving-gc, --debug-block-alloc, --debug-sanity, --debug-zero-on-gc, --debug-stable, --debug-prof, --debug-apply, --debug-linker, --debug-linker-verbose, --debug-stm, --debug-squeeze, --debug-hpc, --debug-sparks, --debug-compact, --debug-continuation, --debug-iomanager
|
| Tracing |
--eventlog-output, --eventlog, --trace-stderr
|
| Ticky | --ticky-stats |
| Extended |
--heap-base, --linker-always-pic, --linker-mem-base, --alloc-limit-grace, --address-space-size
|
| Help | --help |
Checklist
-
if your MR touches base: N/A -
if your MR may break existing programs: This MR is purely additive. No existing programs are affected. New flag names are added; old flag names continue to work identically. -
ensure that your commits are either individually buildable or squashed -
ensure that your commit messages describe what they do -
have added source comments describing your change -
add a testcase to the testsuite -
updates the users guide if applicable -
mentions new features in the release notes for the next release
Fixes #19626.