]> Cypherpunks repositories - gostls13.git/commitdiff
runtime,cmd/link: merge pcbucketsize const into internal/abi
authorqiulaidongfeng <2645477756@qq.com>
Fri, 16 Feb 2024 00:15:29 +0000 (00:15 +0000)
committerCherry Mui <cherryyz@google.com>
Fri, 16 Feb 2024 14:25:22 +0000 (14:25 +0000)
For #59670

Change-Id: I6343bacd3126fe6381a2e73be10f61691792824d
GitHub-Last-Rev: bbab8d1142e5749f58c17f6f668e2eb679ff69d7
GitHub-Pull-Request: golang/go#65373
Reviewed-on: https://go-review.googlesource.com/c/go/+/559475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/ld/pcln.go
src/internal/abi/symtab.go
src/runtime/symtab.go

index 170ebe5ebe11e62a49aee6c74d585bc3a22fd3d5..df06084352942065df6dafe68646107183817d87 100644 (file)
@@ -827,9 +827,8 @@ func expandGoroot(s string) string {
 }
 
 const (
-       BUCKETSIZE    = 256 * abi.MINFUNC
        SUBBUCKETS    = 16
-       SUBBUCKETSIZE = BUCKETSIZE / SUBBUCKETS
+       SUBBUCKETSIZE = abi.FuncTabBucketSize / SUBBUCKETS
        NOIDX         = 0x7fffffff
 )
 
@@ -847,7 +846,7 @@ func (ctxt *Link) findfunctab(state *pclntab, container loader.Bitmap) {
        // that map to that subbucket.
        n := int32((max - min + SUBBUCKETSIZE - 1) / SUBBUCKETSIZE)
 
-       nbuckets := int32((max - min + BUCKETSIZE - 1) / BUCKETSIZE)
+       nbuckets := int32((max - min + abi.FuncTabBucketSize - 1) / abi.FuncTabBucketSize)
 
        size := 4*int64(nbuckets) + int64(n)
 
index 41026ea2ab8a94374a65884c64e74b00bd317c57..a3c9be7aa1ee54c6338dd8645117946c87a163f0 100644 (file)
@@ -107,3 +107,5 @@ const (
 )
 
 const MINFUNC = 16 // minimum size for a function
+
+const FuncTabBucketSize = 256 * MINFUNC // size of bucket in the pc->func lookup table
index a046ebef39e831fb254dd0f926ade0fd407ba011..96a2d290796c34c251542679f5b3742ffa23a570 100644 (file)
@@ -497,8 +497,6 @@ type textsect struct {
        baseaddr uintptr // relocated section address
 }
 
-const pcbucketsize = 256 * abi.MINFUNC // size of bucket in the pc->func lookup table
-
 // findfuncbucket is an array of these structures.
 // Each bucket represents 4096 bytes of the text segment.
 // Each subbucket represents 256 bytes of the text segment.
@@ -780,8 +778,8 @@ func findfunc(pc uintptr) funcInfo {
        }
 
        x := uintptr(pcOff) + datap.text - datap.minpc // TODO: are datap.text and datap.minpc always equal?
-       b := x / pcbucketsize
-       i := x % pcbucketsize / (pcbucketsize / nsub)
+       b := x / abi.FuncTabBucketSize
+       i := x % abi.FuncTabBucketSize / (abi.FuncTabBucketSize / nsub)
 
        ffb := (*findfuncbucket)(add(unsafe.Pointer(datap.findfunctab), b*unsafe.Sizeof(findfuncbucket{})))
        idx := ffb.idx + uint32(ffb.subbuckets[i])