Phasor 3.3.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
Phasor::VM Class Reference

Virtual Machine. More...

#include <VM.hpp>

Collaboration diagram for Phasor::VM:
[legend]

Classes

class  Halt
 Throws when the HALT opcode is reached. More...

Public Types

enum  Register : uint8_t {
  r0 , r1 , r2 , r3 ,
  r4 , r5 , r6 , r7 ,
  r8 , r9 , r10 , r11 ,
  r12 , r13 , r14 , r15 ,
  r16 , r17 , r18 , r19 ,
  r20 , r21 , r22 , r23 ,
  r24 , r25 , r26 , r27 ,
  r28 , r29 , r30 , r31 ,
  r0 , r1 , r2 , r3 ,
  r4 , r5 , r6 , r7 ,
  r8 , r9 , r10 , r11 ,
  r12 , r13 , r14 , r15 ,
  r16 , r17 , r18 , r19 ,
  r20 , r21 , r22 , r23 ,
  r24 , r25 , r26 , r27 ,
  r28 , r29 , r30 , r31
}
 Enum for registers. More...
enum  Register : uint8_t {
  r0 , r1 , r2 , r3 ,
  r4 , r5 , r6 , r7 ,
  r8 , r9 , r10 , r11 ,
  r12 , r13 , r14 , r15 ,
  r16 , r17 , r18 , r19 ,
  r20 , r21 , r22 , r23 ,
  r24 , r25 , r26 , r27 ,
  r28 , r29 , r30 , r31 ,
  r0 , r1 , r2 , r3 ,
  r4 , r5 , r6 , r7 ,
  r8 , r9 , r10 , r11 ,
  r12 , r13 , r14 , r15 ,
  r16 , r17 , r18 , r19 ,
  r20 , r21 , r22 , r23 ,
  r24 , r25 , r26 , r27 ,
  r28 , r29 , r30 , r31
}
 Enum for registers. More...
using NativeFunction = std::function<Value(const std::vector<Value> &args, VM *vm)>
 Native function signature.
using ImportHandler = std::function<void(const std::filesystem::path &path)>
using NativeFunction = std::function<Value(const std::vector<Value> &args, VM *vm)>
 Native function signature.
using ImportHandler = std::function<void(const std::filesystem::path &path)>

Public Member Functions

 VM ()
 VM (const Bytecode &bytecode)
 VM (const OpCode &op, const int &operand1=0, const int &operand2=0, const int &operand3=0)
 ~VM ()
void initFFI (const std::filesystem::path &path)
 Initialize the FFI plugins.
std::string getVersion ()
 Get Phasor VM version.
int run (const Bytecode &bytecode, const size_t startPC=0)
 Run the virtual machine Exits -1 on uncaught exception.
Value runFunction (const std::string &name, const Bytecode &bytecode)
 Run a function from bytecode on the virtual machine.
void registerNativeFunction (const std::string &name, NativeFunction fn)
 Register a native function.
void setImportHandler (const ImportHandler &handler)
 Set the import handler for importing modules.
void freeVariable (size_t index)
 Free a variable in the VM.
void freeVariableByName (const std::string &name)
 Free a variable by name in the VM.
size_t addVariable (const Value &value)
 Add a variable to the VM.
void setVariable (size_t index, const Value &value)
 Set a variable in the VM.
Value getVariable (size_t index)
 Get a variable from the VM.
size_t getVariableCount ()
 Get the number of variables in the VM.
void setRegister (uint8_t index, const Value &value)
 Set a register value.
void freeRegister (uint8_t index)
 Free a register (reset to null).
Value getRegister (uint8_t index)
 Get a register value.
size_t getRegisterCount ()
 Get the total number of registers.
Value operation (const OpCode &op, const int &operand1=0, const int &operand2=0, const int &operand3=0)
 Execute a single operation.
void push (const Value &value)
 Push a value onto the stack.
Value pop ()
 Pop a value from the stack.
Value peek ()
 Peek at the top value on the stack.
void cleanup ()
 Clean up the virtual machine.
void reset (const bool &resetStack=true, const bool &resetFunctions=true, const bool &resetVariables=true)
 Reset the virtual machine.
std::string getInformation ()
 Get VM information for debugging.
std::string getBytecodeInformation ()
 Get bytecode information for debugging.
