Commit Graph

9 Commits

Author SHA1 Message Date
Wiseguy
66062a06e9
Implement live recompiler (#114)
This commit implements the "live recompiler", which is another backend for the recompiler that generates platform-specific assembly at runtime. This is still static recompilation as opposed to dynamic recompilation, as it still requires information about the binary to recompile and leverages the same static analysis that the C recompiler uses. However, similarly to dynamic recompilation it's aimed at recompiling binaries at runtime, mainly for modding purposes.

The live recompiler leverages a library called sljit to generate platform-specific code. This library provides an API that's implemented on several platforms, including the main targets of this component: x86_64 and ARM64.

Performance is expected to be slower than the C recompiler, but should still be plenty fast enough for running large amounts of recompiled code without an issue. Considering these ROMs can often be run through an interpreter and still hit their full speed, performance should not be a concern for running native code even if it's less optimal than the C recompiler's codegen.

As mentioned earlier, the main use of the live recompiler will be for loading mods in the N64Recomp runtime. This makes it so that modders don't need to ship platform-specific binaries for their mods, and allows fixing bugs with recompilation down the line without requiring modders to update their binaries.

This PR also includes a utility for testing the live recompiler. It accepts binaries in a custom format which contain the instructions, input data, and target data. Documentation for the test format as well as most of the tests that were used to validate the live recompiler can be found here. The few remaining tests were hacked together binaries that I put together very hastily, so they need to be cleaned up and will probably be uploaded at a later date. The only test in that suite that doesn't currently succeed is the div test, due to unknown behavior when the two operands aren't properly sign extended to 64 bits. This has no bearing on practical usage, since the inputs will always be sign extended as expected.
2024-12-31 16:11:40 -05:00
Mr-Wiseguy
e0e52d1fc3
Symbol file toml update (#52)
* Symbol input file mechanism

* Migration to new toml lib

---------

Co-authored-by: dcvz <david@dcvz.io>
2024-05-16 22:33:08 -04:00
Mr-Wiseguy
0f813247a1 Added CMake build system, fixed warnings on clang, removed VS solution/projects 2024-04-20 21:05:50 -04:00
Mr-Wiseguy
be275c198a Added single-file mode and absolute symbol options (for patch recompilation) 2023-11-12 14:50:50 -05:00
Mr-Wiseguy
fba0085946 Added toml11 and implemented initial config file parsing, replaces command-line arg inputs 2023-03-24 17:11:17 -04:00
Mr-Wiseguy
217a30b032 Implemented RSP microcode recompilation 2023-02-14 01:06:41 -05:00
Mr-Wiseguy
8a0f0da0cc Implemented initial set of instructions and ignored functions 2022-11-15 19:55:48 -05:00
Mr-Wiseguy
4b1dc14019 Added ELFIO and fmtlib libraries 2022-11-15 19:55:48 -05:00
Mr-Wiseguy
e48fdabdae Initial project setup with rabbitizer submodule 2022-11-15 19:55:48 -05:00