Skip to content

[CoreCLR] Remove unused struct types from CoreCLR host header #10264

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 2, 2025

This PR removes unused struct types from the CoreCLR host header file (src/native/clr/include/xamarin-app.hh).

Analysis

I systematically analyzed all 26 struct types declared in xamarin-app.hh to determine which ones are actually used in the CoreCLR runtime (excluding the header file itself and the stub file application_dso_stub.cc).

Removed Structs

The following struct types were only declared but never used anywhere in the CoreCLR runtime:

  • BinaryTypeMapHeader - Declared in debug mode section but not referenced anywhere
  • TypeMapIndexHeader - Declared in debug mode section but not referenced anywhere

Verified as Used (Kept)

All other 24 struct types are properly used in the runtime:

  • Implementation usage: TypeMapEntry, TypeMapManagedTypeInfo, TypeMap, TypeMapAssembly, TypeMapModuleEntry, TypeMapModule, TypeMapJava, CompressedAssemblyHeader, CompressedAssemblyDescriptor, AssemblyStore*, RuntimeProperty*, DSOApkEntry, DSOCacheEntry, JniRemapping*, AppEnvironmentVariable
  • Global variable declarations: ApplicationConfig (application_config), XamarinAndroidBundledAssembly (bundled_assemblies), AssemblyStoreRuntimeData (assembly_store)

Changes

  • 1 file changed, 18 deletions(-) - Minimal surgical changes
  • Removed only the unused struct definitions
  • No functional changes to the runtime

The removed structs exist in the Mono runtime side (src/native/mono/) where they are actually used, but they were dead code in the CoreCLR side.

Fixes #10263.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] [CoreCLR] There are unused structures in the CoreCLR host [CoreCLR] Remove unused struct types from CoreCLR host header Jul 2, 2025
@Copilot Copilot AI requested a review from grendello July 2, 2025 09:44
Copilot finished work on behalf of grendello July 2, 2025 09:44
@grendello
Copy link
Contributor

@copilot Remove the bundled_assemblies[] variable from src/native/clr/include/xamarin-app.hh and src/native/clr/xamarin-app-stub/application_dso_stub.cc then run the analysis again.

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

@copilot Remove the bundled_assemblies[] variable from src/native/clr/include/xamarin-app.hh and src/native/clr/xamarin-app-stub/application_dso_stub.cc then run the analysis again.

Completed. Removed the bundled_assemblies[] variable from both files and ran the analysis again. This revealed that XamarinAndroidBundledAssembly struct is now truly unused, so I removed it as well. All remaining 23 struct types are verified as used either directly in runtime code or through global variable declarations. (df2b1c2)

Copilot finished work on behalf of grendello July 2, 2025 10:12
@grendello
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grendello grendello marked this pull request as ready for review July 2, 2025 13:34
@grendello
Copy link
Contributor

@copilot generate a concise commit message, with only the removed types mentioned as a bulleted list

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

@copilot generate a concise commit message, with only the removed types mentioned as a bulleted list

[CoreCLR] Remove unused struct types from host header

Removed types:
• BinaryTypeMapHeader
• TypeMapIndexHeader
• XamarinAndroidBundledAssembly

@Copilot Copilot AI requested a review from grendello July 2, 2025 13:58
Copilot finished work on behalf of grendello July 2, 2025 13:58
Copilot AI and others added 3 commits July 2, 2025 17:54
Co-authored-by: grendello <184788+grendello@users.noreply.github.com>
…struct

Co-authored-by: grendello <184788+grendello@users.noreply.github.com>
@grendello grendello force-pushed the copilot/fix-10263 branch from df2b1c2 to 714a1da Compare July 2, 2025 15:55
@grendello
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grendello
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CoreCLR] There are unused structures in the CoreCLR host
2 participants