ccall

package
v0.0.0-...-ff78d45 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JIT_OPTLEVEL_NONE   = C.JIT_OPTLEVEL_NONE
	JIT_OPTLEVEL_NORMAL = C.JIT_OPTLEVEL_NORMAL
	JIT_NO_OFFSET       = C.JIT_NO_OFFSET
)
View Source
var (
	JIT_OPTION_CACHE_LIMIT           = C.JIT_OPTION_CACHE_LIMIT
	JIT_OPTION_CACHE_PAGE_SIZE       = C.JIT_OPTION_CACHE_PAGE_SIZE
	JIT_OPTION_PRE_COMPILE           = C.JIT_OPTION_PRE_COMPILE
	JIT_OPTION_DONT_FOLD             = C.JIT_OPTION_DONT_FOLD
	JIT_OPTION_POSITION_INDEPENDENT  = C.JIT_OPTION_POSITION_INDEPENDENT
	JIT_OPTION_CACHE_MAX_PAGE_FACTOR = C.JIT_OPTION_CACHE_MAX_PAGE_FACTOR
)
View Source
var (
	JIT_TYPE_INVALID       = C.JIT_TYPE_INVALID
	JIT_TYPE_VOID          = C.JIT_TYPE_VOID
	JIT_TYPE_SBYTE         = C.JIT_TYPE_SBYTE
	JIT_TYPE_UBYTE         = C.JIT_TYPE_UBYTE
	JIT_TYPE_SHORT         = C.JIT_TYPE_SHORT
	JIT_TYPE_USHORT        = C.JIT_TYPE_USHORT
	JIT_TYPE_INT           = C.JIT_TYPE_INT
	JIT_TYPE_UINT          = C.JIT_TYPE_UINT
	JIT_TYPE_NINT          = C.JIT_TYPE_NINT
	JIT_TYPE_NUINT         = C.JIT_TYPE_NUINT
	JIT_TYPE_LONG          = C.JIT_TYPE_LONG
	JIT_TYPE_ULONG         = C.JIT_TYPE_ULONG
	JIT_TYPE_FLOAT32       = C.JIT_TYPE_FLOAT32
	JIT_TYPE_FLOAT64       = C.JIT_TYPE_FLOAT64
	JIT_TYPE_NFLOAT        = C.JIT_TYPE_NFLOAT
	JIT_TYPE_MAX_PRIMITIVE = JIT_TYPE_NFLOAT
	JIT_TYPE_STRUCT        = C.JIT_TYPE_STRUCT
	JIT_TYPE_UNION         = C.JIT_TYPE_UNION
	JIT_TYPE_SIGNATURE     = C.JIT_TYPE_SIGNATURE
	JIT_TYPE_PTR           = C.JIT_TYPE_PTR
	JIT_TYPE_FIRST_TAGGED  = C.JIT_TYPE_FIRST_TAGGED
)

Type kinds that may be returned by Kind().

View Source
var (
	JIT_TYPETAG_NAME           = C.JIT_TYPETAG_NAME
	JIT_TYPETAG_STRUCT_NAME    = C.JIT_TYPETAG_STRUCT_NAME
	JIT_TYPETAG_UNION_NAME     = C.JIT_TYPETAG_UNION_NAME
	JIT_TYPETAG_ENUM_NAME      = C.JIT_TYPETAG_ENUM_NAME
	JIT_TYPETAG_CONST          = C.JIT_TYPETAG_CONST
	JIT_TYPETAG_VOLATILE       = C.JIT_TYPETAG_VOLATILE
	JIT_TYPETAG_REFERENCE      = C.JIT_TYPETAG_REFERENCE
	JIT_TYPETAG_OUTPUT         = C.JIT_TYPETAG_OUTPUT
	JIT_TYPETAG_RESTRICT       = C.JIT_TYPETAG_RESTRICT
	JIT_TYPETAG_SYS_BOOL       = C.JIT_TYPETAG_SYS_BOOL
	JIT_TYPETAG_SYS_CHAR       = C.JIT_TYPETAG_SYS_CHAR
	JIT_TYPETAG_SYS_SCHAR      = C.JIT_TYPETAG_SYS_SCHAR
	JIT_TYPETAG_SYS_UCHAR      = C.JIT_TYPETAG_SYS_UCHAR
	JIT_TYPETAG_SYS_SHORT      = C.JIT_TYPETAG_SYS_SHORT
	JIT_TYPETAG_SYS_USHORT     = C.JIT_TYPETAG_SYS_USHORT
	JIT_TYPETAG_SYS_INT        = C.JIT_TYPETAG_SYS_INT
	JIT_TYPETAG_SYS_UINT       = C.JIT_TYPETAG_SYS_UINT
	JIT_TYPETAG_SYS_LONG       = C.JIT_TYPETAG_SYS_LONG
	JIT_TYPETAG_SYS_ULONG      = C.JIT_TYPETAG_SYS_ULONG
	JIT_TYPETAG_SYS_LONGLONG   = C.JIT_TYPETAG_SYS_LONGLONG
	JIT_TYPETAG_SYS_ULONGLONG  = C.JIT_TYPETAG_SYS_ULONGLONG
	JIT_TYPETAG_SYS_FLOAT      = C.JIT_TYPETAG_SYS_FLOAT
	JIT_TYPETAG_SYS_DOUBLE     = C.JIT_TYPETAG_SYS_DOUBLE
	JIT_TYPETAG_SYS_LONGDOUBLE = C.JIT_TYPETAG_SYS_LONGDOUBLE
)

Special tag types.

View Source
var (
	TypeInt         = &Type{C.jit_type_int}
	TypeVoidPtr     = &Type{C.jit_type_void_ptr}
	TypeCharPtr     = &Type{C.jit_type_create_pointer(C.jit_type_sys_char, 0)}
	TypeGoInt       = &Type{C.jit_type_sys_longlong}
	TypeGoString    = CreateStruct([]*Type{TypeCharPtr, TypeInt}, 0)
	TypeGoInterface = CreateStruct([]*Type{TypeVoidPtr, TypeVoidPtr}, 0)
	TypeVoid        = &Type{C.jit_type_void}
	TypeFloat32     = &Type{C.jit_type_float32}
	TypeFloat64     = &Type{C.jit_type_float64}
)
View Source
var (
	UndefinedLabel = &Label{C.jit_label_undefined}
)

Functions

func BestAlignment

func BestAlignment() uint

func MaxOptimizationLevel

func MaxOptimizationLevel() uint

Types

type Block

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

func (*Block) Context

func (b *Block) Context() *Context

func (*Block) EndsInDead

func (b *Block) EndsInDead() bool

func (*Block) Function

func (b *Block) Function() *Function

func (*Block) IsReachable

func (b *Block) IsReachable() bool

func (*Block) Label

func (b *Block) Label() *Label

func (*Block) NextLabel

func (b *Block) NextLabel(label *Label) *Label

type Context

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

func CreateContext

func CreateContext() *Context

func (*Context) BuildEnd

func (c *Context) BuildEnd()

func (*Context) BuildStart

func (c *Context) BuildStart()

func (*Context) CreateFunction

func (c *Context) CreateFunction(signature *Type) *Function

func (*Context) CreateNestedFunction

func (c *Context) CreateNestedFunction(signature *Type, parent *Function) *Function

func (*Context) Destroy

func (c *Context) Destroy()

type Function

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

func (*Function) Abandon

func (f *Function) Abandon()

func (*Function) Abs

func (f *Function) Abs(value1 *Value) *Value

func (*Function) Acos

func (f *Function) Acos(value1 *Value) *Value

func (*Function) Add

func (f *Function) Add(value1, value2 *Value) *Value

func (*Function) AddOvf

func (f *Function) AddOvf(value1, value2 *Value) *Value

func (*Function) AddRelative

func (f *Function) AddRelative(value *Value, offset int) *Value

func (*Function) AddressOf

func (f *Function) AddressOf(value1 *Value) *Value

func (*Function) AddressOfLabel

func (f *Function) AddressOfLabel(label *Label) *Value

func (*Function) Alloca

