Less text and improves codegen a bit.
compilecmp on ARM64:
runtime
(*gcWork).putFast 160 -> 144 (-10.00%)
(*gcWork).tryGetFast 144 -> 128 (-11.11%)
scanobject 784 -> 752 (-4.08%)
greyobject 800 -> 784 (-2.00%)
AMD64:
runtime
greyobject 765 -> 748 (-2.22%)
(*gcWork).tryGetFast 102 -> 85 (-16.67%)
scanobject 837 -> 820 (-2.03%)
(*gcWork).putFast 102 -> 89 (-12.75%)
Change-Id: I6bb508afe1ba416823775c0bfc08ea9dc21de8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393754
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
//go:nowritebarrierrec
func (w *gcWork) putFast(obj uintptr) bool {
wbuf := w.wbuf1
- if wbuf == nil {
- return false
- } else if wbuf.nobj == len(wbuf.obj) {
+ if wbuf == nil || wbuf.nobj == len(wbuf.obj) {
return false
}
//go:nowritebarrierrec
func (w *gcWork) tryGetFast() uintptr {
wbuf := w.wbuf1
- if wbuf == nil {
- return 0
- }
- if wbuf.nobj == 0 {
+ if wbuf == nil || wbuf.nobj == 0 {
return 0
}