October 10, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise Attachments: | On Fri, 10 Oct 2014 09:14:28 +0200 Marco Leise via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > Am Wed, 8 Oct 2014 23:20:13 +0300 > schrieb ketmar via Digitalmars-d <digitalmars-d@puremagic.com>: > > > On Wed, 08 Oct 2014 13:10:11 -0700 > > Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com> > > wrote: > > > > > Or would "static if (__ctfe)" work? -- Andrei > > ha! The Famous Bug! it works, but not as people expected. as "static if" evaluates when function is *compiling*, __ctfe is false there, and so the whole "true" branch will be removed as dead code. > > > > i believe that compiler should warn about this, 'cause i'm tend to repeatedly hit this funny thing. > > Lol, definitely! I made that mistake myself and Robert Schadek, too in his std.logger. It is now the #1 bug in D code. i made a quick patch that warns on "static if (__ctfe)": https://issues.dlang.org/show_bug.cgi?id=13601 |
October 14, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Wednesday, 8 October 2014 at 07:52:37 UTC, Dmitry Olshansky wrote: > On Tuesday, 7 October 2014 at 21:59:08 UTC, Peter Alexander > > Okay, I think I should go a bit futher with the second version of the tool. > > Things on todo list: > - make tool general enough to work for any GitHub based project (and hackable for other hostings) > - use Brian's D parser to accurately find artifacts > - detect "throw new SomeStuff" pattern and automatically populate potential fix line > - list all source links in one coulmn for the same function (this needs proper parser) > - use blacklist of <module-name>:<artifact name> to filter out CTFE > - use current data from wiki for "potential fix" column if present > The new version is out, it's a bit rough for a proper announcement yet and misses a couple of things from my todo list but the improvement is so radical I decided to share it anyway. With the new pattern-matcher/parser I hacked together in on top of Brain's lexer it's now surgically precise in labeling artifacts. Also I retained as much as possible of original comments (line numbers have changed), and grouped source links per artifact. Updated Wiki: http://wiki.dlang.org/Stuff_in_Phobos_That_Generates_Garbage Tool: https://github.com/DmitryOlshansky/gchunt Also it's "universal" as in any github-hosted D project, for example here is an output for druntime: http://wiki.dlang.org/Stuff_in_Druntime_That_Generates_Garbage Still todo: - blacklisting of modules/artifacts - detect usage of (i)dup - label throw new xyz as `EX` - a few bugs to fix in artifact labeling |
October 15, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Tuesday, 14 October 2014 at 13:29:33 UTC, Dmitry Olshansky wrote:
> On Wednesday, 8 October 2014 at 07:52:37 UTC, Dmitry Olshansky wrote:
>> On Tuesday, 7 October 2014 at 21:59:08 UTC, Peter Alexander
>>
>> Okay, I think I should go a bit futher with the second version of the tool.
>>
>> Things on todo list:
>> - make tool general enough to work for any GitHub based project (and hackable for other hostings)
>> - use Brian's D parser to accurately find artifacts
>> - detect "throw new SomeStuff" pattern and automatically populate potential fix line
>> - list all source links in one coulmn for the same function (this needs proper parser)
>> - use blacklist of <module-name>:<artifact name> to filter out CTFE
>> - use current data from wiki for "potential fix" column if present
>>
>
> The new version is out, it's a bit rough for a proper announcement yet and misses a couple of things from my todo list but the improvement is so radical I decided to share it anyway.
>
> With the new pattern-matcher/parser I hacked together in on top of Brain's lexer it's now surgically precise in labeling artifacts. Also I retained as much as possible of original comments (line numbers have changed), and grouped source links per artifact.
>
> Updated Wiki:
> http://wiki.dlang.org/Stuff_in_Phobos_That_Generates_Garbage
>
> Tool:
> https://github.com/DmitryOlshansky/gchunt
>
>
> Also it's "universal" as in any github-hosted D project, for example here is an output for druntime:
>
> http://wiki.dlang.org/Stuff_in_Druntime_That_Generates_Garbage
>
> Still todo:
> - blacklisting of modules/artifacts
> - detect usage of (i)dup
> - label throw new xyz as `EX`
> - a few bugs to fix in artifact labeling
Thanks a million! That's very very useful.
|
October 16, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris | On Wednesday, 15 October 2014 at 11:25:58 UTC, Chris wrote:
> On Tuesday, 14 October 2014 at 13:29:33 UTC, Dmitry Olshansky wrote:
>> On Wednesday, 8 October 2014 at 07:52:37 UTC, Dmitry Olshansky wrote:
>>> On Tuesday, 7 October 2014 at 21:59:08 UTC, Peter Alexander
>>>
>>> Okay, I think I should go a bit futher with the second version of the tool.
>>>
>>> Things on todo list:
>>> - make tool general enough to work for any GitHub based project (and hackable for other hostings)
>>> - use Brian's D parser to accurately find artifacts
>>> - detect "throw new SomeStuff" pattern and automatically populate potential fix line
>>> - list all source links in one coulmn for the same function (this needs proper parser)
>>> - use blacklist of <module-name>:<artifact name> to filter out CTFE
>>> - use current data from wiki for "potential fix" column if present
>>>
>>
>> The new version is out, it's a bit rough for a proper announcement yet and misses a couple of things from my todo list but the improvement is so radical I decided to share it anyway.
>>
>> With the new pattern-matcher/parser I hacked together in on top of Brain's lexer it's now surgically precise in labeling artifacts. Also I retained as much as possible of original comments (line numbers have changed), and grouped source links per artifact.
>>
>> Updated Wiki:
>> http://wiki.dlang.org/Stuff_in_Phobos_That_Generates_Garbage
>>
>> Tool:
>> https://github.com/DmitryOlshansky/gchunt
>>
>>
>> Also it's "universal" as in any github-hosted D project, for example here is an output for druntime:
>>
>> http://wiki.dlang.org/Stuff_in_Druntime_That_Generates_Garbage
>>
>> Still todo:
>> - blacklisting of modules/artifacts
>> - detect usage of (i)dup
>> - label throw new xyz as `EX`
>> - a few bugs to fix in artifact labeling
>
> Thanks a million! That's very very useful.
I sure hoped so! :)
Sadly I'm going to be incredibly busy this weekend, so the proper release date shifts to sometime afterwards.
|
October 18, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 10/08/2014 10:01 PM, Andrei Alexandrescu wrote:
>
> That's a bummer. Can we get the compiler to remove the "if (__ctfe)"
> code after semantic checking?
>
> Andrei
It seems that __ctfe is treated as constant in the backend.
At least there is no asm code generated for these examples (even without -O).
void main()
{
import std.stdio;
if (__ctfe)
writeln("foo");
}
int main() { return __ctfe ? 1 : 0; }
|
October 18, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 10/08/2014 11:40 PM, Timon Gehr wrote: > This is probably a regression somewhere after 2.060, because with 2.060 > I get > > Error: variable __ctfe cannot be read at compile time > Error: expression __ctfe is not constant or does not evaluate to a bool > > as I'd expect. Marked the bugzilla case as regression. https://issues.dlang.org/show_bug.cgi?id=13601 |
October 18, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Tuesday, 14 October 2014 at 13:29:33 UTC, Dmitry Olshansky wrote:
>
> Also it's "universal" as in any github-hosted D project, for example here is an output for druntime:
>
> http://wiki.dlang.org/Stuff_in_Druntime_That_Generates_Garbage
>
> Still todo:
> - a few bugs to fix in artifact labeling
One artefact labelling bug I noticed was GC.removeRange and GC.removeRoot were placed in the Artefact column where it should have been GC.rangeIter and GC.rootIter.
|
October 20, 2014 Re: On Phobos GC hunt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | "Martin Nowak" wrote in message news:m1udcn$s35$1@digitalmars.com... > On 10/08/2014 10:01 PM, Andrei Alexandrescu wrote: > > > > That's a bummer. Can we get the compiler to remove the "if (__ctfe)" > > code after semantic checking? > > > > Andrei > > It seems that __ctfe is treated as constant in the backend. > > At least there is no asm code generated for these examples (even without > -O). > > void main() > { > import std.stdio; > if (__ctfe) > writeln("foo"); > } > > int main() { return __ctfe ? 1 : 0; } __ctfe is passed to the backend as 'false', and even with -O the basic optimizations will strip it as dead code. So it is removed after semantic checking, but that doesn't help as semantic checking includes @nogc checking. |
Copyright © 1999-2021 by the D Language Foundation