Update GC interface to contain array management functions. #20608
+350
−161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This migrates array management primitives into the GC. Each of these functions either updates the array used space, gets the array used space, or expands an array in-place in a GC-sanctioned way.
The intent is for the array runtime to defer to the GC for these operations, and allow innovation in these areas.
The primitives will never reallocate a block in order to expand it. That must be handled via a separate call to allocation routines (currently done in the lifetime module).
I purposely did not add these to core.memory yet, as these are only useful for internal operations managing array memory. This may remain that way, or in the future, we may expose this. For now, it's an internal detail, only relevant to GC implementors.
This was split into 2 commits The first migrates all the array functions from rt.lifetime to the conservative GC. The second commit fixes issues that were found during build/test. The 2 commits will help review actual changes to the code.