Mac OS X i486 ABI -- 16-byte stack alignment

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Wed Nov 7 15:16:34 PST 2007


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.

tom



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 means
>> 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,
> -landonf



More information about the hotspot-dev mailing list