mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-16 12:09:07 +00:00
early jit init
This commit is contained in:
parent
185e6cd429
commit
7326c11a3e
@ -114,11 +114,12 @@ public:
|
||||
void sub_v(int vdst, int vsrc1, int vsrc2);
|
||||
void mul_v(int vdst, int vsrc1, int vsrc2);
|
||||
|
||||
void makeExecutable();
|
||||
|
||||
private:
|
||||
void emit32(u32 instruction);
|
||||
void emit64(u64 instruction);
|
||||
void* allocateCode(size_t size);
|
||||
void makeExecutable();
|
||||
|
||||
void* code_buffer;
|
||||
void* code_ptr;
|
||||
|
||||
@ -55,6 +55,11 @@ ExecutionEngine::~ExecutionEngine() {
|
||||
}
|
||||
|
||||
void ExecutionEngine::Initialize() {
|
||||
if (IsInitialized()) {
|
||||
LOG_DEBUG(Core, "JIT Execution Engine already initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
code_buffer = AllocateExecutableMemory(code_buffer_size);
|
||||
if (!code_buffer) {
|
||||
throw std::bad_alloc();
|
||||
|
||||
@ -28,6 +28,9 @@ public:
|
||||
|
||||
void Initialize();
|
||||
void Shutdown();
|
||||
bool IsInitialized() const {
|
||||
return code_buffer != nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
CodeBlock* TranslateBasicBlock(VAddr start_address, size_t max_instructions = 100);
|
||||
|
||||
@ -56,7 +56,10 @@ static PS4_SYSV_ABI void* RunMainEntry [[noreturn]] (EntryParams* params) {
|
||||
static PS4_SYSV_ABI void* RunMainEntry [[noreturn]] (EntryParams* params) {
|
||||
auto* jit = Core::Jit::JitEngine::Instance();
|
||||
if (jit) {
|
||||
jit->Initialize();
|
||||
// JIT should already be initialized in Emulator::Run(), but check just in case
|
||||
if (!jit->IsInitialized()) {
|
||||
jit->Initialize();
|
||||
}
|
||||
jit->ExecuteBlock(params->entry_addr);
|
||||
} else {
|
||||
LOG_CRITICAL(Core_Linker, "JIT engine not available");
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "core/file_format/psf.h"
|
||||
#include "core/file_format/trp.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/jit/execution_engine.h"
|
||||
#include "core/libraries/disc_map/disc_map.h"
|
||||
#include "core/libraries/font/font.h"
|
||||
#include "core/libraries/font/fontft.h"
|
||||
@ -261,6 +262,19 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
|
||||
controller = Common::Singleton<Input::GameController>::Instance();
|
||||
linker = Common::Singleton<Core::Linker>::Instance();
|
||||
|
||||
#ifdef ARCH_ARM64
|
||||
// Initialize JIT engine early for ARM64 builds
|
||||
auto* jit = Core::Jit::JitEngine::Instance();
|
||||
if (jit) {
|
||||
try {
|
||||
jit->Initialize();
|
||||
LOG_INFO(Loader, "JIT Execution Engine initialized");
|
||||
} catch (const std::bad_alloc& e) {
|
||||
LOG_CRITICAL(Loader, "Failed to initialize JIT engine: {}", e.what());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Load renderdoc module
|
||||
VideoCore::LoadRenderDoc();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user