Coverage Report

Created: 2018-07-03 15:31

/home/travis/build/MoarVM/MoarVM/src/6model/reprs/MVMIter.h
Line
Count
Source
1
/* Representation used by VM-level iterators. */
2
3
2.04M
#define MVM_ITER_MODE_ARRAY         0
4
735k
#define MVM_ITER_MODE_ARRAY_INT     1
5
735k
#define MVM_ITER_MODE_ARRAY_NUM     2
6
735k
#define MVM_ITER_MODE_ARRAY_STR     3
7
3.84M
#define MVM_ITER_MODE_HASH          4
8
9
struct MVMIterBody {
10
    /* whether hash or array */
11
    MVMuint32 mode;
12
13
    /* array or hash being iterated */
14
    MVMObject *target;
15
16
    /* next hash item to give or next array index */
17
    union {
18
        struct {
19
            MVMHashEntry *curr, *next;
20
            unsigned      bucket_state;
21
        } hash_state;
22
        struct {
23
            MVMint64 index;
24
            MVMint64 limit;
25
        } array_state;
26
    };
27
};
28
struct MVMIter {
29
    MVMObject common;
30
    MVMIterBody body;
31
};
32
33
/* Function for REPR setup. */
34
const MVMREPROps * MVMIter_initialize(MVMThreadContext *tc);
35
36
MVMObject * MVM_iter(MVMThreadContext *tc, MVMObject *target);
37
MVMint64 MVM_iter_istrue(MVMThreadContext *tc, MVMIter *iter);
38
MVMString * MVM_iterkey_s(MVMThreadContext *tc, MVMIter *iterator);
39
MVMObject * MVM_iterval(MVMThreadContext *tc, MVMIter *iterator);