mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Add cpu_flag::jit_return
This commit is contained in:
parent
849411693a
commit
3794f65bb6
@ -131,7 +131,7 @@ bool cpu_thread::check_state()
|
|||||||
state -= cpu_flag::memory;
|
state -= cpu_flag::memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state & cpu_flag::exit + cpu_flag::dbg_global_stop)
|
if (state & cpu_flag::exit + cpu_flag::jit_return + cpu_flag::dbg_global_stop)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ enum class cpu_flag : u32
|
|||||||
signal, // Thread received a signal (HLE)
|
signal, // Thread received a signal (HLE)
|
||||||
memory, // Thread must unlock memory mutex
|
memory, // Thread must unlock memory mutex
|
||||||
|
|
||||||
|
jit_return, // JIT compiler event (forced return)
|
||||||
dbg_global_pause, // Emulation paused
|
dbg_global_pause, // Emulation paused
|
||||||
dbg_global_stop, // Emulation stopped
|
dbg_global_stop, // Emulation stopped
|
||||||
dbg_pause, // Thread paused
|
dbg_pause, // Thread paused
|
||||||
@ -60,7 +61,7 @@ public:
|
|||||||
// Test stopped state
|
// Test stopped state
|
||||||
bool is_stopped()
|
bool is_stopped()
|
||||||
{
|
{
|
||||||
return !!(state & (cpu_flag::stop + cpu_flag::exit + cpu_flag::dbg_global_stop));
|
return !!(state & (cpu_flag::stop + cpu_flag::exit + cpu_flag::jit_return + cpu_flag::dbg_global_stop));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test paused state
|
// Test paused state
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// SPU ASMJIT Recompiler
|
// SPU ASMJIT Recompiler
|
||||||
class spu_recompiler : public spu_recompiler_base
|
class spu_recompiler : public spu_recompiler_base
|
||||||
{
|
{
|
||||||
std::shared_ptr<spu_runtime> m_spurt;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
spu_recompiler();
|
spu_recompiler();
|
||||||
|
|
||||||
|
@ -582,6 +582,15 @@ spu_function_t spu_runtime::make_branch_patchpoint(u32 target) const
|
|||||||
return reinterpret_cast<spu_function_t>(raw);
|
return reinterpret_cast<spu_function_t>(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void spu_runtime::handle_return(cpu_thread* _thr)
|
||||||
|
{
|
||||||
|
// Wait until the runtime becomes available
|
||||||
|
//writer_lock lock(*this);
|
||||||
|
|
||||||
|
// Simply reset the flag
|
||||||
|
_thr->state -= cpu_flag::jit_return;
|
||||||
|
}
|
||||||
|
|
||||||
spu_recompiler_base::spu_recompiler_base()
|
spu_recompiler_base::spu_recompiler_base()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1874,9 +1883,6 @@ void spu_recompiler_base::dump(std::string& out)
|
|||||||
|
|
||||||
class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
||||||
{
|
{
|
||||||
// SPU Runtime Instance
|
|
||||||
std::shared_ptr<spu_runtime> m_spurt;
|
|
||||||
|
|
||||||
// JIT Instance
|
// JIT Instance
|
||||||
jit_compiler m_jit{{}, jit_compiler::cpu(g_cfg.core.llvm_cpu)};
|
jit_compiler m_jit{{}, jit_compiler::cpu(g_cfg.core.llvm_cpu)};
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ public:
|
|||||||
// Generate a patchable trampoline to spu_recompiler_base::branch
|
// Generate a patchable trampoline to spu_recompiler_base::branch
|
||||||
spu_function_t make_branch_patchpoint(u32 target) const;
|
spu_function_t make_branch_patchpoint(u32 target) const;
|
||||||
|
|
||||||
|
// Handle cpu_flag::jit_return
|
||||||
|
void handle_return(cpu_thread* _thr);
|
||||||
|
|
||||||
// All dispatchers (array allocated in jit memory)
|
// All dispatchers (array allocated in jit memory)
|
||||||
static atomic_t<spu_function_t>* const g_dispatcher;
|
static atomic_t<spu_function_t>* const g_dispatcher;
|
||||||
};
|
};
|
||||||
@ -87,6 +90,8 @@ public:
|
|||||||
class spu_recompiler_base
|
class spu_recompiler_base
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
std::shared_ptr<spu_runtime> m_spurt;
|
||||||
|
|
||||||
u32 m_pos;
|
u32 m_pos;
|
||||||
u32 m_size;
|
u32 m_size;
|
||||||
|
|
||||||
@ -137,6 +142,17 @@ public:
|
|||||||
// Print analyser internal state
|
// Print analyser internal state
|
||||||
void dump(std::string& out);
|
void dump(std::string& out);
|
||||||
|
|
||||||
|
// Get SPU Runtime
|
||||||
|
spu_runtime& get_runtime()
|
||||||
|
{
|
||||||
|
if (!m_spurt)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
return *m_spurt;
|
||||||
|
}
|
||||||
|
|
||||||
// Create recompiler instance (ASMJIT)
|
// Create recompiler instance (ASMJIT)
|
||||||
static std::unique_ptr<spu_recompiler_base> make_asmjit_recompiler();
|
static std::unique_ptr<spu_recompiler_base> make_asmjit_recompiler();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user