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