Skip to content

Clean up CoreCLR collection usage - #136595

Merged
AaronRobinsonMSFT merged 1 commit into
dotnet:mainfrom
AaronRobinsonMSFT:collection_cleanup_2
Oct 28, 2026
Merged

AaronRobinsonMSFT merged 1 commit into
dotnet:mainfrom
AaronRobinsonMSFT:collection_cleanup_2

Conversation

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

Summary

  • Use ArrayList::Iterator in AppDomain::AddAssembly and AppDomain::RemoveAssembly, retaining the existing assembly-list locking.
  • Remove the now-unused AssemblyList::Get_UnlockedNoReference method and clarify the iterator accessor's locking requirement.
  • Handle SArray::Append explicitly when BITWISE_COPY is enabled and existing capacity can hold the new element. Use SetCount and return a fresh iterator; retain the existing growth and non-bitwise insertion paths.

Note

This PR description was generated with GitHub Copilot.

Use ArrayList iterators for the AppDomain assembly-list scans and remove the unused no-reference accessor. Handle the BITWISE_COPY spare-capacity case explicitly in SArray::Append while retaining growth and non-bitwise insertion behavior.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b690ada5-81db-4dea-85dc-8e95ea37917a
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@AaronRobinsonMSFT
AaronRobinsonMSFT marked this pull request as ready for review October 28, 2026 18:37
@AaronRobinsonMSFT
AaronRobinsonMSFT requested a balanced review from Copilot October 28, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review identifies no active issues requiring changes.

No open issues 🎉

What changed in this PR

This PR simplifies CoreCLR collection usage while retaining assembly-list locking and existing array growth behavior.

Changes:

  • Use ArrayList::Iterator to find and update assembly-list entries.
  • Remove the unused indexed accessor and clarify iterator locking requirements.
  • Add a SArray::Append path for bitwise-copy elements when capacity is available, using SetCount and returning a fresh iterator.
File Description
src/​coreclr/​vm/​appdomain.hpp Removes the unused accessor and documents iterator locking requirements.
src/​coreclr/​vm/​appdomain.cpp Converts assembly addition and removal loops to iterator-based traversal.
src/​coreclr/​inc/​sarray.h Handles bitwise-copy appends directly when spare capacity exists.

Review effort: Balanced

@AaronRobinsonMSFT
AaronRobinsonMSFT merged commit d72352a into dotnet:main Oct 28, 2026
105 checks passed
@AaronRobinsonMSFT
AaronRobinsonMSFT deleted the collection_cleanup_2 branch October 28, 2026 23:33
@github-project-automation github-project-automation Bot moved this to Done in AppModel Oct 28, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants