mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-10-01 10:26:07 -04:00
Reduce recompiler output memory usage, and added multi-threading to recomp process (#128)
* feat(recomp): Reduce recompiler output memory usage Stream output generation, add low-memory config controls, and avoid pathological indirect-jump switch expansion in generated C++. Low-memory mode now avoids retaining per-instruction disassembly strings while still emitting asm comments during output generation. Output workers are bounded/configurable, combined output is streamed, and decoded buffers are released after generation. Also document the new output memory settings. * fix(recomp): added tests for unregistered JR/JALR, updated fallback logic to cover JR/JALR, moved Rabbitizer formatting into R5900Decoder
This commit is contained in:
@@ -39,6 +39,7 @@ namespace ps2recomp
|
||||
std::unordered_set<uint32_t> entryPoints;
|
||||
std::unordered_set<uint32_t> externalEntryPoints;
|
||||
std::unordered_set<uint32_t> resumeEntryPoints;
|
||||
std::unordered_set<uint32_t> indirectFallbackEntryPoints;
|
||||
std::unordered_map<uint32_t, std::vector<uint32_t>> jumpTableTargets;
|
||||
};
|
||||
|
||||
@@ -52,6 +53,7 @@ namespace ps2recomp
|
||||
void setRelocationCallNames(const std::unordered_map<uint32_t, std::string> &callNames);
|
||||
void setConfiguredJumpTables(const std::vector<JumpTable> &jumpTables);
|
||||
void setResumeEntryTargets(const std::unordered_map<uint32_t, std::vector<uint32_t>> &resumeTargetsByOwner);
|
||||
void setEmitInstructionComments(bool emitInstructionComments);
|
||||
|
||||
AnalysisResult collectInternalBranchTargets(const Function &function,
|
||||
const std::vector<Instruction> &instructions,
|
||||
@@ -65,6 +67,7 @@ namespace ps2recomp
|
||||
std::unordered_map<uint32_t, std::vector<uint32_t>> m_resumeEntryTargetsByOwner;
|
||||
const std::vector<Section>& m_sections;
|
||||
BootstrapInfo m_bootstrapInfo;
|
||||
bool m_emitInstructionComments = true;
|
||||
|
||||
std::string translateInstruction(const Instruction &inst);
|
||||
std::string translateMMIInstruction(const Instruction &inst);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "ps2recomp/types.h"
|
||||
#include "ps2recomp/instructions.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace ps2recomp
|
||||
{
|
||||
@@ -14,7 +15,10 @@ namespace ps2recomp
|
||||
R5900Decoder();
|
||||
~R5900Decoder();
|
||||
|
||||
Instruction decodeInstruction(uint32_t address, uint32_t rawInstruction) const;
|
||||
static std::string disassembleInstruction(uint32_t address, uint32_t rawInstruction);
|
||||
static std::string disassembleInstruction(const Instruction &inst);
|
||||
|
||||
Instruction decodeInstruction(uint32_t address, uint32_t rawInstruction, bool includeDisassembly = true) const;
|
||||
|
||||
bool isBranchInstruction(const Instruction &inst) const;
|
||||
bool isJumpInstruction(const Instruction &inst) const;
|
||||
@@ -52,4 +56,4 @@ namespace ps2recomp
|
||||
|
||||
} // namespace ps2recomp
|
||||
|
||||
#endif // PS2RECOMP_R5900_DECODER_H
|
||||
#endif // PS2RECOMP_R5900_DECODER_H
|
||||
|
||||
@@ -173,6 +173,8 @@ namespace ps2recomp
|
||||
std::string outputPath;
|
||||
std::string ghidraMapPath;
|
||||
bool singleFileOutput = false;
|
||||
bool lowMemoryMode = false;
|
||||
uint32_t outputWorkerThreads = 0;
|
||||
bool patchSyscalls = false;
|
||||
bool patchCop0 = true;
|
||||
bool patchCache = true;
|
||||
|
||||
Reference in New Issue
Block a user