Recent Linux distributions' runtime libraries are compiled with SSE enabled; this means that the stack must be aligned on a 16-bit boundary when a function is called. GCC has defaulted to 16-bit-aligned code for many years but HotSpot does not, calling runtime routines with a misaligned stack.
There is some code in HotSpot to work around specific instances of this problem, but it is not applied consistently. If runtime code calls out to C library functions, the stack remains misaligned and a segfault can result, We can work around this by compiling the HotSpot runtime with -mrealign-stack but this causes all code generated by GCC to realign the stack, which is not efficient. It also prevents us from compiling HotSpot with SSE enabled.
We should correctly align the stack at all places where we make the transition from Java to native code.
There is some code in HotSpot to work around specific instances of this problem, but it is not applied consistently. If runtime code calls out to C library functions, the stack remains misaligned and a segfault can result, We can work around this by compiling the HotSpot runtime with -mrealign-stack but this causes all code generated by GCC to realign the stack, which is not efficient. It also prevents us from compiling HotSpot with SSE enabled.
We should correctly align the stack at all places where we make the transition from Java to native code.