aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compiler/goroutine-lowering.go3
-rw-r--r--compiler/wordpack.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/goroutine-lowering.go b/compiler/goroutine-lowering.go
index 3aa72e938..a336a3dd9 100644
--- a/compiler/goroutine-lowering.go
+++ b/compiler/goroutine-lowering.go
@@ -336,6 +336,9 @@ func (c *Compiler) markAsyncFunctions() (needsScheduler bool, err error) {
size = c.builder.CreateZExt(size, c.uintptrType, "task.size.uintptr")
}
data := c.createRuntimeCall("alloc", []llvm.Value{size}, "task.data")
+ if c.needsStackObjects() {
+ c.trackPointer(data)
+ }
frame.taskHandle = c.builder.CreateCall(coroBeginFunc, []llvm.Value{id, data}, "task.handle")
// Modify async calls so this function suspends right after the child
diff --git a/compiler/wordpack.go b/compiler/wordpack.go
index b76bf6a35..e553cb9c4 100644
--- a/compiler/wordpack.go
+++ b/compiler/wordpack.go
@@ -39,6 +39,9 @@ func (c *Compiler) emitPointerPack(values []llvm.Value) llvm.Value {
// Packed data is bigger than a pointer, so allocate it on the heap.
sizeValue := llvm.ConstInt(c.uintptrType, size, false)
packedHeapAlloc = c.createRuntimeCall("alloc", []llvm.Value{sizeValue}, "")
+ if c.needsStackObjects() {
+ c.trackPointer(packedHeapAlloc)
+ }
packedAlloc = c.builder.CreateBitCast(packedHeapAlloc, llvm.PointerType(packedType, 0), "")
}
// Store all values in the alloca or heap pointer.