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: Unreviewed patch for PR 11297


On Mon, Jul 07, 2003 at 03:52:54PM -0400, David Edelsohn wrote:
> 	Has the effect of the patch on AIX been tested?  I would test it
> if the trunk bootstrap on AIX were fixed.

I don't have access to any AIX boxes, but given that ppc64-linux uses
the same ABI I think it should be fine.

> 	What is the benefit of the vthunk static alias anyway?

Avoiding call through .plt or .got access in most arches, often saving
a dynamic relocation.
On some arches the difference is big, on some smaller, but still there.
E.g. on IA-32:
         movl    4(%esp), %eax
         movl    (%eax), %ecx
         addl    -12(%ecx), %eax
         movl    %eax, 4(%esp)
         call    .L85
 .L85:   popl    %ecx
         addl    $_GLOBAL_OFFSET_TABLE_+[.-.L85], %ecx
         movl    _ZN1CD1Ev@GOT(%ecx), %ecx
         jmp     *%ecx
with non-static symbol and:
         movl    4(%esp), %eax
         movl    (%eax), %ecx
         addl    -12(%ecx), %eax
         movl    %eax, 4(%esp)
         jmp     .LTHUNK0
with static symbol.
Even on ppc64-linux, although the generated assembly has identical
insns, the final branch goes to a .plt slot in the non-static case and
can jump the function directly otherwise.

> 	BTW, a "nop" after a thunk call when using ABI_AIX is irrelevant
> because the called function will not return through the thunk anyway.
> Something else needs to ensure the TOC register is restored at the
> original call site, but normally one calls through a function pointer.

I think a virtual thunk cannot be called but throught a function pointer
loaded from virtual table (otherwise the caller could modify the arguments
and call the actual method directly).

	Jakub


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