digitalmars.D.learn - Disabling All Inlining in DMD Debug Builds
- Jack Stouffer (17/17) Oct 24 2022 I use
- Imperatorn (3/20) Oct 24 2022 Search and replace pragma(inline, true) with //pragma(inline,
- ryuukk_ (11/28) Oct 24 2022 This is ugly, but that works
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (7/8) Oct 25 2022 Moreover, I've been using, for instance,
- ryuukk_ (6/15) Oct 25 2022 The 'else' is easy to miss when reading that code
- Jack Stouffer (2/11) Oct 25 2022 This looks like a workable solution for now. Thanks
I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing operator overload function wasn't inlined the debug build would have a ~10x slowdown and become un-testable in many ways. What sucks about this is that stepping through the code in a debugger is way worse because the the "step-over" operation no longer works properly. Maybe this is a bug in the PDB output, but trying to step over an inlined function call still takes you into the inlined function body as if it were a step-in. So is there a way to tell DMD to ignore these pragmas in certain builds?
Oct 24 2022
On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote:I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing operator overload function wasn't inlined the debug build would have a ~10x slowdown and become un-testable in many ways. What sucks about this is that stepping through the code in a debugger is way worse because the the "step-over" operation no longer works properly. Maybe this is a bug in the PDB output, but trying to step over an inlined function call still takes you into the inlined function body as if it were a step-in. So is there a way to tell DMD to ignore these pragmas in certain builds?Search and replace pragma(inline, true) with //pragma(inline, true) ;)
Oct 24 2022
On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote:I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing operator overload function wasn't inlined the debug build would have a ~10x slowdown and become un-testable in many ways. What sucks about this is that stepping through the code in a debugger is way worse because the the "step-over" operation no longer works properly. Maybe this is a bug in the PDB output, but trying to step over an inlined function call still takes you into the inlined function body as if it were a step-in. So is there a way to tell DMD to ignore these pragmas in certain builds?This is ugly, but that works ```D version(DebugFast) pragma(inline, true); void my_function() { } ``` But that'll only inline if you build with DEBUG_FAST, wich is not what you want I wish we could do ``version(DebugFast | Release)``
Oct 24 2022
On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:I wish we could do ``version(DebugFast | Release)``Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to get correct coverage inclusion of `foo()`. Is this still neeed?
Oct 25 2022
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote:On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:The 'else' is easy to miss when reading that code There must be a better solution than that, ``version`` is just too rigid Looks like OP opened an issue about it: https://issues.dlang.org/show_bug.cgi?id=23435I wish we could do ``version(DebugFast | Release)``Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to get correct coverage inclusion of `foo()`. Is this still neeed?
Oct 25 2022
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote:On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:This looks like a workable solution for now. ThanksI wish we could do ``version(DebugFast | Release)``Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to get correct coverage inclusion of `foo()`. Is this still neeed?
Oct 25 2022