/home/travis/build/MoarVM/MoarVM/src/6model/reprs.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* Pull in all of the core REPRs. */ |
2 | | #include "6model/reprs/MVMString.h" |
3 | | #include "6model/reprs/VMArray.h" |
4 | | #include "6model/reprs/MVMHash.h" |
5 | | #include "6model/reprs/MVMCFunction.h" |
6 | | #include "6model/reprs/KnowHOWREPR.h" |
7 | | #include "6model/reprs/P6opaque.h" |
8 | | #include "6model/reprs/MVMCode.h" |
9 | | #include "6model/reprs/MVMOSHandle.h" |
10 | | #include "6model/reprs/P6int.h" |
11 | | #include "6model/reprs/P6num.h" |
12 | | #include "6model/reprs/Uninstantiable.h" |
13 | | #include "6model/reprs/HashAttrStore.h" |
14 | | #include "6model/reprs/KnowHOWAttributeREPR.h" |
15 | | #include "6model/reprs/P6str.h" |
16 | | #include "6model/reprs/MVMThread.h" |
17 | | #include "6model/reprs/MVMIter.h" |
18 | | #include "6model/reprs/MVMContext.h" |
19 | | #include "6model/reprs/SCRef.h" |
20 | | #include "6model/reprs/MVMCallCapture.h" |
21 | | #include "6model/reprs/P6bigint.h" |
22 | | #include "6model/reprs/NFA.h" |
23 | | #include "6model/reprs/MVMException.h" |
24 | | #include "6model/reprs/MVMStaticFrame.h" |
25 | | #include "6model/reprs/MVMCompUnit.h" |
26 | | #include "6model/reprs/MVMDLLSym.h" |
27 | | #include "6model/reprs/MVMMultiCache.h" |
28 | | #include "6model/reprs/MVMContinuation.h" |
29 | | #include "6model/reprs/NativeCall.h" |
30 | | #include "6model/reprs/CPointer.h" |
31 | | #include "6model/reprs/CStr.h" |
32 | | #include "6model/reprs/CArray.h" |
33 | | #include "6model/reprs/CStruct.h" |
34 | | #include "6model/reprs/CUnion.h" |
35 | | #include "6model/reprs/ReentrantMutex.h" |
36 | | #include "6model/reprs/ConditionVariable.h" |
37 | | #include "6model/reprs/Semaphore.h" |
38 | | #include "6model/reprs/ConcBlockingQueue.h" |
39 | | #include "6model/reprs/MVMAsyncTask.h" |
40 | | #include "6model/reprs/MVMNull.h" |
41 | | #include "6model/reprs/CPPStruct.h" |
42 | | #include "6model/reprs/NativeRef.h" |
43 | | #include "6model/reprs/MultiDimArray.h" |
44 | | #include "6model/reprs/Decoder.h" |
45 | | #include "6model/reprs/MVMSpeshLog.h" |
46 | | #include "6model/reprs/MVMStaticFrameSpesh.h" |
47 | | |
48 | | /* REPR related functions. */ |
49 | | void MVM_repr_initialize_registry(MVMThreadContext *tc); |
50 | | MVMuint32 MVM_repr_name_to_id(MVMThreadContext *tc, MVMString *name); |
51 | | const MVMREPROps * MVM_repr_get_by_id(MVMThreadContext *tc, MVMuint32 id); |
52 | | const MVMREPROps * MVM_repr_get_by_name(MVMThreadContext *tc, MVMString *name); |
53 | | |
54 | | /* Core representation IDs (determined by the order we add them |
55 | | * to the registery in reprs.c). */ |
56 | 89.5M | #define MVM_REPR_ID_MVMString 0 |
57 | 10.7M | #define MVM_REPR_ID_VMArray 1 |
58 | 15.8M | #define MVM_REPR_ID_MVMHash 2 |
59 | 173 | #define MVM_REPR_ID_MVMCFunction 3 |
60 | 4.96k | #define MVM_REPR_ID_KnowHOWREPR 4 |
61 | 18.2k | #define MVM_REPR_ID_P6opaque 5 |
62 | 19.0M | #define MVM_REPR_ID_MVMCode 6 |
63 | 16.1k | #define MVM_REPR_ID_MVMOSHandle 7 |
64 | 11.8k | #define MVM_REPR_ID_P6int 8 |
65 | 33 | #define MVM_REPR_ID_P6num 9 |
66 | | #define MVM_REPR_ID_Uninstantiable 10 |
67 | | #define MVM_REPR_ID_HashAttrStore 11 |
68 | 11 | #define MVM_REPR_ID_KnowHOWAttributeREPR 12 |
69 | 50.7k | #define MVM_REPR_ID_P6str 13 |
70 | 206 | #define MVM_REPR_ID_MVMThread 14 |
71 | 1.72M | #define MVM_REPR_ID_MVMIter 15 |
72 | 14.3k | #define MVM_REPR_ID_MVMContext 16 |
73 | 28.8k | #define MVM_REPR_ID_SCRef 17 |
74 | | #define MVM_REPR_ID_MVMSpeshLog 18 |
75 | 124k | #define MVM_REPR_ID_MVMCallCapture 19 |
76 | 5.35k | #define MVM_REPR_ID_P6bigint 20 |
77 | | #define MVM_REPR_ID_NFA 21 |
78 | 412k | #define MVM_REPR_ID_MVMException 22 |
79 | | #define MVM_REPR_ID_MVMStaticFrame 23 |
80 | 1.36k | #define MVM_REPR_ID_MVMCompUnit 24 |
81 | 0 | #define MVM_REPR_ID_MVMDLLSym 25 |
82 | 157k | #define MVM_REPR_ID_MVMMultiCache 26 |
83 | 46 | #define MVM_REPR_ID_MVMContinuation 27 |
84 | 6 | #define MVM_REPR_ID_MVMNativeCall 28 |
85 | 2 | #define MVM_REPR_ID_MVMCPointer 29 |
86 | 2 | #define MVM_REPR_ID_MVMCStr 30 |
87 | 3 | #define MVM_REPR_ID_MVMCArray 31 |
88 | 3 | #define MVM_REPR_ID_MVMCStruct 32 |
89 | 735 | #define MVM_REPR_ID_ReentrantMutex 33 |
90 | 14 | #define MVM_REPR_ID_ConditionVariable 34 |
91 | 21 | #define MVM_REPR_ID_Semaphore 35 |
92 | 7 | #define MVM_REPR_ID_ConcBlockingQueue 36 |
93 | 46 | #define MVM_REPR_ID_MVMAsyncTask 37 |
94 | 1.59k | #define MVM_REPR_ID_MVMNull 38 |
95 | 881 | #define MVM_REPR_ID_NativeRef 39 |
96 | 0 | #define MVM_REPR_ID_MVMCUnion 40 |
97 | | #define MVM_REPR_ID_MultiDimArray 41 |
98 | 3 | #define MVM_REPR_ID_MVMCPPStruct 42 |
99 | 1.90k | #define MVM_REPR_ID_Decoder 43 |
100 | | #define MVM_REPR_ID_MVMStaticFrameSpesh 44 |
101 | | |
102 | 144 | #define MVM_REPR_CORE_COUNT 45 |
103 | 1.52k | #define MVM_REPR_MAX_COUNT 64 |
104 | | |
105 | | /* Default attribute functions for a REPR that lacks them. */ |
106 | | #define MVM_REPR_DEFAULT_ATTR_FUNCS \ |
107 | | { \ |
108 | | MVM_REPR_DEFAULT_GET_ATTRIBUTE, \ |
109 | | MVM_REPR_DEFAULT_BIND_ATTRIBUTE, \ |
110 | | MVM_REPR_DEFAULT_HINT_FOR, \ |
111 | | MVM_REPR_DEFAULT_IS_ATTRIBUTE_INITIALIZED, \ |
112 | | MVM_REPR_DEFAULT_ATTRIBUTE_AS_ATOMIC \ |
113 | | } |
114 | | |
115 | | /* Default boxing functions for a REPR that lacks them. */ |
116 | | #define MVM_REPR_DEFAULT_BOX_FUNCS \ |
117 | | { \ |
118 | | MVM_REPR_DEFAULT_SET_INT, \ |
119 | | MVM_REPR_DEFAULT_GET_INT, \ |
120 | | MVM_REPR_DEFAULT_SET_NUM, \ |
121 | | MVM_REPR_DEFAULT_GET_NUM, \ |
122 | | MVM_REPR_DEFAULT_SET_STR, \ |
123 | | MVM_REPR_DEFAULT_GET_STR, \ |
124 | | MVM_REPR_DEFAULT_SET_UINT, \ |
125 | | MVM_REPR_DEFAULT_GET_UINT, \ |
126 | | MVM_REPR_DEFAULT_GET_BOXED_REF \ |
127 | | } |
128 | | |
129 | | /* Default positional functions for a REPR that lacks them. */ |
130 | | #define MVM_REPR_DEFAULT_POS_FUNCS \ |
131 | | { \ |
132 | | MVM_REPR_DEFAULT_AT_POS, \ |
133 | | MVM_REPR_DEFAULT_BIND_POS, \ |
134 | | MVM_REPR_DEFAULT_SET_ELEMS, \ |
135 | | MVM_REPR_DEFAULT_PUSH, \ |
136 | | MVM_REPR_DEFAULT_POP, \ |
137 | | MVM_REPR_DEFAULT_UNSHIFT, \ |
138 | | MVM_REPR_DEFAULT_SHIFT, \ |
139 | | MVM_REPR_DEFAULT_SLICE, \ |
140 | | MVM_REPR_DEFAULT_SPLICE, \ |
141 | | MVM_REPR_DEFAULT_AT_POS_MULTIDIM, \ |
142 | | MVM_REPR_DEFAULT_BIND_POS_MULTIDIM, \ |
143 | | MVM_REPR_DEFAULT_DIMENSIONS, \ |
144 | | MVM_REPR_DEFAULT_SET_DIMENSIONS, \ |
145 | | MVM_REPR_DEFAULT_GET_ELEM_STORAGE_SPEC, \ |
146 | | MVM_REPR_DEFAULT_POS_AS_ATOMIC, \ |
147 | | MVM_REPR_DEFAULT_POS_AS_ATOMIC_MULTIDIM \ |
148 | | } |
149 | | |
150 | | /* Default associative functions for a REPR that lacks them. */ |
151 | | #define MVM_REPR_DEFAULT_ASS_FUNCS \ |
152 | | { \ |
153 | | MVM_REPR_DEFAULT_AT_KEY, \ |
154 | | MVM_REPR_DEFAULT_BIND_KEY, \ |
155 | | MVM_REPR_DEFAULT_EXISTS_KEY, \ |
156 | | MVM_REPR_DEFAULT_DELETE_KEY, \ |
157 | | MVM_REPR_DEFAULT_GET_VALUE_STORAGE_SPEC \ |
158 | | } |
159 | | |
160 | | /* Register a representation at runtime, setting repr->ID to a dynamically |
161 | | * assigned value. |
162 | | * |
163 | | * Returns nonzero if the representation has been added successfully and |
164 | | * zero if a representation with the same name is already present. |
165 | | * In that case, the MVMREPROps structure is unused and may be deallocated. |
166 | | */ |
167 | | int MVM_repr_register_dynamic_repr(MVMThreadContext *tc, MVMREPROps *repr); |
168 | | |
169 | | /* Default elems REPR function for a REPR that lacks it. */ |
170 | | MVMuint64 MVM_REPR_DEFAULT_ELEMS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data); |
171 | | |
172 | | /* Default attribute access REPR function for a REPR that lacks it. */ |
173 | | void MVM_REPR_DEFAULT_GET_ATTRIBUTE(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *class_handle, MVMString *name, MVMint64 hint, MVMRegister *result, MVMuint16 kind); |
174 | | void MVM_REPR_DEFAULT_BIND_ATTRIBUTE(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *class_handle, MVMString *name, MVMint64 hint, MVMRegister value, MVMuint16 kind); |
175 | | MVMint64 MVM_REPR_DEFAULT_IS_ATTRIBUTE_INITIALIZED(MVMThreadContext *tc, MVMSTable *st, void *data, MVMObject *class_handle, MVMString *name, MVMint64 hint); |
176 | | MVMint64 MVM_REPR_DEFAULT_HINT_FOR(MVMThreadContext *tc, MVMSTable *st, MVMObject *class_handle, MVMString *name); |
177 | | AO_t * MVM_REPR_DEFAULT_ATTRIBUTE_AS_ATOMIC(MVMThreadContext *tc, MVMSTable *st, void *data, MVMObject *class_handle, MVMString *name, MVMuint16 kind); |
178 | | |
179 | | /* Default boxing REPR function for a REPR that lacks it. */ |
180 | | void MVM_REPR_DEFAULT_SET_INT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 value); |
181 | | MVMint64 MVM_REPR_DEFAULT_GET_INT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data); |
182 | | void MVM_REPR_DEFAULT_SET_NUM(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMnum64 value); |
183 | | MVMnum64 MVM_REPR_DEFAULT_GET_NUM(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data); |
184 | | void MVM_REPR_DEFAULT_SET_STR(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMString *value); |
185 | | MVMString * MVM_REPR_DEFAULT_GET_STR(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data); |
186 | | void MVM_REPR_DEFAULT_SET_UINT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMuint64 value); |
187 | | MVMuint64 MVM_REPR_DEFAULT_GET_UINT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data); |
188 | | void * MVM_REPR_DEFAULT_GET_BOXED_REF(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMuint32 repr_id); |
189 | | |
190 | | /* Default positional indexing REPR function for a REPR that lacks it. */ |
191 | | void MVM_REPR_DEFAULT_AT_POS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 index, MVMRegister *value, MVMuint16 kind); |
192 | | void MVM_REPR_DEFAULT_BIND_POS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 index, MVMRegister value, MVMuint16 kind); |
193 | | void MVM_REPR_DEFAULT_SET_ELEMS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMuint64 count); |
194 | | void MVM_REPR_DEFAULT_PUSH(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMRegister value, MVMuint16 kind); |
195 | | void MVM_REPR_DEFAULT_POP(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMRegister *value, MVMuint16 kind); |
196 | | void MVM_REPR_DEFAULT_UNSHIFT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMRegister value, MVMuint16 kind); |
197 | | void MVM_REPR_DEFAULT_SHIFT(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMRegister *value, MVMuint16 kind); |
198 | | void MVM_REPR_DEFAULT_SLICE(MVMThreadContext *tc, MVMSTable *st, MVMObject *src, void *data, MVMObject *dest, MVMint64 start, MVMint64 end); |
199 | | void MVM_REPR_DEFAULT_AT_POS_MULTIDIM(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 num_indices, MVMint64 *indices, MVMRegister *value, MVMuint16 kind); |
200 | | void MVM_REPR_DEFAULT_BIND_POS_MULTIDIM(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 num_indices, MVMint64 *indices, MVMRegister value, MVMuint16 kind); |
201 | | void MVM_REPR_DEFAULT_DIMENSIONS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 *num_dimensions, MVMint64 **dimensions); |
202 | | void MVM_REPR_DEFAULT_SET_DIMENSIONS(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMint64 num_dimensions, MVMint64 *dimensions); |
203 | | MVMStorageSpec MVM_REPR_DEFAULT_GET_ELEM_STORAGE_SPEC(MVMThreadContext *tc, MVMSTable *st); |
204 | | AO_t * MVM_REPR_DEFAULT_POS_AS_ATOMIC(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, |
205 | | void *data, MVMint64 index); |
206 | | AO_t * MVM_REPR_DEFAULT_POS_AS_ATOMIC_MULTIDIM(MVMThreadContext *tc, MVMSTable *st, |
207 | | MVMObject *root, void *data, MVMint64 num_indices, MVMint64 *indices); |
208 | | |
209 | | /* Default associative indexing REPR function for a REPR that lacks it. */ |
210 | | void MVM_REPR_DEFAULT_SPLICE(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *target_array, MVMint64 offset, MVMuint64 elems); |
211 | | void MVM_REPR_DEFAULT_AT_KEY(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *key, MVMRegister *result, MVMuint16 kind); |
212 | | void MVM_REPR_DEFAULT_BIND_KEY(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *key, MVMRegister value, MVMuint16 kind); |
213 | | MVMint64 MVM_REPR_DEFAULT_EXISTS_KEY(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *key); |
214 | | void MVM_REPR_DEFAULT_DELETE_KEY(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *key); |
215 | | MVMStorageSpec MVM_REPR_DEFAULT_GET_VALUE_STORAGE_SPEC(MVMThreadContext *tc, MVMSTable *st); |