[Git][ghc/ghc][wip/T19626] Add more stack flags

Alex D (@nineonine) gitlab at gitlab.haskell.org
Sun Dec 18 23:47:29 UTC 2022



Alex D pushed to branch wip/T19626 at Glasgow Haskell Compiler / GHC


Commits:
b394041d by nineonine at 2022-12-18T15:47:23-08:00
Add more stack flags

- - - - -


5 changed files:

- rts/OptParse.c
- rts/include/rts/OptParse.h
- testsuite/tests/rts/OptParse/OptParseTest.c
- testsuite/tests/rts/OptParse/OptParseTest.stderr
- testsuite/tests/rts/OptParse/OptParseTest.stdout


Changes:

=====================================
rts/OptParse.c
=====================================
@@ -98,7 +98,10 @@ rtsFlags[] = {
     [DEBUG_SPARKS]            = {SAFE,   VOID,       "debug-sparks",                    "Dr", false},
     [DEBUG_COMPACT]           = {SAFE,   VOID,       "debug-compact",                   "DC", false},
 // #endif
-    [MAX_STACK_SIZE]          = {UNSAFE, STGWORD64,  "max-stack-size",                  "K",   true},
+    [MAX_STACK_SIZE]          = {UNSAFE, STGWORD64,  "stack-max-size",                  "K",   true},
+    [STACK_CHUNK_SIZE]        = {UNSAFE, STGWORD64,  "stack-chunk-size",                "kc",  true},
+    [STACK_CHUNK_BUFFER_SIZE] = {UNSAFE, STGWORD64,  "stack-chunk-buffer-size",         "kb",  true},
+    [STACK_INITIAL_SIZE]      = {UNSAFE, STGWORD64,  "stack-initial-size",              "ki",  true},
     // The 'NULL' of flags. Long name just for debugging
     [UNKNOWN_RTS_OPTION]      = {SAFE,   VOID,       "UNKNOWN_RTS_OPTION",              NULL, false},
 };
@@ -418,9 +421,12 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
                     break;
                 }
 
