/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 | 0 | #define MVM_CARRAY_ELEM_KIND_CPPSTRUCT 7 |
36 | | |
37 | | /* The CArray REPR data contains a little info about the type of array |
38 | | * that we have. */ |
39 | | struct MVMCArrayREPRData { |
40 | | /* The number of bytes in size that an element is. */ |
41 | | MVMint32 elem_size; |
42 | | |
43 | | /* The type of an element. */ |
44 | | MVMObject *elem_type; |
45 | | |
46 | | /* What kind of element is it (lets us quickly know how to handle access |
47 | | * to it). */ |
48 | | MVMint32 elem_kind; |
49 | | }; |
50 | | |
51 | | /* Initializes the CArray REPR. */ |
52 | | const MVMREPROps * MVMCArray_initialize(MVMThreadContext *tc); |