Documentation
¶
Index ¶
- Constants
- type Implementation
- func (i *Implementation) ClassifyArgument(t *types.TypeDescriptor, abi types.CallingConvention) arch.ArgumentClassification
- func (i *Implementation) ClassifyReturn(t *types.TypeDescriptor, abi types.CallingConvention) int
- func (i *Implementation) Execute(cif *types.CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, ...) (cerrno uintptr, err error)
- func (i *Implementation) StackArgBytes(cif *types.CallInterface) (need, limit uintptr, err error)
- type SysVAllocator
Constants ¶
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 (i *Implementation) ClassifyArgument( t *types.TypeDescriptor, abi types.CallingConvention, ) arch.ArgumentClassification
func (*Implementation) ClassifyReturn ¶
func (i *Implementation) ClassifyReturn( t *types.TypeDescriptor, abi types.CallingConvention, ) int
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).