November 11
https://issues.dlang.org/show_bug.cgi?id=24838

--- Comment #10 from Manu <turkeyman@gmail.com> ---
I promise you it made sense from the start ;)

--
November 11
https://issues.dlang.org/show_bug.cgi?id=24838

--- Comment #11 from Manu <turkeyman@gmail.com> ---
This is a language thing; GDC/LDC have nothing to say about this.
The frontend implements this, it's semantic to detect if a closure only
contains a single thing and then delete it.

Yes, you touched on one issue with mutability of references to stack objects; however `this` is not mutable, it's impossible for `this` to change during the lifetime of the closure, which is why my initial request applies to `this`... any expansion of this optimisation is theoretical, but the case for `this`, which is overwhelmingly the most common and the most useful case should be addressed initially.

Also, why did you rename my issue? :/

--
November 11
https://issues.dlang.org/show_bug.cgi?id=24838

--- Comment #12 from Richard (Rikki) Andrew Cattermole <alphaglosined@gmail.com> ---
I renamed it to translate it into compiler speak.

The ``@nogc`` aspect has nothing to do with the enhancement.

As for ldc/gdc, yes it is a them problem.

Closure creation is part of the glue code, not the frontend itself.

https://github.com/dlang/dmd/blob/b70e66033c7f53b3ac7def31e49d803ff87d6d30/compiler/src/dmd/toir.d#L779

--
November 11
https://issues.dlang.org/show_bug.cgi?id=24838

--- Comment #13 from Manu <turkeyman@gmail.com> ---
There is no closure creation when this case is detected.

@nogc does have something to do with the enhancement, because the enhancement will make code that doesn't currently work in @nogc work after the fix... and that's specifically why I need this fixed.

--
November 14
https://issues.dlang.org/show_bug.cgi?id=24838

Juraj <zero@vec4.xyz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zero@vec4.xyz

--- Comment #14 from Juraj <zero@vec4.xyz> ---
Created attachment 1923
  --> https://issues.dlang.org/attachment.cgi?id=1923&action=edit
Very crude patch, just to pin point the relevant code path.

I made a whack a mole (literally) attempt on this issue.

The code works on the provided code and closure tests in dmd "test suite" (to best of my knowledge how to run them).

I think it is very fragile, and never got to do much more with it, but better to let it rot here than on my drive.

--
1 2
Next ›   Last »