You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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.
Assert.AreEqual(1,value.Length,$"Field '{fieldName}' in {envFile}:{fileLine} is not a valid boolean value (too long)");
514
+
// Allow both decimal and hexadecimal values
515
+
Assert.IsTrue(value.Length>0&&value.Length<=3,$"Field '{fieldName}' in {envFile}:{fileLine} is not a valid boolean value (length not between 1 and 3)");
501
516
502
517
uintfv;
503
-
Assert.IsTrue(UInt32.TryParse(value,outfv),$"Field '{fieldName}' in {envFile}:{fileLine} is not a valid boolean value (not a valid integer)");
518
+
Assert.IsTrue(TryParseInteger(value,outfv),$"Field '{fieldName}' in {envFile}:{fileLine} is not a valid boolean value (not a valid integer)");
504
519
Assert.IsTrue(fv==0||fv==1,$"Field '{fieldName}' in {envFile}:{fileLine} is not a valid boolean value (not a valid boolean value 0 or 1)");
0 commit comments