• Kirill Smelkov's avatar
    tracing/runtime: Add support for Go1.17 (preliminary) · 68f3a266
    Kirill Smelkov authored
    Generate g for ~ Go 1.17beta1 (go1.17beta1-2-g770f1de8c5)
    Compared to Go1.16 there is one non-cosmetic change to g related to tracking
    scheduling latencies:
    
    https://github.com/golang/go/commit/bedfeed54a7a
    
    Regenerated files stay without changes for Go1.16 and previous releases.
    
    ---- 8< ----
    diff --git a/zruntime_g_go1.16.go b/zruntime_g_go1.17.go
    index 9604d6b..7a76db6 100644
    --- a/zruntime_g_go1.16.go
    +++ b/zruntime_g_go1.17.go
    @@ -1,6 +1,6 @@
     // Code generated by g_typedef; DO NOT EDIT.
    
    -// +build go1.16,!go1.17
    +// +build go1.17,!go1.18
    
     package xruntime
    
    @@ -25,7 +25,18 @@ type g struct {
            syscallsp uintptr // if status==Gsyscall, syscallsp = sched.sp to use during gc
            syscallpc uintptr // if status==Gsyscall, syscallpc = sched.pc to use during gc
            stktopsp  uintptr // expected sp at top of stack, to check in traceback
    -       param        unsafe.Pointer // passed parameter on wakeup
    +       // param is a generic pointer parameter field used to pass
    +       // values in particular contexts where other storage for the
    +       // parameter would be difficult to find. It is currently used
    +       // in three ways:
    +       // 1. When a channel operation wakes up a blocked goroutine, it sets param to
    +       //    point to the sudog of the completed blocking operation.
    +       // 2. By gcAssistAlloc1 to signal back to its caller that the goroutine completed
    +       //    the GC cycle. It is unsafe to do so in any other way, because the goroutine's
    +       //    stack may have moved in the meantime.
    +       // 3. By debugCallWrap to pass parameters to a new goroutine because allocating a
    +       //    closure in the runtime is forbidden.
    +       param        unsafe.Pointer
            atomicstatus uint32
            stackLock    uint32 // sigprof/scang lock; TODO: fold in to atomicstatus
            goid         int64
    @@ -57,6 +68,10 @@ type g struct {
    
            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
    +       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
    @@ -142,7 +157,7 @@ type gobuf struct {
            pc   uintptr
            g    guintptr
            ctxt unsafe.Pointer
    -       ret  uintreg
    +       ret  uintptr
            lr   uintptr
            bp   uintptr // for framepointer-enabled architectures
     }
    68f3a266
zruntime_g_go1.17.go 8.71 KB