github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/internal/task/task.go (about)

     1  package task
     2  
     3  import (
     4  	"unsafe"
     5  )
     6  
     7  // Task is a state of goroutine for scheduling purposes.
     8  type Task struct {
     9  	// Next is a field which can be used to make a linked list of tasks.
    10  	Next *Task
    11  
    12  	// Ptr is a field which can be used for storing a pointer.
    13  	Ptr unsafe.Pointer
    14  
    15  	// Data is a field which can be used for storing state information.
    16  	Data uint64
    17  
    18  	// gcData holds data for the GC.
    19  	gcData gcData
    20  
    21  	// state is the underlying running state of the task.
    22  	state state
    23  
    24  	// DeferFrame stores a pointer to the (stack allocated) defer frame of the
    25  	// goroutine that is used for the recover builtin.
    26  	DeferFrame unsafe.Pointer
    27  }
    28  
    29  // getGoroutineStackSize is a compiler intrinsic that returns the stack size for
    30  // the given function and falls back to the default stack size. It is replaced
    31  // with a load from a special section just before codegen.
    32  func getGoroutineStackSize(fn uintptr) uintptr