diff --git a/Utilities/JIT.h b/Utilities/JIT.h index 4f2617da64..18e6297074 100644 --- a/Utilities/JIT.h +++ b/Utilities/JIT.h @@ -77,7 +77,7 @@ struct jit_runtime_base jit_runtime_base& operator=(const jit_runtime_base&) = delete; const asmjit::Environment& environment() const noexcept; - void* _add(asmjit::CodeHolder* code) noexcept; + void* _add(asmjit::CodeHolder* code, usz align = 64) noexcept; virtual uchar* _alloc(usz size, usz align) noexcept = 0; }; @@ -432,7 +432,7 @@ namespace asmjit // Build runtime function with asmjit::X86Assembler template -inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime* custom_runtime = nullptr) +inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime* custom_runtime = nullptr, bool reduced_size = false) { #ifdef __APPLE__ pthread_jit_write_protect_np(false); @@ -484,7 +484,7 @@ inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime* compiler(); } - const auto result = rt._add(&code); + const auto result = rt._add(&code, reduced_size ? 16 : 64); jit_announce(result, code.codeSize(), name); return reinterpret_cast(uptr(result)); } diff --git a/Utilities/JITASM.cpp b/Utilities/JITASM.cpp index c39d261c22..642eb631bc 100644 --- a/Utilities/JITASM.cpp +++ b/Utilities/JITASM.cpp @@ -211,7 +211,7 @@ const asmjit::Environment& jit_runtime_base::environment() const noexcept return g_env; } -void* jit_runtime_base::_add(asmjit::CodeHolder* code) noexcept +void* jit_runtime_base::_add(asmjit::CodeHolder* code, usz align) noexcept { ensure(!code->flatten()); ensure(!code->resolveUnresolvedLinks()); @@ -219,7 +219,7 @@ void* jit_runtime_base::_add(asmjit::CodeHolder* code) noexcept if (!codeSize) return nullptr; - auto p = ensure(this->_alloc(codeSize, 64)); + auto p = ensure(this->_alloc(codeSize, align)); ensure(!code->relocateToBase(uptr(p))); { diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 144f55e106..c14acd6475 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -4856,7 +4856,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s // Execute LLE call c.br(call_target); #endif - }, runtime.get()); + }, runtime.get(), true); code_ptr = reinterpret_cast(func); return code_ptr;