JIT.h: Add option for lowered function size

This commit is contained in:
Elad 2025-01-22 10:33:07 +02:00
parent 67f2356ef7
commit 3f4210437d
3 changed files with 6 additions and 6 deletions

View File

@ -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 <typename FT, typename Asm = native_asm, typename F>
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<FT>(uptr(result));
}

View File

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

View File

@ -4856,7 +4856,7 @@ bool ppu_initialize(const ppu_module<lv2_obj>& info, bool check_only, u64 file_s
// Execute LLE call
c.br(call_target);
#endif
}, runtime.get());
}, runtime.get(), true);
code_ptr = reinterpret_cast<u64>(func);
return code_ptr;