aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-12-11 19:40:12 -0500
committerAustin Clements <austin@google.com>2018-02-15 21:12:13 +0000
commit058bb7ea278d8e073be1e1c73d01fbfd74c170fd (patch)
treee7f5969e7269be71bb20b3e9837bad1128de597a /src/runtime/race.go
parent41e6abdc61dd23ede4d3509aebf7b5a638f53712 (diff)
downloadgo-058bb7ea278d8e073be1e1c73d01fbfd74c170fd.tar.gz
go-058bb7ea278d8e073be1e1c73d01fbfd74c170fd.zip
runtime: split object finding out of heapBitsForObject
heapBitsForObject does two things: it finds the base of the object and it creates the heapBits for the base of the object. There are several places where we just care about the base of the object. Furthermore, greyobject only needs the heapBits in the checkmark path and can easily compute them only when needed. Once we eliminate passing the heap bits to grayobject, almost all uses of heapBitsForObject don't need the heap bits. Hence, this splits heapBitsForObject into findObject and heapBitsForAddr (the latter already exists), removes the hbits argument to grayobject, and replaces all heapBitsForObject calls with calls to findObject. In addition to making things cleaner overall, heapBitsForAddr is going to get more expensive shortly, so it's important that we don't do it needlessly. Note that there's an interesting performance pitfall here. I had originally moved findObject to mheap.go, since it made more sense there. However, that leads to a ~2% slow down and a whopping 11% increase in L1 icache misses on both the x/garbage and compilebench benchmarks. This suggests we may want to be more principled about this, but, for now, let's just leave findObject in mbitmap.go. (I tried to make findObject small enough to inline by splitting out the error case, but, sadly, wasn't quite able to get it under the inlining budget.) Change-Id: I7bcb92f383ade565d22a9f2494e4c66fd513fb10 Reviewed-on: https://go-review.googlesource.com/85878 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/race.go')
-rw-r--r--src/runtime/race.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/race.go b/src/runtime/race.go
index 1d35d2b641..09a8356770 100644
--- a/src/runtime/race.go
+++ b/src/runtime/race.go
@@ -187,7 +187,7 @@ type symbolizeDataContext struct {
}
func raceSymbolizeData(ctx *symbolizeDataContext) {
- if base, _, span, _ := heapBitsForObject(ctx.addr, 0, 0); base != 0 {
+ if base, span, _ := findObject(ctx.addr, 0, 0); base != 0 {
ctx.heap = 1
ctx.start = base
ctx.size = span.elemsize