Read the blog post at FEX-Emu's Site!
After what felt like a very quick month, it's time for another FEX release. We're busy writing improvements for next month's release already, so let's
not distract for too long and smash through these changes!
Removal of deprecated FEXInterpreter binary
Back in the FEX-2510 release we completely removed a FEXLoader binary with a deprecation of the FEXInterpreter binary, renaming it to
just FEX. We kept the FEXInterpreter binary around for a while because downstream projects had hardcoded the binary in their scripts and we wanted to give
some time for them to migrate. After nearly a year we're hoping that everyone has migrated to the new binary name. If your project is still using the
old binary name then we recommend fix them!
The typical JIT improvements
As typical there are a bunch of JIT changes this month. Let's breakdown what was fixed.
- Use SVE XAR for SHA1 emulation as a minor optimization.
- Fix JIT telemetry value unconstrained predictable problem on ARMv8.0
- Would only cause some missed telemetry on ARMv8.0 platforms, very minor.
- Optimize VMOVMASKPD/PS instructions.
- Cutting from 11/10 instructions down to 7.
- Fix incorrect emulation of BFP store instruction
- Fixes crash if
ProcessorIDIR op was encountered on WINE- Silly little assert check that crashed.
- A bunch more improvements to hardware with 256-bit SVE
- Actually a ton of little bug fixes and edge cases getting patched up.
Fix VirtualProtect on win32
This change is fairly spicy because it means some of our memory protections were silently failing under WINE. With this fixed, it should fix some
weird edge case crashes that weren't able to be explained.
Fix overwriting memory region in allocation tracking
This is a bit of a weird case where FEX's memory allocations on 48-bit VA systems were silently only ever using one allocation region. It was
accidentally overwriting all regions with whatever the smallest allocation happened to be. Luckily on 48-bit systems, the smallest region would still
be very large and unlikely to run out, but a bug fix is a bug fix.
Fix inactive JIT guard pages not being ignored
A funny little quirk of our JIT is that we rely on SIGSEGV to handle memory overflows safely. Where we try to calculate a size of code memory that
gets generated from IR through a heuristic and if the size is calculated incorrectly we safely fault and longjump to try again. The times in which the
heuristic is incorrect isn't very frequent so the performance win of not range checking as heavily is a big win.
One problem is we forgot to turn off the JIT guard page checking when outside of the JIT, so if an application happens to access from [0, 4096), we
would long jump back in to our JIT and hilarious crashes would occur. Oops!
Fixes AVX signal state saving and restoring
While signals are fairly rare, we implementing saving the AVX state incorrectly, which could cause us the fail to restore it if the application jumps
to a new location. This is now fixed which should probably resolve a few crashes.
Spinloop using WFE on WINE
On WINE we had some spinloops that are required when an application is in the process of suspending a thread. We now spin using the WFE instruction
which puts the ARM CPU in lower-power state while waiting on an atomic. This can shave off watts of power in this edge case, so it's worth supporting!
Fix untracked thread handling
When a process creates a new thread using the Clone syscall API, there's a lot of tricky edge cases to support. In one of those paths we were
accidentally losing tracking of a thread in our frontend. Usually this is pretty benign but it could result in some broken TLS tracking due to a new
thread data structure actually pointing to the parent thread. Oops!
Raw Changes
FEX Release FEX-2608
-
64BitAllocator
-
ALUOps
- Remove unused macros (facbc78)
-
AVX128
- Optimize 256-bit vmovmaskpd as well (aa26a78)
-
Allocator
- fix the caching of host va size (5b91642)
-
AllocatorHooks
- Amend VirtualProtect for Windows (12baceb)
-
Arm64Emitter
-
AtomicOps
- Avoid constrained unpredictable case in TelemetrySetValue() (12e8cf0)
-
BPFEmitter
- Amend instruction class checking in HandleStore() (480f45f)
-
CI
- Disable ranges-v3 from trying to build native (68740b3)
-
CPUBackend
- Remove unnecessary reinterpret_casts (58c247b)
-
CodeCache
-
Common
-
Config
-
Context
- Add support for single-step RIP ranges (1bd3945)
-
ConversionOps
- Remove redundant code in Vector_FToS (c8dd9ee)
-
Core
-
Crypto
-
Dispatcher
- Avoid loading unnecessary reg in vixl single step (fb4d8a6)
-
Externals
- Update fmt to 12.2.0 (3bd4d24)
-
FEX
- Remove FEXInterpreter binary (37265b1)
-
FEXCore
-
FEXGetConfig
- Add convenience option for dumping system/tso info (31c2449)
-
FEXOfflineCompiler
- Fix improper syscall ABI on WoA (5a0bf1b)
-
FEXServer
- Fix some missing declaration warnings (7bb380a)
-
Filesystem
- Fix Absolute() on Windows (4518d58)
-
FlexBitSet
- Simplify MemClear/MemSet (7ce172a)
-
Frontend
- Prioritize instruction fetch faults (27315e3)
-
Github
- More dependabot things (1d695f6)
-
HostFeatures
-
HostRunner
- Tidy up interface (a1cc5d0)
-
IR
-
IRDumper
- stringstream -> ostringstream (d6b38b6)
-
IREmitter
- Mark some helpers as const (1cffa00)
-
IRValidation
- Minor cleanups (d028c79)
-
JIT
-
LinuxAllocator
- Reduce MemAllocator32Bit size by 16 bytes (941f0fb)
-
LinuxEmulation
- Resolve missing prototype warnings (b58be2c)
-
MemoryOps
-
MiscOps
- Fix round mode clearing for RP/RM modes in PushRoundingMode (821dfe5)
-
OpcodeDispatcher
-
PassManager
- Simplify initialization interface (eb7e02e)
-
RedundantFlagCalculationElimination
- Minor tidying (34ef28d)
-
RegisterAllocationPass
-
SharedCodeBufferManager
- Minor header tidying (f2e35f3)
-
SignalDelegator
-
Signals
- Preprocessor disable intentional dead code (a135325)
-
Socket
- Pass size by reference in getsockopt (8a844f9)
-
StringUtils
- Handle strings entirely composed of whitespace in trims (76c4ebb)
-
Thread
-
ThreadManager
- Fix error return values in FrontendAllocateSlots() (99b8df4)
-
Utils
- File
- Handle dual read/write case (7ff0466)
- File
-
Vector
-
VectorOps
-
WinAPI
- IO
- Fix handling of end of file offset in SetFilePointerEx (bc16f90)
- IO
-
Windows
-
Wow64
- Spin loop on atomic with WFE (71d4e2c)
-
Misc
- #5795 but with clang_format (4caad9b)
- Fix building for Windows with libc++ 23 (2fdbff3)
- Extend FIST tests to check for indefinite value (7a3fdef)
- AVX_128: Optimize VMOVMSKPS from 11 to 7 instructions (b0af054)
- VDSO_Emulation: Mark relevant members as internally linked (b478f54)
- (903e7db)
- (376e3af)
- (af63c0a)
- (fe6d639)
- (d2f0961)
- (bd1e61b)
- (b97165b)
- (5f2d19c)
- (95e7c86)
- (2effdb0)
- (ab31e3e)
- (8347566)
- Fix movd when prefixed with 0x66 (3370d9a)
- Fix cvttss2si when prefixed with 0x66 (9306de7)
- Fix element getting overwritten in 66_5B test (ff7a54a)
- Fix LZCNT tests reading out of bounds (c3d1157)
- [SVE256] Handle 256-bit blend operations much more efficiently (5f2455c)
- [SVE256] Handle 256-bit AES operations (17e5637)
- [SVE256] EncryptionOps: Handle 256-bit VPCLMULQDQ (f8967aa)
- [SVE256] Ensure SSE insertion behavior for AES/SHA/PCLMUL operations (4233fb6)
-
gitlab
- Fixes CI (c00b2c9)
-
unittests
-
x32
-
x64
- Thread
- Amend faulting copy handling related to LDTs (0e8b01c)
- Thread
-
x87StackOptimizationPass