From e1b20711cc40c29ec4918b54e328ace96470f6e5 Mon Sep 17 00:00:00 2001 From: kobalicek Date: Wed, 22 Jan 2025 22:21:41 +0100 Subject: [PATCH] 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) --- src/asmjit/arm/a64emithelper_p.h | 2 ++ src/asmjit/core.h | 10 ++++++---- src/asmjit/core/emithelper_p.h | 2 ++ src/asmjit/x86/x86emithelper_p.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/asmjit/arm/a64emithelper_p.h b/src/asmjit/arm/a64emithelper_p.h index 6e10f9e..85e0c74 100644 --- a/src/asmjit/arm/a64emithelper_p.h +++ b/src/asmjit/arm/a64emithelper_p.h @@ -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; diff --git a/src/asmjit/core.h b/src/asmjit/core.h index cb19333..834d544 100644 --- a/src/asmjit/core.h +++ b/src/asmjit/core.h @@ -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(p)(out, inA, inB); +//! SumIntsFunc fn = ptr_as_func(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; //! } diff --git a/src/asmjit/core/emithelper_p.h b/src/asmjit/core/emithelper_p.h index 0f4a2f3..2240ae6 100644 --- a/src/asmjit/core/emithelper_p.h +++ b/src/asmjit/core/emithelper_p.h @@ -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; } diff --git a/src/asmjit/x86/x86emithelper_p.h b/src/asmjit/x86/x86emithelper_p.h index e09d084..1288c67 100644 --- a/src/asmjit/x86/x86emithelper_p.h +++ b/src/asmjit/x86/x86emithelper_p.h @@ -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;