mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 06:53:40 +00:00
runtime: fix GC to take goroutines into account
This fix is needed because with the new task-based scheduler, the current stack pointer may not be on the system stack.
This commit is contained in:
committed by
Ron Evans
parent
db4de46d88
commit
6917faabf5
@@ -129,3 +129,15 @@ func reactivateParent(t *task) {
|
||||
func chanYield() {
|
||||
Goexit()
|
||||
}
|
||||
|
||||
// getSystemStackPointer returns the current stack pointer of the system stack.
|
||||
// This is not necessarily the same as the current stack pointer.
|
||||
func getSystemStackPointer() uintptr {
|
||||
if currentTask == nil {
|
||||
// Currently on the system stack.
|
||||
return getCurrentStackPointer()
|
||||
} else {
|
||||
// Currently in a goroutine.
|
||||
return schedulerState.sp
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user