ArkScript
A small, lisp-inspired, functional scripting language
Ark::internal::ExecutionContext Struct Reference

#include <ExecutionContext.hpp>

Collaboration diagram for Ark::internal::ExecutionContext:
[legend]

Public Member Functions

 ExecutionContext () noexcept
 
bool isFree () const
 
void setActive (const bool toggle)
 

Public Attributes

std::size_t ip {}
 Instruction pointer.
 
std::size_t pp {}
 Page pointer.
 
uint16_t sp {}
 Stack pointer.
 
uint16_t fc {}
 Frame count.
 
uint16_t last_symbol
 
const bool primary
 Tells if the current ExecutionContext is the primary one or not.
 
uint16_t inst_exec_counter {}
 
std::atomic_bool active
 
std::optional< ClosureScopesaved_scope {}
 Scope created by CAPTURE <x> instructions, used by the MAKE_CLOSURE instruction.
 
std::optional< uint16_t > capture_rename_id {}
 
std::vector< std::shared_ptr< ClosureScope > > stacked_closure_scopes {}
 Stack the closure scopes to keep the closure alive as long as we are calling them.
 
std::vector< ScopeViewlocals {}
 
std::array< ScopeView::pair_t, ScopeStackSizescopes_storage {}
 All the ScopeView use this array to store id->value.
 
std::array< Value, VMStackSizeWithOverflowBufferstack {}
 

Static Public Attributes

static unsigned Count = 0
 

Detailed Description

Definition at line 26 of file ExecutionContext.hpp.

Constructor & Destructor Documentation

◆ ExecutionContext()

Ark::internal::ExecutionContext::ExecutionContext ( )
inlinenoexcept

Definition at line 48 of file ExecutionContext.hpp.

References active, and Count.

Member Function Documentation

◆ isFree()

bool Ark::internal::ExecutionContext::isFree ( ) const
inlinenodiscard

Definition at line 56 of file ExecutionContext.hpp.

References active.

◆ setActive()

void Ark::internal::ExecutionContext::setActive ( const bool toggle)
inline

Definition at line 61 of file ExecutionContext.hpp.

References active.

Referenced by Ark::VM::createAndGetContext(), and Ark::VM::deleteContext().

Member Data Documentation

◆ active

std::atomic_bool Ark::internal::ExecutionContext::active

Definition at line 37 of file ExecutionContext.hpp.

Referenced by ExecutionContext(), isFree(), and setActive().

◆ capture_rename_id

std::optional<uint16_t> Ark::internal::ExecutionContext::capture_rename_id {}

Definition at line 40 of file ExecutionContext.hpp.

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

◆ Count

unsigned Ark::internal::ExecutionContext::Count = 0
inlinestatic

Definition at line 28 of file ExecutionContext.hpp.

Referenced by ExecutionContext().

◆ fc

uint16_t Ark::internal::ExecutionContext::fc {}

Frame count.

Definition at line 33 of file ExecutionContext.hpp.

Referenced by Ark::VM::backtrace(), Ark::VM::createAndGetContext(), Ark::VM::init(), and Ark::VM::safeRun().

◆ inst_exec_counter

uint16_t Ark::internal::ExecutionContext::inst_exec_counter {}

Definition at line 36 of file ExecutionContext.hpp.

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

◆ ip

std::size_t Ark::internal::ExecutionContext::ip {}

Instruction pointer.

Definition at line 30 of file ExecutionContext.hpp.

Referenced by Ark::VM::backtrace(), Ark::VM::getField(), Ark::VM::safeRun(), and Ark::VM::throwArityError().

◆ last_symbol

uint16_t Ark::internal::ExecutionContext::last_symbol

◆ locals

std::vector<ScopeView> Ark::internal::ExecutionContext::locals {}

◆ pp

std::size_t Ark::internal::ExecutionContext::pp {}

Page pointer.

Definition at line 31 of file ExecutionContext.hpp.

Referenced by Ark::VM::backtrace(), Ark::VM::getField(), Ark::VM::safeRun(), and Ark::VM::throwArityError().

◆ primary

const bool Ark::internal::ExecutionContext::primary

Tells if the current ExecutionContext is the primary one or not.

Definition at line 35 of file ExecutionContext.hpp.

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

◆ saved_scope

std::optional<ClosureScope> Ark::internal::ExecutionContext::saved_scope {}

Scope created by CAPTURE <x> instructions, used by the MAKE_CLOSURE instruction.

Definition at line 39 of file ExecutionContext.hpp.

Referenced by Ark::VM::createAndGetContext(), Ark::VM::init(), and Ark::VM::safeRun().

◆ scopes_storage

std::array<ScopeView::pair_t, ScopeStackSize> Ark::internal::ExecutionContext::scopes_storage {}

All the ScopeView use this array to store id->value.

Definition at line 44 of file ExecutionContext.hpp.

Referenced by Ark::VM::createAndGetContext(), Ark::VM::init(), and Ark::VM::safeRun().

◆ sp

uint16_t Ark::internal::ExecutionContext::sp {}

◆ stack

std::array<Value, VMStackSizeWithOverflowBuffer> Ark::internal::ExecutionContext::stack {}

Definition at line 46 of file ExecutionContext.hpp.

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

◆ stacked_closure_scopes

std::vector<std::shared_ptr<ClosureScope> > Ark::internal::ExecutionContext::stacked_closure_scopes {}

Stack the closure scopes to keep the closure alive as long as we are calling them.

Definition at line 41 of file ExecutionContext.hpp.

Referenced by Ark::VM::createAndGetContext(), and Ark::VM::init().


The documentation for this struct was generated from the following file: