• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ArkScript-lang / Ark / 24364030705

13 Apr 2026 08:00PM UTC coverage: 94.045% (+0.1%) from 93.946%
24364030705

push

github

SuperFola
chore(optimisation): place ARK_ALWAYS_INLINE more carefully in the VM and ScopeView

31 of 31 new or added lines in 2 files covered. (100.0%)

2 existing lines in 1 file now uncovered.

9870 of 10495 relevant lines covered (94.04%)

659551.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.1
/src/arkreactor/VM/ScopeView.cpp
1
#include <Ark/VM/ScopeView.hpp>
2

3
#include <cassert>
4

5
namespace Ark::internal
6
{
7
    void ScopeView::insertFront(const std::vector<pair_t>& values) noexcept
1✔
8
    {
1✔
9
        const std::size_t offset_by = values.size();
1✔
10
        // If there is one day a bug with bad references, this can be caused by this code,
11
        // called when inserting plugins variables in a scope (because we invalidate said
12
        // references by moving them to another slot inside m_storage).
13
        for (std::size_t i = 0; i < m_size; ++i)
2✔
14
        {
15
            // This is a weak attempt to prevent / notice the bug before it goes in production,
16
            // if you hit this assertion read the comments carefully!
17
            assert(m_storage[m_start + m_size - i - 1].second.valueType() != ValueType::Reference && "References can not be moved around!");
1✔
18
            m_storage[m_start + m_size - i + offset_by - 1] = m_storage[m_start + m_size - i - 1];
1✔
19
        }
1✔
20

21
        std::size_t i = 0;
1✔
22
        for (const pair_t& pair : values)
2✔
23
        {
24
            const uint16_t id = pair.first;
1✔
25
            if (id < m_min_id)
1✔
26
                m_min_id = id;
×
27
            if (id > m_max_id)
1✔
28
                m_max_id = id;
1✔
29

30
            m_storage[m_start + i] = pair;
1✔
31
            ++i;
1✔
32
        }
1✔
33

34
        m_size += offset_by;
1✔
35
    }
1✔
36

37
    uint16_t ScopeView::idFromValue(const Value& val) const noexcept
2,096,142✔
38
    {
2,096,142✔
39
        for (std::size_t i = m_start; i < m_start + m_size; ++i)
4,192,281✔
40
        {
41
            const auto& [id, value] = m_storage[i];
2,098,187✔
42
            if (value == val)
2,096,139✔
43
                return id;
2,048✔
44
        }
2,096,139✔
45
        return MaxValue16Bits;
2,094,094✔
46
    }
2,096,142✔
47

UNCOV
48
    bool operator==(const ScopeView& A, const ScopeView& B) noexcept
×
UNCOV
49
    {
×
50
        // if we have two scopes with the same number of elements and starting at the same position,
51
        // they must be identical, as we have a single storage for all scopes
52
        return A.m_size == B.m_size && A.m_start == B.m_start;
×
53
    }
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc