OS/X on Intel requires 16byte stack alignment. We keep the stack aligned to 4 bytes.
For the baseline compiler we should:
before pushing parameters for a call generate alignment operations (either extra push/pop operations or adds to the stack pointer)
the amount required to align the stack is calculated from the number of locals, the height of the stack (we maintain this in an array for the Intel baseline compiler) and the number of parameters.
For the opt compiler we again need to generate extra alignment in the opt stack manager
For the JNI compiler we need to ensure alignment on going to JNI code and when entering from JNI code we need to make sure we maintain alignment.
A number of source forge trackers have tracked this previously a provide incomplete patches or inadmissible patches that change the intel compilers to performing explicit masks on the stack pointer. Here are the trackers:
- tracked a bug when compiling on newer Intel OS/X
SF 1693226 - a patch from April 2007 that tries to force stack alignment using masks. Incomplete and isn't conditionally compiled.
SF 1691503 - again from April 2007, the associated patch is deleted. It did try to align the JNI stack. There are various comments about other build problems on Intel OS/X that weren't present by the resolution of