From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8981 invoked by alias); 18 May 2009 15:31:04 -0000 Received: (qmail 8956 invoked by uid 22791); 18 May 2009 15:31:02 -0000 X-SWARE-Spam-Status: Yes, hits=6.3 required=5.0 tests=AWL,BAYES_50,BOTNET,J_CHICKENPOX_54 X-Spam-Check-By: sourceware.org Received: from vms173009pub.verizon.net (HELO vms173009pub.verizon.net) (206.46.173.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 May 2009 15:30:58 +0000 Received: from [172.16.1.69] ([68.163.235.205]) by vms173009.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KJU00GMFJ15S200@vms173009.mailsrvcs.net> for java-patches@gcc.gnu.org; Mon, 18 May 2009 10:29:34 -0500 (CDT) Cc: Java Patch List , Anthony Green , libffi-discuss@sourceware.org Message-id: <040472BA-616A-47A8-A03F-7A715AA345DD@dev.java.net> From: Timothy Wall To: Andrew Haley In-reply-to: <4A1172A3.7030801@redhat.com> Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-transfer-encoding: 7bit MIME-version: 1.0 (Apple Message framework v930.3) Subject: Re: [PATCH] win64 support for libffi (2/2) Date: Mon, 18 May 2009 15:31:00 -0000 References: <635C3243-B89E-460E-9C0F-209308D89729@dev.java.net> <4A113464.7070906@redhat.com> <4A1172A3.7030801@redhat.com> Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2009-q2/txt/msg00072.txt.bz2 On May 18, 2009, at 10:37 AM, Andrew Haley wrote: > 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 implementation isn't terribly optimized; I started from Thomas Heller's python ctypes implementation, which re-used the 32-bit ffi.c code. I suppose ideally you'd have a separate source file for the win64 stuff (ala darwin64/unix64/etc) but the calling conventions originally looked similar enough that splitting it out didn't seem like it was worth the effort. I'll re-do diffs against gcc libffi.