Help us shape the future of Go! Take the 2026 Go Developer Survey

amd64

package
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MaxStackBytes bounds the stack area for one C call. The words are
	// copied onto the system stack (g0) the call runs on, which is the OS
	// thread's stack: 512 KiB for a secondary thread on macOS, 8 MiB by
	// default on Linux. libffi has no bound (it uses alloca); 64 KiB leaves
	// that stack to the callee, and no real C signature comes close (8192
	// words, e.g. 680 structs of 96 bytes).
	MaxStackBytes = 64 << 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Implementation

type Implementation struct{}

func (*Implementation) ClassifyArgument

func (*Implementation) ClassifyReturn

func (i *Implementation) ClassifyReturn(
	t *types.TypeDescriptor,
	abi types.CallingConvention,
) int

func (*Implementation) Execute

func (i *Implementation) Execute(
	cif *types.CallInterface,
	fn unsafe.Pointer,
	rvalue unsafe.Pointer,
	avalue []unsafe.Pointer,
	errnoFn uintptr,
) (cerrno uintptr, err error)

func (*Implementation) StackArgBytes added in v0.6.8

func (i *Implementation) StackArgBytes(cif *types.CallInterface) (need, limit uintptr, err error)

StackArgBytes reports how many bytes of stack the arguments of cif need and how many the call path supports. PrepareCallInterface uses it to reject calls that do not fit.

type SysVAllocator added in v0.6.8

type SysVAllocator struct {
	// contains filtered or unexported fields
}

SysVAllocator hands out registers and stack words to arguments in the order they are passed. The ffi package uses it to decode callback arguments with the same rules the call path places them.

func (*SysVAllocator) Fits added in v0.6.8

func (a *SysVAllocator) Fits(ngpr, nsse int) bool

Fits reports whether ngpr integer and nsse SSE registers are still free.

func (*SysVAllocator) GPR added in v0.6.8

func (a *SysVAllocator) GPR() int

GPR takes the next integer register and returns its index (0 = RDI).

func (*SysVAllocator) SSE added in v0.6.8

func (a *SysVAllocator) SSE() int

SSE takes the next SSE register and returns its index (0 = XMM0).

func (*SysVAllocator) Stack added in v0.6.8

func (a *SysVAllocator) Stack(size, align uintptr) int

Stack reserves size bytes, aligned to at least 8, and returns the index of the first 8-byte word.

func (*SysVAllocator) StackBytes added in v0.6.8

func (a *SysVAllocator) StackBytes() uintptr

StackBytes returns the stack bytes reserved so far (a multiple of 8).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL