Commit 4a2bf63
authored
Preserve pointer provenance in the Rust backend. (#870)
* Preserve pointer provenance in the Rust backend.
Use the new `Pointer` and `Length` types in the Rust backend to emit
code that uses `*mut c_void` and `usize` instead of `i32` when working
with pointers and array lengths.
To represent `PointerOrI64`, use a `MaybeUninit<u64>`, since that type
can hold any `u64` and is documented to also preserve provenance.
This change happens to get the generated Rust code close to supporting
memory64, however it isn't complete; the abi code still emits hard-coded
`+ 4` offsets for loading the length of a pointer+length pair in memory.
* Fully-qualify `core` in macro expansions.
* Fix bitcasts between i32 and pointer.
* Implement Bitcast::I32ToP and PToI32 in more backends.
* Use `*mut u8` instead of `*mut c_void` for pointers.
And switch to `add` from `byte_add`.
* Add documentation to `Bitcast` arms about provenance.1 parent ec84c8e commit 4a2bf63
File tree
9 files changed
+273
-108
lines changed- crates
- core/src
- csharp/src
- c/src
- rust/src
- teavm-java/src
9 files changed
+273
-108
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2205 | 2205 | | |
2206 | 2206 | | |
2207 | 2207 | | |
2208 | | - | |
| 2208 | + | |
2209 | 2209 | | |
2210 | 2210 | | |
2211 | | - | |
| 2211 | + | |
2212 | 2212 | | |
2213 | 2213 | | |
2214 | | - | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
2215 | 2220 | | |
2216 | 2221 | | |
2217 | 2222 | | |
| |||
2869 | 2874 | | |
2870 | 2875 | | |
2871 | 2876 | | |
2872 | | - | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
2873 | 2882 | | |
2874 | 2883 | | |
2875 | 2884 | | |
2876 | | - | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
2877 | 2888 | | |
2878 | 2889 | | |
2879 | 2890 | | |
| |||
3015 | 3026 | | |
3016 | 3027 | | |
3017 | 3028 | | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
3018 | 3032 | | |
3019 | 3033 | | |
3020 | 3034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
526 | 536 | | |
527 | 537 | | |
528 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
529 | 557 | | |
530 | 558 | | |
531 | 559 | | |
| |||
1517 | 1545 | | |
1518 | 1546 | | |
1519 | 1547 | | |
1520 | | - | |
| 1548 | + | |
1521 | 1549 | | |
1522 | | - | |
| 1550 | + | |
1523 | 1551 | | |
1524 | 1552 | | |
1525 | 1553 | | |
| |||
1689 | 1717 | | |
1690 | 1718 | | |
1691 | 1719 | | |
1692 | | - | |
| 1720 | + | |
1693 | 1721 | | |
1694 | | - | |
| 1722 | + | |
1695 | 1723 | | |
1696 | 1724 | | |
1697 | 1725 | | |
| |||
1742 | 1770 | | |
1743 | 1771 | | |
1744 | 1772 | | |
1745 | | - | |
| 1773 | + | |
1746 | 1774 | | |
1747 | | - | |
| 1775 | + | |
1748 | 1776 | | |
1749 | 1777 | | |
1750 | 1778 | | |
| |||
1772 | 1800 | | |
1773 | 1801 | | |
1774 | 1802 | | |
1775 | | - | |
| 1803 | + | |
1776 | 1804 | | |
1777 | | - | |
| 1805 | + | |
1778 | 1806 | | |
1779 | 1807 | | |
1780 | 1808 | | |
| |||
1862 | 1890 | | |
1863 | 1891 | | |
1864 | 1892 | | |
1865 | | - | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1866 | 1899 | | |
1867 | 1900 | | |
1868 | 1901 | | |
| |||
1875 | 1908 | | |
1876 | 1909 | | |
1877 | 1910 | | |
1878 | | - | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1879 | 1927 | | |
1880 | 1928 | | |
1881 | 1929 | | |
| |||
0 commit comments