Skip to content

Commit 9be7d9d

Browse files
Copilotgrendello
andauthored
[CoreCLR] Remove unused struct types from CoreCLR host header (#10264)
Fixes: #10263 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`) 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. Co-authored-by: Marek Habersack <[email protected]>
1 parent 22f4907 commit 9be7d9d

File tree

2 files changed

+1
-53
lines changed

2 files changed

+1
-53
lines changed

src/native/clr/include/xamarin-app.hh

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ static constexpr uint32_t MODULE_INDEX_MAGIC = 0x49544158; // 'XATI', little-end
3838
static constexpr uint8_t MODULE_FORMAT_VERSION = 2; // Keep in sync with the value in src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs
3939

4040
#if defined (DEBUG)
41-
struct BinaryTypeMapHeader
42-
{
43-
uint32_t magic;
44-
uint32_t version;
45-
uint32_t entry_count;
46-
uint32_t java_name_width;
47-
uint32_t managed_name_width;
48-
uint32_t assembly_name_length;
49-
};
50-
51-
struct TypeMapIndexHeader
52-
{
53-
uint32_t magic;
54-
uint32_t version;
55-
uint32_t entry_count;
56-
uint32_t module_file_name_width;
57-
};
58-
5941
// MUST match src/Xamarin.Android.Build.Tasks/Utilities/TypeMappingDebugNativeAssemblyGeneratorCLR.cs
6042
//
6143
// If any of the members is set to maximum uint32_t value it means the entry is ignored (treated
@@ -134,16 +116,6 @@ struct CompressedAssemblyDescriptor
134116
uint32_t buffer_offset;
135117
};
136118

137-
struct XamarinAndroidBundledAssembly
138-
{
139-
int32_t file_fd;
140-
char *file_name;
141-
uint32_t data_offset;
142-
uint32_t data_size;
143-
uint8_t *data;
144-
uint32_t name_length;
145-
char *name;
146-
};
147119

148120
//
149121
// Assembly store format
@@ -370,7 +342,7 @@ extern "C" {
370342

371343
[[gnu::visibility("default")]] extern const char* const mono_aot_mode_name;
372344

373-
[[gnu::visibility("default")]] extern XamarinAndroidBundledAssembly bundled_assemblies[];
345+
374346
[[gnu::visibility("default")]] extern AssemblyStoreSingleAssemblyRuntimeData assembly_store_bundled_assemblies[];
375347
[[gnu::visibility("default")]] extern AssemblyStoreRuntimeData assembly_store;
376348

src/native/clr/xamarin-app-stub/application_dso_stub.cc

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,8 @@ const AppEnvironmentVariable app_environment_variables[] = {};
7878
const char app_environment_variable_contents[] = {};
7979
const char* const app_system_properties[] = {};
8080

81-
static constexpr size_t AssemblyNameWidth = 128uz;
8281

83-
static char first_assembly_name[AssemblyNameWidth];
84-
static char second_assembly_name[AssemblyNameWidth];
8582

86-
XamarinAndroidBundledAssembly bundled_assemblies[] = {
87-
{
88-
.file_fd = -1,
89-
.file_name = nullptr,
90-
.data_offset = 0,
91-
.data_size = 0,
92-
.data = nullptr,
93-
.name_length = 0,
94-
.name = first_assembly_name,
95-
},
96-
97-
{
98-
.file_fd = -1,
99-
.file_name = nullptr,
100-
.data_offset = 0,
101-
.data_size = 0,
102-
.data = nullptr,
103-
.name_length = 0,
104-
.name = second_assembly_name,
105-
},
106-
};
10783

10884
AssemblyStoreSingleAssemblyRuntimeData assembly_store_bundled_assemblies[] = {
10985
{

0 commit comments

Comments
 (0)