func (f *Function) Alloca(size *Value) *Value

func (*Function) And

func (f *Function) And(value1, value2 *Value) *Value

func (*Function) Apply

func (f *Function) Apply(args []interface{}) interface{}

func (*Function) Asin

func (f *Function) Asin(value1 *Value) *Value

func (*Function) Atan

func (f *Function) Atan(value1 *Value) *Value

func (*Function) Atan2

func (f *Function) Atan2(value1, value2 *Value) *Value

func (*Function) BlockFromLabel

func (f *Function) BlockFromLabel(label *Label) *Block

func (*Function) Branch

func (f *Function) Branch(label *Label) bool

func (*Function) BranchIf

func (f *Function) BranchIf(value *Value, label *Label) bool

func (*Function) BranchIfNot

func (f *Function) BranchIfNot(value *Value, label *Label) bool

func (*Function) Call

func (f *Function) Call(name string, fn *Function, args Values) *Value

func (*Function) CallIndirect

func (f *Function) CallIndirect(fn *Function, value *Value, signature *Type, args Values) *Value

func (*Function) CallIndirectVtable

func (f *Function) CallIndirectVtable(fn *Function, value *Value, signature *Type, args Values) *Value

func (*Function) CallNative

func (f *Function) CallNative(fn *Function, name string, nativeFunc unsafe.Pointer, signature *Type, args Values) *Value

func (*Function) CallNestedIndirect

func (f *Function) CallNestedIndirect(fn *Function, value *Value, parentFrame *Value, signature *Type, args Values) *Value

func (*Function) Ceil

func (f *Function) Ceil(value1 *Value) *Value

func (*Function) CheckNull

func (f *Function) CheckNull(value *Value) bool

func (*Function) ClearRecompilable

func (f *Function) ClearRecompilable()

func (*Function) Cmpg

func (f *Function) Cmpg(value1, value2 *Value) *Value

func (*Function) Cmpl

func (f *Function) Cmpl(value1, value2 *Value) *Value

func (*Function) Compile

func (f *Function) Compile() bool

func (*Function) Context

func (f *Function) Context() *Context

func (*Function) Convert

func (f *Function) Convert(value *Value, typ *Type, overflowCheck int) *Value

func (*Function) Cos

func (f *Function) Cos(value1 *Value) *Value

func (*Function) Cosh

func (f *Function) Cosh(value1 *Value) *Value

func (*Function) CreateFloat32Constant

func (f *Function) CreateFloat32Constant(typ *Type, constValue float32) *Value

func (*Function) CreateFloat64Constant

func (f *Function) CreateFloat64Constant(typ *Type, constValue float64) *Value

func (*Function) CreateIntValue

func (f *Function) CreateIntValue(value int) *Value

func (*Function) CreateLongConstant

func (f *Function) CreateLongConstant(typ *Type, constValue int64) *Value

func (*Function) CreateNintConstant

func (f *Function) CreateNintConstant(typ *Type, constValue int) *Value

func (*Function) CreatePtrValue

func (f *Function) CreatePtrValue(ptr unsafe.Pointer) *Value

func (*Function) CreateValue

func (f *Function) CreateValue(typ *Type) *Value

func (*Function) Current

func (f *Function) Current() *Block

func (*Function) DefaultReturn

func (f *Function) DefaultReturn() int

func (*Function) Div

func (f *Function) Div(value1, value2 *Value) *Value

func (*Function) Dump

func (f *Function) Dump(name string, w io.Writer) error

func (*Function) DumpInstruction

func (f *Function) DumpInstruction(insn *Instruction, w io.Writer) error

func (*Function) DumpValue

func (f *Function) DumpValue(value *Value, prefix string, w io.Writer) error

func (*Function) Dup

func (f *Function) Dup(value *Value) *Value

func (*Function) Entry

func (f *Function) Entry() *Block

func (*Function) Eq

func (f *Function) Eq(value1, value2 *Value) *Value

func (*Function) Exp

func (f *Function) Exp(value1 *Value) *Value

func (*Function) Floor

func (f *Function) Floor(value1 *Value) *Value

func (*Function) FreeMeta

