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

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