void log (const Value &msg)
 Log a Value to stdout.
void logerr (const Value &msg)
 Log a Value to stderr.
void flush ()
 Flush stdout.
void flusherr ()
 Flush stderr.
void setStatus (int newStatus)
 Set VM exit code.
void resetStatus ()
int getStatus ()
template<typename... Args>
Value regRun (OpCode opcode, Args &&...args)
 Run an opcode with arguments pre-loaded into registers.
template<typename... Args>
Value stackRun (OpCode opcode, Args &&...args)
 Run an opcode with values pushed to the stack.
 VM ()
 VM (const Bytecode &bytecode)
 VM (const OpCode &op, const int &operand1=0, const int &operand2=0, const int &operand3=0)
 ~VM ()
void initFFI (const std::filesystem::path &path)
 Initialize the FFI plugins.
std::string getVersion ()
 Get Phasor VM version.
int run (const Bytecode &bytecode, const size_t startPC=0)
 Run the virtual machine Exits -1 on uncaught exception.
Value runFunction (const std::string &name, const Bytecode &bytecode)
 Run a function from bytecode on the virtual machine.
void registerNativeFunction (const std::string &name, NativeFunction fn)
 Register a native function.
void setImportHandler (const ImportHandler &handler)
 Set the import handler for importing modules.
void freeVariable (size_t index)
 Free a variable in the VM.
void freeVariableByName (const std::string &name)
 Free a variable by name in the VM.
size_t addVariable (const Value &value)
 Add a variable to the VM.
void setVariable (size_t index, const Value &value)
 Set a variable in the VM.
Value getVariable (size_t index)
 Get a variable from the VM.
size_t getVariableCount ()
 Get the number of variables in the VM.
void setRegister (uint8_t index, const Value &value)
 Set a register value.
void freeRegister (uint8_t index)
 Free a register (reset to null).
Value getRegister (uint8_t index)
 Get a register value.
size_t getRegisterCount ()
 Get the total number of registers.
Value operation (const OpCode &op, const int &operand1=0, const int &operand2=0, const int &operand3=0)
 Execute a single operation.
void push (const Value &value)
 Push a value onto the stack.
Value pop ()
 Pop a value from the stack.
Value peek ()
 Peek at the top value on the stack.
void cleanup ()
 Clean up the virtual machine.
void reset (const bool &resetStack=true, const bool &resetFunctions=true, const bool &resetVariables=true)
 Reset the virtual machine.
std::string getInformation ()
 Get VM information for debugging.
std::string getBytecodeInformation ()
 Get bytecode information for debugging.
void log (const Value &msg)
 Log a Value to stdout.
void logerr (const Value &msg)
 Log a Value to stderr.
void flush ()
 Flush stdout.
void flusherr ()
 Flush stderr.
void setStatus (int newStatus)
 Set VM exit code.
void resetStatus ()
int getStatus ()
template<typename... Args>
Value regRun (OpCode opcode, Args &&...args)
 Run an opcode with arguments pre-loaded into registers.
template<typename... Args>
Value stackRun (OpCode opcode, Args &&...args)
 Run an opcode with values pushed to the stack.

Private Member Functions

void setup (const Bytecode &bc, const size_t initialPC)
void evalLoop ()
void setup (const Bytecode &bc, const size_t initialPC)
void evalLoop ()

Private Attributes

bool isDirectCall = false
 is a direct call to a function
std::unique_ptr< FFIffi
 FFI.
int status = 0
 Exit code.
ImportHandler importHandler
 Import handler for loading modules.
std::array< Value, MAX_REGISTERSregisters
 Virtual registers for register-based operations (v2.0).
std::pmr::monotonic_buffer_resource stack_pool
 Stack.
std::pmr::vector< Valuestack
std::vector< int > callStack
 Call stack for function calls.
std::vector< Valuevariables
 Variable storage indexed by variable index, or simply: the managed heap.
const Bytecodem_bytecode {}
 Bytecode to execute.
size_t pc = 0
 Program counter.
std::map< std::string, NativeFunctionnativeFunctions
 Native function registry.

Detailed Description

Virtual Machine.

Definition at line 32 of file VM.hpp.

Member Typedef Documentation

◆ ImportHandler [1/2]

using Phasor::VM::ImportHandler = std::function<void(const std::filesystem::path &path)>

