• Kirill Smelkov's avatar
    tracing/runtime: Add support for Go1.21 (1/2) · 3a209cd1
    Kirill Smelkov authored
    Generate g for today's state of Go 1.21 (go1.21.0-15-g70aa116c4a).
    Compared to Go1.20 new field parentGoid was added and tracing-related
    fields were moved to gTraceState struct.
    
    Regenerated files stay without changes for Go1.20 and previous releases.
    
    ---- 8< ----
    diff --git a/zruntime_g_go1.20.go b/zruntime_g_go1.21.go
    index 99f483a..c55d865 100644
    --- a/zruntime_g_go1.20.go
    +++ b/zruntime_g_go1.21.go
    @@ -1,7 +1,7 @@
     // Code generated by g_typedef; DO NOT EDIT.
    
    -//go:build go1.20 && !go1.21
    -// +build go1.20,!go1.21
    +//go:build go1.21 && !go1.22
    +// +build go1.21,!go1.22
    
     package xruntime
    
    @@ -69,20 +69,17 @@ type g struct {
     	parkingOnChan atomic.Bool
    
     	raceignore    int8  // ignore race detection events
    -	sysblocktraced bool     // StartTrace has emitted EvGoInSyscall about this goroutine
     	tracking      bool  // whether we're tracking this G for sched latency statistics
     	trackingSeq   uint8 // used to decide whether to track this G
     	trackingStamp int64 // timestamp of when the G last started being tracked
     	runnableTime  int64 // the amount of time spent runnable, cleared when running, only used when tracking
    -	sysexitticks   int64    // cputicks when syscall has returned (for tracing)
    -	traceseq       uint64   // trace event sequencer
    -	tracelastp     puintptr // last P emitted an event for this goroutine
     	lockedm       muintptr
     	sig           uint32
     	writebuf      []byte
     	sigcode0      uintptr
     	sigcode1      uintptr
     	sigpc         uintptr
    +	parentGoid    uint64          // goid of goroutine that created this goroutine
     	gopc          uintptr         // pc of go statement that created this goroutine
     	ancestors     *[]ancestorInfo // ancestor information goroutine(s) that created this goroutine (only used if debug.tracebackancestors)
     	startpc       uintptr         // pc of goroutine function
    @@ -97,6 +94,9 @@ type g struct {
     	// current in-progress goroutine profile
     	goroutineProfiled goroutineProfileStateHolder
    
    +	// Per-G tracer state.
    +	trace gTraceState
    +
     	// gcAssistBytes is this G's GC assist credit in terms of
     	// bytes allocated. If this is positive, then the G has credit
     	// to allocate gcAssistBytes bytes without assisting. If this
    @@ -202,6 +202,13 @@ type ancestorInfo struct {
     	gopc uintptr   // pc of go statement that created this goroutine
     }
     type goroutineProfileStateHolder atomic.Uint32
    +type gTraceState struct {
    +	sysExitTime        traceTime // timestamp when syscall has returned
    +	tracedSyscallEnter bool      // syscall or cgo was entered while trace was enabled or StartTrace has emitted EvGoInSyscall about this goroutine
    +	seq                uint64    // trace event sequencer
    +	lastP              puintptr  // last P emitted an event for this goroutine
    +}
    +type traceTime uint64
     type uintreg uint          // FIXME wrong on amd64p32
     type m struct{}            // FIXME stub
     type sudog struct{}        // FIXME stub
    3a209cd1
zruntime_g_go1.21.go 9.14 KB