@@ -17,10 +17,11 @@ along with GCC; see the file COPYING3. If not see
1717
1818/* D runtime library functions. */
1919
20- /* DEF_D_RUNTIME (CODE, NAME, FLAGS)
20+ /* DEF_D_RUNTIME (CODE, NAME, FLAGS, FNSPEC )
2121 CODE The enum code used to refer this function.
2222 NAME The name of this function as a string.
2323 FLAGS ECF flags to describe attributes of the function.
24+ FNSPEC A string describing the functions fnspec.
2425
2526 Used for declaring functions that are called by generated code. Most are
2627 extern(C) - for those that are not, ensure to use correct mangling. */
@@ -35,193 +36,207 @@ along with GCC; see the file COPYING3. If not see
3536
3637/* Used when an assert() contract fails. */
3738DEF_D_RUNTIME (ASSERT, "_d_assert", RT(VOID), P2(STRING, UINT),
38- ECF_COLD | ECF_LEAF | ECF_NORETURN)
39+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RR" )
3940DEF_D_RUNTIME (ASSERT_MSG, "_d_assert_msg", RT(VOID), P3(STRING, STRING, UINT),
40- ECF_COLD | ECF_LEAF | ECF_NORETURN)
41+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RRR" )
4142
4243/* Used when an assert() contract fails in a unittest function. */
4344DEF_D_RUNTIME (UNITTEST, "_d_unittest", RT(VOID), P2(STRING, UINT),
44- ECF_COLD | ECF_LEAF | ECF_NORETURN)
45+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RR" )
4546DEF_D_RUNTIME (UNITTEST_MSG, "_d_unittest_msg", RT(VOID),
46- P3(STRING, STRING, UINT), ECF_COLD | ECF_LEAF | ECF_NORETURN)
47+ P3(STRING, STRING, UINT),
48+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RRR")
4749
4850/* Used when an array index outside the bounds of its range. */
4951DEF_D_RUNTIME (ARRAY_BOUNDS, "_d_arraybounds", RT(VOID), P2(STRING, UINT),
50- ECF_COLD | ECF_LEAF | ECF_NORETURN)
52+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RR" )
5153
5254/* Used when calling new on a class. */
5355DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO),
54- ECF_LEAF)
56+ ECF_LEAF, "mR" )
5557
5658/* Used when calling delete on a class or interface. */
57- DEF_D_RUNTIME (DELCLASS, "_d_delclass", RT(VOID), P1(VOIDPTR), 0)
58- DEF_D_RUNTIME (DELINTERFACE, "_d_delinterface", RT(VOID), P1(VOIDPTR), 0)
59+ DEF_D_RUNTIME (DELCLASS, "_d_delclass", RT(VOID), P1(VOIDPTR),
60+ 0, ".w")
61+ DEF_D_RUNTIME (DELINTERFACE, "_d_delinterface", RT(VOID), P1(VOIDPTR),
62+ 0, ".w")
5963
6064/* Same as deleting a class, but used for stack-allocated classes. */
61- DEF_D_RUNTIME (CALLFINALIZER, "_d_callfinalizer", RT(VOID), P1(VOIDPTR), 0)
65+ DEF_D_RUNTIME (CALLFINALIZER, "_d_callfinalizer", RT(VOID), P1(VOIDPTR),
66+ 0, ".w")
6267DEF_D_RUNTIME (CALLINTERFACEFINALIZER, "_d_callinterfacefinalizer", RT(VOID),
63- P1(VOIDPTR), 0)
68+ P1(VOIDPTR), 0, ".w" )
6469
6570/* Used for casting to a class or interface. */
6671DEF_D_RUNTIME (DYNAMIC_CAST, "_d_dynamic_cast", RT(OBJECT),
67- P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF)
72+ P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF, ".rR" )
6873DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
69- P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF)
74+ P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF, ".rR" )
7075
7176/* Used when calling new on a pointer. The `i' variant is for when the
7277 initialiser is non-zero. */
7378DEF_D_RUNTIME (NEWITEMT, "_d_newitemT", RT(VOIDPTR), P1(CONST_TYPEINFO),
74- ECF_LEAF)
79+ ECF_LEAF, ".R" )
7580DEF_D_RUNTIME (NEWITEMIT, "_d_newitemiT", RT(VOIDPTR), P1(CONST_TYPEINFO),
76- ECF_LEAF)
81+ ECF_LEAF, ".R" )
7782
7883/* Used when calling delete on a pointer. */
7984DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR),
80- ECF_LEAF)
85+ ECF_LEAF, ".w" )
8186DEF_D_RUNTIME (DELSTRUCT, "_d_delstruct", RT(VOID),
82- P2(POINTER_VOIDPTR, TYPEINFO), 0)
87+ P2(POINTER_VOIDPTR, TYPEINFO), 0, ".wR" )
8388
8489/* Used when calling new on an array. The `i' variant is for when the
8590 initialiser is non-zero, and the `m' variant is when initialising a
8691 multi-dimensional array. */
8792DEF_D_RUNTIME (NEWARRAYT, "_d_newarrayT", RT(ARRAY_VOID),
88- P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
93+ P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF, "mRR" )
8994DEF_D_RUNTIME (NEWARRAYIT, "_d_newarrayiT", RT(ARRAY_VOID),
90- P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
95+ P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF, "mRR" )
9196DEF_D_RUNTIME (NEWARRAYMTX, "_d_newarraymTX", RT(ARRAY_VOID),
92- P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)
97+ P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF, "mRR" )
9398DEF_D_RUNTIME (NEWARRAYMITX, "_d_newarraymiTX", RT(ARRAY_VOID),
94- P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)
99+ P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF, "mRR" )
95100
96101/* Used for allocating an array literal on the GC heap. */
97102DEF_D_RUNTIME (ARRAYLITERALTX, "_d_arrayliteralTX", RT(VOIDPTR),
98- P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
103+ P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF, "mRR" )
99104
100105/* Used when calling delete on an array. */
101106DEF_D_RUNTIME (DELARRAYT, "_d_delarray_t", RT(VOID),
102- P2(ARRAYPTR_VOID, CONST_TYPEINFO), 0)
107+ P2(ARRAYPTR_VOID, CONST_TYPEINFO), 0, ".wR" )
103108
104109/* Used for value equality (x == y) and comparisons (x < y) of non-trivial
105110 arrays. Such as an array of structs or classes. */
106111DEF_D_RUNTIME (ADEQ2, "_adEq2", RT(INT),
107- P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0)
112+ P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0, ".RRR" )
108113DEF_D_RUNTIME (ADCMP2, "_adCmp2", RT(INT),
109- P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0)
114+ P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0, ".RRR" )
110115
111116/* Used when casting from one array type to another where the index type
112- sizes differ. Such as from int[] to short[]. */
117+ sizes differ, such as from int[] to short[].
118+ TODO: This function returns its third argument, but the backend is may not
119+ handle this for aggregates properly. */
113120DEF_D_RUNTIME (ARRAYCAST, "_d_arraycast", RT(ARRAY_VOID),
114- P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_CONST | ECF_LEAF)
121+ P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_CONST | ECF_LEAF, ".RRw" )
115122
116123/* Used for (array.length = n) expressions. The `i' variant is for when the
117124 initialiser is non-zero. */
118125DEF_D_RUNTIME (ARRAYSETLENGTHT, "_d_arraysetlengthT", RT(ARRAY_VOID),
119- P3(CONST_TYPEINFO, SIZE_T, ARRAYPTR_VOID), 0)
126+ P3(CONST_TYPEINFO, SIZE_T, ARRAYPTR_VOID), 0, ".RR." )
120127DEF_D_RUNTIME (ARRAYSETLENGTHIT, "_d_arraysetlengthiT", RT(ARRAY_VOID),
121- P3(CONST_TYPEINFO, SIZE_T, ARRAYPTR_VOID), 0)
128+ P3(CONST_TYPEINFO, SIZE_T, ARRAYPTR_VOID), 0, ".RR." )
122129
123130/* Used for allocating closures on the GC heap. */
124131DEF_D_RUNTIME (ALLOCMEMORY, "_d_allocmemory", RT(VOIDPTR), P1(SIZE_T),
125- ECF_LEAF | ECF_MALLOC | ECF_PURE)
132+ ECF_LEAF | ECF_MALLOC | ECF_PURE, "mR" )
126133
127134/* Used for copying an array into a slice, adds an enforcment that the source
128- and destination are equal in size and do not overlap. */
135+ and destination are equal in size and do not overlap.
136+ TODO: This function returns its third argument, but the backend is may not
137+ handle this for aggregates properly. */
129138DEF_D_RUNTIME (ARRAYCOPY, "_d_arraycopy", RT(ARRAY_VOID),
130- P3(SIZE_T, ARRAY_VOID, ARRAY_VOID), ECF_LEAF)
139+ P3(SIZE_T, ARRAY_VOID, ARRAY_VOID), ECF_LEAF, ".RRw" )
131140
132141/* Used for array assignments from an existing array. The `set' variant is for
133- when the assignment value is a single element. */
142+ when the assignment value is a single element.
143+ TODO: These functions return their third argument, but the backend is may not
144+ handle this for aggregates properly. */
134145DEF_D_RUNTIME (ARRAYASSIGN, "_d_arrayassign", RT(ARRAY_VOID),
135- P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0)
146+ P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0, ".RR." )
136147DEF_D_RUNTIME (ARRAYASSIGN_L, "_d_arrayassign_l", RT(ARRAY_VOID),
137- P4(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID, VOIDPTR), 0)
148+ P4(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID, VOIDPTR), 0, ".RR.W" )
138149DEF_D_RUNTIME (ARRAYASSIGN_R, "_d_arrayassign_r", RT(ARRAY_VOID),
139- P4(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID, VOIDPTR), 0)
150+ P4(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID, VOIDPTR), 0, ".RRwW" )
140151DEF_D_RUNTIME (ARRAYSETASSIGN, "_d_arraysetassign", RT(VOIDPTR),
141- P4(VOIDPTR, VOIDPTR, SIZE_T, CONST_TYPEINFO), 0)
152+ P4(VOIDPTR, VOIDPTR, SIZE_T, CONST_TYPEINFO), 0, "1.RRR" )
142153
143154/* Used for constructing a new array from an existing array. The `set' variant
144- is for when the constructor value is a single element. */
155+ is for when the constructor value is a single element.
156+ TODO: This function returns its third argument, but the backend is may not
157+ not handle this for aggregates properly. */
145158DEF_D_RUNTIME (ARRAYCTOR, "_d_arrayctor", RT(ARRAY_VOID),
146- P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0)
159+ P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0, ".R.." )
147160DEF_D_RUNTIME (ARRAYSETCTOR, "_d_arraysetctor", RT(VOIDPTR),
148- P4(VOIDPTR, VOIDPTR, SIZE_T, CONST_TYPEINFO), 0)
161+ P4(VOIDPTR, VOIDPTR, SIZE_T, CONST_TYPEINFO), 0, "1.RRR" )
149162
150163/* Used for concatenating two or more arrays together. Then `n' variant is
151164 for when there is more than two arrays to handle. */
152165DEF_D_RUNTIME (ARRAYCATT, "_d_arraycatT", RT(ARRAY_BYTE),
153- P3(CONST_TYPEINFO, ARRAY_BYTE, ARRAY_BYTE), 0)
166+ P3(CONST_TYPEINFO, ARRAY_BYTE, ARRAY_BYTE), 0, "mRRR" )
154167DEF_D_RUNTIME (ARRAYCATNTX, "_d_arraycatnTX", RT(ARRAY_VOID),
155- P2(CONST_TYPEINFO, ARRAYARRAY_BYTE), 0)
168+ P2(CONST_TYPEINFO, ARRAYARRAY_BYTE), 0, "mRr" )
156169
157170/* Used for appending a single element to an array. */
158171DEF_D_RUNTIME (ARRAYAPPENDCTX, "_d_arrayappendcTX", RT(ARRAY_BYTE),
159- P3(CONST_TYPEINFO, ARRAYPTR_BYTE, SIZE_T), 0)
172+ P3(CONST_TYPEINFO, ARRAYPTR_BYTE, SIZE_T), 0, ".R.R" )
160173
161174/* Same as appending a single element to an array, but specific for when the
162175 source is a UTF-32 character, and the destination is a UTF-8 or 16 array. */
163176DEF_D_RUNTIME (ARRAYAPPENDCD, "_d_arrayappendcd", RT(ARRAY_VOID),
164- P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
177+ P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF, ".wR" )
165178DEF_D_RUNTIME (ARRAYAPPENDWD, "_d_arrayappendwd", RT(ARRAY_VOID),
166- P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
179+ P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF, ".wR" )
167180
168181/* Used for appending an existing array to another. */
169182DEF_D_RUNTIME (ARRAYAPPENDT, "_d_arrayappendT", RT(ARRAY_VOID),
170- P3(TYPEINFO, ARRAYPTR_BYTE, ARRAY_BYTE), 0)
183+ P3(TYPEINFO, ARRAYPTR_BYTE, ARRAY_BYTE), 0, ".R.R" )
171184
172185/* Used for allocating a new associative array. */
173186DEF_D_RUNTIME (ASSOCARRAYLITERALTX, "_d_assocarrayliteralTX", RT(VOIDPTR),
174- P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0)
187+ P3(CONST_TYPEINFO, ARRAY_VOID, ARRAY_VOID), 0, "mRRR" )
175188
176189/* Used for value equality of two associative arrays. */
177190DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),
178- P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), 0)
191+ P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), 0, ".RRR" )
179192
180193/* Used to determine is a key exists in an associative array. */
181194DEF_D_RUNTIME (AAINX, "_aaInX", RT(VOIDPTR),
182- P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_CONST | ECF_LEAF)
195+ P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR),
196+ ECF_CONST | ECF_LEAF, ".RRR")
183197
184198/* Used to retrieve a value from an associative array index by a key. The
185199 `Rvalue' variant returns null if the key is not found, where as aaGetY
186200 will create new key entry for assignment. */
187201DEF_D_RUNTIME (AAGETY, "_aaGetY", RT(VOIDPTR),
188- P4(POINTER_ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), 0)
202+ P4(POINTER_ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR),
203+ 0, ".wRRR")
189204DEF_D_RUNTIME (AAGETRVALUEX, "_aaGetRvalueX", RT(VOIDPTR),
190205 P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR),
191- ECF_CONST | ECF_LEAF)
206+ ECF_CONST | ECF_LEAF, ".RRRR" )
192207
193208/* Used when calling delete on a key entry in an associative array. */
194209DEF_D_RUNTIME (AADELX, "_aaDelX", RT(BOOL),
195- P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF)
210+ P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF, ".wRR" )
196211
197212/* Used for throw() expressions. */
198- DEF_D_RUNTIME (THROW, "_d_throw", RT(VOID), P1(OBJECT), ECF_NORETURN)
213+ DEF_D_RUNTIME (THROW, "_d_throw", RT(VOID), P1(OBJECT), ECF_NORETURN, NULL )
199214DEF_D_RUNTIME (BEGIN_CATCH, "__gdc_begin_catch", RT(VOIDPTR), P1(VOIDPTR),
200- ECF_NOTHROW)
215+ ECF_NOTHROW, NULL )
201216
202217/* C++ exception handlers. */
203218DEF_D_RUNTIME (CXA_BEGIN_CATCH, "__cxa_begin_catch", RT(VOIDPTR), P1(VOIDPTR),
204- ECF_NOTHROW)
205- DEF_D_RUNTIME (CXA_END_CATCH, "__cxa_end_catch", RT(VOID), P0(), 0)
219+ ECF_NOTHROW, NULL )
220+ DEF_D_RUNTIME (CXA_END_CATCH, "__cxa_end_catch", RT(VOID), P0(), 0, NULL )
206221
207222/* When invariant() contracts are turned on, used after testing whether a
208223 class != null for validating the state of a class. */
209224DEF_D_RUNTIME (INVARIANT, "_D9invariant12_d_invariantFC6ObjectZv", RT(VOID),
210- P1(OBJECT), 0)
225+ P1(OBJECT), 0, ".r" )
211226
212227/* Used when performing a switch/cases on a string. The `u' and `d' variants
213228 are for UTF-16 and UTF-32 strings respectively. */
214229DEF_D_RUNTIME (SWITCH_STRING, "_d_switch_string", RT(INT),
215- P2(ARRAY_STRING, STRING), ECF_CONST | ECF_LEAF)
230+ P2(ARRAY_STRING, STRING), ECF_CONST | ECF_LEAF, ".RR" )
216231DEF_D_RUNTIME (SWITCH_USTRING, "_d_switch_ustring", RT(INT),
217- P2(ARRAY_WSTRING, WSTRING), ECF_CONST | ECF_LEAF)
232+ P2(ARRAY_WSTRING, WSTRING), ECF_CONST | ECF_LEAF, ".RR" )
218233DEF_D_RUNTIME (SWITCH_DSTRING, "_d_switch_dstring", RT(INT),
219- P2(ARRAY_DSTRING, DSTRING), ECF_CONST | ECF_LEAF)
234+ P2(ARRAY_DSTRING, DSTRING), ECF_CONST | ECF_LEAF, ".RR" )
220235
221236/* Used when throwing an error that a switch statement has no default case,
222237 and yet none of the existing cases matched. */
223238DEF_D_RUNTIME (SWITCH_ERROR, "_d_switch_error", RT(VOID), P2(STRING, UINT),
224- ECF_COLD | ECF_LEAF | ECF_NORETURN)
239+ ECF_COLD | ECF_LEAF | ECF_NORETURN, ".RR" )
225240
226241#undef P0
227242#undef P1
0 commit comments