vm

package
v0.0.0-...-61d83ea Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TSF_Last uint = 1 << iota
	TSF_Return
)
View Source
const (
	RSM_Scalar = iota
	RSM_Array
	RSM_Hash
	RSM_NumberOf
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassLoader

type ClassLoader struct {
	SeeAlso []*ClassLoader

	Modules sync.Map // map[string]*Module

	ModuleRefs sync.Map // map[string]values.Scalar

	Spi ClassLoaderSpi
}

func (*ClassLoader) GetModule

func (cl *ClassLoader) GetModule(name string) values.Scalar

type ClassLoaderSpi

type ClassLoaderSpi interface {
	LoadModule(cl *ClassLoader, name string) *Module
}

type InsOp

type InsOp func(ts *ThreadState, ip *int, ln int)

type Module

type Module struct {
	Parent     *ClassLoader
	Name       string
	Main       *Procedure
	Procedures sync.Map // map[string]*Procedure

	Scalars sync.Map // map[string]*values.Scalar
	Arrays  sync.Map // map[string]*values.AV
	Hashes  sync.Map // map[string]*values.HV
}

func FetchModule

func FetchModule(mod *values.ScModule) (*Module, bool)

func LoadModule

func LoadModule(mod *values.ScModule, ts *ThreadState) (*Module, bool)

This function may panic!

func (*Module) InstallInLoader

func (m *Module) InstallInLoader() *Module

type Procedure

type Procedure struct {
	Parent *Module
	Mets   RSMetrics
	Instrs []InsOp
}

func (*Procedure) Exec

func (p *Procedure) Exec(ts *ThreadState)

func (*Procedure) GetCl

func (p *Procedure) GetCl() *ClassLoader

type RSMetrics

type RSMetrics [RSM_NumberOf]int

func (RSMetrics) Alloc

func (rsm RSMetrics) Alloc() *RegisterSet

type RegisterSet

type RegisterSet struct {
	SRegs []values.Scalar
	ARegs []values.AV
	HRegs []values.HV

	Proc *Procedure
}

func (*RegisterSet) Set

func (rs *RegisterSet) Set(ts *ThreadState) (old *RegisterSet)

func (*RegisterSet) SetDispose

func (rs *RegisterSet) SetDispose(ts *ThreadState)

func (*RegisterSet) Sproc

func (rs *RegisterSet) Sproc(p *Procedure) *RegisterSet

type ThreadState

type ThreadState struct {
	RS *RegisterSet

	Args values.AV // @_

	Flags uint
}

This structure contains everything that is supposed to be global and thread-local.

func NewThreadState

func NewThreadState() (ts *ThreadState)

func (*ThreadState) GoExec

func (ts *ThreadState) GoExec(p *Procedure)

func (*ThreadState) RunSlice

func (ts *ThreadState) RunSlice(slice []InsOp)

func (*ThreadState) SafeExec

func (ts *ThreadState) SafeExec(p *Procedure)

Jump to

Keyboard shortcuts

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