Commit d3f7d59
authored
[mono] Use unsigned char when computing UTF8 string hashes (#83273)
* [mono] Use `unsigned char` when computing UTF8 string hashes
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined.
Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results).
Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device.
Fixes #82187
Fixes #78638
* [aot] add DEBUG_AOT_NAME_TABLE code for debugging the class names
AOT compiler: Emits a second "class_name_table_debug" symbol that has all the class names and hashes as strings.
AOT runtime: warns if a class is not found in the name cache
* Add regression test1 parent bbc7e06 commit d3f7d59
File tree
7 files changed
+114
-6
lines changed- src
- mono/mono
- eglib
- metadata
- mini
- tests/Loader/classloader/regressions/GitHub_82187
7 files changed
+114
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5524 | 5524 | | |
5525 | 5525 | | |
5526 | 5526 | | |
5527 | | - | |
| 5527 | + | |
| 5528 | + | |
5528 | 5529 | | |
5529 | 5530 | | |
5530 | 5531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11417 | 11417 | | |
11418 | 11418 | | |
11419 | 11419 | | |
| 11420 | + | |
| 11421 | + | |
| 11422 | + | |
| 11423 | + | |
11420 | 11424 | | |
11421 | 11425 | | |
| 11426 | + | |
| 11427 | + | |
| 11428 | + | |
| 11429 | + | |
| 11430 | + | |
| 11431 | + | |
| 11432 | + | |
| 11433 | + | |
| 11434 | + | |
| 11435 | + | |
| 11436 | + | |
| 11437 | + | |
| 11438 | + | |
| 11439 | + | |
| 11440 | + | |
11422 | 11441 | | |
11423 | 11442 | | |
11424 | 11443 | | |
11425 | 11444 | | |
11426 | 11445 | | |
11427 | 11446 | | |
11428 | 11447 | | |
11429 | | - | |
11430 | 11448 | | |
11431 | 11449 | | |
| 11450 | + | |
| 11451 | + | |
| 11452 | + | |
| 11453 | + | |
11432 | 11454 | | |
11433 | 11455 | | |
11434 | 11456 | | |
| |||
11446 | 11468 | | |
11447 | 11469 | | |
11448 | 11470 | | |
11449 | | - | |
11450 | | - | |
11451 | | - | |
| 11471 | + | |
11452 | 11472 | | |
11453 | 11473 | | |
11454 | 11474 | | |
11455 | 11475 | | |
| 11476 | + | |
| 11477 | + | |
| 11478 | + | |
| 11479 | + | |
| 11480 | + | |
| 11481 | + | |
11456 | 11482 | | |
11457 | 11483 | | |
11458 | 11484 | | |
| |||
11471 | 11497 | | |
11472 | 11498 | | |
11473 | 11499 | | |
| 11500 | + | |
| 11501 | + | |
| 11502 | + | |
| 11503 | + | |
11474 | 11504 | | |
11475 | 11505 | | |
11476 | 11506 | | |
| |||
11488 | 11518 | | |
11489 | 11519 | | |
11490 | 11520 | | |
| 11521 | + | |
| 11522 | + | |
| 11523 | + | |
| 11524 | + | |
| 11525 | + | |
| 11526 | + | |
11491 | 11527 | | |
11492 | 11528 | | |
| 11529 | + | |
| 11530 | + | |
| 11531 | + | |
11493 | 11532 | | |
11494 | 11533 | | |
11495 | 11534 | | |
11496 | 11535 | | |
11497 | 11536 | | |
11498 | 11537 | | |
| 11538 | + | |
| 11539 | + | |
| 11540 | + | |
| 11541 | + | |
| 11542 | + | |
11499 | 11543 | | |
11500 | 11544 | | |
11501 | 11545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2601 | 2601 | | |
2602 | 2602 | | |
2603 | 2603 | | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
2604 | 2608 | | |
2605 | 2609 | | |
2606 | 2610 | | |
| |||
2634 | 2638 | | |
2635 | 2639 | | |
2636 | 2640 | | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
2637 | 2645 | | |
2638 | 2646 | | |
2639 | 2647 | | |
| |||
2673 | 2681 | | |
2674 | 2682 | | |
2675 | 2683 | | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
2676 | 2687 | | |
2677 | 2688 | | |
2678 | 2689 | | |
| |||
2686 | 2697 | | |
2687 | 2698 | | |
2688 | 2699 | | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
2689 | 2707 | | |
2690 | 2708 | | |
2691 | 2709 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments