Global VM state. More...
#include <vm.h>
Public Member Functions | |
void | krk_initVM (int flags) |
Initialize the VM at program startup. More... | |
void | krk_freeVM (void) |
Release resources from the VM. More... | |
Data Fields | |
int | globalFlags |
char * | binpath |
KrkTable | strings |
KrkTable | modules |
KrkInstance * | builtins |
KrkInstance * | system |
KrkValue * | specialMethodNames |
struct BaseClasses * | baseClasses |
struct Exceptions * | exceptions |
KrkObj * | objects |
size_t | bytesAllocated |
size_t | nextGC |
size_t | grayCount |
size_t | grayCapacity |
KrkObj ** | grayStack |
KrkThreadState * | threads |
struct DebuggerState * | dbgState |
Detailed Description
Global VM state.
This state is shared by all VM threads and stores the path to the VM binary, global execution flags, the string and module tables, tables of builtin types, and the state of the (shared) garbage collector.
Member Function Documentation
◆ krk_freeVM()
void krk_freeVM | ( | void | ) |
Release resources from the VM.
Generally, it is desirable to call this once before the hosting program exits. If a fresh VM state is needed, krk_freeVM should be called before a further call to krk_initVM is made. The resources released here can include allocated heap memory, FILE pointers or descriptors, or various other things which were initialized by C extension modules.
◆ krk_initVM()
void krk_initVM | ( | int | flags | ) |
Initialize the VM at program startup.
All library users must call this exactly once on startup to create the built-in types, modules, and functions for the VM and prepare the string and module tables. Optionally, callers may set vm.binpath
before calling krk_initVM to allow the VM to locate the interpreter binary and establish the default module paths.
- Parameters
-
flags Combination of global VM flags and initial thread flags.
Field Documentation
◆ baseClasses
struct BaseClasses* KrkVM::baseClasses |
◆ binpath
char* KrkVM::binpath |
◆ builtins
KrkInstance* KrkVM::builtins |
◆ bytesAllocated
◆ dbgState
struct DebuggerState* KrkVM::dbgState |
◆ exceptions
struct Exceptions* KrkVM::exceptions |
◆ globalFlags
◆ grayCapacity
size_t KrkVM::grayCapacity |
◆ grayCount
◆ grayStack
◆ modules
◆ nextGC
◆ objects
◆ specialMethodNames
KrkValue* KrkVM::specialMethodNames |
◆ strings
◆ system
KrkInstance* KrkVM::system |
◆ threads
KrkThreadState* KrkVM::threads |
The documentation for this struct was generated from the following file:
- src/kuroko/vm.h