Definition at line 90 of file PhasorVM.hpp.

◆ ImportHandler [2/2]

using Phasor::VM::ImportHandler = std::function<void(const std::filesystem::path &path)>

Definition at line 70 of file VM.hpp.

◆ NativeFunction [1/2]

using Phasor::VM::NativeFunction = std::function<Value(const std::vector<Value> &args, VM *vm)>

Native function signature.

Definition at line 85 of file PhasorVM.hpp.

◆ NativeFunction [2/2]

using Phasor::VM::NativeFunction = std::function<Value(const std::vector<Value> &args, VM *vm)>

Native function signature.

Definition at line 65 of file VM.hpp.

Member Enumeration Documentation

◆ Register [1/2]

enum Phasor::VM::Register : uint8_t

Enum for registers.

Enumerator
r0 
r1 
r2 
r3 
r4 
r5 
r6 
r7 
r8 
r9 
r10 
r11 
r12 
r13 
r14 
r15 
r16 
r17 
r18 
r19 
r20 
r21 
r22 
r23 
r24 
r25 
r26 
r27 
r28 
r29 
r30 
r31 
r0 
r1 
r2 
r3 
r4 
r5 
r6 
r7 
r8 
r9 
r10 
r11 
r12 
r13 
r14 
r15 
r16 
r17 
r18 
r19 
r20 
r21 
r22 
r23 
r24 
r25 
r26 
r27 
r28 
r29 
r30 
r31 

Definition at line 135 of file PhasorVM.hpp.

◆ Register [2/2]

enum Phasor::VM::Register : uint8_t

Enum for registers.

Enumerator
r0 
r1 
r2 
r3 
r4 
r5 
r6 
r7 
r8 
r9 
r10 
r11 
r12 
r13 
r14 
r15 
r16 
r17 
r18 
r19 
r20 
r21 
r22 
r23 
r24 
r25 
r26 
r27 
r28 
r29 
r30 
r31 
r0 
r1 
r2 
r3 
r4 
r5 
r6 
r7 
r8 
r9 
r10 
r11 
r12 
r13 
r14 
r15 
r16 
r17 
r18 
r19 
r20 
r21 
r22 
r23 
r24 
r25 
r26 
r27 
r28 
r29 
r30 
r31 

Definition at line 115 of file VM.hpp.

Constructor & Destructor Documentation

◆ VM() [1/6]

Phasor::VM::VM ( )

Definition at line 8 of file VM.cpp.

Here is the call graph for this function:

◆ VM() [2/6]

Phasor::VM::VM ( const Bytecode & bytecode)

Definition at line 18 of file VM.cpp.

Here is the call graph for this function:

◆ VM() [3/6]

Phasor::VM::VM ( const OpCode & op,
const int & operand1 = 0,
const int & operand2 = 0,
const int & operand3 = 0 )

Definition at line 27 of file VM.cpp.

Here is the call graph for this function:

◆ ~VM() [1/2]

Phasor::VM::~VM ( )

Definition at line 37 of file VM.cpp.

Here is the call graph for this function:

◆ VM() [4/6]

Phasor::VM::VM ( )

◆ VM() [5/6]

Phasor::VM::VM ( const Bytecode & bytecode)

◆ VM() [6/6]

Phasor::VM::VM ( const OpCode & op,
const int & operand1 = 0,
const int & operand2 = 0,
const int & operand3 = 0 )

◆ ~VM() [2/2]

Phasor::VM::~VM ( )

Member Function Documentation

◆ addVariable() [1/2]

size_t Phasor::VM::addVariable ( const Value & value)

Add a variable to the VM.

Parameters
valueThe value to add
Returns
The index of the variable

◆ addVariable() [2/2]

size_t Phasor::VM::addVariable ( const Value & value)

Add a variable to the VM.

Parameters
valueThe value to add
Returns
The index of the variable

Definition at line 8 of file Variables.cpp.

Here is the call graph for this function:

◆ cleanup() [1/2]

void Phasor::VM::cleanup ( )

Clean up the virtual machine.

◆ cleanup() [2/2]

void Phasor::VM::cleanup ( )

Clean up the virtual machine.

Definition at line 162 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evalLoop() [1/2]

void Phasor::VM::evalLoop ( )
private

◆ evalLoop() [2/2]

