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:
Nekotekina 2019-01-26 23:15:45 +03:00
parent d1f544c755
commit 4292997a01
7 changed files with 219 additions and 358 deletions

View file

@ -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);