1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:44:42 -07:00

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: Austin Clements <austin@google.com>
This commit is contained in:
Josh Bleecher Snyder 2018-04-06 21:45:55 -07:00
parent dda4591c8c
commit d91e9705f8

View File

@ -839,9 +839,11 @@ 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")
} }
bv := stackmapdata(stkmap, pcdata) if stkmap.nbit > 0 {
size = uintptr(bv.n) * sys.PtrSize bv := stackmapdata(stkmap, pcdata)
scanblock(frame.varp-size, size, bv.bytedata, gcw) size = uintptr(bv.n) * sys.PtrSize
scanblock(frame.varp-size, size, bv.bytedata, gcw)
}
} }
// Scan arguments. // Scan arguments.
@ -862,7 +864,9 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) {
} }
bv = stackmapdata(stkmap, pcdata) bv = stackmapdata(stkmap, pcdata)
} }
scanblock(frame.argp, uintptr(bv.n)*sys.PtrSize, bv.bytedata, gcw) if bv.n > 0 {
scanblock(frame.argp, uintptr(bv.n)*sys.PtrSize, bv.bytedata, gcw)
}
} }
} }