This is unfortunately API/ABI break, which cannot be deprecated
instead of removed as arm::Vec would collide with a64::Vec if present.
This is a preparetion for ARM32 tooling.
This changeset contains an updated instruction database that brings
ARM32 instructions for the first time. It also updates instruction
database tooling especially for ARM64, which will also be used by
ARM32 generator.
Additionally, new operan has been added, which represents a register
list as used by ARM32 instruction set.
Other minor changes are related to ARM - some stuff had to be moved
to a64 namespace from arm namespace as it's incompatible between
32-bit and 64-bit ISA.
* Added more clang compilers on CI (CI)
* Added memory sanitizer to build matrix (CI)
* Use problem matcher in all builds (CI)
* Fixed the use of some constructs in tests
* Fixed warnings about unused functions in tests
* Fixed warnings about unused variables caused by some build options
* Fixed tests to be clean with MSAN (zeroing memory filled by JIT code)
* Removed -Wclass-memaccess (gcc) from ignored warnings
* Removed -Wconstant-logical-operand (clang) from ignored warnings
* Removed -Wunnamed-type-template-args (clang) from ignored warnings
* Reworked InstData and InstExData to not cause UB (ABI break)
Unfortunately the existing InstData and InstExData was not good for static
analysis and in general compilers emitted warnings regarding accessing
InstNode::_opArray. The reason was that InstExNode added one or two
more operands which extended InstData::_opArray, but there was no way to
tell the C++ compiler about this layout.
It has been changed to InstNode having no operands and InstNodeWithOperands
being templatized for the right number of operands. Nodes that need to
inherit InstNode would just inherit InstNodeWithOperands<N>. It works the
same way as before, just the class hierarchy changed a little.
OSUtils::getTickCount() is a legacy function that used to have some
magic to actually return correct values. However, since the function
was not used by any open-source project on GH it's better if it's just
removed so it doesn't have to be maintained. It had no tests and since
there is <chrono> in C++ it really has no purpose anymore.
In addition, use 64-bit file API by default on some platforms as this
is what most applications use anyway. This is just a little optimization
to avoid using both open() and open64() functions in an application if
it already uses 64-bit file API.
* Added more cmake options to control features to be built
* Added a detection whether to link to libpthread (if not part of libc)
* Added a detection whether to link to librt (if not part of libc)
* Removed pure virtual functions as this collides with -nostdlib
* As a result the support for ASMJIT_NO_STDCXX has improved
We don't import either architecture in archtraits so include
environment.h to ensure Environment is visible, and don't use
__builtin__clear_cache in Emscripten because it's unsupported.
From this moment, the use of Operand::size() is discouraged:
- Use BaseReg::size() to get a size of a register
- Use x86::Mem::size() to get a size of a x88 memory operand
- Use Operand::x86RmSize() to get a size of a register or
x86 memory operand (convenience)
The problem with size occupying bits of each operand is problematic
as we want to pack more information to architecture specific operands.
For example AArch32 and AArch64 memory operands need more payload,
which can use the bits that were used by size in the past.
This changes virtually nothing from API perspective, however, it
allows to embed asmjit well in C projects that do not link to C++
standard library.
In normal circumstances, when a pure virtual function is declared,
but not implemented, the compiler would replace it with it's
default version, which would print a message and terminate the
program. However, this function is part of a C++ standard library,
so we don't want to use it.
Having 'inline' is fine, however, when debugging a class that has
abstractions then sometimes to step over all of them can be very
frustrating. This is solved by ASMJIT_INLINE_NODEBUG, which tells
compiler that the body of a function doesn't have to be debuggable.
This mostly applies to getters, setters, and wrappers around API
functions.
In addition - some assembler tests were split to make the compilation
a little bit faster, especially when compiling with UBSAN.
* Instruction database is now part of asmjit to keep it in sync
* X86/X64 ISA data has been reworked, now in a proper JSON format
* ARM32 ISA data has been added (currently only DB, support later)
* ARM64 ISA data has been added
* ARM features detection has been updated
LLVM's UBSAN (version 17) started using bytes below a function as
metadata for the sanitizer. It adds code to read this metadata when
performing an indirect function call, which means that if the function
itself is placed at a beginning of a mapped page, the application would
crash, because the previous page doesn't have to be accessible.
Unfortunately, LLVM exposes users to this implementation detail now,
and to make it possible to instrument software that links to asmjit,
a workaround had to be added. In addition, it's not just possible to
add this workaround to UBSAN builds, because asmjit can be installed
via a package and third party code that uses UBSAN can just link to
it. This means that we have to add padding to each block that provides
consecutive memory.
This behavior is now the default, however, an option exist:
asmjit::JitAllocatorOptions::kDisableInitialPadding
With this option it's possible to control the behavior and to disable
the artificial padding used as a workaround.
Fixed MSVC AArch64 build
* Detect AArch64 target properly when compiling by MSVC
* Workaround the issue caused by MSVC defining a mvn macro
---------
Co-authored-by: Petr Kobalicek <kobalicek.petr@gmail.com>
The helper functions for the tests were referencing functions which do not exist if AsmJit is built using `ASMJIT_NO_INTROSPECTION`. This commit fixes the issue by moving the helper function inside the preprocessor `if` used for the test cases.
* Refactored workflows to use a single workflow for both VM and non-VM builds
* Compiler tests are now able to test compilation of different architectures