From: Michael Anthony Knyszek Date: Thu, 31 Jan 2019 16:57:29 +0000 (+0000) Subject: runtime: merge codepaths in scavengeLargest X-Git-Tag: go1.13beta1~767 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=23d4c6cdd6712ba45ea4ec784bcb99cb883ab0ea;p=gostls13.git runtime: merge codepaths in scavengeLargest This change just makes the code in scavengeLargest easier to reason about by reducing the number of exit points to the method. It should still be correct either way because the condition checked at the end (released > nbytes) will always be false if we return, but this just makes the code a little easier to maintain. Change-Id: If60da7696aca3fab3b5ddfc795d600d87c988238 Reviewed-on: https://go-review.googlesource.com/c/go/+/160617 Run-TryBot: Michael Knyszek TryBot-Result: Gobot Gobot Reviewed-by: Austin Clements --- diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index 47e3a33391..8b7ed742c9 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -1381,7 +1381,7 @@ func (h *mheap) scavengeLargest(nbytes uintptr) { // This check also preserves the invariant that spans that have // `scavenged` set are only ever in the `scav` treap, and // those which have it unset are only in the `free` treap. - return + break } n := t.prev() h.free.erase(t)