From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25654 invoked by alias); 25 Feb 2011 13:23:40 -0000 Received: (qmail 25645 invoked by uid 22791); 25 Feb 2011 13:23:39 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-px0-f169.google.com (HELO mail-px0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Feb 2011 13:23:35 +0000 Received: by pxi9 with SMTP id 9so379197pxi.0 for ; Fri, 25 Feb 2011 05:23:33 -0800 (PST) Received: by 10.142.188.11 with SMTP id l11mr1683161wff.156.1298640213699; Fri, 25 Feb 2011 05:23:33 -0800 (PST) Received: from [192.168.1.16] (59-104-108-116.adsl.dynamic.seed.net.tw [59.104.108.116]) by mx.google.com with ESMTPS id w11sm971653wfh.6.2011.02.25.05.23.31 (version=SSLv3 cipher=OTHER); Fri, 25 Feb 2011 05:23:33 -0800 (PST) Message-ID: <4D67AD61.9090106@linaro.org> Date: Fri, 25 Feb 2011 13:23:00 -0000 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: David Gilbert CC: Anthony Green , libffi-discuss@sourceware.org, Marcus.Shawcroft@arm.com Subject: Re: [PATCH] Add variadic support References: <20110222154022.GA29862@davesworkthinkpad> <4D650ADE.6040609@linaro.org> <4D653C3D.2050107@linaro.org> <4D654655.5000503@linaro.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org X-SW-Source: 2011/txt/msg00089.txt.bz2 On 2011/2/25 08:56 PM, David Gilbert wrote: >> I'm suggesting this because I see cif->flags being overwritten anyways >> > by the backend ffi_prep_cif_machdep() implementations I see, so it >> > should be valid to pass in values for this use. > The flag doesn't provide the space for the generic code to pass the > extra information (the number of fixed args) to ffi_prep_cif_machdep_var > or the equivalent code in ffi_prep_cif_machdep. Yeah, I forgot that... This might sound a bit hackish, but considering the usual realistic number of fixed args, we should be able to splice the cif->flags word: magic value in upper 16-bits, while lower half contains the passed-in nfixedargs. > I think the way to move it in the direction of what you're suggesting is: > 1) as per my code have an ffi_prep_cif and ffi_prep_cif_var that > both call ffi_prep_cif_core > 2) Explicitly pass ffi_prep_cif_core the extra parameter rather > than storing it in cif. > 3) Still keep an ifdef to say if the backend has explicit variadic > support, if that ifdef is set > then ffi_prep_cif_core will call ffi_prep_cif_machdep_var when > appropriate. > 4) ffi_prep_cif_machdep_var will get the argument count passed as > explicit parameters, > then it can process them as it feels fit including storing them > in an EXTRA_CIF_FIELD > if the backend wants to. Yeah, I think that's fine. My attempt was to avoid the extra #ifdefs and extra backend machine-dependent function; if that's unavoidable, then I think this is fine. Anthony, as maintainer, do you have any ideas? Thanks, Chung-Lin