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
Changes related to VirtMem
* Moved memory mapping code to mapMemory() and unmapMemory() helper functions
* Added MemoryFlags::kMapShared to optionally allow MAP_SHARED when necessary
* Clarified that MAP_SHARED is used by dual mapping by default
* Extends MemoryFlags::kMMapMax... to use PROT_MPROTECT on NetBSD
* Changed NetBSD dual mapping code to use MAP_SHARED to avoid COW
Changes related to JitAllocator
* Propagate error from VirtMem (not just OOM) when VirtMem allocation failed
* Added more tests to verify that RW + RX regions share the same content
In addition, always enable DualMapping when RWX pages are not
possible to allocate in JitAllocator, because otherwise the
allocator would not be able to allocate memory for JIT code
execution.
New CI runners to test FreeBSD, NetBSD, and OpenBSD are also
provided.