This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] win64 support for libffi (2/2)
- From: Andrew Haley <aph at redhat dot com>
- To: Timothy Wall <twalljava at dev dot java dot net>
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>, Anthony Green <green at redhat dot com>, libffi-discuss at sourceware dot org
- Date: Mon, 18 May 2009 15:37:23 +0100
- Subject: Re: [PATCH] win64 support for libffi (2/2)
- References: <635C3243-B89E-460E-9C0F-209308D89729@dev.java.net> <4A113464.7070906@redhat.com> <FB32AAAA-0AD1-46E5-AC8C-C4CD2FB056C7@dev.java.net>
Timothy Wall wrote:
>
> On May 18, 2009, at 6:11 AM, Andrew Haley wrote:
>
>>
>> Some of your patch seems odd to me, and perhaps changes are needed.
>>
>> For example, why this change?
>>
>> @@ -62,41 +71,59 @@
>> size_t z;
>>
>> /* Align if necessary */
>> - if ((sizeof(int) - 1) & (unsigned) argp)
>> - argp = (char *) ALIGN(argp, sizeof(int));
>> + if ((sizeof(void*) - 1) & (size_t) argp)
>> + argp = (char *) ALIGN(argp, sizeof(void*));
>>
>
> sizeof(void*) would probably be more accurately represented by
> sizeof(ffi_arg), although the effect is the same. win64 is looking for
> a 64-bit alignment, versus the original 32-bit alignment.
But this is in 32-bit generic code. I take it that the file ffi.c, which
is used for 32-bit code on Linux, is also to be used for 64-bit code on
Windows, which is still using the old calling convention of passing args
via memory rather than registers.
OK, I think I get it now.
A warning to that effect for Linux maintainers might be a good idea.
> The (size_t) cast should probably be intptr_t.
I see.
This looks fine. Can you prepare a patch for the libffi that's in gcc?
I'll look at doing a merge upstream.
Andrew.