aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-08-07 18:11:39 -0400
committerGopher Robot <gobot@golang.org>2023-08-07 22:27:53 +0000
commit26e0660811d477dcb30f1abcf71ed9db7a9c4472 (patch)
tree1444b09056de9661906405e3f4c52128340232e5 /src/runtime/symtab.go
parent5f674f64e4e3f79adf45d301bcbc16a8a3a82b1d (diff)
downloadgo-26e0660811d477dcb30f1abcf71ed9db7a9c4472.tar.xz
Revert "runtime: move pcvalue cache to M"
This reverts CL 515276. This broke the longtest builders. For example: https://build.golang.org/log/351a1a198a6b843b1881c1fb6cdef51f3e413e8b Change-Id: Ie79067464fe8e226da31721cf127f3efb6011452 Reviewed-on: https://go-review.googlesource.com/c/go/+/516856 Auto-Submit: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/symtab.go')
-rw-r--r--src/runtime/symtab.go46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 18ba683d69..ff5f5f7f0e 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -843,32 +843,30 @@ func pcvalueCacheKey(targetpc uintptr) uintptr {
}
// Returns the PCData value, and the PC where this value starts.
-func pcvalue(f funcInfo, off uint32, targetpc uintptr, _ *pcvalueCache, strict bool) (int32, uintptr) {
+func pcvalue(f funcInfo, off uint32, targetpc uintptr, cache *pcvalueCache, strict bool) (int32, uintptr) {
if off == 0 {
return -1, 0
}
// Check the cache. This speeds up walks of deep stacks, which
- // tend to have the same recursive functions over and over,
- // or repetitive stacks between goroutines.
- ck := pcvalueCacheKey(targetpc)
- {
- mp := acquirem()
- cache := &mp.pcvalueCache
- for i := range cache.entries[ck] {
+ // tend to have the same recursive functions over and over.
+ //
+ // This cache is small enough that full associativity is
+ // cheaper than doing the hashing for a less associative
+ // cache.
+ if cache != nil {
+ x := pcvalueCacheKey(targetpc)
+ for i := range cache.entries[x] {
// We check off first because we're more
// likely to have multiple entries with
// different offsets for the same targetpc
// than the other way around, so we'll usually
// fail in the first clause.
- ent := &cache.entries[ck][i]
+ ent := &cache.entries[x][i]
if ent.off == off && ent.targetpc == targetpc {
- val, pc := ent.val, ent.valPC
- releasem(mp)
- return val, pc
+ return ent.val, ent.valPC
}
}
- releasem(mp)
}
if !f.valid() {
@@ -896,18 +894,18 @@ func pcvalue(f funcInfo, off uint32, targetpc uintptr, _ *pcvalueCache, strict b
// larger than the cache.
// Put the new element at the beginning,
// since it is the most likely to be newly used.
- mp := acquirem()
- cache := &mp.pcvalueCache
- e := &cache.entries[ck]
- ci := fastrandn(uint32(len(cache.entries[ck])))
- e[ci] = e[0]
- e[0] = pcvalueCacheEnt{
- targetpc: targetpc,
- off: off,
- val: val,
- valPC: prevpc,
+ if cache != nil {
+ x := pcvalueCacheKey(targetpc)
+ e := &cache.entries[x]
+ ci := fastrandn(uint32(len(cache.entries[x])))
+ e[ci] = e[0]
+ e[0] = pcvalueCacheEnt{
+ targetpc: targetpc,
+ off: off,
+ val: val,
+ valPC: prevpc,
+ }
}
- releasem(mp)
return val, prevpc
}