From 0943382a0cca0f5370462678ca14b1c8c932b129 Mon Sep 17 00:00:00 2001 From: kobalicek Date: Thu, 2 Feb 2017 00:35:30 +0100 Subject: [PATCH] Minor changes, fixed a very rare X86Compiler bug in liveness analysis --- README.md | 6 +++--- src/asmjit/base/codecompiler.cpp | 2 +- src/asmjit/base/codeholder.cpp | 8 +------- src/asmjit/base/codeholder.h | 2 +- src/asmjit/base/regalloc.cpp | 4 ++-- src/asmjit/x86/x86emitter.h | 2 -- src/asmjit/x86/x86regalloc.cpp | 2 +- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index cf07cd9..9715304 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ AsmJit is designed to be easy embeddable in any project. However, it depends on ### Build Type: * **ASMJIT_DEBUG** - Define to always turn debugging on (regardless of compile-time options detected). - * **ASMJIT_RELEASE** - Define to always turn debugging off (regardless of compiler-time options detected). + * **ASMJIT_RELEASE** - Define to always turn debugging off (regardless of compile-time options detected). By default none of these is defined, AsmJit detects build-type based on compile-time macros and supports most IDE and compiler settings out of box. @@ -154,7 +154,7 @@ By default none of these is defined, AsmJit detects build-type based on compile- * **ASMJIT_EMBED** - Define to embed AsmJit in another project. Embedding means that neither shared nor static library is created and AsmJit's source files and source files of the product that embeds AsmJit are part of the same target. This way of building AsmJit has certain advantages that are beyond this manual. **ASMJIT_EMBED** behaves similarly to **ASMJIT_STATIC** (no API exports). * **ASMJIT_STATIC** - Define to build AsmJit as a static library. No symbols are exported in such case. -By default AsmJit build is configured to be built as a shared library, thus note of **ASMJIT_EMBED** and **ASMJIT_STATIC** is defined. +By default AsmJit build is configured to be built as a shared library, thus none of **ASMJIT_EMBED** and **ASMJIT_STATIC** is defined. ### Build Backends: @@ -170,7 +170,7 @@ If none of **ASMJIT_BUILD_...** is defined AsmJit bails to **ASMJIT_BUILD_HOST** * **ASMJIT_DISABLE_COMPILER** - Disables **CodeCompiler** emitter. For users that use **CodeBuilder**, but not **CodeCompiler** * **ASMJIT_DISABLE_LOGGING** - Disables logging (**Logger** and all classes that inherit it) and formatting features. * **ASMJIT_DISABLE_TEXT** - Disables everything that uses text-representation and that causes certain strings to be stored in the resulting binary. For example when this flag is enabled all instruction and error names (and related APIs) will not be available. This flag has to be disabled together with **ASMJIT_DISABLE_LOGGING**. This option is suitable for deployment builds or builds that don't want to reveal the use of AsmJit. - * **ASMJIT_DISABLE_VALIDATION** - Disables instruction validation. Saves around 5kB of space when used. + * **ASMJIT_DISABLE_VALIDATION** - Disables instruction validation feature. Saves around 5kB of space when used. NOTE: Please don't disable any features if you plan to build AsmJit as a shared library that will be used by multiple projects that you don't control (for example asmjit in a Linux distribution). The possibility to disable certain features exists mainly for static builds of AsmJit. diff --git a/src/asmjit/base/codecompiler.cpp b/src/asmjit/base/codecompiler.cpp index 15bf9dd..a9176be 100644 --- a/src/asmjit/base/codecompiler.cpp +++ b/src/asmjit/base/codecompiler.cpp @@ -178,7 +178,7 @@ CBSentinel* CodeCompiler::endFunc() { return nullptr; } - // Add the local constant pool at the end of the function (if exist). + // Add the local constant pool at the end of the function (if exists). setCursor(func->getExitNode()); if (_localConstPool) { diff --git a/src/asmjit/base/codeholder.cpp b/src/asmjit/base/codeholder.cpp index 1bba912..d9706ff 100644 --- a/src/asmjit/base/codeholder.cpp +++ b/src/asmjit/base/codeholder.cpp @@ -92,11 +92,7 @@ CodeHolder::CodeHolder() noexcept _trampolinesSize(0), _baseZone(16384 - Zone::kZoneOverhead), _dataZone(16384 - Zone::kZoneOverhead), - _baseHeap(&_baseZone), - _labels(), - _sections(), - _relocations() { -} + _baseHeap(&_baseZone) {} CodeHolder::~CodeHolder() noexcept { CodeHolder_resetInternal(this, true); @@ -562,9 +558,7 @@ size_t CodeHolder::relocate(void* _dst, uint64_t baseAddress) const noexcept { SectionEntry* section = _sections[0]; ASMJIT_ASSERT(section != nullptr); - uint32_t archType = getArchType(); uint8_t* dst = static_cast(_dst); - if (baseAddress == Globals::kNoBaseAddress) baseAddress = static_cast((uintptr_t)dst); diff --git a/src/asmjit/base/codeholder.h b/src/asmjit/base/codeholder.h index 1f70572..c499c74 100644 --- a/src/asmjit/base/codeholder.h +++ b/src/asmjit/base/codeholder.h @@ -475,7 +475,7 @@ struct RelocEntry { //! NOTE: CodeHolder has ability to attach an \ref ErrorHandler, however, this //! error handler is not triggered by CodeHolder itself, it's only used by the //! attached code generators. -class ASMJIT_VIRTAPI CodeHolder { +class CodeHolder { public: ASMJIT_NONCOPYABLE(CodeHolder) diff --git a/src/asmjit/base/regalloc.cpp b/src/asmjit/base/regalloc.cpp index 92699a4..37a46fa 100644 --- a/src/asmjit/base/regalloc.cpp +++ b/src/asmjit/base/regalloc.cpp @@ -359,8 +359,8 @@ Error RAPass::removeUnreachableCode() { //! \internal struct LivenessTarget { LivenessTarget* prev; //!< Previous target. - CBLabel* node; //!< Target node. - CBJump* from; //!< Jumped from. + CBLabel* node; //!< Target node. + CBJump* from; //!< Jumped from. }; Error RAPass::livenessAnalysis() { diff --git a/src/asmjit/x86/x86emitter.h b/src/asmjit/x86/x86emitter.h index c3f9b5a..898353a 100644 --- a/src/asmjit/x86/x86emitter.h +++ b/src/asmjit/x86/x86emitter.h @@ -4934,9 +4934,7 @@ struct X86EmitterImplicitT : public X86EmitterExplicitT { // [MONITOR|MWAIT] // -------------------------------------------------------------------------- - //! Setup monitor address [IMPLICIT] (MONITOR|MWAIT). ASMJIT_INST_0x(monitor, Monitor) - //! Monitor wait [IMPLICIT] (MONITOR|MWAIT). ASMJIT_INST_0x(mwait, Mwait) // -------------------------------------------------------------------------- diff --git a/src/asmjit/x86/x86regalloc.cpp b/src/asmjit/x86/x86regalloc.cpp index add121e..6a89b6c 100644 --- a/src/asmjit/x86/x86regalloc.cpp +++ b/src/asmjit/x86/x86regalloc.cpp @@ -1749,7 +1749,7 @@ _NextGroup: // We also advance our node pointer to the target node to simulate // natural flow of the function. if (jNode->isJmp()) { - if (!next->hasPassData()) + if (next && !next->hasPassData()) ASMJIT_PROPAGATE(addUnreachableNode(next)); // Jump not followed.