-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hash names of all the packaged DSOs (#6522)
[monodroid] Hash the names of all packaged DSOs (#6522) Context: #6522 Context: https://sourceware.org/binutils/docs-2.37/as/index.html Context: https://sourceware.org/binutils/docs-2.37/as/AArch64-Directives.html#AArch64-Directives Context: https://sourceware.org/binutils/docs-2.37/as/ARM-Directives.html#ARM-Directives Context: https://sourceware.org/binutils/docs-2.37/as/ARM-Directives.html#ARM-Directives Context: https://sourceware.org/binutils/docs-2.37/as/Quad.html#Quad Commit 000cf5a introduced hashing of native library names so that we would only try to load specific Mono components which were configured at app build time. Expand this concept so that we support hashing any form of native library name (DSO name) sent to use by Mono, and look for a cached entry for that DSO. The cache includes the actual native library name, whether it should be ignored when requested (e.g. an empty AOT `.so` file; see db161ae & df667b0), and the cached `dlopen()` value: struct DSOCacheEntry { uint64_t hash; bool ignore; const char *name; void *handle; }; DSOCacheEntry dso_cache[] = {…}; The `dso_cache` is computed at App build time, and stored in `libxamarin-app.so`, and contains values sorted on `DSOCacheEntry::hash`. The use of `dso_cache` removes a bit of string processing from both startup and the application run time, reducing app startup times in some scenarios: | Scenario | Before ms | After ms | Δ | | --------------------------------------------- | --------: | --------: | -------: | | Plain Xamarin.Android (JIT, 64-bit) | 311.500 | 311.600 | +0.03% ✗ | | Plain Xamarin.Android (Profiled AOT, 64-bit) | 253.500 | 247.000 | -2.56% ✓ | | .NET MAUI Hello World (JIT, 64-bit) | 1156.300 | 1159.500 | +0.28% ✗ | | .NET MAUI Hello World (Profiled AOT, 64-bit) | 868.900 | 831.700 | -4.28% ✓ | (Times measured on a Pixel 3 XL.) Above table is a subset of values from #6522; see original PR for complete table information. We believe that the occasional increases are within the margin of error. While implementing the above described `dso_cache` idea, I hit known limitations of the native assembler generator code which, until this commit, weren't a problem (mostly related to hard-coded structure and array alignment). Address these limitations by rewriting the assembly generator. It now fully implements the structure and symbol alignment calculation for all the supported architectures. Also added is the ability to generate assembler code from managed structures, using reflection, without the need of manually written code. It also fixes a previously unnoticed issue which made typemap structures not aligned properly, which may have made them slightly slower than necessary.
- Loading branch information
Showing
43 changed files
with
2,626 additions
and
1,269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.