]> Cypherpunks repositories - gostls13.git/commit
runtime: eliminate scase.kind field
authorMatthew Dempsky <mdempsky@google.com>
Mon, 27 Jul 2020 23:19:15 +0000 (16:19 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 18 Aug 2020 20:06:33 +0000 (20:06 +0000)
commitfe23ba4a145ce8465d16ea2a92b9a7e96e15c28e
treea50c3c2cf3d82df52dfb6ed20245584c991d77a2
parentd36bc7d78ad226b20056c08fb8bca041e25b3d1d
runtime: eliminate scase.kind field

Currently, we include a "kind" field on scase to distinguish the three
kinds of cases in a select statement: sends, receives, and defaults.

This commit removes by kind field by instead arranging for the
compiler to always place sends before receives, and to provide their
counts separately. It also passes an explicit "block bool" parameter
to avoid needing to include a default case in the array.

It's safe to shuffle cases like this because the runtime will
randomize the order they're polled in anyway.

Fixes #40410.

Change-Id: Iaeaed4cf7bddd576d78f2c863bd91a03a5c82df2
Reviewed-on: https://go-review.googlesource.com/c/go/+/245125
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/builtin.go
src/cmd/compile/internal/gc/builtin/runtime.go
src/cmd/compile/internal/gc/select.go
src/reflect/all_test.go
src/runtime/select.go