diff options
author | Michael Pratt <mpratt@google.com> | 2022-07-20 12:59:03 -0400 |
---|---|---|
committer | Michael Pratt <mpratt@google.com> | 2022-08-02 18:51:17 +0000 |
commit | 222799fde653358d9748ed24c133cffa18208951 (patch) | |
tree | a8ff5223d503c4ad4734657a84d0853d009a2056 | |
parent | e9d7f54a1acf6706f790776f69972ce92d59e910 (diff) | |
download | go-git-222799fde653358d9748ed24c133cffa18208951.tar.gz |
runtime: tricky replacements of _g_ in mgc.go
getg() is used primarily for gp.m, so use mp. gp.m.curg is also used,
name that curgp.
Change-Id: I9db2dc4adce2b17d6b41c60d4f2dfbc9aa41fac1
Reviewed-on: https://go-review.googlesource.com/c/go/+/418578
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r-- | src/runtime/mgc.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 5c1069eed7..84a7216b10 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -929,11 +929,10 @@ func gcMarkTermination() { mp := acquirem() mp.preemptoff = "gcing" - _g_ := getg() - _g_.m.traceback = 2 - gp := _g_.m.curg - casgstatus(gp, _Grunning, _Gwaiting) - gp.waitreason = waitReasonGarbageCollection + mp.traceback = 2 + curgp := mp.curg + casgstatus(curgp, _Grunning, _Gwaiting) + curgp.waitreason = waitReasonGarbageCollection // Run gc on the g0 stack. We do this so that the g stack // we're currently running on will no longer change. Cuts @@ -972,8 +971,8 @@ func gcMarkTermination() { gcSweep(work.mode) }) - _g_.m.traceback = 0 - casgstatus(gp, _Gwaiting, _Grunning) + mp.traceback = 0 + casgstatus(curgp, _Gwaiting, _Grunning) if trace.enabled { traceGCDone() |