mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
Added jit_runtime class
Is a memory manager for ASMJIT, replaces asmjit::JitRuntime Unified memory manager for ASMJIT and LLVM Unified SPU trampoline generation Remove previous workarounds
This commit is contained in:
parent
d1f544c755
commit
4292997a01
7 changed files with 219 additions and 358 deletions
|
@ -7,10 +7,32 @@
|
|||
#include <array>
|
||||
#include <functional>
|
||||
|
||||
// ASMJIT runtime for emitting code in a single 2G region
|
||||
struct jit_runtime final : asmjit::HostRuntime
|
||||
{
|
||||
jit_runtime();
|
||||
~jit_runtime() override;
|
||||
|
||||
// Allocate executable memory
|
||||
asmjit::Error _add(void** dst, asmjit::CodeHolder* code) noexcept override;
|
||||
|
||||
// Do nothing (deallocation is delayed)
|
||||
asmjit::Error _release(void* p) noexcept override;
|
||||
|
||||
// Allocate memory
|
||||
static u8* alloc(std::size_t size, uint align, bool exec = true) noexcept;
|
||||
|
||||
// Should be called at least once after global initialization
|
||||
static void initialize();
|
||||
|
||||
// Deallocate all memory
|
||||
static void finalize() noexcept;
|
||||
};
|
||||
|
||||
namespace asmjit
|
||||
{
|
||||
// Should only be used to build global functions
|
||||
JitRuntime& get_global_runtime();
|
||||
::jit_runtime& get_global_runtime();
|
||||
|
||||
// Emit xbegin and adjacent loop, return label at xbegin
|
||||
Label build_transaction_enter(X86Assembler& c, Label fallback);
|
||||
|
@ -130,9 +152,6 @@ public:
|
|||
// Get compiled function address
|
||||
u64 get(const std::string& name);
|
||||
|
||||
// Allocate writable executable memory (alignment is assumed 16)
|
||||
static u8* alloc(u32 size);
|
||||
|
||||
// Get CPU info
|
||||
static std::string cpu(const std::string& _cpu);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue