Skip to content

Commit

Permalink
Minor changes, fixed a very rare X86Compiler bug in liveness analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
kobalicek committed Feb 1, 2017
1 parent dc0ccfd commit 0943382
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/asmjit/base/codecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 1 addition & 7 deletions src/asmjit/base/codeholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<uint8_t*>(_dst);

if (baseAddress == Globals::kNoBaseAddress)
baseAddress = static_cast<uint64_t>((uintptr_t)dst);

Expand Down
2 changes: 1 addition & 1 deletion src/asmjit/base/codeholder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/asmjit/base/regalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 0 additions & 2 deletions src/asmjit/x86/x86emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4934,9 +4934,7 @@ struct X86EmitterImplicitT : public X86EmitterExplicitT<This> {
// [MONITOR|MWAIT]
// --------------------------------------------------------------------------

//! Setup monitor address [IMPLICIT] (MONITOR|MWAIT).
ASMJIT_INST_0x(monitor, Monitor)
//! Monitor wait [IMPLICIT] (MONITOR|MWAIT).
ASMJIT_INST_0x(mwait, Mwait)

// --------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/asmjit/x86/x86regalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ Error X86RAPass::fetch() {
// 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.
Expand Down

0 comments on commit 0943382

Please sign in to comment.