From: Austin Clements Date: Tue, 1 Aug 2023 17:45:31 +0000 (-0400) Subject: runtime: store start PC in pcvalueCache X-Git-Tag: go1.22rc1~1377 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6be2639aff73389fce845cd7a6d1c568a5ef5625;p=gostls13.git runtime: store start PC in pcvalueCache Currently, pcvalue only returns a valid start PC if cache is nil. We're about to eliminate the cache argument and always use a pcvalue cache, so make sure the cache stores the start PC and always return it from pcvalue. Change-Id: Ie8854af4b7e7ba1c2a17a495d9229320821daa23 Reviewed-on: https://go-review.googlesource.com/c/go/+/515275 Run-TryBot: Austin Clements Reviewed-by: Michael Knyszek Reviewed-by: Carlos Amedee Auto-Submit: Austin Clements TryBot-Result: Gopher Robot --- diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index b47f2d8390..ff5f5f7f0e 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -829,8 +829,9 @@ type pcvalueCacheEnt struct { // targetpc and off together are the key of this cache entry. targetpc uintptr off uint32 - // val is the value of this cached pcvalue entry. - val int32 + + val int32 // The value of this entry. + valPC uintptr // The PC at which val starts } // pcvalueCacheKey returns the outermost index in a pcvalueCache to use for targetpc. @@ -842,7 +843,6 @@ func pcvalueCacheKey(targetpc uintptr) uintptr { } // Returns the PCData value, and the PC where this value starts. -// TODO: the start PC is returned only when cache is nil. func pcvalue(f funcInfo, off uint32, targetpc uintptr, cache *pcvalueCache, strict bool) (int32, uintptr) { if off == 0 { return -1, 0 @@ -864,7 +864,7 @@ func pcvalue(f funcInfo, off uint32, targetpc uintptr, cache *pcvalueCache, stri // fail in the first clause. ent := &cache.entries[x][i] if ent.off == off && ent.targetpc == targetpc { - return ent.val, 0 + return ent.val, ent.valPC } } } @@ -903,6 +903,7 @@ func pcvalue(f funcInfo, off uint32, targetpc uintptr, cache *pcvalueCache, stri targetpc: targetpc, off: off, val: val, + valPC: prevpc, } }