@@ -17,10 +17,11 @@ along with GCC; see the file COPYING3. If not see
17
17
18
18
/* D runtime library functions. */
19
19
20
- /* DEF_D_RUNTIME (CODE, NAME, FLAGS)
20
+ /* DEF_D_RUNTIME (CODE, NAME, FLAGS, FNSPEC )
21
21
CODE The enum code used to refer this function.
22
22
NAME The name of this function as a string.
23
23
FLAGS ECF flags to describe attributes of the function.
24
+ FNSPEC A string describing the functions fnspec.
24
25
25
26
Used for declaring functions that are called by generated code. Most are
26
27
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
35
36
36
37
/* Used when an assert() contract fails. */
37
38
DEF_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" )
39
40
DEF_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" )
41
42
42
43
/* Used when an assert() contract fails in a unittest function. */
43
44
DEF_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" )
45
46
DEF_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")
47
49
48
50
/* Used when an array index outside the bounds of its range. */
49
51
DEF_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" )
51
53
52
54
/* Used when calling new on a class. */
53
55
DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO),
54
- ECF_LEAF)
56
+ ECF_LEAF, ".R" )
55
57
56
58
/* 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")
59
63
60
64
/* 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")
62
67
DEF_D_RUNTIME (CALLINTERFACEFINALIZER, "_d_callinterfacefinalizer", RT(VOID),
63
- P1(VOIDPTR), 0)
68
+ P1(VOIDPTR), 0, ".w" )
64
69
65
70
/* Used for casting to a class or interface. */
66
71
DEF_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" )
68
73
DEF_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" )
70
75
71
76
/* Used when calling new on a pointer. The `i' variant is for when the
72
77
initialiser is non-zero. */
73
78
DEF_D_RUNTIME (NEWITEMT, "_d_newitemT", RT(VOIDPTR), P1(CONST_TYPEINFO),
74
- ECF_LEAF)
79
+ ECF_LEAF, ".R" )
75
80
DEF_D_RUNTIME (NEWITEMIT, "_d_newitemiT", RT(VOIDPTR), P1(CONST_TYPEINFO),
76
- ECF_LEAF)
81
+ ECF_LEAF, ".R" )
77
82
78
83
/* Used when calling delete on a pointer. */
79
84
DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR),
80
- ECF_LEAF)
85
+ ECF_LEAF, ".w" )
81
86
DEF_D_RUNTIME (DELSTRUCT, "_d_delstruct", RT(VOID),
82
- P2(POINTER_VOIDPTR, TYPEINFO), 0)
87
+ P2(POINTER_VOIDPTR, TYPEINFO), 0, ".wR" )
83
88
84
89
/* Used when calling new on an array. The `i' variant is for when the
85
90
initialiser is non-zero, and the `m' variant is when initialising a
86
91
multi-dimensional array. */
87
92
DEF_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" )
89
94
DEF_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" )
91
96
DEF_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" )
93
98
DEF_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" )
95
100
96
101
/* Used for allocating an array literal on the GC heap. */
97
102
DEF_D_RUNTIME (ARRAYLITERALTX, "_d_arrayliteralTX", RT(VOIDPTR),
98
- P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
103
+ P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF, ".RR" )
99
104
100
105
/* Used when calling delete on an array. */
101
106
DEF_D_RUNTIME (DELARRAYT, "_d_delarray_t", RT(VOID),
102
- P2(ARRAYPTR_VOID, CONST_TYPEINFO), 0)
107
+ P2(ARRAYPTR_VOID, CONST_TYPEINFO), 0, ".wR" )
103
108
104
109
/* Used for value equality (x == y) and comparisons (x < y) of non-trivial
105
110
arrays. Such as an array of structs or classes. */
106
111
DEF_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" )
108
113
DEF_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" )
110
115
111
116
/* 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. */
113
120
DEF_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" )
115
122
116
123
/* Used for (array.length = n) expressions. The `i' variant is for when the
117
124
initialiser is non-zero. */
118
125
DEF_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." )
120
127
DEF_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." )
122
129
123
130
/* Used for allocating closures on the GC heap. */
124
131
DEF_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" )
126
133
127
134
/* 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. */
129
138
DEF_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" )
131
140
132
141
/* 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. */
134
145
DEF_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." )
136
147
DEF_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" )
138
149
DEF_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" )
140
151
DEF_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" )
142
153
143
154
/* 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. */
145
158
DEF_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.." )
147
160
DEF_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" )
149
162
150
163
/* Used for concatenating two or more arrays together. Then `n' variant is
151
164
for when there is more than two arrays to handle. */
152
165
DEF_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" )
154
167
DEF_D_RUNTIME (ARRAYCATNTX, "_d_arraycatnTX", RT(ARRAY_VOID),
155
- P2(CONST_TYPEINFO, ARRAYARRAY_BYTE), 0)
168
+ P2(CONST_TYPEINFO, ARRAYARRAY_BYTE), 0, "mRr" )
156
169
157
170
/* Used for appending a single element to an array. */
158
171
DEF_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" )
160
173
161
174
/* Same as appending a single element to an array, but specific for when the
162
175
source is a UTF-32 character, and the destination is a UTF-8 or 16 array. */
163
176
DEF_D_RUNTIME (ARRAYAPPENDCD, "_d_arrayappendcd", RT(ARRAY_VOID),
164
- P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
177
+ P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF, ".wR" )
165
178
DEF_D_RUNTIME (ARRAYAPPENDWD, "_d_arrayappendwd", RT(ARRAY_VOID),
166
- P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
179
+ P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF, ".wR" )
167
180
168
181
/* Used for appending an existing array to another. */
169
182
DEF_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" )
171
184
172
185
/* Used for allocating a new associative array. */
173
186
DEF_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" )
175
188
176
189
/* Used for value equality of two associative arrays. */
177
190
DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),
178
- P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), 0)
191
+ P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), 0, ".RRR" )
179
192
180
193
/* Used to determine is a key exists in an associative array. */
181
194
DEF_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")
183
197
184
198
/* Used to retrieve a value from an associative array index by a key. The
185
199
`Rvalue' variant returns null if the key is not found, where as aaGetY
186
200
will create new key entry for assignment. */
187
201
DEF_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")
189
204
DEF_D_RUNTIME (AAGETRVALUEX, "_aaGetRvalueX", RT(VOIDPTR),
190
205
P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR),
191
- ECF_CONST | ECF_LEAF)
206
+ ECF_CONST | ECF_LEAF, ".RRRR" )
192
207
193
208
/* Used when calling delete on a key entry in an associative array. */
194
209
DEF_D_RUNTIME (AADELX, "_aaDelX", RT(BOOL),
195
- P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF)
210
+ P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF, ".wRR" )
196
211
197
212
/* 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 )
199
214
DEF_D_RUNTIME (BEGIN_CATCH, "__gdc_begin_catch", RT(VOIDPTR), P1(VOIDPTR),
200
- ECF_NOTHROW)
215
+ ECF_NOTHROW, NULL )
201
216
202
217
/* C++ exception handlers. */
203
218
DEF_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 )
206
221
207
222
/* When invariant() contracts are turned on, used after testing whether a
208
223
class != null for validating the state of a class. */
209
224
DEF_D_RUNTIME (INVARIANT, "_D9invariant12_d_invariantFC6ObjectZv", RT(VOID),
210
- P1(OBJECT), 0)
225
+ P1(OBJECT), 0, ".r" )
211
226
212
227
/* Used when performing a switch/cases on a string. The `u' and `d' variants
213
228
are for UTF-16 and UTF-32 strings respectively. */
214
229
DEF_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" )
216
231
DEF_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" )
218
233
DEF_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" )
220
235
221
236
/* Used when throwing an error that a switch statement has no default case,
222
237
and yet none of the existing cases matched. */
223
238
DEF_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" )
225
240
226
241
#undef P0
227
242
#undef P1
0 commit comments