The compiler zero-initializes the order array before calling selectgo, but the runtime ends up overwriting almost all of it anyway. We could probably shave a few instructions from call sites if selectgo took full responsibility for initializing the array.
I think this is just a matter of adding a pollorder[0] = 0 assignment in selectgo, and removing the nod(OAS, order, nil) assignment in cmd/compile/internal/gc/select.go.
See also #40397 (comment).
/cc @cuonglm
The compiler zero-initializes the order array before calling
selectgo, but the runtime ends up overwriting almost all of it anyway. We could probably shave a few instructions from call sites ifselectgotook full responsibility for initializing the array.I think this is just a matter of adding a
pollorder[0] = 0assignment inselectgo, and removing thenod(OAS, order, nil)assignment in cmd/compile/internal/gc/select.go.See also #40397 (comment).
/cc @cuonglm