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


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
then you get a random jump somewhere which tends to be hard
to debug. This has happened in the past when porting
existing code.

Just alone getting rid of that would be worth changing it.
varargs shouldn't be that time critical anyways

-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]