diff options
author | Javran Cheng <Javran.c@gmail.com> | 2015-05-06 07:47:20 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-05-06 07:50:49 -0500 |
commit | 477f514f6ebcf783810da93e2191e4b6ea65559b (patch) | |
tree | 937142e105718d77b9a7c404cd538e3dd9e78f55 /rts | |
parent | 03c4893e355948fe865bc52c744359c42e4b06d7 (diff) | |
download | haskell-477f514f6ebcf783810da93e2191e4b6ea65559b.tar.gz |
rts: add "-no-rtsopts-suggestions" option
Depends on D767
Setting this flag prevents RTS from giving RTS suggestions like "Use
`+RTS -Ksize -RTS' to increase it."
According to the comment @rwbarton made in #9579, sometimes "+RTS"
suggestions don't make sense (e.g. when the program is precompiled and
installed through package managers), we can encourage people to
distribute binaries with either "-no-rtsopts-suggestions" or "-rtsopts".
Reviewed By: erikd, austin
Differential Revision: https://phabricator.haskell.org/D809
GHC Trac Issues: #9579
Diffstat (limited to 'rts')
-rw-r--r-- | rts/ProfHeap.c | 14 | ||||
-rw-r--r-- | rts/RtsFlags.c | 1 | ||||
-rw-r--r-- | rts/hooks/OutOfHeap.c | 33 | ||||
-rw-r--r-- | rts/hooks/StackOverflow.c | 19 |
4 files changed, 40 insertions, 27 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index ba1adcd5d0..25112a7e1e 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -280,12 +280,14 @@ nextEra( void ) era++; if (era == max_era) { - if (rtsConfig.rts_opts_enabled == RtsOptsAll) { - errorBelch("maximum number of censuses reached;\n" - "use +RTS -i to reduce"); - } else { - errorBelch("maximum number of censuses reached;\n" - "Relink with -rtsopts and use `+RTS -i` to reduce"); + errorBelch("Maximum number of censuses reached."); + if (rtsConfig.rts_opts_suggestions == rtsTrue) { + if (rtsConfig.rts_opts_enabled == RtsOptsAll) { + errorBelch("Use `+RTS -i' to reduce censuses."); + } else { + errorBelch("Relink with -rtsopts and " + "use `+RTS -i' to reduce censuses."); + } } stg_exit(EXIT_FAILURE); } diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 0fbd05af2f..94a6c0edeb 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -59,6 +59,7 @@ RtsConfig rtsConfig; const RtsConfig defaultRtsConfig = { .rts_opts_enabled = RtsOptsSafeOnly, + .rts_opts_suggestions = rtsTrue, .rts_opts = NULL, .rts_hs_main = rtsFalse, .defaultsHook = FlagDefaultsHook, diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c index bb8752846f..5e68750d71 100644 --- a/rts/hooks/OutOfHeap.c +++ b/rts/hooks/OutOfHeap.c @@ -13,17 +13,24 @@ void OutOfHeapHook (W_ request_size, W_ heap_size) /* both sizes in bytes */ { - (void)request_size; /* keep gcc -Wall happy */ - if (heap_size > 0) { - errorBelch("Heap exhausted;\n" - "Current maximum heap size is %" FMT_Word - " bytes (%" FMT_Word " MB);\n" - "%s `+RTS -M<size>' to increase it.", - heap_size, heap_size / (1024*1024), - ((rtsConfig.rts_opts_enabled == RtsOptsAll) - ? "use" - : "relink with -rtsopts and use")); - } else { - errorBelch("out of memory"); - } + (void)request_size; /* keep gcc -Wall happy */ + if (heap_size > 0) { + errorBelch("Heap exhausted;"); + errorBelch("Current maximum heap size is %" FMT_Word + " bytes (%" FMT_Word " MB).", + heap_size, heap_size / (1024*1024)); + + if (rtsConfig.rts_opts_suggestions == rtsTrue) { + + if (rtsConfig.rts_opts_enabled == RtsOptsAll) { + errorBelch("Use `+RTS -M<size>' to increase it."); + } else { + errorBelch("Relink with -rtsopts and " + "use `+RTS -M<size>' to increase it."); + } + + } + } else { + errorBelch("Out of memory.\n"); + } } diff --git a/rts/hooks/StackOverflow.c b/rts/hooks/StackOverflow.c index 1ae8603eec..602700ad77 100644 --- a/rts/hooks/StackOverflow.c +++ b/rts/hooks/StackOverflow.c @@ -14,12 +14,15 @@ void StackOverflowHook (W_ stack_size) /* in bytes */ { - fprintf(stderr, - "Stack space overflow: current size %" FMT_Word " bytes.\n" - "%s `+RTS -Ksize -RTS' to increase it.\n", - stack_size, - ((rtsConfig.rts_opts_enabled == RtsOptsAll) - ? "Use" - : "Relink with -rtsopts and use") - ); + errorBelch("Stack space overflow: current size %" FMT_Word " bytes.", + stack_size); + + if (rtsConfig.rts_opts_suggestions == rtsTrue) { + if (rtsConfig.rts_opts_enabled == RtsOptsAll) { + errorBelch("Use `+RTS -Ksize -RTS' to increase it."); + } else { + errorBelch("Relink with -rtsopts and " + "use `+RTS -Ksize -RTS' to increase it."); + } + } } |