Bug 23435 – Add Flag To Disable All Inlining

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-25T02:31:08Z
Last change time
2024-12-13T19:25:10Z
Assigned to
No Owner
Creator
Jack Stouffer
Moved to GitHub: dmd#20169 →

Comments

Comment #0 by jack — 2022-10-25T02:31:08Z
I use `pragma(inline, true)` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. 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 when trying to step over an inlined function call. Maybe this is a bug in the PDB output, but what happens is the inlined function call still takes you into the inlined function body as if you were using step-in. step-over essentially becomes useless for these function calls. Please add a flag -inline=false to hard disable all inlining in the compiler.
Comment #1 by razvan.nitu1305 — 2022-10-26T06:30:06Z
Given the history of dismissing the addition of CLI options, I think that this bug report has a small chance of being fixed. However, as a workaround you could define an `enum INLINE=true` and use `pragma(inline, INLINE)` instead of `pragma(inline, true)`. That way, you can just switch the INLINE to false when you don't want the compiler to do any inlining.
Comment #2 by jack — 2022-10-31T05:03:09Z
(In reply to RazvanN from comment #1) > Given the history of dismissing the addition of CLI options, I think that > this bug report has a small chance of being fixed. However, as a workaround > you could define an `enum INLINE=true` and use `pragma(inline, INLINE)` > instead of `pragma(inline, true)`. That way, you can just switch the INLINE > to false when you don't want the compiler to do any inlining. This doesn't work for inlined functions in dub packages, as you have no control over the source in that case. An actual work-around here is using ldc and passing in --enable-inlining=false, which really sucks because the ldc build for my project is way slower. Since there's already a precedent from LDC, this seems like a really sensible addition. It seems like a smaller change that would make using debuggers a much better experience for everyone. Although, I'm starting to wonder how many D developers use debuggers at all.
Comment #3 by robert.schadek — 2024-12-13T19:25:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20169 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB