Project

General

Profile

Actions

Emulator Issues #11333

closed

Dolphin's JIT can't handle LLVM code

Added by CryZe92 over 6 years ago. Updated over 6 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

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

bug.dol (130 KB) bug.dol CryZe92, 08/09/2018 08:17 AM
template.elf.map (346 KB) template.elf.map CryZe92, 08/09/2018 08:17 AM
Actions

Also available in: Atom PDF