aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts/config.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-09-14 14:09:46 +0200
committerRon Evans <[email protected]>2022-09-15 12:43:51 +0200
commit5f96d2b7843ceebeedd91acae0985f3bcb8a7516 (patch)
tree15c8a0332f5679e5d9d1d459b065be88ab2e102b /compileopts/config.go
parentbd1d93b7058e19ebd82b57171eb7bf4f8bd42411 (diff)
downloadtinygo-5f96d2b7843ceebeedd91acae0985f3bcb8a7516.tar.gz
tinygo-5f96d2b7843ceebeedd91acae0985f3bcb8a7516.zip
all: add flag for setting the goroutine stack size
This is helpful in some cases where the default stack size isn't big enough.
Diffstat (limited to 'compileopts/config.go')
-rw-r--r--compileopts/config.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/compileopts/config.go b/compileopts/config.go
index 9ee6d0aa3..e1d1a311f 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -175,6 +175,15 @@ func (c *Config) AutomaticStackSize() bool {
return false
}
+// StackSize returns the default stack size to be used for goroutines, if the
+// stack size could not be determined automatically at compile time.
+func (c *Config) StackSize() uint64 {
+ if c.Options.StackSize != 0 {
+ return c.Options.StackSize
+ }
+ return c.Target.DefaultStackSize
+}
+
// UseThinLTO returns whether ThinLTO should be used for the given target. Some
// targets (such as wasm) are not yet supported.
// We should try and remove as many exceptions as possible in the future, so