executor

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Package executor provides an interface for executing compiled API programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCExtern added in v1.2.0

func RegisterCExtern(name string, e unsafe.Pointer)

RegisterCExtern registers the c extern e.

func RegisterGoExtern added in v1.2.0

func RegisterGoExtern(name string, e Extern)

RegisterGoExtern registers the golang extern e.

Types

type Encodable

type Encodable interface {
	Encode([]byte) bool
}

type Env

type Env struct {
	// Arena is the memory arena used by this execution environment.
	Arena arena.Arena

	// Executor is the parent executor.
	Executor *Executor
	// contains filtered or unexported fields
}

Env is the go execution environment.

func GetEnv

func GetEnv(c unsafe.Pointer) *Env

GetEnv returns the environment for the given context c.

func (*Env) Any added in v1.2.0

func (e *Env) Any(p unsafe.Pointer) interface{}

Any unpacks and returns the value held by the gapil_any at p.

func (*Env) CContext added in v1.2.0

func (e *Env) CContext() unsafe.Pointer

CContext returns the pointer to the c context.

func (*Env) Context added in v1.2.0

func (e *Env) Context() context.Context

Context returns the go context of the environment.

func (*Env) Dispose

func (e *Env) Dispose()

Dispose releases the memory used by the environment. Call after the env is no longer needed to avoid leaking memory.

func (*Env) Execute

func (e *Env) Execute(ctx context.Context, cmd api.Cmd, id api.CmdID) error

Execute executes the command cmd.

func (*Env) GetBytes

func (e *Env) GetBytes(rng memory.Range) []byte

GetBytes returns the bytes that are in the given memory range.

func (*Env) Globals

func (e *Env) Globals() []byte

Globals returns the memory of the global state.

func (*Env) Message added in v1.2.0

func (e *Env) Message(p unsafe.Pointer) *stringtable.Msg

Message unpacks the gapil_msg at p, returning a stringtable Msg.

type Executor

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

Executor is used to create execution environments for a compiled program. Use New() to create Executors, do not create directly.

func New

func New(prog *compiler.Program, optimize bool) *Executor

New returns a new and initialized Executor for the given program.

func (*Executor) FunctionAddress added in v1.2.0

func (e *Executor) FunctionAddress(name string) unsafe.Pointer

FunctionAddress returns the function address of the function with the given name or nil if the function was not found.

func (*Executor) NewEnv

func (e *Executor) NewEnv(ctx context.Context, capture *capture.GraphicsCapture) *Env

NewEnv creates a new execution environment for the given capture.

type Extern added in v1.2.0

type Extern func(e *Env, args, res unsafe.Pointer)

Jump to

Keyboard shortcuts

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