-                case MAX_STACK_SIZE: {
-                    min = 0;
-                    max = HS_INT_MAX;
+                case MAX_STACK_SIZE:
+                case STACK_CHUNK_SIZE:
+                case STACK_CHUNK_BUFFER_SIZE:
+                case STACK_INITIAL_SIZE: {
+                    min = sizeof(W_);
+                    max = HS_WORD_MAX;
                     value = decodeSize(arg, offset, min, max, error);
                     break;
                 }


=====================================
rts/include/rts/OptParse.h
=====================================
@@ -73,6 +73,9 @@ typedef enum _RtsFlagKey {
     DEBUG_COMPACT,
 // #endif
     MAX_STACK_SIZE,
+    STACK_CHUNK_SIZE,
+    STACK_CHUNK_BUFFER_SIZE,
+    STACK_INITIAL_SIZE,
 
     UNKNOWN_RTS_OPTION,
 } RtsFlagKey;


=====================================
testsuite/tests/rts/OptParse/OptParseTest.c
=====================================
@@ -75,6 +75,9 @@ int main (int argc, char *argv[])
      VOID_FLAG_TEST(DEBUG_COMPACT);
 
      STGWORD64_FLAG_TEST(MAX_STACK_SIZE);
+     STGWORD64_FLAG_TEST(STACK_CHUNK_SIZE);
+     STGWORD64_FLAG_TEST(STACK_CHUNK_BUFFER_SIZE);
+     STGWORD64_FLAG_TEST(STACK_INITIAL_SIZE);
 
      printf("\n=== OptParseTest END ===\n");
      return 0;


=====================================
testsuite/tests/rts/OptParse/OptParseTest.stderr
=====================================
@@ -1677,67 +1677,67 @@ flag DC given an argument when none was expected: -DC3622
 (FAIL_TEST) input: -DC=3600
 unknown RTS option: -DC=3600
 
-(TEST) input: --max-stack-size=8193
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=8193
+46: stack-max-size K UNSAFE
 expected: 8193 actual: 8193
 
-(TEST) input: --max-stack-size=8193K
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=8193K
+46: stack-max-size K UNSAFE
 expected: 8389632 actual: 8389632
 
-(TEST) input: --max-stack-size=2M
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=2M
+46: stack-max-size K UNSAFE
 expected: 2097152 actual: 2097152
 
-(TEST) input: --max-stack-size=9G
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=9G
+46: stack-max-size K UNSAFE
 expected: 9663676416 actual: 9663676416
 
-(TEST) input: --max-stack-size=2G
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=2G
+46: stack-max-size K UNSAFE
 expected: 2147483648 actual: 2147483648
 
-(TEST) input: --max-stack-size=3333w
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=3333w
+46: stack-max-size K UNSAFE
 expected: 26664 actual: 26664
 
-(FAIL_TEST) input: --max-stack-size=
-unknown RTS option: --max-stack-size=
+(FAIL_TEST) input: --stack-max-size=
+unknown RTS option: --stack-max-size=
 
-(FAIL_TEST) input: --max-stack-size=fbar
-bad value for max-stack-size=fbar
+(FAIL_TEST) input: --stack-max-size=fbar
+bad value for stack-max-size=fbar
 
-(FAIL_TEST) input: --max-stack-size=false
-bad value for max-stack-size=false
+(FAIL_TEST) input: --stack-max-size=false
+bad value for stack-max-size=false
 
-(FAIL_TEST) input: --max-stack-size=true
-bad value for max-stack-size=true
+(FAIL_TEST) input: --stack-max-size=true
+bad value for stack-max-size=true
 
-(FAIL_TEST) input: --max-stack-sizexxzag
-unknown RTS option: --max-stack-sizexxzag
+(FAIL_TEST) input: --stack-max-sizexxzag
+unknown RTS option: --stack-max-sizexxzag
 
 (TEST) input: -K8193
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 8193 actual: 8193
 
 (TEST) input: -K8193k
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 8389632 actual: 8389632
 
 (TEST) input: -K2m
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 2097152 actual: 2097152
 
 (TEST) input: -K9g
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 9663676416 actual: 9663676416
 
 (TEST) input: -K1G
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 1073741824 actual: 1073741824
 
 (TEST) input: -K3333w
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 expected: 26664 actual: 26664
 
 (FAIL_TEST) input: -K=
@@ -1754,3 +1754,237 @@ unknown RTS option: -K=true
 
 (FAIL_TEST) input: -Kjhgl
 unknown RTS option: -Kjhgl
+
+(TEST) input: --stack-chunk-size=8193
+47: stack-chunk-size kc UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: --stack-chunk-size=8193K
+47: stack-chunk-size kc UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: --stack-chunk-size=2M
+47: stack-chunk-size kc UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: --stack-chunk-size=9G
+47: stack-chunk-size kc UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --stack-chunk-size=2G
+47: stack-chunk-size kc UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --stack-chunk-size=3333w
+47: stack-chunk-size kc UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --stack-chunk-size=
+unknown RTS option: --stack-chunk-size=
+
+(FAIL_TEST) input: --stack-chunk-size=fbar
+bad value for stack-chunk-size=fbar
+
+(FAIL_TEST) input: --stack-chunk-size=false
+bad value for stack-chunk-size=false
+
+(FAIL_TEST) input: --stack-chunk-size=true
+bad value for stack-chunk-size=true
+
+(FAIL_TEST) input: --stack-chunk-sizexxzag
+unknown RTS option: --stack-chunk-sizexxzag
+
+(TEST) input: -kc8193
+47: stack-chunk-size kc UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: -kc8193k
+47: stack-chunk-size kc UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: -kc2m
+47: stack-chunk-size kc UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -kc9g
+47: stack-chunk-size kc UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -kc1G
+47: stack-chunk-size kc UNSAFE
+expected: 1073741824 actual: 1073741824
+
+(TEST) input: -kc3333w
+47: stack-chunk-size kc UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: -kc=
+unknown RTS option: -kc=
+
+(FAIL_TEST) input: -kc=baz
+unknown RTS option: -kc=baz
+
+(FAIL_TEST) input: -kc=false
+unknown RTS option: -kc=false
+
+(FAIL_TEST) input: -kc=true
+unknown RTS option: -kc=true
+
+(FAIL_TEST) input: -kcjhgl
+unknown RTS option: -kcjhgl
+
+(TEST) input: --stack-chunk-buffer-size=8193
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: --stack-chunk-buffer-size=8193K
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: --stack-chunk-buffer-size=2M
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: --stack-chunk-buffer-size=9G
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --stack-chunk-buffer-size=2G
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --stack-chunk-buffer-size=3333w
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --stack-chunk-buffer-size=
+unknown RTS option: --stack-chunk-buffer-size=
+
+(FAIL_TEST) input: --stack-chunk-buffer-size=fbar
+bad value for stack-chunk-buffer-size=fbar
+
+(FAIL_TEST) input: --stack-chunk-buffer-size=false
+bad value for stack-chunk-buffer-size=false
+
+(FAIL_TEST) input: --stack-chunk-buffer-size=true
+bad value for stack-chunk-buffer-size=true
+
+(FAIL_TEST) input: --stack-chunk-buffer-sizexxzag
+unknown RTS option: --stack-chunk-buffer-sizexxzag
+
+(TEST) input: -kb8193
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: -kb8193k
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: -kb2m
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -kb9g
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -kb1G
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 1073741824 actual: 1073741824
+
+(TEST) input: -kb3333w
+48: stack-chunk-buffer-size kb UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: -kb=
+unknown RTS option: -kb=
+
+(FAIL_TEST) input: -kb=baz
+unknown RTS option: -kb=baz
+
+(FAIL_TEST) input: -kb=false
+unknown RTS option: -kb=false
+
+(FAIL_TEST) input: -kb=true
+unknown RTS option: -kb=true
+
+(FAIL_TEST) input: -kbjhgl
+unknown RTS option: -kbjhgl
+
+(TEST) input: --stack-initial-size=8193
+49: stack-initial-size ki UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: --stack-initial-size=8193K
+49: stack-initial-size ki UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: --stack-initial-size=2M
+49: stack-initial-size ki UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: --stack-initial-size=9G
+49: stack-initial-size ki UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --stack-initial-size=2G
+49: stack-initial-size ki UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --stack-initial-size=3333w
+49: stack-initial-size ki UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --stack-initial-size=
+unknown RTS option: --stack-initial-size=
+
+(FAIL_TEST) input: --stack-initial-size=fbar
+bad value for stack-initial-size=fbar
+
+(FAIL_TEST) input: --stack-initial-size=false
+bad value for stack-initial-size=false
+
+(FAIL_TEST) input: --stack-initial-size=true
+bad value for stack-initial-size=true
+
+(FAIL_TEST) input: --stack-initial-sizexxzag
+unknown RTS option: --stack-initial-sizexxzag
+
+(TEST) input: -ki8193
+49: stack-initial-size ki UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: -ki8193k
+49: stack-initial-size ki UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: -ki2m
+49: stack-initial-size ki UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -ki9g
+49: stack-initial-size ki UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -ki1G
+49: stack-initial-size ki UNSAFE
+expected: 1073741824 actual: 1073741824
+
+(TEST) input: -ki3333w
+49: stack-initial-size ki UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: -ki=
+unknown RTS option: -ki=
+
+(FAIL_TEST) input: -ki=baz
+unknown RTS option: -ki=baz
+
+(FAIL_TEST) input: -ki=false
+unknown RTS option: -ki=false
+
+(FAIL_TEST) input: -ki=true
+unknown RTS option: -ki=true
+
+(FAIL_TEST) input: -kijhgl
+unknown RTS option: -kijhgl


=====================================
testsuite/tests/rts/OptParse/OptParseTest.stdout
=====================================
@@ -578,52 +578,196 @@
 (TEST) input: -DC
 45: debug-compact DC SAFE
 
-(TEST) input: --max-stack-size=8193
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=8193
+46: stack-max-size K UNSAFE
 	value: 8193
 
-(TEST) input: --max-stack-size=8193K
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=8193K
+46: stack-max-size K UNSAFE
 	value: 8389632
 
-(TEST) input: --max-stack-size=2M
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=2M
+46: stack-max-size K UNSAFE
 	value: 2097152
 
-(TEST) input: --max-stack-size=9G
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=9G
+46: stack-max-size K UNSAFE
 	value: 9663676416
 
-(TEST) input: --max-stack-size=2G
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=2G
+46: stack-max-size K UNSAFE
 	value: 2147483648
 
-(TEST) input: --max-stack-size=3333w
-46: max-stack-size K UNSAFE
+(TEST) input: --stack-max-size=3333w
+46: stack-max-size K UNSAFE
 	value: 26664
 
 (TEST) input: -K8193
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 	value: 8193
 
 (TEST) input: -K8193k
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 	value: 8389632
 
 (TEST) input: -K2m
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 	value: 2097152
 
 (TEST) input: -K9g
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 	value: 9663676416
 
 (TEST) input: -K1G
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
 	value: 1073741824
 
 (TEST) input: -K3333w
-46: max-stack-size K UNSAFE
+46: stack-max-size K UNSAFE
+	value: 26664
+
+(TEST) input: --stack-chunk-size=8193
+47: stack-chunk-size kc UNSAFE
+	value: 8193
+
+(TEST) input: --stack-chunk-size=8193K
+47: stack-chunk-size kc UNSAFE
+	value: 8389632
+
+(TEST) input: --stack-chunk-size=2M
+47: stack-chunk-size kc UNSAFE
+	value: 2097152
+
+(TEST) input: --stack-chunk-size=9G
+47: stack-chunk-size kc UNSAFE
+	value: 9663676416
+
+(TEST) input: --stack-chunk-size=2G
+47: stack-chunk-size kc UNSAFE
+	value: 2147483648
+
+(TEST) input: --stack-chunk-size=3333w
+47: stack-chunk-size kc UNSAFE
+	value: 26664
+
+(TEST) input: -kc8193
+47: stack-chunk-size kc UNSAFE
+	value: 8193
+
+(TEST) input: -kc8193k
+47: stack-chunk-size kc UNSAFE
+	value: 8389632
+
+(TEST) input: -kc2m
+47: stack-chunk-size kc UNSAFE
+	value: 2097152
+
+(TEST) input: -kc9g
+47: stack-chunk-size kc UNSAFE
+	value: 9663676416
+
+(TEST) input: -kc1G
+47: stack-chunk-size kc UNSAFE
+	value: 1073741824
+
+(TEST) input: -kc3333w
+47: stack-chunk-size kc UNSAFE
+	value: 26664
+
+(TEST) input: --stack-chunk-buffer-size=8193
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 8193
+
+(TEST) input: --stack-chunk-buffer-size=8193K
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 8389632
+
+(TEST) input: --stack-chunk-buffer-size=2M
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 2097152
+
+(TEST) input: --stack-chunk-buffer-size=9G
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 9663676416
+
+(TEST) input: --stack-chunk-buffer-size=2G
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 2147483648
+
+(TEST) input: --stack-chunk-buffer-size=3333w
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 26664
+
+(TEST) input: -kb8193
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 8193
+
+(TEST) input: -kb8193k
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 8389632
+
+(TEST) input: -kb2m
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 2097152
+
+(TEST) input: -kb9g
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 9663676416
+
+(TEST) input: -kb1G
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 1073741824
+
+(TEST) input: -kb3333w
+48: stack-chunk-buffer-size kb UNSAFE
+	value: 26664
+
+(TEST) input: --stack-initial-size=8193
+49: stack-initial-size ki UNSAFE
+	value: 8193
+
+(TEST) input: --stack-initial-size=8193K
+49: stack-initial-size ki UNSAFE
+	value: 8389632
+
+(TEST) input: --stack-initial-size=2M
+49: stack-initial-size ki UNSAFE
+	value: 2097152
+
+(TEST) input: --stack-initial-size=9G
+49: stack-initial-size ki UNSAFE
+	value: 9663676416
+
+(TEST) input: --stack-initial-size=2G
+49: stack-initial-size ki UNSAFE
+	value: 2147483648
+
+(TEST) input: --stack-initial-size=3333w
+49: stack-initial-size ki UNSAFE
+	value: 26664
+
+(TEST) input: -ki8193
+49: stack-initial-size ki UNSAFE
+	value: 8193
+
+(TEST) input: -ki8193k
+49: stack-initial-size ki UNSAFE
+	value: 8389632
+
+(TEST) input: -ki2m
+49: stack-initial-size ki UNSAFE
+	value: 2097152
+
+(TEST) input: -ki9g
+49: stack-initial-size ki UNSAFE
+	value: 9663676416
+
+(TEST) input: -ki1G
+49: stack-initial-size ki UNSAFE
+	value: 1073741824
+
+(TEST) input: -ki3333w
+49: stack-initial-size ki UNSAFE
 	value: 26664
 
 === OptParseTest END ===



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b394041d5ddae7587d039598319d02932168f9c8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b394041d5ddae7587d039598319d02932168f9c8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221218/588b91ab/attachment-0001.html>


More information about the ghc-commits mailing list