void Phasor::VM::evalLoop ( )
private

Definition at line 73 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush() [1/2]

void Phasor::VM::flush ( )

Flush stdout.

◆ flush() [2/2]

void Phasor::VM::flush ( )

Flush stdout.

Definition at line 281 of file Utility.cpp.

Here is the caller graph for this function:

◆ flusherr() [1/2]

void Phasor::VM::flusherr ( )

Flush stderr.

◆ flusherr() [2/2]

void Phasor::VM::flusherr ( )

Flush stderr.

Definition at line 286 of file Utility.cpp.

Here is the caller graph for this function:

◆ freeRegister() [1/2]

void Phasor::VM::freeRegister ( uint8_t index)

Free a register (reset to null).

Parameters
indexRegister index to free

◆ freeRegister() [2/2]

void Phasor::VM::freeRegister ( uint8_t index)

Free a register (reset to null).

Parameters
indexRegister index to free

Definition at line 17 of file Register.cpp.

Here is the call graph for this function:

◆ freeVariable() [1/2]

void Phasor::VM::freeVariable ( size_t index)

Free a variable in the VM.

◆ freeVariable() [2/2]

void Phasor::VM::freeVariable ( size_t index)

Free a variable in the VM.

Definition at line 18 of file Variables.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeVariableByName() [1/2]

void Phasor::VM::freeVariableByName ( const std::string & name)

Free a variable by name in the VM.

◆ freeVariableByName() [2/2]

void Phasor::VM::freeVariableByName ( const std::string & name)

Free a variable by name in the VM.

Definition at line 30 of file Variables.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBytecodeInformation() [1/2]

std::string Phasor::VM::getBytecodeInformation ( )

Get bytecode information for debugging.

◆ getBytecodeInformation() [2/2]

std::string Phasor::VM::getBytecodeInformation ( )

Get bytecode information for debugging.

Definition at line 234 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInformation() [1/2]

std::string Phasor::VM::getInformation ( )

Get VM information for debugging.

◆ getInformation() [2/2]

std::string Phasor::VM::getInformation ( )

Get VM information for debugging.

Definition at line 207 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRegister() [1/2]

Value Phasor::VM::getRegister ( uint8_t index)

Get a register value.

Parameters
indexRegister index
Returns
Value in the register

◆ getRegister() [2/2]

Value Phasor::VM::getRegister ( uint8_t index)

Get a register value.

Parameters
indexRegister index
Returns
Value in the register

Definition at line 26 of file Register.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRegisterCount() [1/2]

size_t Phasor::VM::getRegisterCount ( )

Get the total number of registers.

Returns
Number of registers

◆ getRegisterCount() [2/2]

size_t Phasor::VM::getRegisterCount ( )

Get the total number of registers.

Returns
Number of registers

Definition at line 35 of file Register.cpp.

Here is the call graph for this function:

◆ getStatus() [1/2]

int Phasor::VM::getStatus ( )

◆ getStatus() [2/2]

int Phasor::VM::getStatus ( )

Definition at line 46 of file Utility.cpp.

◆ getVariable() [1/2]

Value Phasor::VM::getVariable ( size_t index)

Get a variable from the VM.

◆ getVariable() [2/2]

Value Phasor::VM::getVariable ( size_t index)

Get a variable from the VM.

Definition at line 58 of file Variables.cpp.

Here is the call graph for this function:

◆ getVariableCount() [1/2]

size_t Phasor::VM::getVariableCount ( )

Get the number of variables in the VM.

◆ getVariableCount() [2/2]

size_t Phasor::VM::getVariableCount ( )

Get the number of variables in the VM.

Definition at line 75 of file Variables.cpp.

Here is the call graph for this function:

◆ getVersion() [1/2]

std::string Phasor::VM::getVersion ( )

Get Phasor VM version.

◆ getVersion() [2/2]

std::string Phasor::VM::getVersion ( )

Get Phasor VM version.

Definition at line 34 of file Utility.cpp.

Here is the caller graph for this function:

◆ initFFI() [1/2]

void Phasor::VM::initFFI ( const std::filesystem::path & path)

Initialize the FFI plugins.

◆ initFFI() [2/2]

void Phasor::VM::initFFI ( const std::filesystem::path & path)

Initialize the FFI plugins.

