Temporaries which may need to invoke the copy or move constructor or the postblit but do not currently do so:
Legend:
- s: created with a call to
symbol_genauto()
- c: created with a call to
el_copytotmp()
orexp2_copytotemp()
- m: created with a call to
el_same()
- a: created with a call to
addressElem()
- e: created with a call to
ExpressionsToStaticArray()
source code | test case | fixed by pull request | creation method | description |
---|---|---|---|---|
e2ir.d:315 | link | 10510 | s | the "hidden argument" for a function call. assignments to it do not call the copy constructor. when nrvo is applicable there is no issue. |
e2ir.d:3322 | link | 10539 | s | concatenation assignment of an element to an array |
e2ir.d:5441 | see rows with e as the creation method |
- | s | static array creation inside ExpressionsToStaticArray() |
e2ir.d:5668 | link | 10510 | s | symbol for struct literal |
e2ir.d:623 | link | not solved yet | c | temporaries made to enforce the evaluation order of function arguments |
e2ir.d:5926 | link | partial fix at 10577 | m | side effect extracted before calling scope destructors |
e2ir.d:263 | link | 10510 | a | value argument copied then passed by ref to conform to calling conventions. usually is a non-POD struct |
e2ir.d:5242 | link | 10510 | e | static array literal |
e2ir.d:5520 | not sure how to test it | - | e | keys of associative array literal. |
e2ir.d:5523 | link | needs move constructor | e | values of associative array literal. passed to druntime which does a move currently. will need to call the move constructor when it arrives in the language. |
Following is a list of temporaries which on the surface seem to be potentially copying non POD aggregates, but auditing and testing has shown that it doesn't happen in practice.
source code | creation method | description |
---|---|---|
e2ir.d:674 | s | Inside addressElem() , which practically only copies non POD aggregates when the alwaysCopy argument is true , which only happens for function arguments. See note below about addressElem() . |
e2ir.d:5406 | s | Static array temporary. The enclosing function is only called in one location for making a static array of slices. |
s2ir.d:1588 | s | A finally block is inserted, and a temporary is created to hold the return value until the finally block is executed. At the return block level non PODs are only returned by pointer, so the variable's type will be a pointer. |
Following are calls to addressElem()
with the alwaysCopy
argument omitted or explicitly set to false
, in this case it doesn't copy unless the operand is something other than a variable or a dereference.
Auditing and testing on dmd, druntime, and phobos source and test-suites, confirmed that at the IR level non-POD aggregates are either accessed from a variable or a deference thus never get copied here.
source code | creation method | description |
---|---|---|
e2ir.d:254 | a | ref argument |
e2ir.d:350 | a | struct this argument |
e2ir.d:743 | a | static array |
e2ir.d:772 | a | static array |
e2ir.d:822 | a | element of array |
e2ir.d:856 | a | static array |
e2ir.d:2481 | a | static array |
e2ir.d:2495 | a | static array |
e2ir.d:2628 | a | associative array index |
e2ir.d:2648 | a | associative array index |
e2ir.d:2936 | a | reference initialization |
e2ir.d:2969 | a | assignment left hand side |
e2ir.d:3153 | a | assignment left hand side |
e2ir.d:3608 | a | field access |
e2ir.d:3675 | a | this argument |
e2ir.d:3966 | a | address of expression |
e2ir.d:5114 | a | associative array index |
s2ir.d:713 | a | return by reference |
source code | creation method | description |
---|---|---|
e2ir.d:1645 | s | class allocated on the stack |
e2ir.d:1906 | s | new T() |
e2ir.d:2066 | s | class |
e2ir.d:2075 | s | pointer to struct |
e2ir.d:3152 | s | pointer to array |
e2ir.d:3209 | s | temporary used by druntime for swapping elements. druntime takes responsibility of calling the proper functions |
e2ir.d:3334 | s | dynamic array (part of cat elem assign) |
e2ir.d:3820 | s | pointer to function |
e2ir.d:3831 | s | function |
e2ir.d:3887 | s | pointer to function |
e2ir.d:3896 | s | delegate |
e2ir.d:4157 | s | array from vector |
e2ir.d:5258 | s | pointer to the first element of a gc array literal |
e2ir.d:359 | c | this pointer |
e2ir.d:4983 | c | array index |
e2ir.d:202 | m | delegate |
e2ir.d:390 | m | this pointer |
e2ir.d:518 | m | this pointer |
e2ir.d:1660 | m | class pointer |
e2ir.d:1666 | m | class pointer |
e2ir.d:1683 | m | class pointer |
e2ir.d:1689 | m | class pointer |
e2ir.d:1801 | m | struct pointer |
e2ir.d:2217 | m | pointer |
e2ir.d:2236 | m | pointer |
e2ir.d:2473 | m | dynamic array of scalar type |
e2ir.d:2474 | m | dynamic array of scalar type |
e2ir.d:2475 | m | integer type |
e2ir.d:2482 | m | pointer to static array |
e2ir.d:2487 | m | dynamic array of scalar type |
e2ir.d:2489 | m | dynamic array of scalar type |
e2ir.d:2490 | m | integer type |
e2ir.d:2496 | m | pointer to static array |
e2ir.d:2506 | m | integer type |
e2ir.d:2712 | m | pointer to static array |
e2ir.d:2717 | m | dynamic array |
e2ir.d:2725 | m | pointer |
e2ir.d:2732 | m | integer type |
e2ir.d:2734 | m | integer type |
e2ir.d:2764 | m | integer type |
e2ir.d:2820 | m | array of scalar or trivial type |
e2ir.d:2847 | m | array of scalar or trivial type |
e2ir.d:2969 | m | pointer |
e2ir.d:3049 | m | pointer |
e2ir.d:3053 | m | pointer |
e2ir.d:3697 | m | this pointer |
e2ir.d:4299 | m | dynamic array |
e2ir.d:4343 | m | class pointer |
e2ir.d:4975 | m | dynamic array or pointer to static array |
e2ir.d:4983 | m | integer type, array index |
e2ir.d:4997 | m | integer type, array index |
e2ir.d:5011 | m | dynamic array |
e2ir.d:5028 | m | integer type, array index |
e2ir.d:5137 | m | pointer |
e2ir.d:5167 | m | dynamic array |
e2ir.d:5171 | m | integer type, array index |
e2ir.d:5917 | m | pointer to struct or static array |
s2ir.d:912 | s | pointer |
s2ir.d:478 | c | switch cond |
toir.d:194 | s | pointer |
toir.d:809 | m | dynamic array |
e2ir.d:1023 | a | argument to memset. assume type is trivial since it will be copied by memset |
e2ir.d:1040 | a | argument to memset |
e2ir.d:1063 | a | argument to memset |
e2ir.d:1879 | a | dynamic array |
e2ir.d:2102 | a | dynamic array |
e2ir.d:2114 | a | dynamic array |
e2ir.d:2216 | a | scalar type |
e2ir.d:2235 | a | scalar type |
e2ir.d:2274 | a | dynamic array |
e2ir.d:2323 | a | dynamic array |
e2ir.d:2591 | a | struct argument to memcmp, assume trivial since memcmp only does bit comparison |
e2ir.d:2593 | a | struct argument to memcmp |
e2ir.d:2899 | a | dynamic array |
e2ir.d:2900 | a | dynamic array |
e2ir.d:2914 | a | dynamic array |
e2ir.d:2915 | a | dynamic array |
e2ir.d:3197 | a | dynamic array |
e2ir.d:3198 | a | dynamic array |
e2ir.d:3220 | a | dynamic array |
e2ir.d:3221 | a | dynamic array |
e2ir.d:3299 | a | dynamic array argument on windows x64 |
e2ir.d:3829 | a | function or delegate |
e2ir.d:4012 | a | dynamic array |
e2ir.d:4045 | a | class object |
e2ir.d:4052 | a | pointer |
e2ir.d:4171 | a | SIMD vector |
e2ir.d:4400 | a | SIMD vector |
e2ir.d:4940 | a | delegate |
e2ir.d:4951 | a | delegate |
e2ir.d:5529 | a | dynamic array |
e2ir.d:5530 | a | dynamic array |
e2ir.d:5540 | a | associative array |
e2ir.d:5552 | a | associative array |
e2ir.d:6089 | a | dynamic array |
e2ir.d:6104 | a | dynamic array |
glue.d:435 | a | dynamic array |
glue.d:436 | a | dynamic array |
glue.d:441 | a | dynamic array |
objc_glue.d:210 | a | delegate |
e2ir.d:1875 | e | static array of integer types |
e2ir.d:3157 | e | array literal constructed directly on the left hand side of assignment |
e2ir.d:5266 | e | dynamically allocated array literal |