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

     1  // Code generated by g_typedef; DO NOT EDIT.
     2  
     3  //go:build go1.18 && !go1.19
     4  // +build go1.18,!go1.19
     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  	started bool
   120  	heap    bool
   121  	// openDefer indicates that this _defer is for a frame with open-coded
   122  	// defers. We have only one defer record for the entire frame (which may
   123  	// currently have 0, 1, or more defers active).
   124  	openDefer bool
   125  	sp        uintptr // sp at time of defer
   126  	pc        uintptr // pc at time of defer
   127  	fn        func()  // can be nil for open-coded defers
   128  	_panic    *_panic // panic that is running defer
   129  	link      *_defer // next defer on G; can point to either heap or stack!
   130  
   131  	// If openDefer is true, the fields below record values about the stack
   132  	// frame and associated function that has the open-coded defer(s). sp
   133  	// above will be the sp for the frame, and pc will be address of the
   134  	// deferreturn call in the function.
   135  	fd   unsafe.Pointer // funcdata for the function associated with the frame
   136  	varp uintptr        // value of varp for the stack frame
   137  	// framepc is the current pc associated with the stack frame. Together,
   138  	// with sp above (which is the sp associated with the stack frame),
   139  	// framepc/sp can be used as pc/sp pair to continue a stack trace via
   140  	// gentraceback().
   141  	framepc uintptr
   142  }
   143  type gobuf struct {
   144  	// The offsets of sp, pc, and g are known to (hard-coded in) libmach.
   145  	//
   146  	// ctxt is unusual with respect to GC: it may be a
   147  	// heap-allocated funcval, so GC needs to track it, but it
   148  	// needs to be set and cleared from assembly, where it's
   149  	// difficult to have write barriers. However, ctxt is really a
   150  	// saved, live register, and we only ever exchange it between
   151  	// the real register and the gobuf. Hence, we treat it as a
   152  	// root during stack scanning, which means assembly that saves
   153  	// and restores it doesn't need write barriers. It's still
   154  	// typed as a pointer so that any other writes from Go get
   155  	// write barriers.
   156  	sp   uintptr
   157  	pc   uintptr
   158  	g    guintptr
   159  	ctxt unsafe.Pointer
   160  	ret  uintptr
   161  	lr   uintptr
   162  	bp   uintptr // for framepointer-enabled architectures
   163  }
   164  type funcval struct {
   165  	fn uintptr
   166  }
   167  type timer struct {
   168  	// If this timer is on a heap, which P's heap it is on.
   169  	// puintptr rather than *p to match uintptr in the versions
   170  	// of this struct defined in other packages.
   171  	pp puintptr
   172  
   173  	// Timer wakes up at when, and then at when+period, ... (period > 0 only)
   174  	// each time calling f(arg, now) in the timer goroutine, so f must be
   175  	// a well-behaved function and not block.
   176  	//
   177  	// when must be positive on an active timer.
   178  	when   int64
   179  	period int64
   180  	f      func(interface{}, uintptr)
   181  	arg    interface{}
   182  	seq    uintptr
   183  
   184  	// What to set the when field to in timerModifiedXX status.
   185  	nextwhen int64
   186  
   187  	// The status field holds one of the values below.
   188  	status uint32
   189  }
   190  type guintptr uintptr
   191  type puintptr uintptr
   192  type muintptr uintptr
   193  type waitReason uint8
   194  type ancestorInfo struct {
   195  	pcs  []uintptr // pcs from the stack of this goroutine
   196  	goid int64     // goroutine id of this goroutine; original goroutine possibly dead
   197  	gopc uintptr   // pc of go statement that created this goroutine
   198  }
   199  type uintreg uint          // FIXME wrong on amd64p32
   200  type m struct{}            // FIXME stub
   201  type sudog struct{}        // FIXME stub
   202  type timersBucket struct{} // FIXME stub