Definition at line 51 of file Utility.cpp.

Here is the caller graph for this function:

◆ log() [1/2]

void Phasor::VM::log ( const Value & msg)

Log a Value to stdout.

◆ log() [2/2]

void Phasor::VM::log ( const Value & msg)

Log a Value to stdout.

Definition at line 269 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logerr() [1/2]

void Phasor::VM::logerr ( const Value & msg)

Log a Value to stderr.

◆ logerr() [2/2]

void Phasor::VM::logerr ( const Value & msg)

Log a Value to stderr.

Definition at line 275 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operation() [1/2]

Value Phasor::VM::operation ( const OpCode & op,
const int & operand1 = 0,
const int & operand2 = 0,
const int & operand3 = 0 )

Execute a single operation.

◆ operation() [2/2]

Value Phasor::VM::operation ( const OpCode & op,
const int & operand1 = 0,
const int & operand2 = 0,
const int & operand3 = 0 )

Execute a single operation.

Definition at line 8 of file Operations.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peek() [1/2]

Value Phasor::VM::peek ( )

Peek at the top value on the stack.

◆ peek() [2/2]

Value Phasor::VM::peek ( )

Peek at the top value on the stack.

Definition at line 38 of file Stack.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pop() [1/2]

Value Phasor::VM::pop ( )

Pop a value from the stack.

◆ pop() [2/2]

Value Phasor::VM::pop ( )

Pop a value from the stack.

Definition at line 17 of file Stack.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push() [1/2]

void Phasor::VM::push ( const Value & value)

Push a value onto the stack.

◆ push() [2/2]

void Phasor::VM::push ( const Value & value)

Push a value onto the stack.

Definition at line 8 of file Stack.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerNativeFunction() [1/2]

void Phasor::VM::registerNativeFunction ( const std::string & name,
NativeFunction fn )

Register a native function.

◆ registerNativeFunction() [2/2]

void Phasor::VM::registerNativeFunction ( const std::string & name,
NativeFunction fn )

Register a native function.

Definition at line 5 of file Native.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ regRun() [1/2]

template<typename... Args>
Value Phasor::VM::regRun ( OpCode opcode,
Args &&... args )
inline

Run an opcode with arguments pre-loaded into registers.

Template Parameters
ArgsArgument types
Parameters
opcodeOpcode to run
argsArguments to load into registers
Returns
Return value of the operation

Definition at line 228 of file PhasorVM.hpp.

Here is the call graph for this function:

◆ regRun() [2/2]

template<typename... Args>
Value Phasor::VM::regRun ( OpCode opcode,
Args &&... args )
inline

Run an opcode with arguments pre-loaded into registers.

Template Parameters
ArgsArgument types
Parameters
opcodeOpcode to run
argsArguments to load into registers
Returns
Return value of the operation

Definition at line 208 of file VM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset() [1/2]

void Phasor::VM::reset ( const bool & resetStack = true,
const bool & resetFunctions = true,
const bool & resetVariables = true )

Reset the virtual machine.

◆ reset() [2/2]

void Phasor::VM::reset ( const bool & resetStack = true,
const bool & resetFunctions = true,
const bool & resetVariables = true )

Reset the virtual machine.

Definition at line 181 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetStatus() [1/2]

void Phasor::VM::resetStatus ( )

◆ resetStatus() [2/2]

void Phasor::VM::resetStatus ( )

Definition at line 42 of file Utility.cpp.

Here is the caller graph for this function:

◆ run() [1/2]

int Phasor::VM::run ( const Bytecode & bytecode,
const size_t startPC = 0 )

Run the virtual machine Exits -1 on uncaught exception.

◆ run() [2/2]

int Phasor::VM::run ( const Bytecode & bytecode,
const size_t startPC = 0 )

Run the virtual machine Exits -1 on uncaught exception.

Definition at line 88 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runFunction() [1/2]

Value Phasor::VM::runFunction ( const std::string & name,
const Bytecode & bytecode )

Run a function from bytecode on the virtual machine.

◆ runFunction() [2/2]

Value Phasor::VM::runFunction ( const std::string & name,
const Bytecode & bytecode )

Run a function from bytecode on the virtual machine.

Definition at line 144 of file Utility.cpp.

Here is the call graph for this function:

◆ setImportHandler() [1/2]

