-
-
Notifications
You must be signed in to change notification settings - Fork 643
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
Templated arrayshrinkfit #21152
base: master
Are you sure you want to change the base?
Templated arrayshrinkfit #21152
Conversation
Thanks for your pull request and interest in making D better, @solo-source! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. 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#21152" |
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.
I made an initial review. This is a good starting point. Now to start templating the hook itself, first make sure all tests pass with this approach. Then copy the logic of the old one in the template and extract the TypeInfo
using typeid
. When all tests pass with this approach, start replacing TypeInfo
usage with the template T
and static if
s.
The current test failure still has to do with your hook [1].
[1] https://github.com/dlang/dmd/actions/runs/14283753130/job/40036353251?pr=21152
Co-authored-by: Teodor Dutu <[email protected]>
Co-authored-by: Teodor Dutu <[email protected]>
Co-authored-by: Teodor Dutu <[email protected]>
Hi @teodutu i tried to isolate and reproduce the failing behavior i was observing on my local machine at Line 4043 in b2926b6
While executing this i am getting the following Output
I am stumped, can’t pin point why this is happening, what are your thoughts on this? |
This PR is for demonstrating the protoype implementation of the _d_arrayshrinkfit runtime hook.
This implementation:
Implementation Details
The implementation:
_d_arrayshrinkfitT
that forwards to the original implementationobject.d
to use this templated version in theassumeSafeAppend
functionTesting

I've added a simple unittest to verify the basic functionality. The test creates an array with extra capacity, applies the shrinkfit function, and checks that the array contents remain unchanged. While running the full druntime-test suite shows some failures in the profile subsystem, these appear unrelated to this change. I have added a screehshot capturing the error below.
I have a few questions