Commit c865a54
authored
[Mono] Optimize mono_dl_build_path for component and Android module loading. (#54971)
* Optimize mono_dl_build_path for component and Android module loading.
mono_dl_build_path probes a lot of variations of paths and in some
situations where modules uses platform specific naming,
it could try at least two paths before getting to the correct one.
This have been a problem for Android a long time since IO is slow
on devices, so always failing two probes per module load adds to
the startup time on Android.
For dynamic component loading the existing schema is particular
bad since the scenario of disabling a component means that the component
won't exist, and using the existing probing it could do 3 or more
load attempts before realize that the component is not present and
use the stub implmenentation.
Commit splits current mono_dl_build_path probing logic so it can be
customized.
For components a new function has been added that will
always use platform prefix and platform suffixes, and if not found
it will stop looking. For most platform that means only one attempt
to load a component instead of at least 3, optimize both the scenario
when the component is awailable as well as when it should be disabled.
Commit also change the default behavior of mono_dl_build_path on Android
reversing current schema making it more likely to find modules using
platform specific naming, like libMyLibrary.so, in first attempt.
It will still fallback using no prefix and default suffix and then
the verbatim name to make sure dllimports will still work as before, but
favorizing modules using platform specific naming.
On all other platforms mono_dl_build_path will continue to keep
its current behaviour.1 parent dd63190 commit c865a54
File tree
4 files changed
+188
-74
lines changed- src/mono/mono
- metadata
- utils
4 files changed
+188
-74
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
| 68 | + | |
61 | 69 | | |
62 | | - | |
| 70 | + | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
| |||
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
| 93 | + | |
| 94 | + | |
85 | 95 | | |
86 | | - | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | | - | |
90 | | - | |
| 99 | + | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| |||
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
109 | | - | |
| 119 | + | |
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
113 | | - | |
| 123 | + | |
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
| |||
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
153 | | - | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | | - | |
157 | | - | |
158 | 166 | | |
159 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
160 | 171 | | |
161 | | - | |
162 | 172 | | |
163 | 173 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 174 | + | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| 178 | + | |
| 179 | + | |
170 | 180 | | |
171 | | - | |
| 181 | + | |
172 | 182 | | |
173 | 183 | | |
174 | 184 | | |
175 | | - | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
180 | 190 | | |
| 191 | + | |
181 | 192 | | |
182 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
183 | 201 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
189 | 207 | | |
190 | | - | |
191 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
192 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
193 | 217 | | |
194 | | - | |
| 218 | + | |
195 | 219 | | |
196 | 220 | | |
197 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
198 | 224 | | |
| 225 | + | |
199 | 226 | | |
200 | 227 | | |
201 | 228 | | |
202 | 229 | | |
203 | | - | |
| 230 | + | |
204 | 231 | | |
205 | | - | |
| 232 | + | |
206 | 233 | | |
207 | 234 | | |
208 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
501 | | - | |
| 499 | + | |
| 500 | + | |
502 | 501 | | |
503 | 502 | | |
504 | 503 | | |
505 | 504 | | |
506 | 505 | | |
507 | 506 | | |
508 | 507 | | |
509 | | - | |
510 | 508 | | |
511 | 509 | | |
512 | 510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 393 | + | |
421 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
422 | 399 | | |
423 | 400 | | |
424 | 401 | | |
| |||
428 | 405 | | |
429 | 406 | | |
430 | 407 | | |
431 | | - | |
432 | | - | |
433 | 408 | | |
434 | 409 | | |
435 | | - | |
436 | | - | |
437 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
438 | 413 | | |
439 | 414 | | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
444 | 418 | | |
445 | 419 | | |
446 | | - | |
447 | | - | |
448 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
449 | 457 | | |
450 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
451 | 481 | | |
452 | 482 | | |
453 | 483 | | |
| |||
471 | 501 | | |
472 | 502 | | |
473 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
474 | 562 | | |
475 | 563 | | |
476 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments