Documentation
¶
Overview ¶
Package pclntab contains the Go-style findfunc bucket/index algorithm used by LLGo runtime metadata. It is intentionally free of LLVM dependencies so build-time emitters and tests share one implementation of the pclntab logic.
Index ¶
Constants ¶
const ( // These constants intentionally match Go's pclntab findfunc layout: // cmd/link builds one 4096-byte text bucket, split into 16 256-byte // subbuckets, and runtime.findfunc starts scanning from the recorded // bucket base plus subbucket delta. MinFuncSize = uint32(16) FuncTabBucketSize = uint32(256) * MinFuncSize FindFuncSubbucket = 16 )
Variables ¶
This section is empty.
Functions ¶
func FuncIndexForPC ¶
func FuncIndexForPC(ftab []FuncTabEntry, pcOff uint32) int
FuncIndexForPC is the slow reference lookup over the sorted functab. It is kept for tests and for building the compact bucket table.
func LookupFuncIndex ¶
func LookupFuncIndex(ftab []FuncTabEntry, buckets []FindFuncBucket, pcOff uint32) int
LookupFuncIndex mirrors runtime.findfunc's hot lookup: use the bucket and subbucket to jump near the target function, then linearly scan the remaining entries in that small range.
Types ¶
type FindFuncBucket ¶
type FindFuncBucket struct {
Idx uint32
Subbuckets [FindFuncSubbucket]uint8
}
FindFuncBucket mirrors runtime.findfuncbucket: one uint32 base function index plus 16 one-byte deltas into the sorted functab.
func BuildFindFuncBuckets ¶
func BuildFindFuncBuckets(ftab []FuncTabEntry, textSize uint32) ([]FindFuncBucket, error)
BuildFindFuncBuckets ports Go's cmd/link findfunctab construction for a sorted functab. It deliberately stays independent of LLVM so build/link code can use it without duplicating the algorithm.
type FuncTabEntry ¶
FuncTabEntry mirrors the two pieces of data Go's linker stores in functab: a PC offset sorted by final text address, and an opaque function metadata offset. LLGo's current caller uses FuncOff as a payload index.