summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-21 14:58:14 -0800
committerIan Lance Taylor <iant@golang.org>2020-12-22 11:54:03 -0800
commit1fa5fc7408d05710cb63a5e91c5df6c787b51019 (patch)
treef2eabda05e2cfcaca5cd88e30d2a8f11ef25567a /libgo
parentffd454b92ba6ff5499cf57f82a2b0f4cee59978c (diff)
downloadgcc-1fa5fc7408d05710cb63a5e91c5df6c787b51019.tar.gz
runtime: remove scase.releasetime field
This is the gofrontend version of https://golang.org/cl/245122. Original CL description: selectgo will report at most one block event, so there's no need to keep a releasetime for every select case. It suffices to simply track the releasetime of the case responsible for the wakeup. Updates golang/go#40410. This is being brought over to gofrontend as a step toward upgrading to Go1.16beta1. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279732
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/select.go21
1 files changed, 9 insertions, 12 deletions
diff --git a/libgo/go/runtime/select.go b/libgo/go/runtime/select.go
index c8910b8dc23..81e00ec5a4e 100644
--- a/libgo/go/runtime/select.go
+++ b/libgo/go/runtime/select.go
@@ -32,10 +32,9 @@ const (
// Known to compiler.
// Changes here must also be made in src/cmd/internal/gc/select.go's scasetype.
type scase struct {
- c *hchan // chan
- elem unsafe.Pointer // data element
- kind uint16
- releasetime int64
+ c *hchan // chan
+ elem unsafe.Pointer // data element
+ kind uint16
}
func sellock(scases []scase, lockorder []uint16) {
@@ -151,9 +150,6 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) {
var t0 int64
if blockprofilerate > 0 {
t0 = cputicks()
- for i := 0; i < ncases; i++ {
- scases[i].releasetime = -1
- }
}
// The compiler rewrites selects that statically have
@@ -241,6 +237,7 @@ loop:
var dfl *scase
var casi int
var cas *scase
+ var caseReleaseTime int64 = -1
var recvOK bool
for i := 0; i < ncases; i++ {
casi = int(pollorder[i])
@@ -361,13 +358,13 @@ loop:
if k.kind == caseNil {
continue
}
- if sglist.releasetime > 0 {
- k.releasetime = sglist.releasetime
- }
if sg == sglist {
// sg has already been dequeued by the G that woke us up.
casi = int(casei)
cas = k
+ if sglist.releasetime > 0 {
+ caseReleaseTime = sglist.releasetime
+ }
} else {
c = k.c
if k.kind == caseSend {
@@ -465,8 +462,8 @@ send:
goto retc
retc:
- if cas.releasetime > 0 {
- blockevent(cas.releasetime-t0, 1)
+ if caseReleaseTime > 0 {
+ blockevent(caseReleaseTime-t0, 1)
}
// Check preemption, since unlike gc we don't check on every call.