• Kirill Smelkov's avatar
    tracing/runtime: Add support for Go1.20 · 0399d7ad
    Kirill Smelkov authored
    Generate g for today's state of Go 1.20 (go1.20-0-gde4748c47c).
    Compared to Go1.19 goid is changed from int64 -> to uint64, and that
    more variables, that are used atomically, now use atomic.X types.
    
    Regenerated files stay without changes for Go1.19 and previous releases.
    
    ---- 8< ----
    diff --git a/zruntime_g_go1.19.go b/zruntime_g_go1.20.go
    index 707aadd..99f483a 100644
    --- a/zruntime_g_go1.19.go
    +++ b/zruntime_g_go1.20.go
    @@ -1,7 +1,7 @@
     // Code generated by g_typedef; DO NOT EDIT.
    
    -//go:build go1.19 && !go1.20
    -// +build go1.19,!go1.20
    +//go:build go1.20 && !go1.21
    +// +build go1.20,!go1.21
    
     package xruntime
    
    @@ -39,9 +39,9 @@ type g struct {
     	// 3. By debugCallWrap to pass parameters to a new goroutine because allocating a
     	//    closure in the runtime is forbidden.
     	param        unsafe.Pointer
    -	atomicstatus uint32
    +	atomicstatus atomic.Uint32
     	stackLock    uint32 // sigprof/scang lock; TODO: fold in to atomicstatus
    -	goid         int64
    +	goid         uint64
     	schedlink    guintptr
     	waitsince    int64      // approx time when the g become blocked
     	waitreason   waitReason // if status==Gwaiting
    @@ -65,14 +65,14 @@ type g struct {
     	activeStackChans bool
     	// parkingOnChan indicates that the goroutine is about to
     	// park on a chansend or chanrecv. Used to signal an unsafe point
    -	// for stack shrinking. It's a boolean value, but is updated atomically.
    -	parkingOnChan uint8
    +	// for stack shrinking.
    +	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
    -	runnableStamp  int64    // timestamp of when the G last became runnable, only used when tracking
    +	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
    @@ -91,7 +91,7 @@ type g struct {
     	cgoCtxt        []uintptr      // cgo traceback context
     	labels         unsafe.Pointer // profiler labels
     	timer          *timer         // cached timer for time.Sleep
    -	selectDone     uint32         // are we participating in a select and did someone win the race?
    +	selectDone     atomic.Uint32  // are we participating in a select and did someone win the race?
    
     	// goroutineProfiled indicates the status of this goroutine's stack for the
     	// current in-progress goroutine profile
    @@ -190,7 +190,7 @@ type timer struct {
     	nextwhen int64
    
     	// The status field holds one of the values below.
    -	status uint32
    +	status atomic.Uint32
     }
     type guintptr uintptr
     type puintptr uintptr
    @@ -198,7 +198,7 @@ type muintptr uintptr
     type waitReason uint8
     type ancestorInfo struct {
     	pcs  []uintptr // pcs from the stack of this goroutine
    -	goid int64     // goroutine id of this goroutine; original goroutine possibly dead
    +	goid uint64    // goroutine id of this goroutine; original goroutine possibly dead
     	gopc uintptr   // pc of go statement that created this goroutine
     }
     type goroutineProfileStateHolder atomic.Uint32
    0399d7ad
zruntime_g_go1.20.go 8.94 KB