-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor TemplateInstance to reduce its size
#11368
Conversation
|
Thanks for your pull request, @andralex! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. 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#11368" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update headers
|
@thewilsonator will update the C++ headers once review settles, thanks! @MoonlightSentinel minded your review, thanks. |
This is because you must reduce the size down to 368 to see an impact (which makes 23 blocks exactly). |
|
OK, so following the recent comments I made |
|
Size is 371 now. |
|
Sorry i was thinking modifications were in TemplateDeclaration hence my previous message could be confusing. |
|
Maybe the solution: inherited member |
Interesting, one step at a time though. |
|
@NilsLankila eh, removed |
OK thanks, I undid my related commit. |
|
@rainers has confirmed that ScopeDsymbol.endlinnum should not be removed, although it's most of the time unsued but when debug info are generated (and codeview only !). Sorry for the wrong track. |
|
The C++ headers need updating as well for the changed layout. (None of the fields seem to be used directly from LDC this time, so this is just a matter of avoiding ABI issues down the road.) |
Will do as soon as we settle on the layout. |
|
Operated change on the C++ side as well (blindly), any mistake? Any other places to change? |
Don't think so. You could probably drop the C++ implementations as well; it's unlikely that these members are even used from C++ land. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from small nits also mentioned by @dnadlinger, I have some reservations about whether nest and the other bool flags really are mutually exclusive (what happens if I call toChars in the middle of a gdb session after one of the flags has been set?)
They can be used concomitantly. The taken bits are the uppermost ones, whereas the only way |
Oh, now I see. I'm Captain Slow today. |
Refactor `TemplateInstance` to reduce its size merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
Refactor `TemplateInstance` to reduce its size merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
|
This code is severely aesthetically displeasing. |
|
|
||
| extern(D) final @safe @property pure nothrow @nogc | ||
| { | ||
| ushort nest() const { return _nest & Flag.available; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andralex style mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one?
It's in line with https://dlang.org/dstyle.html (see "exceptions") and common pattern used all over in DMD/Druntime/Phobos.
| bool semantictiargsdone() const { return (_nest & Flag.semantictiargsdone) != 0; } | ||
| void semantictiargsdone(bool x) | ||
| { | ||
| if (x) _nest |= Flag.semantictiargsdone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andralex style mistake
This reduces the size of
TemplateInstancefrom 384 bytes to 375 bytes. It does not affect compilation times or memory consumed in my tests on a large project. The impact will come if combined with other size improvements.