Coverage Report

Created: 2017-04-15 07:07

/home/travis/build/MoarVM/MoarVM/src/6model/reprs/CArray.h
Line
Count
Source (jump to first uncovered line)
1
/* Body of a CArray. */
2
struct MVMCArrayBody {
3
    /* The storage of C-land elements. */
4
    void *storage;
5
6
    /* The storage of Perl-land elements */
7
    MVMObject **child_objs;
8
9
    /* Are we managing the memory for this array ourselves, or does it come
10
     * from C? */
11
    MVMint32 managed;
12
13
    /* The number of elements we've allocated. If we do not know,
14
     * because the array was returned to us from elsewhere and we
15
     * are not managing it's memory, this is 0. */
16
    MVMint32 allocated;
17
18
    /* The number of elements we have, if known. Invalid if we
19
     * are not managing the array. */
20
    MVMint32 elems;
21
};
22
23
struct MVMCArray {
24
    MVMObject common;
25
    MVMCArrayBody body;
26
};
27
28
/* What kind of element do we have? */
29
0
#define MVM_CARRAY_ELEM_KIND_NUMERIC    1
30
0
#define MVM_CARRAY_ELEM_KIND_STRING     2
31
0
#define MVM_CARRAY_ELEM_KIND_CPOINTER   3
32
0
#define MVM_CARRAY_ELEM_KIND_CARRAY     4
33
0
#define MVM_CARRAY_ELEM_KIND_CSTRUCT    5
34
0
#define MVM_CARRAY_ELEM_KIND_CUNION     6
35
36
/* The CArray REPR data contains a little info about the type of array
37
 * that we have. */
38
struct MVMCArrayREPRData {
39
    /* The number of bytes in size that an element is. */
40
    MVMint32 elem_size;
41
42
    /* The type of an element. */
43
    MVMObject *elem_type;
44
45
    /* What kind of element is it (lets us quickly know how to handle access
46
     * to it). */
47
    MVMint32 elem_kind;
48
};
49
50
/* Initializes the CArray REPR. */
51
const MVMREPROps * MVMCArray_initialize(MVMThreadContext *tc);