lab.nexedi.com/kirr/go123@v0.0.0-20240207185015-8299741fa871/tracing/internal/xruntime/zruntime_g_go1.20.go (about)

     1  // Code generated by g_typedef; DO NOT EDIT.
     2  
     3  //go:build go1.20 && !go1.21
     4  // +build go1.20,!go1.21
     5  
     6  package xruntime
     7  
     8  import "unsafe"
     9  import "sync/atomic"
    10  
    11  type g struct {
    12  	// Stack parameters.
    13  	// stack describes the actual stack memory: [stack.lo, stack.hi).
    14  	// stackguard0 is the stack pointer compared in the Go stack growth prologue.
    15  	// It is stack.lo+StackGuard normally, but can be StackPreempt to trigger a preemption.
    16  	// stackguard1 is the stack pointer compared in the C stack growth prologue.
    17  	// It is stack.lo+StackGuard on g0 and gsignal stacks.
    18  	// It is ~0 on other goroutine stacks, to trigger a call to morestackc (and crash).
    19  	stack       stack   // offset known to runtime/cgo
    20  	stackguard0 uintptr // offset known to liblink
    21  	stackguard1 uintptr // offset known to liblink
    22  
    23  	_panic    *_panic // innermost panic - offset known to liblink
    24  	_defer    *_defer // innermost defer
    25  	m         *m      // current m; offset known to arm liblink
    26  	sched     gobuf
    27  	syscallsp uintptr // if status==Gsyscall, syscallsp = sched.sp to use during gc
    28  	syscallpc uintptr // if status==Gsyscall, syscallpc = sched.pc to use during gc
    29  	stktopsp  uintptr // expected sp at top of stack, to check in traceback
    30  	// param is a generic pointer parameter field used to pass
    31  	// values in particular contexts where other storage for the
    32  	// parameter would be difficult to find. It is currently used
    33  	// in three ways:
    34  	// 1. When a channel operation wakes up a blocked goroutine, it sets param to
    35  	//    point to the sudog of the completed blocking operation.
    36  	// 2. By gcAssistAlloc1 to signal back to its caller that the goroutine completed
    37  	//    the GC cycle. It is unsafe to do so in any other way, because the goroutine's
    38  	//    stack may have moved in the meantime.
    39  	// 3. By debugCallWrap to pass parameters to a new goroutine because allocating a
    40  	//    closure in the runtime is forbidden.
    41  	param        unsafe.Pointer
    42  	atomicstatus atomic.Uint32
    43  	stackLock    uint32 // sigprof/scang lock; TODO: fold in to atomicstatus
    44  	goid         uint64
    45  	schedlink    guintptr
    46  	waitsince    int64      // approx time when the g become blocked
    47  	waitreason   waitReason // if status==Gwaiting
    48  
    49  	preempt       bool // preemption signal, duplicates stackguard0 = stackpreempt
    50  	preemptStop   bool // transition to _Gpreempted on preemption; otherwise, just deschedule
    51  	preemptShrink bool // shrink stack at synchronous safe point
    52  
    53  	// asyncSafePoint is set if g is stopped at an asynchronous
    54  	// safe point. This means there are frames on the stack
    55  	// without precise pointer information.
    56  	asyncSafePoint bool
    57  
    58  	paniconfault bool // panic (instead of crash) on unexpected fault address
    59  	gcscandone   bool // g has scanned stack; protected by _Gscan bit in status
    60  	throwsplit   bool // must not split stack
    61  	// activeStackChans indicates that there are unlocked channels
    62  	// pointing into this goroutine's stack. If true, stack
    63  	// copying needs to acquire channel locks to protect these
    64  	// areas of the stack.
    65  	activeStackChans bool
    66  	// parkingOnChan indicates that the goroutine is about to
    67  	// park on a chansend or chanrecv. Used to signal an unsafe point
    68  	// for stack shrinking.
    69  	parkingOnChan atomic.Bool
    70  
    71  	raceignore     int8     // ignore race detection events
    72  	sysblocktraced bool     // StartTrace has emitted EvGoInSyscall about this goroutine
    73  	tracking       bool     // whether we're tracking this G for sched latency statistics
    74  	trackingSeq    uint8    // used to decide whether to track this G
    75  	trackingStamp  int64    // timestamp of when the G last started being tracked
    76  	runnableTime   int64    // the amount of time spent runnable, cleared when running, only used when tracking
    77  	sysexitticks   int64    // cputicks when syscall has returned (for tracing)
    78  	traceseq       uint64   // trace event sequencer
    79  	tracelastp     puintptr // last P emitted an event for this goroutine
    80  	lockedm        muintptr
    81  	sig            uint32
    82  	writebuf       []byte
    83  	sigcode0       uintptr
    84  	sigcode1       uintptr
    85  	sigpc          uintptr
    86  	gopc           uintptr         // pc of go statement that created this goroutine
    87  	ancestors      *[]ancestorInfo // ancestor information goroutine(s) that created this goroutine (only used if debug.tracebackancestors)
    88  	startpc        uintptr         // pc of goroutine function
    89  	racectx        uintptr
    90  	waiting        *sudog         // sudog structures this g is waiting on (that have a valid elem ptr); in lock order
    91  	cgoCtxt        []uintptr      // cgo traceback context
    92  	labels         unsafe.Pointer // profiler labels
    93  	timer          *timer         // cached timer for time.Sleep
    94  	selectDone     atomic.Uint32  // are we participating in a select and did someone win the race?
    95  
    96  	// goroutineProfiled indicates the status of this goroutine's stack for the
    97  	// current in-progress goroutine profile
    98  	goroutineProfiled goroutineProfileStateHolder
    99  
   100  	// gcAssistBytes is this G's GC assist credit in terms of
   101  	// bytes allocated. If this is positive, then the G has credit
   102  	// to allocate gcAssistBytes bytes without assisting. If this
   103  	// is negative, then the G must correct this by performing
   104  	// scan work. We track this in bytes to make it fast to update
   105  	// and check for debt in the malloc hot path. The assist ratio
   106  	// determines how this corresponds to scan work debt.
   107  	gcAssistBytes int64
   108  }
   109  type stack struct {
   110  	lo uintptr
   111  	hi uintptr
   112  }
   113  type _panic struct {
   114  	argp      unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink
   115  	arg       interface{}    // argument to panic
   116  	link      *_panic        // link to earlier panic
   117  	pc        uintptr        // where to return to in runtime if this panic is bypassed
   118  	sp        unsafe.Pointer // where to return to in runtime if this panic is bypassed
   119  	recovered bool           // whether this panic is over
   120  	aborted   bool           // the panic was aborted
   121  	goexit    bool
   122  }
   123  type _defer struct {
   124  	started bool
   125  	heap    bool
   126  	// openDefer indicates that this _defer is for a frame with open-coded
   127  	// defers. We have only one defer record for the entire frame (which may
   128  	// currently have 0, 1, or more defers active).
   129  	openDefer bool
   130  	sp        uintptr // sp at time of defer
   131  	pc        uintptr // pc at time of defer
   132  	fn        func()  // can be nil for open-coded defers
   133  	_panic    *_panic // panic that is running defer
   134  	link      *_defer // next defer on G; can point to either heap or stack!
   135  
   136  	// If openDefer is true, the fields below record values about the stack
   137  	// frame and associated function that has the open-coded defer(s). sp
   138  	// above will be the sp for the frame, and pc will be address of the
   139  	// deferreturn call in the function.
   140  	fd   unsafe.Pointer // funcdata for the function associated with the frame
   141  	varp uintptr        // value of varp for the stack frame
   142  	// framepc is the current pc associated with the stack frame. Together,
   143  	// with sp above (which is the sp associated with the stack frame),
   144  	// framepc/sp can be used as pc/sp pair to continue a stack trace via
   145  	// gentraceback().
   146  	framepc uintptr
   147  }
   148  type gobuf struct {
   149  	// The offsets of sp, pc, and g are known to (hard-coded in) libmach.
   150  	//
   151  	// ctxt is unusual with respect to GC: it may be a
   152  	// heap-allocated funcval, so GC needs to track it, but it
   153  	// needs to be set and cleared from assembly, where it's
   154  	// difficult to have write barriers. However, ctxt is really a
   155  	// saved, live register, and we only ever exchange it between
   156  	// the real register and the gobuf. Hence, we treat it as a
   157  	// root during stack scanning, which means assembly that saves
   158  	// and restores it doesn't need write barriers. It's still
   159  	// typed as a pointer so that any other writes from Go get
   160  	// write barriers.
   161  	sp   uintptr
   162  	pc   uintptr
   163  	g    guintptr
   164  	ctxt unsafe.Pointer
   165  	ret  uintptr
   166  	lr   uintptr
   167  	bp   uintptr // for framepointer-enabled architectures
   168  }
   169  type funcval struct {
   170  	fn uintptr
   171  }
   172  type timer struct {
   173  	// If this timer is on a heap, which P's heap it is on.
   174  	// puintptr rather than *p to match uintptr in the versions
   175  	// of this struct defined in other packages.
   176  	pp puintptr
   177  
   178  	// Timer wakes up at when, and then at when+period, ... (period > 0 only)
   179  	// each time calling f(arg, now) in the timer goroutine, so f must be
   180  	// a well-behaved function and not block.
   181  	//
   182  	// when must be positive on an active timer.
   183  	when   int64
   184  	period int64
   185  	f      func(interface{}, uintptr)
   186  	arg    interface{}
   187  	seq    uintptr
   188  
   189  	// What to set the when field to in timerModifiedXX status.
   190  	nextwhen int64
   191  
   192  	// The status field holds one of the values below.
   193  	status atomic.Uint32
   194  }
   195  type guintptr uintptr
   196  type puintptr uintptr
   197  type muintptr uintptr
   198  type waitReason uint8
   199  type ancestorInfo struct {
   200  	pcs  []uintptr // pcs from the stack of this goroutine
   201  	goid uint64    // goroutine id of this goroutine; original goroutine possibly dead
   202  	gopc uintptr   // pc of go statement that created this goroutine
   203  }
   204  type goroutineProfileStateHolder atomic.Uint32
   205  type uintreg uint          // FIXME wrong on amd64p32
   206  type m struct{}            // FIXME stub
   207  type sudog struct{}        // FIXME stub
   208  type timersBucket struct{} // FIXME stub