Commit Graph

463 Commits

Author SHA1 Message Date
kobalicek
f21f4a4ba2 Added support for lo12 label operation 2023-09-09 01:14:29 +02:00
kobalicek
bb47dc3ede Added a workaround to JitAllocator to work well with clang-17 UBSAN
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.
2023-09-08 16:04:19 +02:00
kobalicek
15919150fb Fixed asmjit_test_perf to use something else than mips() name
The problem is that mips is also defined as a macro when compiling
for MIPS target, which then causes a compilation error when used as
a function.
2023-08-18 10:03:43 +02:00
kobalicek
63fdb762f0 [Bug] Fixed constpool tests to not fail on big-endian machines 2023-08-07 15:33:44 +02:00
ZeeWanderer
3577608cab [MSVC] workaround mvn macro and detect ARM64 (#407)
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>
2023-04-28 01:14:41 +02:00
kobalicek
5635cf463a Added a unique register metadata to asmjit's instruction database 2023-04-26 22:00:56 +02:00
kobalicek
4163483b36 [Bug] Properly detect MMX2 on Intel CPUs via CPUID.SSE flag 2023-04-26 11:07:20 +02:00
kobalicek
42894f67e5 [Bug] Fixed VPTERNLOG[D|Q] RW info when the predicate doesn't influence DST 2023-04-26 10:58:08 +02:00
kobalicek
ff6775f424 [Bug] Fixed x86::Compiler to not rewrite reg->mem when embedded rounding is used 2023-04-25 19:58:18 +02:00
kobalicek
51b10b19b6 [Bug] Fixed build having ASMJIT_NO_TEXT enabled (AArch64) 2023-03-25 00:09:15 +01:00
Adrian Vogelsgesang
f1ea8a46c3 [Bug] Fixed ASMJIT_NO_INTROSPECTION build (#403)
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.
2023-03-22 08:48:33 +01:00
kobalicek
0cd18daa5d [Bug] Properly report AVX512 when querying GATHER instructions without {k} 2023-03-11 13:21:26 +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
d7edac813a [Bug] Don't crash when formatting label without having an emitter 2023-03-10 20:20:20 +01:00
John Högberg
1098b7d887 [Bug] Don't enable both MAP_JIT and MAP_SHARED (#402) 2023-03-06 10:51:53 +01:00
kobalicek
d38b12a2b5 Switched to a newer testing framework, fixed warnings on AArch64 2023-03-05 15:28:27 +01:00
kobalicek
76520a513d Use MFD_CLOEXEC when using memfd_create, documentation update 2023-03-05 13:23:53 +01:00
kobalicek
915186f6c5 [Bug] Virtual memory changes - addressing remaining issues on NetBSD
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
2023-03-02 15:53:45 +01:00
Nicolas Roussel
d4dfd8e865 [Bug] Don't compile formatter API of disabled backends (#400) 2023-02-28 18:34:59 +01:00
kobalicek
c87476dd5d [Bug] Use ReadWrite scope to fill memory in JitAllocator::shrink() (MAP_JIT) 2023-02-27 20:41:08 +01:00
kobalicek
965d19506f [CI] Updated build matrix, updated docs regarding CI 2023-02-25 00:46:33 +01:00
kobalicek
8552e286c2 [CI] Updated to use build-actions new prepare-environment 2023-02-23 16:18:07 +01:00
kobalicek
d5b2cd2ba8 [Bug] Don't check for TARGET_OS_XXX before checking for __APPLE__ (VirtMem) 2023-02-23 08:43:42 +01:00
kobalicek
9d33c892f7 [Bug] Use mremap() to allocate a dual mapped region on NetBSD
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.
2023-02-23 00:40:20 +01:00
uvxwx
8c31a8f34f JitRuntime: removed duplicate code (#397) 2023-02-18 19:48:58 +01:00
kobalicek
e136425673 [Bug] Added unsigned case to imul with 16-bit and 32-bit immediate 2023-01-18 16:49:19 +01:00
kobalicek
f97475e5ab Fixed a signed/unsigned conversion warning when compiling for OSX target 2023-01-17 13:08:22 +01:00
kobalicek
3ee3846283 [ABI] Raised ABI version due to recent changes 2023-01-16 14:55:03 +01:00
kobalicek
0186d3022d [ABI] Optimized size of instruction name data (X86, AArch64) 2023-01-16 00:25:48 +01:00
kobalicek
001c5231e6 [ABI] Added more CPU feature identifiers and detection (X86) 2023-01-16 00:16:56 +01:00
kobalicek
1ed8b77f5b [ABI] Added CpuFeatures to Target and CodeHolder, improved test_perf 2023-01-16 00:10:56 +01:00
kobalicek
a9ac13536e [Bug] Removed a debugging printf() 2023-01-08 21:49:01 +01:00
kobalicek
8a33b814d6 [Bug] Assign inline comments to Invoke/Func nodes, annotate without Logger 2023-01-08 14:34:36 +01:00
kobalicek
6a414ea141 Added a possibility to reset a red zone in FuncFrame 2023-01-08 14:34:07 +01:00
kobalicek
9f6d677615 [Bug] Fixed push/pop RW instruction data (segment and GP interfering each other) 2023-01-08 13:54:47 +01:00
kobalicek
5c18fcafc5 [Bug] Don't repeat comment as inline comment when formatting a Builder/Compiler Node 2023-01-07 11:57:56 +01:00
kobalicek
5b5b0b3877 [CI] Updated CI configurations 2022-12-10 15:07:55 +01:00
kobalicek
45f3b764b3 [Bug] Fixed a ModRM/MR check in X86 assembler (mov instruction) (fixes #392) 2022-11-26 00:05:25 +01:00
Matthias Moninger
0c03ed2f74 Use static constexpr for RegTraits to make it possible to use asmjit in CLR environment (fixes #386) 2022-11-10 16:58:41 +01:00
aegistudio
5af57595a9 [Bug] Fixed LDURSW instruction on AArch64 (#389)
The instruction was wrongly described as supporting both W/X registers, however, it only supports X register.
2022-11-10 10:11:05 +01:00
Herman Semenov
ae63ced6dd Fixed offset index predicate in arm::Mem::post() (#388) 2022-11-04 09:54:19 +01:00
kobalicek
8f2c237b83 Added x86::Mem::cloneResized() to complement cloneAdjusted() and cloneBroadcasted() 2022-10-18 18:43:48 +02:00
kobalicek
15a6036618 Fixed iOS compilation (reworked MAP_JIT detection, and pthread_jit_write_protect_np() support) 2022-10-09 19:30:14 +02:00
Viktor Chlumský
bb3dc125fa Visual Studio 2015/2017 compatibility (#383) 2022-10-09 13:05:20 +02:00
Peter Meerwald-Stadler
8dd64c32ac [Doc] Fixed some typos (#382) 2022-10-07 10:58:58 +02:00
kobalicek
052b4430e9 Fixed indirect jumps to a single label (Compiler) (fixes #380) 2022-09-18 10:26:53 +02:00
kobalicek
5c469e3f7c Reversed the order of visualizing shuffles (via ExplainImm) to reflect their composition 2022-07-24 17:04:00 +02:00
kobalicek
3502a8fe0d [Build] Changed CMAKE_CXX_SIMULATE_ID to CMAKE_CXX_COMPILER_FRONTEND_VARIANT as that seems to be the valid variable for detecting a MSVC frontend 2022-07-24 13:51:53 +02:00
kobalicek
2ae2d897f4 [CI] Use newer macos images as the older ones were deprecated 2022-07-21 21:52:33 +02:00
kobalicek
c59847629d Use casting to suppress -Wbitwise-instead-of-logical warning instead of suppressing it globally 2022-07-02 10:03:51 +02:00