(
&mut self,
op: Transcode,
from: RuntimeMemoryIndex,
from64: bool,
to: RuntimeMemoryIndex,
to64: bool,
)
| 1816 | |
| 1817 | impl TrampolineCompiler<'_> { |
| 1818 | fn translate_transcode( |
| 1819 | &mut self, |
| 1820 | op: Transcode, |
| 1821 | from: RuntimeMemoryIndex, |
| 1822 | from64: bool, |
| 1823 | to: RuntimeMemoryIndex, |
| 1824 | to64: bool, |
| 1825 | ) { |
| 1826 | let pointer_type = self.isa.pointer_type(); |
| 1827 | let vmctx = self.builder.func.dfg.block_params(self.block0)[0]; |
| 1828 | |
| 1829 | // Determine the static signature of the host libcall for this transcode |
| 1830 | // operation and additionally calculate the static offset within the |
| 1831 | // transode libcalls array. |
| 1832 | let get_libcall = match op { |
| 1833 | Transcode::Copy(FixedEncoding::Utf8) => host::utf8_to_utf8, |
| 1834 | Transcode::Copy(FixedEncoding::Utf16) => host::utf16_to_utf16, |
| 1835 | Transcode::Copy(FixedEncoding::Latin1) => host::latin1_to_latin1, |
| 1836 | Transcode::Latin1ToUtf16 => host::latin1_to_utf16, |
| 1837 | Transcode::Latin1ToUtf8 => host::latin1_to_utf8, |
| 1838 | Transcode::Utf16ToCompactProbablyUtf16 => host::utf16_to_compact_probably_utf16, |
| 1839 | Transcode::Utf16ToCompactUtf16 => host::utf16_to_compact_utf16, |
| 1840 | Transcode::Utf16ToLatin1 => host::utf16_to_latin1, |
| 1841 | Transcode::Utf16ToUtf8 => host::utf16_to_utf8, |
| 1842 | Transcode::Utf8ToCompactUtf16 => host::utf8_to_compact_utf16, |
| 1843 | Transcode::Utf8ToLatin1 => host::utf8_to_latin1, |
| 1844 | Transcode::Utf8ToUtf16 => host::utf8_to_utf16, |
| 1845 | }; |
| 1846 | |
| 1847 | // Load the base pointers for the from/to linear memories. |
| 1848 | let from_base = self.load_runtime_memory_base(vmctx, from); |
| 1849 | let to_base = self.load_runtime_memory_base(vmctx, to); |
| 1850 | |
| 1851 | let mut args = Vec::new(); |
| 1852 | args.push(vmctx); |
| 1853 | |
| 1854 | let uses_retptr = match op { |
| 1855 | Transcode::Utf16ToUtf8 |
| 1856 | | Transcode::Latin1ToUtf8 |
| 1857 | | Transcode::Utf8ToLatin1 |
| 1858 | | Transcode::Utf16ToLatin1 => true, |
| 1859 | _ => false, |
| 1860 | }; |
| 1861 | |
| 1862 | // Most transcoders share roughly the same signature despite doing very |
| 1863 | // different things internally, so most libcalls are lumped together |
| 1864 | // here. |
| 1865 | match op { |
| 1866 | Transcode::Copy(_) |
| 1867 | | Transcode::Latin1ToUtf16 |
| 1868 | | Transcode::Utf16ToCompactProbablyUtf16 |
| 1869 | | Transcode::Utf8ToLatin1 |
| 1870 | | Transcode::Utf16ToLatin1 |
| 1871 | | Transcode::Utf8ToUtf16 => { |
| 1872 | args.push(self.ptr_param(0, from64, from_base)); |
| 1873 | args.push(self.len_param(1, from64)); |
| 1874 | args.push(self.ptr_param(2, to64, to_base)); |
| 1875 | } |
no test coverage detected