runtime

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	IP     int
	Vars   map[string]value.Value // Local scope
	Fn     *value.Lambda          // Hàm đang được thực thi
	Defers []*value.Lambda        // Deferred functions
}

Frame đại diện cho một khung thực thi (Activation Record)

type Runtime

type Runtime struct {
	Bytecode  []byte
	Constants []value.Value
	Stack     []value.Value
	Vars      map[string]value.Value // Biến của từng Request (Cho phép ghi)
	Globals   map[string]value.Value // Chung cho toàn bộ Host (Chỉ đọc)
	Builtins  []value.Value          // Mảng các hàm hệ thống (Siêu nhanh - Index lookup)
	Frames    []Frame                // Call Stack
	FrameIdx  int                    // Hiện tại đang ở Frame nào
	Energy    uint64                 // Năng lượng tiêu thụ
	Spawner   func(s *value.Lambda)
}

func New

func New(code []byte, constants []value.Value) *Runtime

func (*Runtime) Defer

func (vm *Runtime) Defer(fn *value.Lambda)

func (*Runtime) ExecuteLambda

func (vm *Runtime) ExecuteLambda(s *value.Lambda, args []value.Value) value.Value

func (*Runtime) FastReset

func (vm *Runtime) FastReset(code []byte, constants []value.Value, globals map[string]value.Value)

func (*Runtime) Run

func (vm *Runtime) Run() value.Value

func (*Runtime) Stop added in v0.1.1

func (vm *Runtime) Stop()

Jump to

Keyboard shortcuts

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