ArkScript
A small, fast, functional and scripting language for video games
VM.cpp File Reference
#include <Ark/VM/VM.hpp>
#include <utility>
#include <numeric>
#include <limits>
#include <ranges>
#include <fmt/core.h>
#include <fmt/color.h>
#include <Ark/Files.hpp>
#include <Ark/Utils.hpp>
#include <Ark/TypeChecker.hpp>
#include <Ark/Compiler/Instructions.hpp>
Include dependency graph for VM.cpp:

Go to the source code of this file.

Classes

struct  mapping
 

Namespaces

namespace  Ark
 
namespace  Ark::helper
 

Macros

#define TARGET(op)
 
#define DISPATCH_GOTO()
 
#define GOTO_HALT()
 
#define NEXTOPARG()
 
#define DISPATCH()
 
#define UNPACK_ARGS()
 

Functions

Value Ark::helper::tail (Value *a)
 
Value Ark::helper::head (Value *a)
 

Macro Definition Documentation

◆ DISPATCH

#define DISPATCH ( )
Value:
NEXTOPARG(); \
DISPATCH_GOTO();
#define NEXTOPARG()

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

◆ DISPATCH_GOTO

#define DISPATCH_GOTO ( )
Value:
goto dispatch_opcode

◆ GOTO_HALT

#define GOTO_HALT ( )
Value:
break

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

◆ NEXTOPARG

#define NEXTOPARG ( )
Value:
do \
{ \
inst = m_state.m_pages[context.pp][context.ip]; \
padding = m_state.m_pages[context.pp][context.ip + 1]; \
arg = static_cast<uint16_t>((m_state.m_pages[context.pp][context.ip + 2] << 8) + \
m_state.m_pages[context.pp][context.ip + 3]); \
context.ip += 4; \
} while (false)

◆ TARGET

#define TARGET ( op)
Value:
case op:

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

◆ 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::safeRun().