Mac OS X i486 ABI -- 16-byte stack alignment
Paul.Hohensee at Sun.COM
Fri Nov 9 07:49:02 PST 2007
You're right about x64. My bad.
Another possibility is to adopt the sparc paradigm whereby the max size
java expression stack is allocated in the top interpreter frame and cut back
on calls. You can maintain 16-byte stack alignment at all times in the
that way, which would allow you to properly align the stack at call
you push arguments onto the stack, rather than in the call_VM wrappers.
Tom Rodriguez wrote:
> I think your initial inclination might be the right one. You could
> put that logic into the each of the call_VM wrappers but that doesn't
> seem right. Alternatively you could predefine what registers are used
> for argument passing so that the number of arguments essentially
> determines the contents of your Register args. That would make it a
> bit more like the 64-bit code. You'd have to rule out the use of esi
> for arguments since you're using that to preserve esp so making them
> fixed doesn't seem so bad. In the end I think I'd lean to your
> original suggestion since it seems like a localized solution.
> Landon Fuller wrote:
>> On Nov 7, 2007, at 14:16, Paul Hohensee wrote:
>>> Take a look at the x64 code. The x64 ABI requires 16-byte alignment at
>>> call sites. Compiler-generated code maintains 16-byte alignment at all
>>> times, but the template interpreter doesn't, so calling out from it
>>> aligning the stack.
>>> See, e.g., call_VM_base in assembler_x86_64.cpp.
>> x64's call_VM_base() can assume 8 bytes in either direction will
>> align the stack, as it uses 8-byte word size. It also looks like all
>> call_VM_base() arguments must be register-passed. x64's 16-byte
>> alignment looks like:
>> testl(rsp, 15);
>> jcc(Assembler::zero, L);
>> subq(rsp, 8);
>> call(entry_point, relocInfo::runtime_call_type);
>> addq(rsp, 8);
>> Am I mistaken? -- On x86-32, the stack can be 4, 8, or 12 bytes
>> offset from 16 byte alignment, and the stack has to be padded to
>> ensure that it's still aligned once all the arguments have been
>> pushed on the stack -- I'm not sure how to make the Darwin x86-32
>> alignment simplier.
>> Thank you,
More information about the hotspot-dev