]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: eliminate a few usages of named return values in functions to make it consistent
authorAndy Pan <panjf2000@gmail.com>
Fri, 20 May 2022 16:20:47 +0000 (00:20 +0800)
committerMichael Pratt <mpratt@google.com>
Thu, 11 Aug 2022 16:20:20 +0000 (16:20 +0000)
Change-Id: Ia7d72b134a52627fd3c19a3c238fba8deb5e01c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/407534
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/proc.go

index b6500bff00061f9c6abecfa3986c3bf9f3eb0f2f..ea7c349912e3d536cbd7602d3ad302911c3e75fe 100644 (file)
@@ -2571,7 +2571,7 @@ top:
 
        // Try to schedule the trace reader.
        if trace.enabled || trace.shutdown {
-               gp = traceReader()
+               gp := traceReader()
                if gp != nil {
                        casgstatus(gp, _Gwaiting, _Grunnable)
                        traceGoUnpark(gp, 0)
@@ -2581,10 +2581,11 @@ top:
 
        // Try to schedule a GC worker.
        if gcBlackenEnabled != 0 {
-               gp, now = gcController.findRunnableGCWorker(pp, now)
+               gp, tnow := gcController.findRunnableGCWorker(pp, now)
                if gp != nil {
                        return gp, false, true
                }
+               now = tnow
        }
 
        // Check the global runnable queue once in a while to ensure fairness.
@@ -2592,7 +2593,7 @@ top:
        // by constantly respawning each other.
        if pp.schedtick%61 == 0 && sched.runqsize > 0 {
                lock(&sched.lock)
-               gp = globrunqget(pp, 1)
+               gp := globrunqget(pp, 1)
                unlock(&sched.lock)
                if gp != nil {
                        return gp, false, false
@@ -2656,7 +2657,6 @@ top:
                }
 
                gp, inheritTime, tnow, w, newWork := stealWork(now)
-               now = tnow
                if gp != nil {
                        // Successfully stole.
                        return gp, inheritTime, false
@@ -2666,6 +2666,8 @@ top:
                        // discover.
                        goto top
                }
+
+               now = tnow
                if w != 0 && (pollUntil == 0 || w < pollUntil) {
                        // Earlier timer to wait for.
                        pollUntil = w
@@ -2767,7 +2769,7 @@ top:
                // latency. See golang.org/issue/43997.
 
                // Check all runqueues once again.
-               pp = checkRunqsNoP(allpSnapshot, idlepMaskSnapshot)
+               pp := checkRunqsNoP(allpSnapshot, idlepMaskSnapshot)
                if pp != nil {
                        acquirep(pp)
                        mp.spinning = true
@@ -2776,7 +2778,7 @@ top:
                }
 
                // Check for idle-priority GC work again.
-               pp, gp = checkIdleGCNoP()
+               pp, gp := checkIdleGCNoP()
                if pp != nil {
                        acquirep(pp)
                        mp.spinning = true
@@ -2832,7 +2834,7 @@ top:
                        goto top
                }
                lock(&sched.lock)
-               pp, _ = pidleget(now)
+               pp, _ := pidleget(now)
                unlock(&sched.lock)
                if pp == nil {
                        injectglist(&list)
@@ -4248,7 +4250,7 @@ func gfput(pp *p, gp *g) {
                        noStackQ gQueue
                )
                for pp.gFree.n >= 32 {
-                       gp = pp.gFree.pop()
+                       gp := pp.gFree.pop()
                        pp.gFree.n--
                        if gp.stack.lo == 0 {
                                noStackQ.push(gp)