Little maintenance update

* Little documentation fixes
  * Added virtual destructor to emit helpers to silence warnings of
    some compilers (it's totally useless change though as it changes
    nothing in reality - emit helpers are allocated mostly on stack)
This commit is contained in:
kobalicek
2025-01-22 22:21:41 +01:00
parent cfc9f813cc
commit e1b20711cc
4 changed files with 12 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ public:
ASMJIT_INLINE_NODEBUG explicit EmitHelper(BaseEmitter* emitter = nullptr) noexcept
: BaseEmitHelper(emitter) {}
ASMJIT_INLINE_NODEBUG virtual ~EmitHelper() noexcept = default;
Error emitRegMove(
const Operand_& dst_,
const Operand_& src_, TypeId typeId, const char* comment = nullptr) override;

View File

@@ -742,8 +742,9 @@ namespace asmjit {
//! JitAllocator::Span span;
//! Error err = allocator.alloc(span, estimatedSize);
//!
//! if (err != kErrorOk) // <- NOTE: This must be checked, always!
//! if (err != kErrorOk) { // <- NOTE: This must be checked, always!
//! return 0;
//! }
//!
//! // Now relocate the code to the address provided by the memory allocator.
//! // Please note that this DOESN'T COPY anything to it. This function will
@@ -780,15 +781,16 @@ namespace asmjit {
//! int out[4];
//!
//! // This code uses AsmJit's ptr_as_func<> to cast between void* and SumIntsFunc.
//! ptr_as_func<SumIntsFunc>(p)(out, inA, inB);
//! SumIntsFunc fn = ptr_as_func<SumIntsFunc>(span.rx());
//! fn(out, inA, inB);
//!
//! // Prints {5 8 4 9}
//! printf("{%d %d %d %d}\n", out[0], out[1], out[2], out[3]);
//!
//! // Release 'p' is it's no longer needed. It will be destroyed with 'vm'
//! // Release `fn` is it's no longer needed. It will be destroyed with 'vm'
//! // instance anyway, but it's a good practice to release it explicitly
//! // when you know that the function will not be needed anymore.
//! allocator.release(p);
//! allocator.release(fn);
//!
//! return 0;
//! }

View File

@@ -24,6 +24,8 @@ public:
ASMJIT_INLINE_NODEBUG explicit BaseEmitHelper(BaseEmitter* emitter = nullptr) noexcept
: _emitter(emitter) {}
ASMJIT_INLINE_NODEBUG virtual ~BaseEmitHelper() noexcept = default;
ASMJIT_INLINE_NODEBUG BaseEmitter* emitter() const noexcept { return _emitter; }
ASMJIT_INLINE_NODEBUG void setEmitter(BaseEmitter* emitter) noexcept { _emitter = emitter; }

View File

@@ -34,6 +34,8 @@ public:
_avxEnabled(avxEnabled || avx512Enabled),
_avx512Enabled(avx512Enabled) {}
ASMJIT_INLINE_NODEBUG virtual ~EmitHelper() noexcept = default;
Error emitRegMove(
const Operand_& dst_,
const Operand_& src_, TypeId typeId, const char* comment = nullptr) override;