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:
+23
-4
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user