lab.nexedi.com/kirr/go123@v0.0.0-20240207185015-8299741fa871/tracing/internal/xruntime/zruntime_g_go1.22.go (about) 1 // Code generated by g_typedef; DO NOT EDIT. 2 3 //go:build go1.22 && !go1.23 4 // +build go1.22,!go1.23 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 //go:systemstack 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 four 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 // 4. When a panic is recovered and control returns to the respective frame, 42 // param may point to a savedOpenDeferState. 43 param unsafe.Pointer 44 atomicstatus atomic.Uint32 45 stackLock uint32 // sigprof/scang lock; TODO: fold in to atomicstatus 46 goid uint64 47 schedlink guintptr 48 waitsince int64 // approx time when the g become blocked 49 waitreason waitReason // if status==Gwaiting 50 51 preempt bool // preemption signal, duplicates stackguard0 = stackpreempt 52 preemptStop bool // transition to _Gpreempted on preemption; otherwise, just deschedule 53 preemptShrink bool // shrink stack at synchronous safe point 54 55 // asyncSafePoint is set if g is stopped at an asynchronous 56 // safe point. This means there are frames on the stack 57 // without precise pointer information. 58 asyncSafePoint bool 59 60 paniconfault bool // panic (instead of crash) on unexpected fault address 61 gcscandone bool // g has scanned stack; protected by _Gscan bit in status 62 throwsplit bool // must not split stack 63 // activeStackChans indicates that there are unlocked channels 64 // pointing into this goroutine's stack. If true, stack 65 // copying needs to acquire channel locks to protect these 66 // areas of the stack. 67 activeStackChans bool 68 // parkingOnChan indicates that the goroutine is about to 69 // park on a chansend or chanrecv. Used to signal an unsafe point 70 // for stack shrinking. 71 parkingOnChan atomic.Bool 72 // inMarkAssist indicates whether the goroutine is in mark assist. 73 // Used by the execution tracer. 74 inMarkAssist bool 75 coroexit bool // argument to coroswitch_m 76 77 raceignore int8 // ignore race detection events 78 nocgocallback bool // whether disable callback from C 79 tracking bool // whether we're tracking this G for sched latency statistics 80 trackingSeq uint8 // used to decide whether to track this G 81 trackingStamp int64 // timestamp of when the G last started being tracked 82 runnableTime int64 // the amount of time spent runnable, cleared when running, only used when tracking 83 lockedm muintptr 84 sig uint32 85 writebuf []byte 86 sigcode0 uintptr 87 sigcode1 uintptr 88 sigpc uintptr 89 parentGoid uint64 // goid of goroutine that created this goroutine 90 gopc uintptr // pc of go statement that created this goroutine 91 ancestors *[]ancestorInfo // ancestor information goroutine(s) that created this goroutine (only used if debug.tracebackancestors) 92 startpc uintptr // pc of goroutine function 93 racectx uintptr 94 waiting *sudog // sudog structures this g is waiting on (that have a valid elem ptr); in lock order 95 cgoCtxt []uintptr // cgo traceback context 96 labels unsafe.Pointer // profiler labels 97 timer *timer // cached timer for time.Sleep 98 selectDone atomic.Uint32 // are we participating in a select and did someone win the race? 99 100 coroarg *coro // argument during coroutine transfers 101 102 // goroutineProfiled indicates the status of this goroutine's stack for the 103 // current in-progress goroutine profile 104 goroutineProfiled goroutineProfileStateHolder 105 106 // Per-G tracer state. 107 trace gTraceState 108 109 // gcAssistBytes is this G's GC assist credit in terms of 110 // bytes allocated. If this is positive, then the G has credit 111 // to allocate gcAssistBytes bytes without assisting. If this 112 // is negative, then the G must correct this by performing 113 // scan work. We track this in bytes to make it fast to update 114 // and check for debt in the malloc hot path. The assist ratio 115 // determines how this corresponds to scan work debt. 116 gcAssistBytes int64 117 } 118 type stack struct { 119 lo uintptr 120 hi uintptr 121 } 122 type _panic struct { 123 argp unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink 124 arg interface{} // argument to panic 125 link *_panic // link to earlier panic 126 127 // startPC and startSP track where _panic.start was called. 128 startPC uintptr 129 startSP unsafe.Pointer 130 131 // The current stack frame that we're running deferred calls for. 132 sp unsafe.Pointer 133 lr uintptr 134 fp unsafe.Pointer 135 136 // retpc stores the PC where the panic should jump back to, if the 137 // function last returned by _panic.next() recovers the panic. 138 retpc uintptr 139 140 // Extra state for handling open-coded defers. 141 deferBitsPtr *uint8 142 slotsPtr unsafe.Pointer 143 144 recovered bool // whether this panic has been recovered 145 goexit bool 146 deferreturn bool 147 } 148 type _defer struct { 149 heap bool 150 rangefunc bool // true for rangefunc list 151 sp uintptr // sp at time of defer 152 pc uintptr // pc at time of defer 153 fn func() // can be nil for open-coded defers 154 link *_defer // next defer on G; can point to either heap or stack! 155 156 // If rangefunc is true, *head is the head of the atomic linked list 157 // during a range-over-func execution. 158 head *atomic.Pointer[_defer] 159 } 160 type gobuf struct { 161 // The offsets of sp, pc, and g are known to (hard-coded in) libmach. 162 // 163 // ctxt is unusual with respect to GC: it may be a 164 // heap-allocated funcval, so GC needs to track it, but it 165 // needs to be set and cleared from assembly, where it's 166 // difficult to have write barriers. However, ctxt is really a 167 // saved, live register, and we only ever exchange it between 168 // the real register and the gobuf. Hence, we treat it as a 169 // root during stack scanning, which means assembly that saves 170 // and restores it doesn't need write barriers. It's still 171 // typed as a pointer so that any other writes from Go get 172 // write barriers. 173 sp uintptr 174 pc uintptr 175 g guintptr 176 ctxt unsafe.Pointer 177 ret uintptr 178 lr uintptr 179 bp uintptr // for framepointer-enabled architectures 180 } 181 type funcval struct { 182 fn uintptr 183 } 184 type timer struct { 185 // If this timer is on a heap, which P's heap it is on. 186 // puintptr rather than *p to match uintptr in the versions 187 // of this struct defined in other packages. 188 pp puintptr 189 190 // Timer wakes up at when, and then at when+period, ... (period > 0 only) 191 // each time calling f(arg, now) in the timer goroutine, so f must be 192 // a well-behaved function and not block. 193 // 194 // when must be positive on an active timer. 195 when int64 196 period int64 197 f func(interface{}, uintptr) 198 arg interface{} 199 seq uintptr 200 201 // What to set the when field to in timerModifiedXX status. 202 nextwhen int64 203 204 // The status field holds one of the values below. 205 status atomic.Uint32 206 } 207 type guintptr uintptr 208 type puintptr uintptr 209 type muintptr uintptr 210 type waitReason uint8 211 type ancestorInfo struct { 212 pcs []uintptr // pcs from the stack of this goroutine 213 goid uint64 // goroutine id of this goroutine; original goroutine possibly dead 214 gopc uintptr // pc of go statement that created this goroutine 215 } 216 type goroutineProfileStateHolder atomic.Uint32 217 type gTraceState struct { 218 traceSchedResourceState 219 } 220 type traceTime uint64 221 type coro struct { 222 gp guintptr 223 f func(*coro) 224 } 225 type traceSchedResourceState struct { 226 // statusTraced indicates whether a status event was traced for this resource 227 // a particular generation. 228 // 229 // There are 3 of these because when transitioning across generations, traceAdvance 230 // needs to be able to reliably observe whether a status was traced for the previous 231 // generation, while we need to clear the value for the next generation. 232 statusTraced [3]atomic.Uint32 233 234 // seq is the sequence counter for this scheduling resource's events. 235 // The purpose of the sequence counter is to establish a partial order between 236 // events that don't obviously happen serially (same M) in the stream ofevents. 237 // 238 // There are two of these so that we can reset the counter on each generation. 239 // This saves space in the resulting trace by keeping the counter small and allows 240 // GoStatus and GoCreate events to omit a sequence number (implicitly 0). 241 seq [2]uint64 242 } 243 type uintreg uint // FIXME wrong on amd64p32 244 type m struct{} // FIXME stub 245 type sudog struct{} // FIXME stub 246 type timersBucket struct{} // FIXME stub