mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +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:
@@ -0,0 +1,19 @@
|
||||
//go:build (gc.conservative || gc.extalloc) && tinygo.wasm && !scheduler.coroutines
|
||||
// +build gc.conservative gc.extalloc
|
||||
// +build tinygo.wasm
|
||||
// +build !scheduler.coroutines
|
||||
|
||||
package task
|
||||
|
||||
import "unsafe"
|
||||
|
||||
//go:linkname swapStackChain runtime.swapStackChain
|
||||
func swapStackChain(dst *unsafe.Pointer)
|
||||
|
||||
type gcData struct {
|
||||
stackChain unsafe.Pointer
|
||||
}
|
||||
|
||||
func (gcd *gcData) swap() {
|
||||
swapStackChain(&gcd.stackChain)
|
||||
}
|
||||
Reference in New Issue
Block a user