diff options
author | Austin Clements <austin@google.com> | 2017-03-07 15:36:49 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2017-03-07 21:19:38 +0000 |
commit | d50f892abca46b794a23f20777c0b2425467d407 (patch) | |
tree | 24860cb18fb48f360612905ca4a76a2139b29d67 /src/runtime/select.go | |
parent | 5e4a958351222233fbc6f82ab621a7d15299eea5 (diff) | |
download | go-git-d50f892abca46b794a23f20777c0b2425467d407.tar.gz |
runtime: join selectgo and selectgoImpl
Currently selectgo is just a wrapper around selectgoImpl. This keeps
the hard-coded frame skip counts for tracing the same between the
channel implementation and the select implementation.
However, this is fragile and confusing, so pass a skip parameter to
send and recv, join selectgo and selectgoImpl into one function, and
use decrease all of the skips in selectgo by one.
Change-Id: I11b8cbb7d805b55f5dc6ab4875ac7dde79412ff2
Reviewed-on: https://go-review.googlesource.com/37860
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/runtime/select.go')
-rw-r--r-- | src/runtime/select.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/runtime/select.go b/src/runtime/select.go index 03b699796f..715cee8750 100644 --- a/src/runtime/select.go +++ b/src/runtime/select.go @@ -199,13 +199,7 @@ func block() { // // selectgo returns the index of the chosen scase, which matches the // ordinal position of its respective select{recv,send,default} call. -//go:nosplit func selectgo(sel *hselect) int { - return selectgoImpl(sel) -} - -// Separate function to keep runtime/trace.TestTraceSymbolize happy. -func selectgoImpl(sel *hselect) int { if debugSelect { print("select: sel=", sel, "\n") } @@ -398,7 +392,7 @@ loop: // wait for someone to wake us up gp.param = nil - gopark(selparkcommit, nil, "select", traceEvGoBlockSelect, 2) + gopark(selparkcommit, nil, "select", traceEvGoBlockSelect, 1) // While we were asleep, some goroutine came along and completed // one of the cases in the select and woke us up (called ready). @@ -592,7 +586,7 @@ bufsend: recv: // can receive from sleeping sender (sg) - recv(c, sg, cas.elem, func() { selunlock(scases, lockorder) }) + recv(c, sg, cas.elem, func() { selunlock(scases, lockorder) }, 2) if debugSelect { print("syncrecv: sel=", sel, " c=", c, "\n") } @@ -623,7 +617,7 @@ send: if msanenabled { msanread(cas.elem, c.elemtype.size) } - send(c, sg, cas.elem, func() { selunlock(scases, lockorder) }) + send(c, sg, cas.elem, func() { selunlock(scases, lockorder) }, 2) if debugSelect { print("syncsend: sel=", sel, " c=", c, "\n") } @@ -631,7 +625,7 @@ send: retc: if cas.releasetime > 0 { - blockevent(cas.releasetime-t0, 2) + blockevent(cas.releasetime-t0, 1) } return casi |