Coverage Report

Created: 2018-07-03 15:31

/home/travis/build/MoarVM/MoarVM/src/6model/reprs/VMArray.h
Line
Count
Source (jump to first uncovered line)
1
/* Concurrent use of a VMArray is erroneous. This debugging option will
2
 * catch bad usages. (Eventually, we will refactor VMArray to not have
3
 * this issue.) */
4
#define MVM_ARRAY_CONC_DEBUG 0
5
6
/* Representation used by VM-level arrays. Adopted from QRPA work by
7
 * Patrick Michaud. */
8
struct MVMArrayBody {
9
    /* number of elements (from user's point of view) */
10
    MVMuint64   elems;
11
12
    /* slot index of first element */
13
    MVMuint64   start;
14
15
    /* size of slots array */
16
    MVMuint64   ssize;
17
18
    /* slot array; union of various types of storage we may have. */
19
    union {
20
        MVMObject **o;
21
        MVMString **s;
22
        MVMint64   *i64;
23
        MVMint32   *i32;
24
        MVMint16   *i16;
25
        MVMint8    *i8;
26
        MVMnum64   *n64;
27
        MVMnum32   *n32;
28
        MVMuint64  *u64;
29
        MVMuint32  *u32;
30
        MVMuint16  *u16;
31
        MVMuint8   *u8;
32
        void       *any;
33
    } slots;
34
35
#if MVM_ARRAY_CONC_DEBUG
36
    AO_t in_use;
37
#endif 
38
};
39
struct MVMArray {
40
    MVMObject common;
41
    MVMArrayBody body;
42
};
43
44
/* Types of things we may be storing. */
45
22.7M
#define MVM_ARRAY_OBJ   0
46
410k
#define MVM_ARRAY_STR   1
47
35.0M
#define MVM_ARRAY_I64   2
48
11
#define MVM_ARRAY_I32   3
49
3
#define MVM_ARRAY_I16   4
50
233
#define MVM_ARRAY_I8    5
51
217
#define MVM_ARRAY_N64   6
52
2
#define MVM_ARRAY_N32   7
53
0
#define MVM_ARRAY_U64   8
54
33
#define MVM_ARRAY_U32   9
55
3
#define MVM_ARRAY_U16   10
56
26.9k
#define MVM_ARRAY_U8    11
57
0
#define MVM_ARRAY_U4    12
58
0
#define MVM_ARRAY_U2    13
59
0
#define MVM_ARRAY_U1    14
60
0
#define MVM_ARRAY_I4    15
61
0
#define MVM_ARRAY_I2    16
62
0
#define MVM_ARRAY_I1    17
63
64
/* Function for REPR setup. */
65
const MVMREPROps * MVMArray_initialize(MVMThreadContext *tc);
66
67
/* Array REPR data specifies the type of array elements we have. */
68
struct MVMArrayREPRData {
69
    /* The size of each element. */
70
    size_t elem_size;
71
72
    /* What type of slots we have. */
73
    MVMuint8 slot_type;
74
75
    /* Type object for the element type. */
76
    MVMObject *elem_type;
77
};
78
void MVM_VMArray_at_pos(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 index, MVMRegister *value, MVMuint16 kind);