ArkScript
A small, lisp-inspired, functional scripting language
VM.cpp File Reference
#include <Ark/VM/VM.hpp>
#include <utility>
#include <numeric>
#include <fmt/core.h>
#include <fmt/color.h>
#include <fmt/ranges.h>
#include <fmt/ostream.h>
#include <Ark/Utils/Files.hpp>
#include <Ark/Utils/Utils.hpp>
#include <Ark/Error/Diagnostics.hpp>
#include <Ark/TypeChecker.hpp>
#include <Ark/VM/ModuleMapping.hpp>
#include <Ark/VM/Value/Dict.hpp>
#include <Ark/VM/Helpers.hpp>
Include dependency graph for VM.cpp:

Go to the source code of this file.

Namespaces

namespace  Ark
 

Macros

#define WITH_TRY
 
#define TARGET(op)
 
#define DISPATCH_GOTO()
 
#define GOTO_HALT()
 
#define FETCH_NEXT_INSTRUCTION()
 
#define DISPATCH()
 
#define UNPACK_ARGS()
 

Macro Definition Documentation

◆ DISPATCH

#define DISPATCH ( )
Value:
DISPATCH_GOTO();
#define FETCH_NEXT_INSTRUCTION()

Referenced by Ark::VM::unsafeRun().

◆ DISPATCH_GOTO

#define DISPATCH_GOTO ( )
Value:
goto dispatch_opcode

◆ FETCH_NEXT_INSTRUCTION

#define FETCH_NEXT_INSTRUCTION ( )
Value:
do \
{ \
inst = m_state.inst(context.pp, context.ip); \
padding = m_state.inst(context.pp, context.ip + 1); \
arg = static_cast<uint16_t>((m_state.inst(context.pp, context.ip + 2) << 8) + \
m_state.inst(context.pp, context.ip + 3)); \
context.ip += 4; \
context.inst_exec_counter = (context.inst_exec_counter + 1) % VMOverflowBufferSize; \
if constexpr (WithDebugger) \
{ \
if (!m_debugger) initDebugger(context); \
m_debugger->registerInstruction(inst, padding, arg, context.ip - 4, context.pp); \
} \
if (context.inst_exec_counter < 2 && context.sp >= VMStackSize) \
stackOverflowError(context); \
} while (false)

◆ GOTO_HALT

#define GOTO_HALT ( )
Value:
break

Referenced by Ark::VM::unsafeRun().

◆ TARGET

#define TARGET ( op)
Value:
case op:

Referenced by Ark::VM::unsafeRun().

◆ UNPACK_ARGS

#define UNPACK_ARGS ( )
Value:
do \
{ \
secondary_arg = static_cast<uint16_t>((padding << 4) | (arg & 0xf000) >> 12); \
primary_arg = arg & 0x0fff; \
} while (false)

Referenced by Ark::VM::unsafeRun().

◆ WITH_TRY

#define WITH_TRY