Fix the concat assign case of Issue 20321 in a frontend solution#10539
Fix the concat assign case of Issue 20321 in a frontend solution#10539SSoulaimane wants to merge 9 commits intodlang:masterfrom
Conversation
e0a8351 to
edd93f9
Compare
|
buildkite failures are fixed by this DUB PR dlang/dub#1796. |
|
@SSoulaimane although I agree with the change to dub, it looks worrying that this PR causes change in behavior. Do you know what now causes DMD to "print some stuff in between calls of pragma(msg)"? |
Yes, the first commit of this pull request moves druntime calls which are issued for array element concatenation assignment |
|
The part that actually confuses me is this one:
That shouldn't happen, unless dmd is invoked with |
|
Thanks for your pull request, @SSoulaimane! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#10539" |
Solves one of the cases of issue 20321 which wasn't straight forward to solve in the backend since elablorate copy semantics are currently understood by the semantic phase only. See issues 17448 and 20321. The problem is solved by avoiding `doCopyOrMove()` which only partially helps the backend with elaborate copy. This goes hand in hand with the effort being spent on templatizing druntime, this benefit from that effort actually.
Some cases in the test suite started failing after the lowering of concat element assign, particularly `test9023()` from `runnable/interpret.d` which combines array operations with associative arrays.
The instantiation of `_d_arrayappendTImpl` template complains that `__c_wchar_t` is forward referenced because the declaration had no body.
Reproducible with:
```
enum T : int;
void main()
{
T[] a;
_d_arrayappendTImpl!(T[])(a, 1);
}
```
preserves the behaviour of test file `compilable/vgc2.d`.
`static foreach` generates a struct type called `Tuple` which is meant for compile time use only, thus it never ends in the object file. We can't pass this type to a druntime function which uses typeinfo.
Index is not decremented which causes bounds checking error.
Assignment to a ref variable is really assignment to where it points to, which is known to the compiler when the variable is initialized. Reference initialization happens only for foreach parameters and internally made temporaries as far as I know, since `ref` cannot be used for regular variables.
|
This has been superseded by: #13495 |
See discussion on #10510.
Do more lowering in the front-end that reduces the need to create temporaries in the glue layer.
This PR only does the concatenation assignment for arrays, but more cases could be potentially solved in the same way.
When the glue layer decides to copy or move it doesn't call the copy constructor or the postblit since only the semantic phase knows how elaborate copy semantics works.