vm

package
v0.0.0-...-810c941 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFrames = 1024
View Source
const StackSize = 2048

Variables

View Source
var DevMode = os.Getenv("RGO_DEV") == "1"

Functions

func CallBlock

func CallBlock(args ...*object.EmeraldValue) *object.EmeraldValue

func CallBlockOne

func CallBlockOne(arg *object.EmeraldValue) *object.EmeraldValue

func CompactObjectLayoutsEnabled

func CompactObjectLayoutsEnabled() bool

Compact object layouts are a closed-world optimization owned by the object package. Keep the VM-side check in one place so child VMs can share the same allocation arena without duplicating the environment policy.

func SourceChillsStringLiterals

func SourceChillsStringLiterals(source string) bool

func SourceFreezesStringLiterals

func SourceFreezesStringLiterals(source string) bool

Types

type ActiveRescue

type ActiveRescue struct {
	BodyOffset        int
	RescueOffset      int
	StackTop          int
	EndOffset         int
	EnsureOffset      int
	EnsureEndOffset   int
	Frame             *Frame
	Exception         *object.EmeraldValue
	PreviousException *object.EmeraldValue
	RescueStackDepth  int
}

type CatchHandler

type CatchHandler struct {
	Label     *object.EmeraldValue
	EndOffset int
	Frame     *Frame
	StackTop  int
	VM        *VM
}

type Frame

type Frame struct {
	ID      int
	Fn      *object.Function
	Ip      int
	Bp      int
	Closure *object.Closure

	MethodName             string
	OriginalMethodName     string
	LabelName              string
	SuperStart             *object.Class
	SuperModule            *object.Module
	SuperAfterClass        bool
	Args                   []*object.EmeraldValue
	Block                  *object.EmeraldValue
	DefinedByDefineMethod  bool
	IsLambda               bool
	CapturedBindings       []*object.RBinding
	ClosureBindingSite     int
	ClosureBinding         *object.RBinding
	ClosureBindings        map[int]*object.RBinding
	CapturedLocalValues    []*object.EmeraldValue
	TraceSelf              *object.EmeraldValue
	TraceDefinedClass      *object.EmeraldValue
	TraceMethodID          string
	TraceCalleeID          string
	TraceParameters        *object.EmeraldValue
	BacktraceReceiver      *object.EmeraldValue
	BacktraceMethod        *object.Method
	BacktraceOwner         *object.Class
	InstructionException   *object.EmeraldValue
	InstructionSnapshotSet bool
	SendArgStorage         [4]*object.EmeraldValue

	BlockBreakAddr int
	WhileStart     int
	WhileEnd       int
	BlockBreak     bool
	BlockBreakVal  *object.EmeraldValue
	BlockNextVal   *object.EmeraldValue
	Returned       bool
	TraceLine      int64
	ExecutionLine  int64
	RetryRescue    *ActiveRescue
	// contains filtered or unexported fields
}

type PendingEnsure

type PendingEnsure struct {
	EnsureEndOffset   int
	Frame             *Frame
	Exception         *object.EmeraldValue
	PreviousException *object.EmeraldValue
	ReturnValue       *object.EmeraldValue
	IsReturn          bool
	IsBreak           bool
	IsNext            bool
	IsRedo            bool
	IsThrow           bool
	ThrowHandler      *CatchHandler
	BreakTarget       int
}

type RescueHandler

type RescueHandler struct {
	BodyOffset      int
	StackTop        int
	RescueOffset    int
	EnsureOffset    int
	EnsureEndOffset int
	EndOffset       int
	Frame           *Frame
}

type VM

type VM struct {
	// contains filtered or unexported fields
}
var CurrentVM *VM

func New

func New(bytecode *compiler.Bytecode) *VM

func (*VM) GetAllResults

func (vm *VM) GetAllResults() []*object.EmeraldValue

func (*VM) GetCurrentBlock

func (vm *VM) GetCurrentBlock() *object.EmeraldValue

func (*VM) LastPoppedStackElement

func (vm *VM) LastPoppedStackElement() *object.EmeraldValue

func (*VM) PreloadSource

func (vm *VM) PreloadSource(source, path string) *object.EmeraldValue

func (*VM) Run

func (vm *VM) Run() error

func (*VM) SetChillStringLiterals

func (vm *VM) SetChillStringLiterals(enabled bool)

func (*VM) SetFreezeStringLiterals

func (vm *VM) SetFreezeStringLiterals(enabled bool)

func (*VM) SetInstructionLimit

func (vm *VM) SetInstructionLimit(limit uint64)

SetInstructionLimit bounds the number of bytecode instructions executed by one Run call. A zero limit, the production default, means unlimited.

func (*VM) SetProgramName

func (vm *VM) SetProgramName(name string)

func (*VM) SetTopLevelConstant

func (vm *VM) SetTopLevelConstant(name string, value *object.EmeraldValue)

func (*VM) UnhandledException

func (vm *VM) UnhandledException() *object.EmeraldValue

Jump to

Keyboard shortcuts

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