Emulator Issues #11333
closedDolphin's JIT can't handle LLVM code
0%
Description
What's the problem? Describe what went wrong.
If you compile Homebrew / Rom Hacks with LLVM, then Dolphin's JIT VERY often miscompiles the code, which then likely results in a crash. You can work around this by disabling optimizations, but that's not really what you want. So I've found this very nice JIT miscompilation bug that I turned into a simple dol file that you can run. If you run it in interpreter mode it prints
[
"Hello"
]
while in JIT mode the jitted code mistakes those ASCII characters as "weird unicode symbols" that should be unicode escaped instead, which gets you:
[
"\u{48}\u{65}\u{6c}\u{6c}\u{6f}"
]
There's also ld's emitted map file attached (although Dolphin can't seem to parse it), but it may still help debugging this code. The problematic code in question is here:
.text._ZN4core7unicode9printable5check17h1839400d5551a9daE.llvm.7306809659103185747
0x8001317c 0xfc ..\libdolphin_bug_report.a(dolphin_bug_report-8cb22bef69218f50.dolphin_bug_report5.rcgu.o)
.text._ZN4core7unicode9printable12is_printable17h9f185153c4da479cE
0x80013278 0x114 ..\libdolphin_bug_report.a(dolphin_bug_report-8cb22bef69218f50.dolphin_bug_report5.rcgu.o)
.text._ZN4core7unicode9bool_trie8BoolTrie6lookup17h62f2e4b30ac269d5E
0x80014940 0xd8 ..\libdolphin_bug_report.a(dolphin_bug_report-8cb22bef69218f50.dolphin_bug_report5.rcgu.o)
which correlate to the following source code:
https://github.com/rust-lang/rust/blob/76b69a604ee0d70be1edfa2828c769dc1b148d13/src/libcore/unicode/printable.rs#L14-L81
and
https://github.com/rust-lang/rust/blob/76b69a604ee0d70be1edfa2828c769dc1b148d13/src/libcore/unicode/bool_trie.rs
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
I'm pretty sure this exists on all Dolphin versions. I'm using 5.0-6865.
Files
Updated by JMC4789 over 6 years ago
If you can compile Dolphin, could you try turning off various JIT optimizations in the PPCAnalyst? Maybe one of those are triggering a bug.
Updated by CryZe92 over 6 years ago
JMC4789 wrote:
If you can compile Dolphin, could you try turning off various JIT optimizations in the PPCAnalyst? Maybe one of those are triggering a bug.
I turned off all of these and it's still happening:
Updated by delroth over 6 years ago
Any way you could just provide this as an ELF with symbols instead of a DOL? Would make things a bit easier. Thanks.
Updated by delroth over 6 years ago
- Status changed from New to Fix pending
- Assignee set to delroth
https://github.com/dolphin-emu/dolphin/pull/7315 fixes your test case.
In general LLVM generates some very CR-heavy code, which is unlike Metrowerks and GCC. As such it's going to hit a lot of rarely used code in our JIT. I wouldn't be surprised if you found a few more issues like that :)
The reduced repro was super useful, thanks a lot!