name old time/op new time/op delta
StackCopyWithStkobj-8 12.1ms ± 7% 11.6ms ± 8% -3.88% (p=0.002 n=19+19)
Change-Id: Idf810017d541eba70bcf9c736267de9efae916d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/354072
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
}
p = add(p, uintptr(i)*4)
off := *(*uint32)(p)
+ // Return off == ^uint32(0) ? 0 : f.datap.gofunc + uintptr(off), but without branches.
+ // The compiler calculates mask on most architectures using conditional assignment.
+ var mask uintptr
if off == ^uint32(0) {
- return nil
+ mask = 1
}
- return unsafe.Pointer(f.datap.gofunc + uintptr(off))
+ mask--
+ raw := f.datap.gofunc + uintptr(off)
+ return unsafe.Pointer(raw & mask)
}
// step advances to the next pc, value pair in the encoded table.