func (f *Function) FreeMeta(typ int)

func (*Function) Ge

func (f *Function) Ge(value1, value2 *Value) *Value

func (*Function) GoCall

func (f *Function) GoCall(fn interface{}, args []*Value) ([]*Value, error)

func (*Function) Gt

func (f *Function) Gt(value1, value2 *Value) *Value

func (*Function) IncomingReg

func (f *Function) IncomingReg(value *Value, reg int) int

func (*Function) IsCompiled

func (f *Function) IsCompiled() bool

func (*Function) IsDeadCurrentBlock

func (f *Function) IsDeadCurrentBlock() bool

func (*Function) IsFinite

func (f *Function) IsFinite(value1 *Value) *Value

func (*Function) IsInf

func (f *Function) IsInf(value1 *Value) *Value

func (*Function) IsNan

func (f *Function) IsNan(value1 *Value) *Value

func (*Function) IsRecompilable

func (f *Function) IsRecompilable() bool

func (*Function) JumpTable

func (f *Function) JumpTable(value *Value, labels Labels) bool

func (*Function) Label

func (f *Function) Label(label *Label) bool

func (*Function) LabelRight

func (f *Function) LabelRight(label *Label) bool

func (*Function) LabelsEqual

func (f *Function) LabelsEqual(label *Label, label2 *Label) bool

func (*Function) Le

func (f *Function) Le(value1, value2 *Value) *Value

func (*Function) Load

func (f *Function) Load(value *Value) *Value

func (*Function) LoadElem

func (f *Function) LoadElem(baseAddr *Value, index *Value, elemType *Type) *Value

func (*Function) LoadElemAddress

func (f *Function) LoadElemAddress(baseAddr *Value, index *Value, elemType *Type) *Value

func (*Function) LoadRelative

func (f *Function) LoadRelative(value *Value, offset int, typ *Type) *Value

func (*Function) Log

func (f *Function) Log(value1 *Value) *Value

func (*Function) Log10

func (f *Function) Log10(value1 *Value) *Value

func (*Function) Lt

func (f *Function) Lt(value1, value2 *Value) *Value

func (*Function) MarkBreakpoint

func (f *Function) MarkBreakpoint(data1, data2 int) int

func (*Function) MarkBreakpointVariable

func (f *Function) MarkBreakpointVariable(data1, data2 *Value) int

func (*Function) MarkOffset

func (f *Function) MarkOffset(offset int) int

func (*Function) Max

func (f *Function) Max(value1, value2 *Value) *Value

func (*Function) Memcpy

func (f *Function) Memcpy(dest, src, size *Value) int

func (*Function) Memmove

func (f *Function) Memmove(dest, src, size *Value) int

func (*Function) Memset

func (f *Function) Memset(dest, src, size *Value) int

func (*Function) Meta

func (f *Function) Meta(typ int) unsafe.Pointer

func (*Function) Min

func (f *Function) Min(value1, value2 *Value) *Value

func (*Function) MoveBlocksToEnd

func (f *Function) MoveBlocksToEnd(fromLabel *Label, toLabel *Label) int

func (*Function) MoveBlocksToStart

func (f *Function) MoveBlocksToStart(fromLabel *Label, toLabel *Label) int

func (*Function) Mul

func (f *Function) Mul(value1, value2 *Value) *Value

func (*Function) MulOvf

func (f *Function) MulOvf(value1, value2 *Value) *Value

func (*Function) Ne

func (f *Function) Ne(value1, value2 *Value) *Value

func (*Function) Neg

func (f *Function) Neg(value1 *Value) *Value

func (*Function) NestedParent

func (f *Function) NestedParent() *Function

func (*Function) NewBlock

func (f *Function) NewBlock(label *Label) bool

func (*Function) NextBlock

func (f *Function) NextBlock(next *Block) *Block

func (*Function) Nop

func (f *Function) Nop() bool

func (*Function) Not

func (f *Function) Not(value1 *Value) *Value

func (*Function) OptimizationLevel

func (f *Function) OptimizationLevel() uint

func (*Function) Optimize

func (f *Function) Optimize() bool

