memory

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	True    = NewAddr(TypeBool, 1)
	False   = NewAddr(TypeBool, 0)
	NoBytes = NewAddr(TypeBytes)
	Nil     = NewAddr(TypeNil)
)

Functions

This section is empty.

Types

type Addr

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

func NewAddr

func NewAddr(t Type, dat ...byte) Addr

func (Addr) Bool

func (a Addr) Bool() bool

func (Addr) Bytes

func (a Addr) Bytes() []byte

func (Addr) CopyBytes

func (a Addr) CopyBytes(src ...Addr)

func (Addr) CopyVector

func (a Addr) CopyVector(v []Addr)

func (Addr) EqualBytes

func (a Addr) EqualBytes(b Addr) bool

func (Addr) EqualType added in v1.1.0

func (a Addr) EqualType(b Addr) bool

func (Addr) Int64

func (a Addr) Int64() int64

func (Addr) Print added in v1.2.0

func (a Addr) Print(w io.Writer)

func (Addr) SetInt64 added in v1.2.0

func (a Addr) SetInt64(n int64)

func (Addr) SetVectorAt

func (a Addr) SetVectorAt(i int, v Addr)

func (Addr) Size

func (a Addr) Size() uint32

func (Addr) Type

func (a Addr) Type() Type

func (Addr) TypeOf added in v1.1.0

func (a Addr) TypeOf(t Type) bool

func (Addr) Vector

func (a Addr) Vector() []Addr

func (Addr) VectorAt

func (a Addr) VectorAt(i int) Addr

func (Addr) VectorLen

func (a Addr) VectorLen() int

type Memory

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

func New added in v1.1.0

func New(opts ...Opt) Memory

func (*Memory) Alloc added in v1.0.2

func (b *Memory) Alloc(in interface{}) (Addr, error)

func (*Memory) AllocBytes

func (b *Memory) AllocBytes(size uint32) Addr

func (*Memory) AllocBytesAddr

func (b *Memory) AllocBytesAddr(dat []byte) Addr

func (*Memory) AllocInt64

func (b *Memory) AllocInt64(v int64) Addr

func (*Memory) AllocVector

func (b *Memory) AllocVector(size uint32) Addr

func (*Memory) CopyVector

func (b *Memory) CopyVector(elems ...Addr) Addr

func (*Memory) Reset

func (b *Memory) Reset()

type Opt added in v1.1.0

type Opt func(*Memory)

func PreallocGrid added in v1.1.0

func PreallocGrid(size uint32) Opt

func PreallocHeap added in v1.1.0

func PreallocHeap(size uint32) Opt

type Type

type Type uint8

Type represents a data type.

const (
	TypeNil Type = iota
	TypeBytes
	TypeInt64
	TypeBool
	TypeVector
)

Memory types supported by the virtual machine.

func (Type) String

func (t Type) String() string

String returns a name of the type.

Jump to

Keyboard shortcuts

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