1
0
mirror of https://github.com/golang/go synced 2024-11-22 22:40:02 -07: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) { func (root *semaRoot) rotateLeft(x *sudog) {
// p -> (x a (y b c)) // p -> (x a (y b c))
p := x.parent p := x.parent
a, y := x.prev, x.next y := x.next
b, c := y.prev, y.next b := y.prev
y.prev = x y.prev = x
x.parent = y x.parent = y
y.next = c
if c != nil {
c.parent = y
}
x.prev = a
if a != nil {
a.parent = x
}
x.next = b x.next = b
if b != nil { if b != nil {
b.parent = x b.parent = x
@ -409,23 +401,15 @@ func (root *semaRoot) rotateLeft(x *sudog) {
func (root *semaRoot) rotateRight(y *sudog) { func (root *semaRoot) rotateRight(y *sudog) {
// p -> (y (x a b) c) // p -> (y (x a b) c)
p := y.parent p := y.parent
x, c := y.prev, y.next x := y.prev
a, b := x.prev, x.next b := x.next
x.prev = a
if a != nil {
a.parent = x
}
x.next = y x.next = y
y.parent = x y.parent = x
y.prev = b y.prev = b
if b != nil { if b != nil {
b.parent = y b.parent = y
} }
y.next = c
if c != nil {
c.parent = y
}
x.parent = p x.parent = p
if p == nil { if p == nil {