Commit 2adc355
committed
Fix type/instruction cache races with atomic ops
- Type cache: use try_to_owned (CAS-based safe_inc) instead of
ManuallyDrop+clone to prevent use-after-free when a concurrent
writer drops the cached value between pointer load and refcount
increment.
- Instruction cache: replace split 4×u16 read/write (torn
read/write under concurrent specialization) with single
AtomicUsize load/store via pointer_cache side array.
- Instruction cache reads: use try_to_owned with deoptimize
fallback instead of blind to_owned on cached descriptor pointers.
- Call modified() BEFORE attribute modification in set_attr and
set___type_params__ so cached descriptor pointers remain alive
when type_cache_clear_version drops cache entries.1 parent 223cf12 commit 2adc355
File tree
3 files changed
+147
-123
lines changed- crates
- compiler-core/src
- vm/src
- builtins
3 files changed
+147
-123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
414 | 418 | | |
415 | 419 | | |
416 | 420 | | |
| |||
432 | 436 | | |
433 | 437 | | |
434 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
435 | 444 | | |
436 | 445 | | |
437 | 446 | | |
| 447 | + | |
438 | 448 | | |
439 | 449 | | |
440 | 450 | | |
| |||
472 | 482 | | |
473 | 483 | | |
474 | 484 | | |
475 | | - | |
| 485 | + | |
| 486 | + | |
476 | 487 | | |
477 | 488 | | |
478 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
479 | 494 | | |
480 | 495 | | |
481 | 496 | | |
| 497 | + | |
482 | 498 | | |
483 | 499 | | |
484 | 500 | | |
| |||
600 | 616 | | |
601 | 617 | | |
602 | 618 | | |
603 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
604 | 623 | | |
605 | 624 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
612 | 628 | | |
613 | 629 | | |
614 | | - | |
| 630 | + | |
615 | 631 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
622 | 635 | | |
623 | 636 | | |
624 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
704 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
705 | 707 | | |
| 708 | + | |
706 | 709 | | |
707 | 710 | | |
708 | 711 | | |
| |||
735 | 738 | | |
736 | 739 | | |
737 | 740 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
753 | 754 | | |
754 | | - | |
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
| |||
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
1501 | | - | |
1502 | 1501 | | |
| 1502 | + | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
| |||
1510 | 1510 | | |
1511 | 1511 | | |
1512 | 1512 | | |
1513 | | - | |
1514 | 1513 | | |
| 1514 | + | |
1515 | 1515 | | |
1516 | 1516 | | |
1517 | 1517 | | |
| |||
0 commit comments