![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
A class to handle the VM scope more efficiently. More...
#include <ScopeView.hpp>
Public Types | |
| using | pair_t = std::pair<uint16_t, Value> |
Public Member Functions | |
| ScopeView ()=delete | |
| Deleted constructor to avoid creating ScopeViews pointing to nothing. Helps catch bugs at compile time. | |
| ARK_ALWAYS_INLINE | ScopeView (pair_t *storage, const std::size_t start) noexcept |
| Create a new ScopeView. | |
| ARK_ALWAYS_INLINE void | pushBack (uint16_t id, Value &&val) noexcept |
| Put a value in the scope. | |
| ARK_ALWAYS_INLINE void | pushBack (uint16_t id, const Value &val) noexcept |
| Put a value in the scope. | |
| void | insertFront (const std::vector< pair_t > &values) noexcept |
| Insert one or more pairs at the beginning of the scope. | |
| ARK_ALWAYS_INLINE bool | maybeHas (const uint16_t id) const noexcept |
| Check if the scope maybe holds a specific symbol in memory. | |
| ARK_ALWAYS_INLINE Value * | operator[] (const uint16_t id_to_look_for) noexcept |
| Get a value from its symbol id. | |
| ARK_ALWAYS_INLINE const Value * | operator[] (const uint16_t id_to_look_for) const noexcept |
| Get a value from its symbol id. | |
| uint16_t | idFromValue (const Value &val) const noexcept |
| Get the id of a variable based on its value ; used for debug only. | |
| ARK_ALWAYS_INLINE const pair_t & | atPos (const std::size_t i) const noexcept |
| Return the element at index in scope. | |
| ARK_ALWAYS_INLINE pair_t & | atPosReverse (const std::size_t i) const noexcept |
| Return the element at index, starting from the end. | |
| ARK_ALWAYS_INLINE void | reset () noexcept |
| Reset size, min and max id for the scope, to signify it's empty. | |
| ARK_ALWAYS_INLINE std::size_t | size () const noexcept |
| Return the size of the scope. | |
| ARK_ALWAYS_INLINE std::size_t | storageEnd () const noexcept |
| Compute the position of the first free slot in the shared storage, after this scope. | |
Private Attributes | |
| pair_t * | m_storage |
| std::size_t | m_start |
| std::size_t | m_size |
| uint16_t | m_min_id |
| Minimum stored ID, used for a basic bloom filter. | |
| uint16_t | m_max_id |
| Maximum stored ID, used for a basic bloom filter. | |
Friends | |
| class | Ark::VM |
| ARK_API bool | operator== (const ScopeView &A, const ScopeView &B) |
A class to handle the VM scope more efficiently.
Definition at line 26 of file ScopeView.hpp.
| using Ark::internal::ScopeView::pair_t = std::pair<uint16_t, Value> |
Definition at line 29 of file ScopeView.hpp.
|
delete |
Deleted constructor to avoid creating ScopeViews pointing to nothing. Helps catch bugs at compile time.
|
inlinenoexcept |
Create a new ScopeView.
| storage | pointer to the shared scope storage |
| start | first free starting position |
Definition at line 42 of file ScopeView.hpp.
|
inlinenodiscardnoexcept |
Return the element at index in scope.
Definition at line 153 of file ScopeView.hpp.
Referenced by Ark::VM::backtrace().
|
inlinenodiscardnoexcept |
Return the element at index, starting from the end.
Definition at line 163 of file ScopeView.hpp.
Referenced by Ark::internal::Debugger::showLocals().
|
nodiscardnoexcept |
Get the id of a variable based on its value ; used for debug only.
| val |
Definition at line 37 of file ScopeView.cpp.
References Ark::MaxValue16Bits.
|
noexcept |
Insert one or more pairs at the beginning of the scope.
This can ONLY be called on the last known scope, otherwise it will override the data of the next scope!
| values |
Definition at line 7 of file ScopeView.cpp.
References Ark::Reference.
|
inlinenodiscardnoexcept |
Check if the scope maybe holds a specific symbol in memory.
| id | The id of the symbol |
Definition at line 95 of file ScopeView.hpp.
|
inlinenodiscardnoexcept |
Get a value from its symbol id.
| id_to_look_for |
Definition at line 126 of file ScopeView.hpp.
|
inlinenodiscardnoexcept |
Get a value from its symbol id.
| id_to_look_for |
Definition at line 106 of file ScopeView.hpp.
|
inlinenoexcept |
Put a value in the scope.
| id | The symbol id of the variable |
| val | The value linked to the symbol |
Definition at line 69 of file ScopeView.hpp.
|
inlinenoexcept |
Put a value in the scope.
| id | The symbol id of the variable |
| val | The value linked to the symbol |
Definition at line 52 of file ScopeView.hpp.
Referenced by Ark::internal::ClosureScope::mergeRefInto().
|
inlinenoexcept |
Reset size, min and max id for the scope, to signify it's empty.
Definition at line 171 of file ScopeView.hpp.
References Ark::MaxValue16Bits.
|
inlinenodiscardnoexcept |
Return the size of the scope.
Definition at line 183 of file ScopeView.hpp.
Referenced by Ark::VM::backtrace(), and Ark::internal::Debugger::showLocals().
|
inlinenodiscardnoexcept |
Compute the position of the first free slot in the shared storage, after this scope.
Definition at line 193 of file ScopeView.hpp.
|
friend |
Definition at line 200 of file ScopeView.hpp.
Definition at line 48 of file ScopeView.cpp.
|
private |
Maximum stored ID, used for a basic bloom filter.
Definition at line 207 of file ScopeView.hpp.
|
private |
Minimum stored ID, used for a basic bloom filter.
Definition at line 206 of file ScopeView.hpp.
|
private |
Definition at line 205 of file ScopeView.hpp.
|
private |
Definition at line 204 of file ScopeView.hpp.
|
private |
Definition at line 203 of file ScopeView.hpp.