mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
internal/task: swap stack chain when switching goroutines
This change swaps the stack chain when switching goroutines, ensuring that the chain is maintained consistently. This is only really currently necessary with asyncify on wasm.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//go:build (gc.conservative || gc.extalloc) && tinygo.wasm
|
||||
// +build gc.conservative gc.extalloc
|
||||
// +build tinygo.wasm
|
||||
|
||||
@@ -37,3 +38,9 @@ func markStack() {
|
||||
// construction. Calls to it are later replaced with regular stack bookkeeping
|
||||
// code.
|
||||
func trackPointer(ptr unsafe.Pointer)
|
||||
|
||||
// swapStackChain swaps the stack chain.
|
||||
// This is called from internal/task when switching goroutines.
|
||||
func swapStackChain(dst **stackChainObject) {
|
||||
*dst, stackChainStart = stackChainStart, *dst
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user