asmjit::JitRuntime Class Reference
Inheritance diagram for asmjit::JitRuntime:
asmjit::Target

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

JIT runtime is the easiest way of using AsmJit as it abstracts allocation and deallocation of virtual memory where executable code can be placed and from which it can be executed as well.

Public Members

- Public Attributes inherited from asmjit::Target

Member Functions

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

Constructor & Destructor Documentation

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

Creates a JitRuntime instance.

JitRuntime::~JitRuntime()overridenoexcept◆ 

Destroys the JitRuntime instance.

Member Function Documentation

void JitRuntime::reset(ResetPolicy resetPolicy = ResetPolicy::kSoft)noexcept◆ 

Resets the JitRuntime, freeing everything that was allocated by it.

Depending on resetPolicy the currently held memory can be either freed entirely when ResetPolicy::kHard is used, or the allocator can keep some of it for next allocations when ResetPolicy::kSoft is used, which is the default behavior.

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().

Member Data Documentation

JitAllocator JitRuntime::_allocator◆ 

Virtual memory allocator.