Coverage Report

Created: 2017-04-15 07:07

/home/travis/build/MoarVM/MoarVM/src/mast/nodes.h
Line
Count
Source (jump to first uncovered line)
1
/* MAST::CompUnit */
2
typedef struct {
3
    MVMP6opaque  p6o_header;
4
    MVMObject   *frames;
5
    MVMString   *hll;
6
    MVMObject   *main_frame;
7
    MVMObject   *load_frame;
8
    MVMObject   *deserialize_frame;
9
    MVMObject   *sc_handles;
10
    MVMObject   *sc_lookup;
11
    MVMObject   *extop_sigs;
12
    MVMObject   *extop_idx;
13
    MVMObject   *extop_names;
14
} MAST_CompUnit;
15
16
/* MAST::Frame */
17
typedef struct {
18
    MVMP6opaque  p6o_header;
19
    MVMString   *cuuid;
20
    MVMString   *name;
21
    MVMObject   *lexical_types;
22
    MVMObject   *lexical_names;
23
    MVMObject   *local_types;
24
    MVMObject   *instructions;
25
    MVMObject   *outer;
26
    MVMObject   *lexical_map;
27
    MVMint64     flags;
28
    MVMint64     index;
29
    MVMObject   *static_lex_values;
30
    MVMint64     code_obj_sc_dep_idx;
31
    MVMint64     code_obj_sc_idx;
32
} MAST_Frame;
33
34
/* MAST::Op */
35
typedef struct {
36
    MVMP6opaque  p6o_header;
37
    MVMint64     op;
38
    MVMObject   *operands;
39
} MAST_Op;
40
41
/* MAST::ExtOp */
42
typedef struct {
43
    MVMP6opaque  p6o_header;
44
    MVMint64     op;
45
    MVMObject   *operands;
46
    MVMString   *name;
47
} MAST_ExtOp;
48
49
/* MAST::SVal */
50
typedef struct {
51
    MVMP6opaque  p6o_header;
52
    MVMString   *value;
53
} MAST_SVal;
54
55
/* MAST::IVal */
56
typedef struct {
57
    MVMP6opaque p6o_header;
58
    MVMint64    value;
59
} MAST_IVal;
60
61
/* MAST::NVal */
62
typedef struct {
63
    MVMP6opaque p6o_header;
64
    MVMnum64    value;
65
} MAST_NVal;
66
67
/* MAST::Label */
68
typedef struct {
69
    MVMP6opaque  p6o_header;
70
} MAST_Label;
71
72
/* MAST::Local */
73
typedef struct {
74
    MVMP6opaque p6o_header;
75
    MVMint64    index;
76
} MAST_Local;
77
78
/* MAST::Lexical */
79
typedef struct {
80
    MVMP6opaque p6o_header;
81
    MVMint64    index;
82
    MVMint64    frames_out;
83
} MAST_Lexical;
84
85
/* MAST::Call */
86
typedef struct {
87
    MVMP6opaque  p6o_header;
88
    MVMObject   *target;
89
    MVMObject   *flags;
90
    MVMObject   *args;
91
    MVMObject   *result;
92
} MAST_Call;
93
94
/* MAST::Annotated */
95
typedef struct {
96
    MVMP6opaque  p6o_header;
97
    MVMString   *file;
98
    MVMint64     line;
99
    MVMObject   *instructions;
100
} MAST_Annotated;
101
102
/* MAST::HandlerScope */
103
typedef struct {
104
    MVMP6opaque  p6o_header;
105
    MVMObject   *instructions;
106
    MVMint64     category_mask;
107
    MVMint64     action;
108
    MVMObject   *goto_label;
109
    MVMObject   *block_local;
110
    MVMObject   *label_local;
111
} MAST_HandlerScope;
112
113
/* Node types structure. */
114
typedef struct _MASTNodeTypes {
115
    MVMObject *CompUnit;
116
    MVMObject *Frame;
117
    MVMObject *Op;
118
    MVMObject *ExtOp;
119
    MVMObject *SVal;
120
    MVMObject *IVal;
121
    MVMObject *NVal;
122
    MVMObject *Label;
123
    MVMObject *Local;
124
    MVMObject *Lexical;
125
    MVMObject *Call;
126
    MVMObject *Annotated;
127
    MVMObject *HandlerScope;
128
} MASTNodeTypes;
129
130
/* This means we can talk about MASTNode in the compiler, not MVMObject. */
131
typedef MVMObject MASTNode;
132
133
/* Similar for strings. */
134
typedef MVMString VMSTR;
135
136
/* Way of talking about the interpreter. */
137
#define VM MVMThreadContext *tc
138
1.96M
#define vm tc
139
140
/* Some macros for getting at and examining nodes data. */
141
955k
#define ISTYPE(VM, s, t)            (STABLE(s) == STABLE(t))
142
0
#define DIE(vm, msg, ...)           MVM_exception_throw_adhoc(tc, msg, ## __VA_ARGS__)
143
1.18k
#define GET_CompUnit(n)             ((MAST_CompUnit *)n)
144
4.04k
#define GET_Frame(n)                ((MAST_Frame *)n)
145
245k
#define GET_Op(n)                   ((MAST_Op *)n)
146
0
#define GET_ExtOp(n)                ((MAST_ExtOp *)n)
147
55.7k
#define GET_Label(n)                ((MAST_Label *)n)
148
429k
#define GET_Local(n)                ((MAST_Local *)n)
149
3.25k
#define GET_Lexical(n)              ((MAST_Lexical *)n)
150
79.0k
#define GET_IVal(n)                 ((MAST_IVal *)n)
151
398
#define GET_NVal(n)                 ((MAST_NVal *)n)
152
39.1k
#define GET_SVal(n)                 ((MAST_SVal *)n)
153
13.0k
#define GET_Call(n)                 ((MAST_Call *)n)
154
8.83k
#define GET_Annotated(n)            ((MAST_Annotated *)n)
155
300
#define GET_HandlerScope(n)         ((MAST_HandlerScope *)n)
156
#define NEWLIST_I(vm)               (MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTIntArray))
157
1.18k
#define NEWLIST_S(vm)               (MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTStrArray))
158
318k
#define ELEMS(vm, arr)              ((unsigned int )MVM_repr_elems(vm, arr))
159
890k
#define ATPOS(vm, arr, i)           (MVM_repr_at_pos_o(vm, arr, i))
160
3.72k
#define ATPOS_I(vm, arr, i)         (MVM_repr_at_pos_i(vm, arr, i))
161
32.5k
#define ATPOS_S(vm, arr, i)         (MVM_repr_at_pos_s(vm, arr, i))
162
47.1k
#define ATPOS_I_C(vm, arr, i)       (MVM_repr_get_int(vm, MVM_repr_at_pos_o(vm, arr, i)))
163
4.97k
#define ATPOS_S_C(vm, arr, i)       (MVM_repr_get_str(vm, MVM_repr_at_pos_o(vm, arr, i)))
164
#define BINDPOS(vm, arr, i, v)      (MVM_repr_bind_pos_o(vm, arr, i, v))
165
#define BINDPOS_I(vm, arr, i, v)    (MVM_repr_bind_pos_i(vm, arr, i, v))
166
32.5k
#define BINDPOS_S(vm, arr, i, v)    (MVM_repr_bind_pos_s(vm, arr, i, v))
167
1.18k
#define NEWHASH(vm)                 (MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash))
168
#define HASHELEMS(vm, hash)         ((unsigned int )MVM_repr_elems(vm, hash))
169
#define ATKEY(vm, hash, k)          (MVM_repr_at_key_o(vm, hash, k))
170
32.6k
#define ATKEY_I(vm, hash, k)        (MVM_repr_get_int(tc, MVM_repr_at_key_o(vm, hash, k)))
171
#define BINDKEY(vm, hash, k, v)     (MVM_repr_bind_key_o(vm, hash, k, v))
172
32.5k
#define BINDKEY_I(vm, hash, k, v)   do {                                          \
173
32.5k
    MVMObject *boxed = MVM_repr_box_int(tc, tc->instance->boot_types.BOOTInt, v); \
174
32.5k
    MVM_repr_bind_key_o(vm, hash, k, boxed);                                      \
175
32.5k
} while (0)
176
65.1k
#define EXISTSKEY(vm, hash, k)      (MVM_repr_exists_key(vm, hash, k))
177
#define DELETEKEY(vm, hash, k)      (MVM_repr_delete_key(vm, hash, k))
178
86
#define EMPTY_STRING(vm)            (tc->instance->str_consts.empty)
179
1.18k
#define VM_STRING_IS_NULL(s)        (s == NULL)
180
62.1k
#define VM_OBJ_IS_NULL(o)           (o == NULL)
181
0
#define VM_STRING_TO_C_STRING(vm, s) (MVM_string_ascii_encode_any(tc, s))
182
183
0
#define DIE_FREE(vm, waste, msg, ...) MVM_exception_throw_adhoc_free(tc, waste, msg, ## __VA_ARGS__)