-
Notifications
You must be signed in to change notification settings - Fork 555
[CoreCLR] Generate less relocations in the native typemap code #10225
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
Conversation
77ed61f
to
fa405a6
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
7e7b44d
to
37c49f7
Compare
37c49f7
to
9b627d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the native typemap data in order to reduce the number of relocations in libxamarin-app.so by replacing per-module pointer fields with array indices. Key changes include replacing pointer fields with index fields in TypeMapModule, reorganizing type mapping arrays for primary and duplicate maps in both native and managed code, and updating the LLVM IR generation to support the new array-based layout.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/native/clr/xamarin-app-stub/application_dso_stub.cc | Added declarations for modules_map_data and modules_duplicates_data arrays. |
src/native/clr/include/xamarin-app.hh | Modified TypeMapModule to store indices instead of pointers. |
src/native/clr/host/typemap.cc | Updated typemap lookup logic to use the new index fields and arrays. |
src/Xamarin.Android.Build.Tasks/Utilities/TypeMappingReleaseNativeAssemblyGeneratorCLR.cs | Removed redundant symbol name lookup methods that referenced removed pointer fields. |
src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/* | Updated LLVM IR generation code to support the new sectioned array types for module maps. |
Context: 96a73e6
Context: f37158e
This is another PR in the series that remove native relocations from
the
libxamarin-app.so
library.Modify the typemap data so that no pointers to per-module data for
the primary and duplicate maps need to be stored. Module here refers
to a single assembly used by the application. Each assembly/module is
described by an instance of a C++
struct
which used to contain up totwo pointers to tables containing actual type mapping data - one for the
primary map (all modules have this one) and an optional map of duplicate
types, which was stored in another pointer.
The two pointers pointed to separate arrays of map data structures. Instead,
this PR now puts all of the primary map data for all modules in one array,
and all of the duplicate map data in another array. The assembly/module descriptor
structures now merely contain indices into those arrays.
This removes up to X*2 relocations (with X being the number of assemblies).
The change gives us another modest startup performance boost of 0.67% on a Pixel 8
device, using the
dotnet new maui -sc
sample. It also decreases the number ofrelocations in
libxamarin-app.so
from 394 to 70 entries for this sample app.Modest size decrease of
libxamarin-app.so
is another outcome: