Commit ab76f64
authored
Make
This is a small step forward to making `vm::Instance` safe internally.
Notably the `get_defined_memory` helper now returns a safe mutable
reference instead of a raw pointer. This is then additionally coupled
with the canonicalization of always working with memories as "instance
plus defined memory index" instead of "instance plus memory index". This
enables removing some unsafe `VMContext` to `Instance` conversion as
well. This change, however, required updating libcalls to special-case
when an imported memory is operated on to load the vmcontext/index in
the libcall itself.
This change notably does not update the `memory_init` libcall just yet
due to the fact that the `DataIndex` is relative to the owning instance
even if the memory is owned by a different instance (e.g. it's
imported). Otherwise this chips away at some of the `unsafe` related to
memory/table management in `vm::Instance`.vm::Instance::get_defined_memory safe (#11211)1 parent 8a23cc7 commit ab76f64
File tree
11 files changed
+210
-150
lines changed- crates
- cranelift/src
- environ/src
- wasmtime/src/runtime
- vm
- winch/codegen/src
- codegen
11 files changed
+210
-150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 285 | + | |
291 | 286 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 287 | + | |
| 288 | + | |
300 | 289 | | |
301 | 290 | | |
302 | 291 | | |
| |||
2744 | 2733 | | |
2745 | 2734 | | |
2746 | 2735 | | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
2747 | 2775 | | |
2748 | 2776 | | |
2749 | 2777 | | |
| |||
2753 | 2781 | | |
2754 | 2782 | | |
2755 | 2783 | | |
2756 | | - | |
2757 | 2784 | | |
2758 | | - | |
2759 | | - | |
| 2785 | + | |
| 2786 | + | |
2760 | 2787 | | |
2761 | 2788 | | |
2762 | 2789 | | |
2763 | | - | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
2764 | 2793 | | |
2765 | 2794 | | |
2766 | 2795 | | |
| |||
2910 | 2939 | | |
2911 | 2940 | | |
2912 | 2941 | | |
2913 | | - | |
2914 | | - | |
2915 | | - | |
| 2942 | + | |
| 2943 | + | |
2916 | 2944 | | |
2917 | | - | |
2918 | | - | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
2919 | 2949 | | |
2920 | 2950 | | |
2921 | 2951 | | |
| |||
3056 | 3086 | | |
3057 | 3087 | | |
3058 | 3088 | | |
3059 | | - | |
3060 | | - | |
3061 | | - | |
3062 | | - | |
| 3089 | + | |
3063 | 3090 | | |
3064 | | - | |
| 3091 | + | |
| 3092 | + | |
3065 | 3093 | | |
3066 | 3094 | | |
3067 | 3095 | | |
3068 | | - | |
| 3096 | + | |
3069 | 3097 | | |
3070 | 3098 | | |
3071 | 3099 | | |
| |||
3093 | 3121 | | |
3094 | 3122 | | |
3095 | 3123 | | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
3100 | | - | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
3101 | 3130 | | |
3102 | 3131 | | |
3103 | 3132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
750 | 762 | | |
751 | 763 | | |
752 | 764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
607 | 609 | | |
608 | 610 | | |
609 | 611 | | |
| |||
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
642 | 647 | | |
643 | 648 | | |
644 | 649 | | |
| |||
1040 | 1045 | | |
1041 | 1046 | | |
1042 | 1047 | | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
1047 | 1051 | | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1052 | + | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | 1055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | 426 | | |
443 | 427 | | |
444 | 428 | | |
| |||
698 | 682 | | |
699 | 683 | | |
700 | 684 | | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | 685 | | |
707 | 686 | | |
708 | 687 | | |
709 | 688 | | |
710 | 689 | | |
711 | 690 | | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | 691 | | |
732 | 692 | | |
733 | 693 | | |
| |||
1064 | 1024 | | |
1065 | 1025 | | |
1066 | 1026 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
| 1027 | + | |
| 1028 | + | |
1071 | 1029 | | |
1072 | 1030 | | |
1073 | 1031 | | |
| |||
1126 | 1084 | | |
1127 | 1085 | | |
1128 | 1086 | | |
1129 | | - | |
| 1087 | + | |
1130 | 1088 | | |
1131 | 1089 | | |
1132 | 1090 | | |
1133 | 1091 | | |
| 1092 | + | |
1134 | 1093 | | |
1135 | 1094 | | |
1136 | 1095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
171 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
440 | | - | |
| 443 | + | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
| |||
1056 | 1059 | | |
1057 | 1060 | | |
1058 | 1061 | | |
1059 | | - | |
| 1062 | + | |
1060 | 1063 | | |
1061 | | - | |
| 1064 | + | |
1062 | 1065 | | |
1063 | 1066 | | |
1064 | 1067 | | |
| |||
1073 | 1076 | | |
1074 | 1077 | | |
1075 | 1078 | | |
1076 | | - | |
| 1079 | + | |
1077 | 1080 | | |
1078 | | - | |
| 1081 | + | |
1079 | 1082 | | |
1080 | 1083 | | |
1081 | 1084 | | |
| |||
1090 | 1093 | | |
1091 | 1094 | | |
1092 | 1095 | | |
1093 | | - | |
| 1096 | + | |
1094 | 1097 | | |
1095 | | - | |
| 1098 | + | |
1096 | 1099 | | |
1097 | 1100 | | |
1098 | 1101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
| |||
0 commit comments