Commit d91e9705 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

runtime: avoid unnecessary scanblock calls

This is the scanstack analog of CL 104737,
which made a similar change for copystack.

name         old time/op  new time/op  delta
ScanStack-8  41.1ms ± 6%  38.9ms ± 5%  -5.52%  (p=0.000 n=50+48)

Change-Id: I7427151dea2895ed3934f8a0f61d96b568019217
Reviewed-on: https://go-review.googlesource.com/105536
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarAustin Clements <austin@google.com>
parent dda4591c
...@@ -839,10 +839,12 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) { ...@@ -839,10 +839,12 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) {
print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " locals stack map entries for ", funcname(f), " (targetpc=", targetpc, ")\n") print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " locals stack map entries for ", funcname(f), " (targetpc=", targetpc, ")\n")
throw("scanframe: bad symbol table") throw("scanframe: bad symbol table")
} }
if stkmap.nbit > 0 {
bv := stackmapdata(stkmap, pcdata) bv := stackmapdata(stkmap, pcdata)
size = uintptr(bv.n) * sys.PtrSize size = uintptr(bv.n) * sys.PtrSize
scanblock(frame.varp-size, size, bv.bytedata, gcw) scanblock(frame.varp-size, size, bv.bytedata, gcw)
} }
}
// Scan arguments. // Scan arguments.
if frame.arglen > 0 { if frame.arglen > 0 {
...@@ -862,8 +864,10 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) { ...@@ -862,8 +864,10 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) {
} }
bv = stackmapdata(stkmap, pcdata) bv = stackmapdata(stkmap, pcdata)
} }
if bv.n > 0 {
scanblock(frame.argp, uintptr(bv.n)*sys.PtrSize, bv.bytedata, gcw) scanblock(frame.argp, uintptr(bv.n)*sys.PtrSize, bv.bytedata, gcw)
} }
}
} }
type gcDrainFlags int type gcDrainFlags int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment