1
0
mirror of https://github.com/golang/go synced 2024-07-03 08:51:14 +00:00

runtime: remove no-op pointer writes in treap rotations

Change-Id: If5a272f331fe9da09467efedd0231a4ce34db0f8
GitHub-Last-Rev: 4b81a79a92
GitHub-Pull-Request: golang/go#28420
Reviewed-on: https://go-review.googlesource.com/c/go/+/144999
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
alan 2019-10-10 18:56:27 +00:00 committed by Brad Fitzpatrick
parent 68395a66f9
commit 26ff21d44d

View File

@ -373,19 +373,11 @@ Found:
func (root *semaRoot) rotateLeft(x *sudog) {
// p -> (x a (y b c))
p := x.parent
a, y := x.prev, x.next
b, c := y.prev, y.next
y := x.next
b := y.prev
y.prev = x
x.parent = y
y.next = c
if c != nil {
c.parent = y
}
x.prev = a
if a != nil {
a.parent = x
}
x.next = b
if b != nil {
b.parent = x
@ -409,23 +401,15 @@ func (root *semaRoot) rotateLeft(x *sudog) {
func (root *semaRoot) rotateRight(y *sudog) {
// p -> (y (x a b) c)
p := y.parent
x, c := y.prev, y.next
a, b := x.prev, x.next
x := y.prev
b := x.next
x.prev = a
if a != nil {
a.parent = x
}
x.next = y
y.parent = x
y.prev = b
if b != nil {
b.parent = y
}
y.next = c
if c != nil {
c.parent = y
}
x.parent = p
if p == nil {