RFR(M): 8024344: PPC64 (part 112): C argument in register AND stack slot.

Volker Simonis volker.simonis at gmail.com
Tue Sep 10 08:25:27 PDT 2013


Hi Chris,

I think it is hard to find a real authoritative documentation for this
convention. But GCC itself provides the option '
-mxl-compat/-mno-xl-compat' [1]) (was '-mxl-call/-mno-xl-call in older GCC
versions prior to 3.4 [2]) which state:

...
Produce code that conforms more closely to IBM XL compiler semantics when
using AIX-compatible ABI.  *Pass floating-point arguments to prototyped
functions beyond the register save area (RSA) on the stack in addition to
argument FPRs*. Do not assume that most significant double in 128-bit long
double value is properly rounded when comparing values and converting to
double.  Use XL symbol names for long double support routines.

*The AIX calling convention was extended but not initially documented to
handle an obscure K&R C case of calling a function that takes the address
of its arguments with fewer arguments than declared.  IBM XL compilers
access floating point arguments which do not fit in the RSA from the stack
when a subroutine is compiled without optimization*. Because always storing
floating-point arguments on the stack is inefficient and rarely needed,
this option is not enabled by default and only is necessary when calling
subroutines compiled by IBM XL compilers without optimization.
...

I think that's basically the reason why we've adapted the calling
conventions as well in order to be on the safe side:)

Regards,
Volker

[1]
http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/RS_002f6000-and-PowerPC-Options.html
[2]
http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/RS_002f6000-and-PowerPC-Options.html



On Mon, Sep 9, 2013 at 9:26 PM, Chris Plummer <chris.plummer at oracle.com>wrote:

>  Hi Goetz,
>
> From what I've read of both 32-bit and 64-bit PPC calling conventions,
> arguments passed in registers are not also placed on the stack.
>
>
> http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#PARAM-PASS
>
> Can you please explain when you think an FP argument can end up both in a
> register and on the stack? Is there some supporting documentation for this?
>
> thanks,
>
> Chris
>
>
> On 9/9/13 2:41 AM, Lindenmaier, Goetz wrote:
>
>  Hi,****
>
> ** **
>
> On PPC, the first 13 floating point arguments are passed in****
>
> floating point registers. Also, all but the first 8 arguments****
>
> are passed on the stack. So there can be floating point****
>
> arguments that are passed on the stack and in a register.****
>
> ** **
>
> This change adapts the c_calling_conventions() to this.****
>
> We duplicate the regs datastructure passed to c_calling_convention().****
>
> This change adapts all the signatures of this function, which is ****
>
> defined in a shared file, but implemented platform dependent.****
>
> How we use this can be seen in the ppc64 sharedRuntime file in ****
>
> function c_calling_convention() and the stub generators.****
>
>
> http://hg.openjdk.java.net/ppc-aix-port/stage/hotspot/file/bdd155477289/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
> ****
>
> ** **
>
> Please review and test this change.****
>
> http://cr.openjdk.java.net/~goetz/webrevs/8024344-stackArg/****
>
> ** **
>
> Best regards,****
>
>   Goetz.****
>
> ** **
>
> ** **
>
> ** **
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/attachments/20130910/47ee6162/attachment.html 


More information about the ppc-aix-port-dev mailing list