[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libjit] Stack alignment in 32-bit MinGW builds

From: Eli Zaretskii
Subject: [Libjit] Stack alignment in 32-bit MinGW builds
Date: Mon, 20 Aug 2018 22:19:17 +0300

While working on integration of libjit with Emacs, I discovered a
problem with stack alignment in functions invoked from JIT-compiled
code on x86 (32-bit) Windows systems.  MS-Windows only guarantees
4-byte alignment of the stack in 32-bit programs.  While MinGW GCC
takes care to align the stack on 8-byte boundary at program startup,
it assumes that this is enough to keep the stack in all the functions
8-byte aligned.  JIT-compiled code seems to break that, because when
it calls back into Emacs functions, the stack is not necessarily
aligned on a 8-byte boundary.  (Emacs needs that to be able to create
stack-based Lisp objects, which must be 8-byte aligned.)

Is it possible to have the JIT code make sure the stack is 8-byte
aligned, either always or as a special feature (like some special call
in the function's prologue)?  This would allow to arrange for a 8-byte
aligned stack in all Emacs functions when JIT compilation is used.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]