Commit Graph

11 Commits

Author SHA1 Message Date
kobalicek
2ff454d415 [abi] AsmJit v1.17 - cumulative & breaking changes
* Reworked register operands - all vector registers are now
    platform::Vec deriving from UniVec (universal vector operand),
    additionally, there is no platform::Reg, instead asmjit::Reg
    provides all necessary features to make it a base register for
    each target architecture
  * Reworked casting between registers - now architecture agnostic
    names are preferred - use Gp32 instead of Gpd or GpW, Gp64
    instead of Gpq and GpX, etc...
  * Reworked vector registers and their names - architecture
    agnostic naming is now preferred Vec32, Vec64, Vec128, etc...
  * Reworked naming conventions used across AsmJit - for clarity
    Identifiers are now prefixed with the type, like sectionId(),
    labelId(), etc...
  * Reworked how Zone and ZoneAllocator are used across AsmJit,
    prefering Zone in most cases and ZoneAllocator only for
    containers - this change alone achieves around 5% better
    performance of Builder and Compiler
  * Reworked LabelEntry - decreased the size of the base entry
    to 16 bytes for anonymous and unnamed labels. Avoided an
    indirection when using labelEntries() - LabelEntry is now
    a value and not a pointer
  * Renamed LabelLink to Fixup
  * Added a new header <asmjit/host.h> which would include
    <asmjit/core.h> + target tools for the host architecture,
    if enabled and supported
  * Added new AArch64 instructions (BTI, CSSC, CHKFEAT)
  * Added a mvn_ alternative of mvn instruction (fix for Windows
    ARM64 SDK)
  * Added more AArch64 CPU features to CpuInfo
  * Added better support for Apple CPU detection (Apple M3, M4)
  * Added a new benchmarking tool asmjit_bench_overhead, which
    benchmarks the overhead of CodeHolder::init()/reset() and
    creating/attaching emitters to it. Thanks to the benchmark the
    most common code-paths were optimized
  * Added a new benchmarking tool asmjit_bench_regalloc, which
    aims to benchmark the cost and complexity of register allocation.
  * Renamed asmjit_test_perf to asmjit_bench_codegen to make it
    clear what is a test and what is a benchmark
2025-06-15 16:45:37 +02:00
kobalicek
356dddbc55 [abi] Switched to C++17 2025-05-24 19:21:17 +02:00
kobalicek
a63d41e80b Added support for mach_vm_remap() for dual mapping
mach_vm_remap() allows to create a dual mapping without having to
use a file descriptor, which has to open a file or shm memory. The
problem is that the recent macos version started displaying a popup
message when such file is opened and that annoyed a lot of users.

Thus, the initial code-path is no longer used, and mach_vm_remap()
is used instead.

This change only applies for x86 macs. Apple silicon doesn't allow
dual mapping and instead uses MAP_JIT.
2024-01-25 22:23:13 +01:00
kobalicek
3772c447ca [ABI] Accumulated API/ABI changes
* Renamed all eq() methods to equals() (consistency) (ABI)
  * Reorganized some X86 instructions in X86 database
  * Properly detect RISC-V CPU at compile time (Environment)
  * Removed CallConvId::kNone in favor of defaulting to kCDecl (ABI)
  * CallConvId::kHost is now alias to CallConvId::kCDecl (ABI)
  * Added FloatABI to Environment to disginguish between softfloat
    and hardfloat
  * Added more AArch64 CPU features and their detection (ABI)
  * Because of CallConvId changes it's now possible to run
    compiler tests on 32-bit ARM (fixes a bug in test cases)
  * Added QEMU to CI build matrix to test different architectures
2024-01-01 20:15:00 +01:00
kobalicek
a465fe71ab [ABI] Reworked FuncSignature 2023-12-27 21:17:45 +01:00
kobalicek
073f6e85e4 [ABI] Improvements to avoid UB and warnings, clean build with MSAN
* 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.
2023-12-26 19:00:00 +01:00
kobalicek
c1019f1642 Improved testing
* 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
2023-03-11 00:31:03 +01:00
kobalicek
1ed8b77f5b [ABI] Added CpuFeatures to Target and CodeHolder, improved test_perf 2023-01-16 00:10:56 +01:00
kobalicek
996deae327 [ABI] Refactored AsmJit to use strong-typed enums, this breaks both API and ABI
[ABI] Added ABI version as an inline namespace, which forms asmjit::_abi_MAJOR_MINOR
[ABI] Added support for AVX512_FP16, 16-bit broadcast, and AVX512_FP16 tests
[ABI] Added initial support for consecutive registers into instruction database and register allocator
[ABI] Added a possibility to use temporary memory in CodeHolder's zone
[ABI] Compiler::setArg() is now deprecated, use FuncNode::setArg()
[Bug] Fixed correct RW information of instructions that only support implicit zeroing with {k}
[Bug] Fixed broadcast to be able to broadcast bcst16 operands
2021-12-13 19:34:56 +01:00
kobalicek
a4dd0b2d8b [ABI] Build improvements - replaced ASMJIT_BUIlD_X86 with ASMJIT_NO_X86 and other changes... 2021-03-21 14:42:47 +01:00
kobalicek
58b6c025f2 [ABI] Added more AVX_VNNI instructions, added MOVABS for explicit Imm64 encodings, added more assembler tests 2021-01-26 01:00:29 +01:00