Documentation
¶
Index ¶
- Constants
- func Add[T any, O num.Integer](p *T, off O) *T
- func Assign[T any, Ptr num.Pointer](base Ptr, offset uintptr, v T)
- func Cast[T any, Ptr num.Pointer](p Ptr) *T
- func CheckAlignment(p unsafe.Pointer, elem *abi.Type, n uintptr)
- func CheckArithmetic(p unsafe.Pointer, originals []unsafe.Pointer)
- func CheckptrBase(p unsafe.Pointer) uintptr
- func CheckptrStraddles(ptr unsafe.Pointer, size uintptr) bool
- type TaggedPointer
Constants ¶
const MinTagBits = 10
MinTagBits is the minimum number of tag bits that we expect.
const TaggedPointerBits = (os.IsAix * aixTagBits) + (arch.IsRiscv64 * riscv64TagBits) + ((1 - os.IsAix) * (1 - arch.IsRiscv64) * tagBits)
The number of bits stored in the numeric tag of a TaggedPointer
Variables ¶
This section is empty.
Functions ¶
func CheckptrBase ¶
CheckptrBase returns the base address for the allocation containing the address p.
Importantly, if p1 and p2 point into the same variable, then CheckptrBase(p1) == CheckptrBase(p2). However, the converse/inverse is not necessarily true as allocations can have trailing padding, and multiple variables may be packed into a single allocation.
Types ¶
type TaggedPointer ¶
type TaggedPointer uint64
TaggedPointer is a pointer with a numeric tag. The size of the numeric tag is GOARCH-dependent, currently at least 10 bits. This should only be used with pointers allocated outside the Go heap.
func TaggedPointerPack ¶
func TaggedPointerPack(ptr unsafe.Pointer, tag uintptr) TaggedPointer
TaggedPointerPack created a TaggedPointer from a pointer and a tag. Tag bits that don't fit in the result are discarded.