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: vararg calls with libffi on x86_64


On Wed, May 04, 2005 at 02:46:25PM +0200, Andreas Degert wrote:
> The patch survives the testsuite. I hope it's sound enough now to be
> applied :-)

Two more small changes...

> -  tramp[10] = 0xff49;		/* jmp *%r11	*/
> -  tramp[11] = 0x00e3;
> +  tramp[10] = 0x49f8;		/* clc; jmp *%r11	*/
> +  tramp[11] = 0xe3ff;
>    *(void * volatile *) &tramp[1] = ffi_closure_unix64;
>    *(void * volatile *) &tramp[6] = closure;
> +  if (cif->flags & (1 << 11))
> +    *(volatile char*) &tramp[10] = 0xf9; /* stc */

I'd prefer to write this

  /* Set the carry bit iff the function uses any sse registers.
     This is clc or stc, together with the first byte of the jmp.  */
  tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8;

  tramp[11] = 0xe3ff;			/* jmp *%r11    */

>  ffi_closure_unix64:
>  .LUW4:
> +        setc    %al   /* carry set by trampoline iff SSE registers are used
>  	subq	$200, %rsp

You don't need the stc (and following test) if you change the subq to leaq.



r~


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