asmjit::JitRuntime Class Reference

JIT execution runtime is a special Target that is designed to store and execute the generated code.

Public Members

- Public Attributes inherited from asmjit::Target

Member Functions

Construction & Destruction
- Public Member Functions inherited from asmjit::Target

Constructor & Destructor Documentation

JitRuntime::JitRuntime(const JitAllocator::CreateParams* params = nullptr)explicitnoexcept

Creates a JitRuntime instance.


Destroys the JitRuntime instance.

Member Function Documentation

JitAllocator* JitRuntime::allocator() constnoexcept

Returns the associated JitAllocator.

template<typename Func>
Error JitRuntime::add(Func* dst, CodeHolder* code)noexcept

Allocates memory needed for a code stored in the CodeHolder and relocates the code to the pointer allocated.

The beginning of the memory allocated for the function is returned in dst. If failed Error code is returned and dst is explicitly set to nullptr (this means that you don't have to set it to null before calling add()).

template<typename Func>
Error JitRuntime::release(Func p)noexcept

Releases p which was obtained by calling add().

Error JitRuntime::_add(void** dst, CodeHolder* code)virtualnoexcept

Type-unsafe version of add().

Error JitRuntime::_release(void* p)virtualnoexcept

Type-unsafe version of release().

void JitRuntime::flush(const void* p, size_t size)virtualnoexcept

Flushes an instruction cache.

This member function is called after the code has been copied to the destination buffer. It is only useful for JIT code generation as it causes a flush of the processor's cache.

Flushing is basically a NOP under X86, but is needed by architectures that do not have a transparent instruction cache like ARM.

This function can also be overridden to improve compatibility with tools such as Valgrind, however, it's not an official part of AsmJit.

Member Data Documentation

JitAllocator JitRuntime::_allocator

Virtual memory allocator.