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

Commit

Permalink
Mark library functions that don't call postblit(), destroy(), or othe…
Browse files Browse the repository at this point in the history
…r user implemented functions as ECF_LEAF.
  • Loading branch information
ibuclaw committed Feb 11, 2018
1 parent 9891aaa commit e12299c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
13 changes: 13 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2018-02-11 Iain Buclaw <[email protected]>

* runtime.def (NEWCLASS): Set ECF_LEAF.
(DYNAMIC_CAST, INTERFACE_CAST): Likewise.
(NEWITEMT, NEWITEMIT, DELMEMORY): Likewise.
(NEWARRAYT, NEWARRAYIT): Likewise.
(NEWARRAYMTX, NEWARRAYMITX): Likewise.
(ARRAYLITERALTX, ARRAYCAST): Likewise.
(ALLOCMEMORY, ARRAYCOPY): Likewise.
(ARRAYAPPENDCD, ARRAYAPPENDWD): Likewise.
(AAINX, AAGETRVALUEX, AADELX): Likewise.
(SWITCH_STRING, SWITCH_USTRING, SWITCH_DSTRING): Likewise.

2018-02-11 Iain Buclaw <[email protected]>

* d-codegen.cc (d_save_expr): Always stabilize CALL_EXPR.
Expand Down
48 changes: 26 additions & 22 deletions gcc/d/runtime.def
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ DEF_D_RUNTIME (ARRAY_BOUNDS, "_d_arraybounds", RT(VOID), P2(STRING, UINT),
ECF_COLD | ECF_LEAF | ECF_NORETURN)

/* Used when calling new on a class. */
DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO), 0)
DEF_D_RUNTIME (NEWCLASS, "_d_newclass", RT(OBJECT), P1(CONST_CLASSINFO),
ECF_LEAF)

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

/* Used for casting to a class or interface. */
DEF_D_RUNTIME (DYNAMIC_CAST, "_d_dynamic_cast", RT(OBJECT),
P2(OBJECT, CLASSINFO), 0)
P2(OBJECT, CLASSINFO), ECF_LEAF)
DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
P2(OBJECT, CLASSINFO), 0)
P2(OBJECT, CLASSINFO), ECF_LEAF)

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

/* Used when calling delete on a pointer. */
DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR), 0)
DEF_D_RUNTIME (DELMEMORY, "_d_delmemory", RT(VOID), P1(POINTER_VOIDPTR),
ECF_LEAF)
DEF_D_RUNTIME (DELSTRUCT, "_d_delstruct", RT(VOID),
P2(POINTER_VOIDPTR, TYPEINFO), 0)

/* Used when calling new on an array. The `i' variant is for when the
initialiser is non-zero, and the `m' variant is when initialising a
multi-dimensional array. */
DEF_D_RUNTIME (NEWARRAYT, "_d_newarrayT", RT(ARRAY_VOID),
P2(CONST_TYPEINFO, SIZE_T), 0)
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
DEF_D_RUNTIME (NEWARRAYIT, "_d_newarrayiT", RT(ARRAY_VOID),
P2(CONST_TYPEINFO, SIZE_T), 0)
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)
DEF_D_RUNTIME (NEWARRAYMTX, "_d_newarraymTX", RT(ARRAY_VOID),
P2(CONST_TYPEINFO, ARRAY_SIZE_T), 0)
P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)
DEF_D_RUNTIME (NEWARRAYMITX, "_d_newarraymiTX", RT(ARRAY_VOID),
P2(CONST_TYPEINFO, ARRAY_SIZE_T), 0)
P2(CONST_TYPEINFO, ARRAY_SIZE_T), ECF_LEAF)

/* Used for allocating an array literal on the GC heap. */
DEF_D_RUNTIME (ARRAYLITERALTX, "_d_arrayliteralTX", RT(VOIDPTR),
P2(CONST_TYPEINFO, SIZE_T), 0)
P2(CONST_TYPEINFO, SIZE_T), ECF_LEAF)

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

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

/* Used for allocating closures on the GC heap. */
DEF_D_RUNTIME (ALLOCMEMORY, "_d_allocmemory", RT(VOIDPTR), P1(SIZE_T),
ECF_MALLOC | ECF_PURE)
ECF_LEAF | ECF_MALLOC | ECF_PURE)

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

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

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

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

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

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

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

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

0 comments on commit e12299c

Please sign in to comment.