func (*Function) Or

func (f *Function) Or(value1, value2 *Value) *Value

func (*Function) Param

func (f *Function) Param(param uint) *Value

func (*Function) Pow

func (f *Function) Pow(value1, value2 *Value) *Value

func (*Function) PreviousBlock

func (f *Function) PreviousBlock(previous *Block) *Block

func (*Function) Rem

func (f *Function) Rem(value1, value2 *Value) *Value

func (*Function) RemIEEE

func (f *Function) RemIEEE(value1, value2 *Value) *Value

func (*Function) ReserveLabel

func (f *Function) ReserveLabel() *Label

func (*Function) Return

func (f *Function) Return(value *Value) int

func (*Function) ReturnPtr

func (f *Function) ReturnPtr(value *Value, typ *Type) int

func (*Function) Rint

func (f *Function) Rint(value1 *Value) *Value

func (*Function) Round

func (f *Function) Round(value1 *Value) *Value

func (*Function) SetOptimizationLevel

func (f *Function) SetOptimizationLevel(level uint)

func (*Function) SetParentFrame

func (f *Function) SetParentFrame(parentFrame *Value)

func (*Function) SetRecompilable

func (f *Function) SetRecompilable()

func (*Function) SetupEntry

func (f *Function) SetupEntry(entryPoint unsafe.Pointer)

func (*Function) Shl

func (f *Function) Shl(value1, value2 *Value) *Value

func (*Function) Shr

func (f *Function) Shr(value1, value2 *Value) *Value

func (*Function) Sign

func (f *Function) Sign(value1 *Value) *Value

func (*Function) Signature

func (f *Function) Signature() *Type

func (*Function) Sin

func (f *Function) Sin(value1 *Value) *Value

func (*Function) Sinh

func (f *Function) Sinh(value1 *Value) *Value

func (*Function) Sqrt

func (f *Function) Sqrt(value1 *Value) *Value

func (*Function) Sshr

func (f *Function) Sshr(value1, value2 *Value) *Value

func (*Function) Store

func (f *Function) Store(dest, value *Value) bool

func (*Function) StoreElem

func (f *Function) StoreElem(baseAddr, index, value *Value) bool

func (*Function) StoreRelative

func (f *Function) StoreRelative(dest *Value, offset int, value *Value) bool

func (*Function) StructPointer

func (f *Function) StructPointer() *Value

func (*Function) Sub

func (f *Function) Sub(value1, value2 *Value) *Value

func (*Function) SubOvf

func (f *Function) SubOvf(value1, value2 *Value) *Value

func (*Function) Tan

func (f *Function) Tan(value1 *Value) *Value

func (*Function) Tanh

func (f *Function) Tanh(value1 *Value) *Value

func (*Function) ToBool

func (f *Function) ToBool(value1 *Value) *Value

func (*Function) ToClosure

func (f *Function) ToClosure() unsafe.Pointer

func (*Function) ToNotBool

func (f *Function) ToNotBool(value1 *Value) *Value

func (*Function) ToVtablePointer

func (f *Function) ToVtablePointer() unsafe.Pointer

func (*Function) Trunc

func (f *Function) Trunc(value1 *Value) *Value

func (*Function) Ushr

func (f *Function) Ushr(value1, value2 *Value) *Value

func (*Function) ValueRef

func (f *Function) ValueRef(value *Value)

func (*Function) Xor

func (f *Function) Xor(value1, value2 *Value) *Value

type Instruction

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

func (*Instruction) Code

func (i *Instruction) Code() int

func (*Instruction) Dest

func (i *Instruction) Dest() *Value

func (*Instruction) DestIsValue

func (i *Instruction) DestIsValue() bool

func (*Instruction) Function

func (i *Instruction) Function() *Function

func (*Instruction) Label

func (i *Instruction) Label() *Label

func (*Instruction) Name

func (i *Instruction) Name() string

func (*Instruction) Native

func (i *Instruction) Native() unsafe.Pointer

func (*Instruction) Signature

func (i *Instruction) Signature() *Type

func (*Instruction) Value1

func (i *Instruction) Value1() *Value

