This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86_64 varargs setup jump table


On Mon, Jul 19, 2010 at 09:15:47AM -0700, H.J. Lu wrote:
> On Mon, Jul 19, 2010 at 9:09 AM, Andi Kleen <andi@firstfloor.org> wrote:
> > Richard Henderson <rth@redhat.com> writes:
> >
> >> On 07/17/2010 07:25 AM, Bernd Schmidt wrote:
> >>> ? ? ?leaq ? ?0(,%rax,4), %rcx
> >>> ? ? ?movl ? ?$.L2, %eax
> >>> ? ? ?subq ? ?%rcx, %rax
> >>> ? ? ?jmp ? ? *%rax
> >>
> >> I've often thought this was over-engineering in the x86_64 abi.
> >> This jump table is trading memory bandwidth for unpredictability
> >> in the branch target.
> >
> > The other problem with the jump is that if you misdeclare
> > the prototype and nothing correct is passed in %eax
> 
> FWIW, we DON'T support varargs without correct prototype
> on x86-64. See AVX support in x86-64 psABI for details.

Yes, it's the same on non AVX. But still if it goes wrong
(and in practice it sometimes does) it's better if it's a smooth landing 
than if it jumps randomly over the address space. 

-Andi
-- 
ak@linux.intel.com -- Speaking for myself only.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]