qruntime

package
v0.0.0-...-5e90b7b Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MaxNativeFuncArgs = 6
View Source
const SizeofSlot = unsafe.Sizeof(Slot{})

Variables

This section is empty.

Functions

func InitEnv

func InitEnv(env *Env)

func InitEvalEnv

func InitEvalEnv(env *Env, ee *EvalEnv, stackSize int)

Types

type DebugInfo

type DebugInfo struct {
	Funcs map[*Func]FuncDebugInfo
}

func NewDebugInfo

func NewDebugInfo() *DebugInfo

type Env

type Env struct {
	NativeFuncs        []NativeFunc
	NameToNativeFuncID map[FuncKey]uint16

	UserFuncs    []*Func
	NameToFuncID map[FuncKey]uint16

	// debug contains all information that is only needed
	// for better debugging and compiled code introspection.
	// Right now it's always enabled, but we may allow stripping it later.
	Debug *DebugInfo
}

Env is used to hold both compilation and evaluation data.

func (*Env) AddFunc

func (env *Env) AddFunc(pkgPath, funcName string, f *Func)

func (*Env) AddNativeFunc

func (env *Env) AddNativeFunc(pkgPath, funcName string, f func(NativeCallContext))

func (*Env) AddNativeMethod

func (env *Env) AddNativeMethod(typeName, methodName string, f func(NativeCallContext))

func (*Env) GetFunc

func (env *Env) GetFunc(pkgPath, funcName string) *Func

type EvalEnv

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

EvalEnv is a goroutine-local handle for Env. To get one, use Env.GetEvalEnv() method.

func (*EvalEnv) BindArgs

func (env *EvalEnv) BindArgs(args ...interface{})

type Func

type Func struct {
	StrConstants    []string
	ScalarConstants []uint64

	Codeptr *byte
	Code    []byte

	FrameSize  int
	FrameSlots byte
	NumParams  byte
	NumTemps   byte

	CanInline bool

	Name string
}

type FuncDebugInfo

type FuncDebugInfo struct {
	SlotNames []string
}

type FuncKey

type FuncKey struct {
	Qualifier string
	Name      string
}

func (FuncKey) String

func (k FuncKey) String() string

type NativeCallContext

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

func (NativeCallContext) BoolArg

func (ncc NativeCallContext) BoolArg(index int) bool

func (NativeCallContext) ByteArg

func (ncc NativeCallContext) ByteArg(index int) byte

func (NativeCallContext) ByteSliceArg

func (ncc NativeCallContext) ByteSliceArg(index int) []byte

func (NativeCallContext) FloatArg

func (ncc NativeCallContext) FloatArg(index int) float64

func (NativeCallContext) IntArg

func (ncc NativeCallContext) IntArg(index int) int

func (NativeCallContext) InterfaceArg

func (ncc NativeCallContext) InterfaceArg(index int) interface{}

func (NativeCallContext) SetBoolResult

func (ncc NativeCallContext) SetBoolResult(v bool)

func (NativeCallContext) SetBoolResult2

func (ncc NativeCallContext) SetBoolResult2(v bool)

func (NativeCallContext) SetByteSliceResult

func (ncc NativeCallContext) SetByteSliceResult(v []byte)

func (NativeCallContext) SetByteSliceResult2

func (ncc NativeCallContext) SetByteSliceResult2(v []byte)

func (NativeCallContext) SetFloatResult

func (ncc NativeCallContext) SetFloatResult(v float64)

func (NativeCallContext) SetFloatResult2

func (ncc NativeCallContext) SetFloatResult2(v float64)

func (NativeCallContext) SetIntResult

func (ncc NativeCallContext) SetIntResult(v int)

func (NativeCallContext) SetIntResult2

func (ncc NativeCallContext) SetIntResult2(v int)

func (NativeCallContext) SetInterfaceResult

func (ncc NativeCallContext) SetInterfaceResult(v interface{})

func (NativeCallContext) SetInterfaceResult2

func (ncc NativeCallContext) SetInterfaceResult2(v interface{})

func (NativeCallContext) SetStringResult

func (ncc NativeCallContext) SetStringResult(v string)

func (NativeCallContext) SetStringResult2

func (ncc NativeCallContext) SetStringResult2(v string)

func (NativeCallContext) StringArg

func (ncc NativeCallContext) StringArg(index int) string

func (NativeCallContext) VariadicArg

func (ncc NativeCallContext) VariadicArg() []interface{}

type NativeFunc

type NativeFunc struct {
	Name string // Needed for the readable disasm
	// contains filtered or unexported fields
}

type Slot

type Slot struct {
	// TODO: make fields unexported, adjust the user code as needed.
	Ptr     unsafe.Pointer
	Scalar  uint64
	Scalar2 uint64
}

func Call

func Call(env *EvalEnv, fn *Func) Slot

func (Slot) Bool

func (slot Slot) Bool() bool

func (Slot) Byte

func (slot Slot) Byte() byte

func (Slot) ByteSlice

func (slot Slot) ByteSlice() []byte

func (Slot) Float

func (slot Slot) Float() float64

func (Slot) Int

func (slot Slot) Int() int

func (Slot) Interface

func (slot Slot) Interface() interface{}

func (Slot) IsNil

func (slot Slot) IsNil() bool

func (Slot) IsNilInterface

func (slot Slot) IsNilInterface() bool

func (*Slot) MoveInterface

func (slot *Slot) MoveInterface(src *Slot)

func (*Slot) SetBool

func (slot *Slot) SetBool(v bool)

func (*Slot) SetByte

func (slot *Slot) SetByte(v byte)

func (*Slot) SetByteSlice

func (slot *Slot) SetByteSlice(v []byte)

func (*Slot) SetFloat

func (slot *Slot) SetFloat(v float64)

func (*Slot) SetInt

func (slot *Slot) SetInt(v int)

func (*Slot) SetInterface

func (slot *Slot) SetInterface(v interface{})

func (*Slot) SetString

func (slot *Slot) SetString(v string)

func (Slot) String

func (slot Slot) String() string

Jump to

Keyboard shortcuts

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