aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
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 /transform
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 'transform')
-rw-r--r--transform/stacksize.go2
-rw-r--r--transform/stacksize_test.go1
2 files changed, 2 insertions, 1 deletions
diff --git a/transform/stacksize.go b/transform/stacksize.go
index 4d8a13816..7be49238f 100644
--- a/transform/stacksize.go
+++ b/transform/stacksize.go
@@ -40,7 +40,7 @@ func CreateStackSizeLoads(mod llvm.Module, config *compileopts.Config) []string
stackSizesGlobal := llvm.AddGlobal(mod, stackSizesGlobalType, "internal/task.stackSizes")
stackSizesGlobal.SetSection(".tinygo_stacksizes")
defaultStackSizes := make([]llvm.Value, len(functions))
- defaultStackSize := llvm.ConstInt(functions[0].Type(), config.Target.DefaultStackSize, false)
+ defaultStackSize := llvm.ConstInt(functions[0].Type(), config.StackSize(), false)
for i := range defaultStackSizes {
defaultStackSizes[i] = defaultStackSize
}
diff --git a/transform/stacksize_test.go b/transform/stacksize_test.go
index c38a7b2f8..a96b7bb02 100644
--- a/transform/stacksize_test.go
+++ b/transform/stacksize_test.go
@@ -13,6 +13,7 @@ func TestCreateStackSizeLoads(t *testing.T) {
testTransform(t, "testdata/stacksize", func(mod llvm.Module) {
// Run optimization pass.
transform.CreateStackSizeLoads(mod, &compileopts.Config{
+ Options: &compileopts.Options{},
Target: &compileopts.TargetSpec{
DefaultStackSize: 1024,
},