Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit e12299c

Browse files
committed
Mark library functions that don't call postblit(), destroy(), or other user implemented functions as ECF_LEAF.
1 parent 9891aaa commit e12299c

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

gcc/d/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2018-02-11 Iain Buclaw <[email protected]>
2+
3+
* runtime.def (NEWCLASS): Set ECF_LEAF.
4+
(DYNAMIC_CAST, INTERFACE_CAST): Likewise.
5+
(NEWITEMT, NEWITEMIT, DELMEMORY): Likewise.
6+
(NEWARRAYT, NEWARRAYIT): Likewise.
7+
(NEWARRAYMTX, NEWARRAYMITX): Likewise.
8+
(ARRAYLITERALTX, ARRAYCAST): Likewise.
9+
(ALLOCMEMORY, ARRAYCOPY): Likewise.
10+
(ARRAYAPPENDCD, ARRAYAPPENDWD): Likewise.
11+
(AAINX, AAGETRVALUEX, AADELX): Likewise.
12+
(SWITCH_STRING, SWITCH_USTRING, SWITCH_DSTRING): Likewise.
13+
114
2018-02-11 Iain Buclaw <[email protected]>
215

316
* d-codegen.cc (d_save_expr): Always stabilize CALL_EXPR.

gcc/d/runtime.def

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ DEF_D_RUNTIME (ARRAY_BOUNDS, "_d_arraybounds", RT(VOID), P2(STRING, UINT),
5050
ECF_COLD | ECF_LEAF | ECF_NORETURN)
5151

5252
/* Used when calling new on a class. */
53-
DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO), 0)
53+
DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO),
54+
ECF_LEAF)
5455

5556
/* Used when calling delete on a class or interface. */
5657
DEF_D_RUNTIME (DELCLASS, "_d_delclass", RT(VOID), P1(VOIDPTR), 0)
@@ -63,35 +64,38 @@ DEF_D_RUNTIME (CALLINTERFACEFINALIZER, "_d_callinterfacefinalizer", RT(VOID),
6364

6465
/* Used for casting to a class or interface. */
6566
DEF_D_RUNTIME (DYNAMIC_CAST, "_d_dynamic_cast", RT(OBJECT),
66-
P2(OBJECT, CLASSINFO), 0)
67+
P2(OBJECT, CLASSINFO), ECF_LEAF)
6768
DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
68-
P2(OBJECT, CLASSINFO), 0)
69+
P2(OBJECT, CLASSINFO), ECF_LEAF)
6970

7071
/* Used when calling new on a pointer. The `i' variant is for when the
7172
initialiser is non-zero. */
72-
DEF_D_RUNTIME (NEWITEMT, "_d_newitemT", RT(VOIDPTR), P1(CONST_TYPEINFO), 0)
73-
DEF_D_RUNTIME (NEWITEMIT, "_d_newitemiT", RT(VOIDPTR), P1(CONST_TYPEINFO), 0)
73+
DEF_D_RUNTIME (NEWITEMT, "_d_newitemT", RT(VOIDPTR), P1(CONST_TYPEINFO),
74+
ECF_LEAF)
75+
DEF_D_RUNTIME (NEWITEMIT, "_d_newitemiT", RT(VOIDPTR), P1(CONST_TYPEINFO),
76+
ECF_LEAF)
7477

7578
/* Used when calling delete on a pointer. */
76-
DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR), 0)
79+
DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR),
80+
ECF_LEAF)
7781
DEF_D_RUNTIME (DELSTRUCT, "_d_delstruct", RT(VOID),
7882
P2(POINTER_VOIDPTR, TYPEINFO), 0)
7983

8084
/* Used when calling new on an array. The `i' variant is for when the
8185
initialiser is non-zero, and the `m' variant is when initialising a
8286
multi-dimensional array. */
8387
DEF_D_RUNTIME (NEWARRAYT, "_d_newarrayT", RT(ARRAY_VOID),
84-
P2(CONST_TYPEINFO, SIZE_T), 0)
88+
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
8589
DEF_D_RUNTIME (NEWARRAYIT, "_d_newarrayiT", RT(ARRAY_VOID),
86-
P2(CONST_TYPEINFO, SIZE_T), 0)
90+
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
8791
DEF_D_RUNTIME (NEWARRAYMTX, "_d_newarraymTX", RT(ARRAY_VOID),
88-
P2(CONST_TYPEINFO, ARRAY_SIZE_T), 0)
92+
P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)
8993
DEF_D_RUNTIME (NEWARRAYMITX, "_d_newarraymiTX", RT(ARRAY_VOID),
90-
P2(CONST_TYPEINFO, ARRAY_SIZE_T), 0)
94+
P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)
9195

9296
/* Used for allocating an array literal on the GC heap. */
9397
DEF_D_RUNTIME (ARRAYLITERALTX, "_d_arrayliteralTX", RT(VOIDPTR),
94-
P2(CONST_TYPEINFO, SIZE_T), 0)
98+
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
9599