void Phasor::VM::setImportHandler ( const ImportHandler & handler)

Set the import handler for importing modules.

◆ setImportHandler() [2/2]

void Phasor::VM::setImportHandler ( const ImportHandler & handler)

Set the import handler for importing modules.

Definition at line 153 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRegister() [1/2]

void Phasor::VM::setRegister ( uint8_t index,
const Value & value )

Set a register value.

Parameters
indexRegister index
valueValue to set

◆ setRegister() [2/2]

void Phasor::VM::setRegister ( uint8_t index,
const Value & value )

Set a register value.

Parameters
indexRegister index
valueValue to set

Definition at line 8 of file Register.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStatus() [1/2]

void Phasor::VM::setStatus ( int newStatus)

Set VM exit code.

◆ setStatus() [2/2]

void Phasor::VM::setStatus ( int newStatus)

Set VM exit code.

Definition at line 38 of file Utility.cpp.

Here is the caller graph for this function:

◆ setup() [1/2]

void Phasor::VM::setup ( const Bytecode & bc,
const size_t initialPC )
private

◆ setup() [2/2]

void Phasor::VM::setup ( const Bytecode & bc,
const size_t initialPC )
private

Definition at line 58 of file Utility.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVariable() [1/2]

void Phasor::VM::setVariable ( size_t index,
const Value & value )

Set a variable in the VM.

Parameters
indexThe index of the variable
valueThe value to set

◆ setVariable() [2/2]

void Phasor::VM::setVariable ( size_t index,
const Value & value )

Set a variable in the VM.

Parameters
indexThe index of the variable
valueThe value to set

Definition at line 45 of file Variables.cpp.

Here is the call graph for this function:

◆ stackRun() [1/2]

template<typename... Args>
Value Phasor::VM::stackRun ( OpCode opcode,
Args &&... args )
inline

Run an opcode with values pushed to the stack.

Template Parameters
ArgsArgument types
Parameters
opcodeOpcode to run
argsArguments to push to the stack
Returns
Value returned to stack

Definition at line 243 of file PhasorVM.hpp.

Here is the call graph for this function:

◆ stackRun() [2/2]

template<typename... Args>
Value Phasor::VM::stackRun ( OpCode opcode,
Args &&... args )
inline

Run an opcode with values pushed to the stack.

Template Parameters
ArgsArgument types
Parameters
opcodeOpcode to run
argsArguments to push to the stack
Returns
Value returned to stack

Definition at line 223 of file VM.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ callStack

std::vector< int > Phasor::VM::callStack
private

Call stack for function calls.

Definition at line 256 of file VM.hpp.

◆ ffi

std::unique_ptr< FFI > Phasor::VM::ffi
private

FFI.

Definition at line 240 of file VM.hpp.

◆ importHandler

ImportHandler Phasor::VM::importHandler
private

Import handler for loading modules.

Definition at line 246 of file VM.hpp.

◆ isDirectCall

bool Phasor::VM::isDirectCall = false
private

is a direct call to a function

Definition at line 236 of file VM.hpp.

◆ m_bytecode

const Bytecode * Phasor::VM::m_bytecode {}
private

Bytecode to execute.

Definition at line 262 of file VM.hpp.

◆ nativeFunctions

std::map< std::string, NativeFunction > Phasor::VM::nativeFunctions
private

Native function registry.

Definition at line 268 of file VM.hpp.

◆ pc

size_t Phasor::VM::pc = 0
private

Program counter.

Definition at line 265 of file VM.hpp.

◆ registers

std::array< Value, MAX_REGISTERS > Phasor::VM::registers
private

Virtual registers for register-based operations (v2.0).

Definition at line 249 of file VM.hpp.

◆ stack

std::pmr::vector< Value > Phasor::VM::stack
private

Definition at line 253 of file VM.hpp.

◆ stack_pool

std::pmr::monotonic_buffer_resource Phasor::VM::stack_pool
private

Stack.

Definition at line 252 of file VM.hpp.

◆ status

int Phasor::VM::status = 0
private

Exit code.

Definition at line 243 of file VM.hpp.

◆ variables

std::vector< Value > Phasor::VM::variables
private

Variable storage indexed by variable index, or simply: the managed heap.

Definition at line 259 of file VM.hpp.


The documentation for this class was generated from the following files: