Skip to content

Move all array and finalizer functionality into the GC#20698

Merged
thewilsonator merged 6 commits intodlang:masterfrom
schveiguy:gcfinalizerarrays
Jan 14, 2025
Merged

Move all array and finalizer functionality into the GC#20698
thewilsonator merged 6 commits intodlang:masterfrom
schveiguy:gcfinalizerarrays

Conversation

@schveiguy
Copy link
Member

This also removes almost all dependency of the block metadata usage from rt.lifetime, and moves it into the GC. Now, instead of using the runtime to set up the metadata, the GC does it based on the attributes passed in.

Passing in APPENDABLE sets up the used data. Passing in FINALIZE + a typeinfo that is a struct typeinfo sets up the STRUCTFINAL bit and also stores the finalizer in the block.

There are a few remnants, such as the GC calling into the runtime to finalize where the typeinfo is extracted in the runtime instead of by the GC. This will be adjusted in a further PR.

This is split into 2 commits, the first commit adds the feature to set up the metadata in the GC allocation routines. The second commit migrates all calls to use the GC API.

The second commit is quite large, and if it needs further splitting, let me know.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @schveiguy!

Bugzilla references

Your 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 locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#20698"

@schveiguy schveiguy changed the title Move all array functionality into the GC Move all array and finalizer functionality into the GC Jan 14, 2025
@thewilsonator thewilsonator added the Druntime:GC Issues relating the Garbage Collector label Jan 14, 2025
handled by allocating an empty array with metadata!
@schveiguy
Copy link
Member Author

OK, I think I got the issue fixed with the latest commit. Let's see if there are any more...

@schveiguy
Copy link
Member Author

I think there was a non-deterministic test in druntime depending on the GC to collect some specific memory, let's see if this fixes it. The buildkite failure from sociomantic, I have no idea. If that keeps happening, I'll have to investigate.

@schveiguy
Copy link
Member Author

sociomantic swarm was just updated, that's why it's breaking: sociomantic-tsunami/swarm#439

@schveiguy
Copy link
Member Author

buildkite is going to fail until this is merged: sociomantic-tsunami/swarm#440. Other than that I think this is good now.

Realized that I messed up the multi-dimensional array allocator, but there was no official unittest for a 3-dim array! Only the doc builder/autotest caught it! So I added a unittest for it.

@schveiguy
Copy link
Member Author

FYI, I'm going to make a PR for the changelog for all the GC changes separately. It will be one entry, but relate to all the PRs.

@thewilsonator thewilsonator merged commit 93ca467 into dlang:master Jan 14, 2025
38 checks passed
@schveiguy schveiguy deleted the gcfinalizerarrays branch January 15, 2025 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Druntime:GC Issues relating the Garbage Collector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants