mirror of
https://github.com/golang/go
synced 2024-11-23 06:30:06 -07:00
runtime,cmd/link: merge pcbucketsize const into internal/abi
For #59670
Change-Id: I6343bacd3126fe6381a2e73be10f61691792824d
GitHub-Last-Rev: bbab8d1142
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>
This commit is contained in:
parent
daa58db486
commit
284e553035
@ -827,9 +827,8 @@ func expandGoroot(s string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BUCKETSIZE = 256 * abi.MINFUNC
|
|
||||||
SUBBUCKETS = 16
|
SUBBUCKETS = 16
|
||||||
SUBBUCKETSIZE = BUCKETSIZE / SUBBUCKETS
|
SUBBUCKETSIZE = abi.FuncTabBucketSize / SUBBUCKETS
|
||||||
NOIDX = 0x7fffffff
|
NOIDX = 0x7fffffff
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -847,7 +846,7 @@ func (ctxt *Link) findfunctab(state *pclntab, container loader.Bitmap) {
|
|||||||
// that map to that subbucket.
|
// that map to that subbucket.
|
||||||
n := int32((max - min + SUBBUCKETSIZE - 1) / SUBBUCKETSIZE)
|
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)
|
size := 4*int64(nbuckets) + int64(n)
|
||||||
|
|
||||||
|
@ -107,3 +107,5 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const MINFUNC = 16 // minimum size for a function
|
const MINFUNC = 16 // minimum size for a function
|
||||||
|
|
||||||
|
const FuncTabBucketSize = 256 * MINFUNC // size of bucket in the pc->func lookup table
|
||||||
|
@ -497,8 +497,6 @@ type textsect struct {
|
|||||||
baseaddr uintptr // relocated section address
|
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.
|
// findfuncbucket is an array of these structures.
|
||||||
// Each bucket represents 4096 bytes of the text segment.
|
// Each bucket represents 4096 bytes of the text segment.
|
||||||
// Each subbucket represents 256 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?
|
x := uintptr(pcOff) + datap.text - datap.minpc // TODO: are datap.text and datap.minpc always equal?
|
||||||
b := x / pcbucketsize
|
b := x / abi.FuncTabBucketSize
|
||||||
i := x % pcbucketsize / (pcbucketsize / nsub)
|
i := x % abi.FuncTabBucketSize / (abi.FuncTabBucketSize / nsub)
|
||||||
|
|
||||||
ffb := (*findfuncbucket)(add(unsafe.Pointer(datap.findfunctab), b*unsafe.Sizeof(findfuncbucket{})))
|
ffb := (*findfuncbucket)(add(unsafe.Pointer(datap.findfunctab), b*unsafe.Sizeof(findfuncbucket{})))
|
||||||
idx := ffb.idx + uint32(ffb.subbuckets[i])
|
idx := ffb.idx + uint32(ffb.subbuckets[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user