func (*Instruction) Value2

func (i *Instruction) Value2() *Value

type Label

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

type Labels

type Labels []*Label

type Type

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

func CreateSignature

func CreateSignature(args Types, rtype *Type) *Type

func CreateStruct

func CreateStruct(fields Types, incref int) *Type

func CreateUnion

func CreateUnion(fields Types, incref int) *Type

func ReflectTypeToType

func ReflectTypeToType(typ reflect.Type) *Type

func (*Type) Alignment

func (t *Type) Alignment() uint

func (*Type) Copy

func (t *Type) Copy() *Type

func (*Type) CreatePointer

func (t *Type) CreatePointer(incref int) *Type

func (*Type) Dump

func (t *Type) Dump(w io.Writer) error

func (*Type) Field

func (t *Type) Field(index uint) *Type

func (*Type) FindName

func (t *Type) FindName(name string) uint

func (*Type) Free

func (t *Type) Free()

func (*Type) HasTag

func (t *Type) HasTag(kind int) bool

func (*Type) IsPointer

func (t *Type) IsPointer() bool

func (*Type) IsPrimitive

func (t *Type) IsPrimitive() bool

func (*Type) IsSignature

func (t *Type) IsSignature() bool

func (*Type) IsStruct

func (t *Type) IsStruct() bool

func (*Type) IsTagged

func (t *Type) IsTagged() bool

func (*Type) IsUnion

func (t *Type) IsUnion() bool

func (*Type) Kind

func (t *Type) Kind() int

func (*Type) Name

func (t *Type) Name(index uint) string

func (*Type) Normalize

func (t *Type) Normalize() *Type

func (*Type) NumFields

func (t *Type) NumFields() uint

func (*Type) NumParams

func (t *Type) NumParams() uint

func (*Type) Offset

func (t *Type) Offset(index uint) uint

func (*Type) Param

func (t *Type) Param(index uint) *Type

func (*Type) PromoteInt

func (t *Type) PromoteInt() *Type

func (*Type) Ref

func (t *Type) Ref() *Type

func (*Type) RemoveTags

func (t *Type) RemoveTags() *Type

func (*Type) Return

func (t *Type) Return() *Type

func (*Type) ReturnViaPointer

func (t *Type) ReturnViaPointer() int

func (*Type) SetOffset

func (t *Type) SetOffset(fieldIndex, offset uint)

func (*Type) SetSizeAndAlignment

func (t *Type) SetSizeAndAlignment(size, alignment int)

func (*Type) SetTaggedType

func (t *Type) SetTaggedType(underlying *Type, incref int)

func (*Type) Size

func (t *Type) Size() uint

func (*Type) TaggedData

func (t *Type) TaggedData() unsafe.Pointer

func (*Type) TaggedKind

func (t *Type) TaggedKind() int

func (*Type) TaggedType

func (t *Type) TaggedType() *Type

type Types

type Types []*Type

type Value

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

func (*Value) Block

func (v *Value) Block() *Block

func (*Value) Context

func (v *Value) Context() *Context

func (*Value) Float32

func (v *Value) Float32() float32

func (*Value) Float64

func (v *Value) Float64() float64

func (*Value) Function

func (v *Value) Function() *Function

func (*Value) Int

func (v *Value) Int() int

func (*Value) IsAddressable

func (v *Value) IsAddressable() bool

func (*Value) IsConstant

func (v *Value) IsConstant() bool

func (*Value) IsLocal

func (v *Value) IsLocal() bool

func (*Value) IsParameter

func (v *Value) IsParameter() bool

func (*Value) IsTemporary

func (v *Value) IsTemporary() bool

func (*Value) IsTrue

func (v *Value) IsTrue() bool

func (*Value) IsVolatile

func (v *Value) IsVolatile() bool

func (*Value) Long

func (v *Value) Long() int64

func (*Value) SetAddressable

func (v *Value) SetAddressable()

func (*Value) SetVolatile

func (v *Value) SetVolatile()

func (*Value) Type

func (v *Value) Type() *Type

type Values

type Values []*Value

Jump to

Keyboard shortcuts

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