Skip to content

Commit d62d831

Browse files
committed
runtime: clean up adjustpointer and eliminate write barrier
Commit a5c3bbe modified adjustpointers to use *uintptrs instead of *unsafe.Pointers for manipulating stack pointers for clarity and to eliminate the unnecessary write barrier when writing the updated stack pointer. This commit makes the equivalent change to adjustpointer. Change-Id: I6dc309590b298bdd86ecdc9737db848d6786c3f7 Reviewed-on: https://go-review.googlesource.com/17148 Reviewed-by: Rick Hudson <[email protected]> Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 71cc445 commit d62d831

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/runtime/stack.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,15 @@ type adjustinfo struct {
521521
// Adjustpointer checks whether *vpp is in the old stack described by adjinfo.
522522
// If so, it rewrites *vpp to point into the new stack.
523523
func adjustpointer(adjinfo *adjustinfo, vpp unsafe.Pointer) {
524-
pp := (*unsafe.Pointer)(vpp)
524+
pp := (*uintptr)(vpp)
525525
p := *pp
526526
if stackDebug >= 4 {
527-
print(" ", pp, ":", p, "\n")
527+
print(" ", pp, ":", hex(p), "\n")
528528
}
529-
if adjinfo.old.lo <= uintptr(p) && uintptr(p) < adjinfo.old.hi {
530-
*pp = add(p, adjinfo.delta)
529+
if adjinfo.old.lo <= p && p < adjinfo.old.hi {
530+
*pp = p + adjinfo.delta
531531
if stackDebug >= 3 {
532-
print(" adjust ptr ", pp, ":", p, " -> ", *pp, "\n")
532+
print(" adjust ptr ", pp, ":", hex(p), " -> ", hex(*pp), "\n")
533533
}
534534
}
535535
}

0 commit comments

Comments
 (0)