96100
/* Used when calling delete on an array. */
97101
DEF_D_RUNTIME (DELARRAYT, "_d_delarray_t", RT(VOID),
@@ -107,7 +111,7 @@ DEF_D_RUNTIME (ADCMP2, "_adCmp2", RT(INT),
107111
/* Used when casting from one array type to another where the index type
108112
sizes differ. Such as from int[] to short[]. */
109113
DEF_D_RUNTIME (ARRAYCAST, "_d_arraycast", RT(ARRAY_VOID),
110-
P3(SIZE_T, SIZE_T, ARRAY_VOID), 0)
114+
P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_LEAF)
111115

112116
/* Used for (array.length = n) expressions. The `i' variant is for when the
113117
initialiser is non-zero. */
@@ -118,12 +122,12 @@ DEF_D_RUNTIME (ARRAYSETLENGTHIT, "_d_arraysetlengthiT", RT(ARRAY_VOID),
118122

119123
/* Used for allocating closures on the GC heap. */
120124
DEF_D_RUNTIME (ALLOCMEMORY, "_d_allocmemory", RT(VOIDPTR), P1(SIZE_T),
121-
ECF_MALLOC | ECF_PURE)
125+
ECF_LEAF | ECF_MALLOC | ECF_PURE)
122126

123127
/* Used for copying an array into a slice, adds an enforcment that the source
124128
and destination are equal in size and do not overlap. */
125129
DEF_D_RUNTIME (ARRAYCOPY, "_d_arraycopy", RT(ARRAY_VOID),
126-
P3(SIZE_T, ARRAY_VOID, ARRAY_VOID), 0)
130+
P3(SIZE_T, ARRAY_VOID, ARRAY_VOID), ECF_LEAF)
127131

128132
/* Used for array assignments from an existing array. The `set' variant is for
129133
when the assignment value is a single element. */
@@ -157,9 +161,9 @@ DEF_D_RUNTIME (ARRAYAPPENDCTX, "_d_arrayappendcTX", RT(ARRAY_BYTE),
157161
/* Same as appending a single element to an array, but specific for when the
158162
source is a UTF-32 character, and the destination is a UTF-8 or 16 array. */
159163
DEF_D_RUNTIME (ARRAYAPPENDCD, "_d_arrayappendcd", RT(ARRAY_VOID),
160-
P2(ARRAYPTR_BYTE, DCHAR), 0)
164+
P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
161165
DEF_D_RUNTIME (ARRAYAPPENDWD, "_d_arrayappendwd", RT(ARRAY_VOID),
162-
P2(ARRAYPTR_BYTE, DCHAR), 0)
166+
P2(ARRAYPTR_BYTE, DCHAR), ECF_LEAF)
163167

164168
/* Used for appending an existing array to another. */
165169
DEF_D_RUNTIME (ARRAYAPPENDT, "_d_arrayappendT", RT(ARRAY_VOID),
@@ -175,19 +179,19 @@ DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),
175179

176180
/* Used to determine is a key exists in an associative array. */
177181
DEF_D_RUNTIME (AAINX, "_aaInX", RT(VOIDPTR),
178-
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), 0)
182+
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF)
179183

180184
/* Used to retrieve a value from an associative array index by a key. The
181185
`Rvalue' variant returns null if the key is not found, where as aaGetY
182186
will create new key entry for assignment. */
183187
DEF_D_RUNTIME (AAGETY, "_aaGetY", RT(VOIDPTR),
184188
P4(POINTER_ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), 0)
185189
DEF_D_RUNTIME (AAGETRVALUEX, "_aaGetRvalueX", RT(VOIDPTR),
186-
P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), 0)
190+
P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), ECF_LEAF)
187191

188192
/* Used when calling delete on a key entry in an associative array. */
189193
DEF_D_RUNTIME (AADELX, "_aaDelX", RT(BOOL),
190-
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), 0)
194+
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF)
191195

192196
/* Used for throw() expressions. */
193197
DEF_D_RUNTIME (THROW, "_d_throw", RT(VOID), P1(OBJECT), ECF_NORETURN)
@@ -206,11 +210,11 @@ DEF_D_RUNTIME (INVARIANT, "_D9invariant12_d_invariantFC6ObjectZv", RT(VOID),
206210
/* Used when performing a switch/cases on a string. The `u' and `d' variants
207211
are for UTF-16 and UTF-32 strings respectively. */
208212
DEF_D_RUNTIME (SWITCH_STRING, "_d_switch_string", RT(INT),
209-
P2(ARRAY_STRING, STRING), 0)
213+
P2(ARRAY_STRING, STRING), ECF_LEAF)
210214
DEF_D_RUNTIME (SWITCH_USTRING, "_d_switch_ustring", RT(INT),
211-
P2(ARRAY_WSTRING, WSTRING), 0)
215+
P2(ARRAY_WSTRING, WSTRING), ECF_LEAF)
212216
DEF_D_RUNTIME (SWITCH_DSTRING, "_d_switch_dstring", RT(INT),
213-
P2(ARRAY_DSTRING, DSTRING), 0)
217+
P2(ARRAY_DSTRING, DSTRING), ECF_LEAF)
214218

215219
/* Used when throwing an error that a switch statement has no default case,
216220
and yet none of the existing cases matched. */

0 commit comments

Comments
 (0)