From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: Wishlist: support > 10 args to foreign functions Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 25 Feb 2013 00:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 13809@debbugs.gnu.org Cc: Andy Wingo X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136175257613430 (code B ref -1); Mon, 25 Feb 2013 00:37:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Feb 2013 00:36:16 +0000 Received: from localhost ([127.0.0.1]:48363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9m3D-0003UZ-Ob for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:36:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54124) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9m3C-0003UR-4A for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:36:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9m1c-00085I-KR for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:34:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:39698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1c-00085D-HV for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:34:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1b-0007HW-F4 for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9m1Y-00084b-Tv for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:35 -0500 Received: from world.peace.net ([96.39.62.75]:59594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1Y-00084R-PY for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:32 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1U9m1S-00065d-3m; Sun, 24 Feb 2013 19:34:26 -0500 From: Mark H Weaver Date: Sun, 24 Feb 2013 19:34:18 -0500 Message-ID: <87621h6xkl.fsf@tines.lan> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) The current limitation of 10 arguments to foreign functions is proving to be a problem for some libraries, in particular the Allegro game library. Is there a reason why raising this limit to 16 or 20 would be undesirable? What tradeoffs are involved? Thanks, Mark From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: Wishlist: support > 10 args to foreign functions Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 25 Feb 2013 09:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Mark H Weaver Cc: 13809@debbugs.gnu.org X-Debbugs-Original-Cc: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13617830215241 (code B ref -1); Mon, 25 Feb 2013 09:04:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Feb 2013 09:03:41 +0000 Received: from localhost ([127.0.0.1]:48899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9tyE-0001MS-El for submit@debbugs.gnu.org; Mon, 25 Feb 2013 04:03:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36559) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9tyC-0001MK-1N for submit@debbugs.gnu.org; Mon, 25 Feb 2013 04:03:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9twT-0005qW-NQ for submit@debbugs.gnu.org; Mon, 25 Feb 2013 04:01:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:42728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9twT-0005qS-KO for submit@debbugs.gnu.org; Mon, 25 Feb 2013 04:01:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9twQ-00051W-P9 for bug-guile@gnu.org; Mon, 25 Feb 2013 04:01:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9twP-0005pC-DX for bug-guile@gnu.org; Mon, 25 Feb 2013 04:01:46 -0500 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:63011 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9twP-0005p5-8K for bug-guile@gnu.org; Mon, 25 Feb 2013 04:01:45 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id BCA40A572; Mon, 25 Feb 2013 04:01:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=qo9gIBB2PQT+RRP/KijazCBU4YE=; b=BmI6Ah 52Ftck5Jn6A/8Wu7SsKeVhDBdPc8qGnim/yDfOiA5LdxXJE9K7a+AcfEHB/Ehn+k 65uLzA0ZAQ6sXDByGNNJkIVNDdDYMB6q0Temk5SQ/jtVQF6But4v0FxSV+RpFqhm 66NsLDc5hjdcQvbuvJXDLTp/8o3In3lq9BiBo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=AOkJD/Addqe1gnMnpBoQq8cR2Pbaajhy 2fjRy40h8OnSJ3pq7C3mCL7RaIs/CN/tRdWsvYPR3x1+PAdkW6T0kIsNuTtFtOOt 8kmRniLT7ke9YU4EjrNY2EUkchdQ7JDqbD59wz3wFnYi4FqtrJueXUm/6zz7o4Y+ I5EXAhBseiA= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id B2F22A571; Mon, 25 Feb 2013 04:01:44 -0500 (EST) Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 2FA72A570; Mon, 25 Feb 2013 04:01:44 -0500 (EST) From: Andy Wingo References: <87621h6xkl.fsf@tines.lan> Date: Mon, 25 Feb 2013 10:01:41 +0100 In-Reply-To: <87621h6xkl.fsf@tines.lan> (Mark H. Weaver's message of "Sun, 24 Feb 2013 19:34:18 -0500") Message-ID: <87a9qs937u.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: FA3DAE3C-7F29-11E2-A254-1C2F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) On Mon 25 Feb 2013 01:34, Mark H Weaver writes: > The current limitation of 10 arguments to foreign functions is proving > to be a problem for some libraries, in particular the Allegro game > library. > > Is there a reason why raising this limit to 16 or 20 would be > undesirable? What tradeoffs are involved? Each arity of foreign functions gets a little VM program stub that checks the argument count then actually does the call. We statically generate the first N of those arities (currently 10), and then for the rest we should dynamically allocate the objcode stubs. Dynamic allocation is currently unimplemented. We could raise the pregenerated size, but I think it would be better to do the dynamic allocation thing. Andy -- http://wingolog.org/ From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: [PATCH] Support calling foreign functions of 10 or more arguments Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 26 Feb 2013 22:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Andy Wingo Cc: guile-devel@gnu.org, 13809@debbugs.gnu.org Received: via spool by 13809-submit@debbugs.gnu.org id=B13809.136191854032208 (code B ref 13809); Tue, 26 Feb 2013 22:43:02 +0000 Received: (at 13809) by debbugs.gnu.org; 26 Feb 2013 22:42:20 +0000 Received: from localhost ([127.0.0.1]:51785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UATE3-0008NO-0m for submit@debbugs.gnu.org; Tue, 26 Feb 2013 17:42:20 -0500 Received: from world.peace.net ([96.39.62.75]:59809) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UATDy-0008NE-PI for 13809@debbugs.gnu.org; Tue, 26 Feb 2013 17:42:16 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UATC6-0004E5-16; Tue, 26 Feb 2013 17:40:18 -0500 From: Mark H Weaver References: <87621h6xkl.fsf@tines.lan> <87a9qs937u.fsf@pobox.com> Date: Tue, 26 Feb 2013 17:40:09 -0500 In-Reply-To: <87a9qs937u.fsf@pobox.com> (Andy Wingo's message of "Mon, 25 Feb 2013 10:01:41 +0100") Message-ID: <878v6azol2.fsf_-_@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) --=-=-= Content-Type: text/plain Hi Andy, Andy Wingo writes: > On Mon 25 Feb 2013 01:34, Mark H Weaver writes: > >> The current limitation of 10 arguments to foreign functions is proving >> to be a problem for some libraries, in particular the Allegro game >> library. >> >> Is there a reason why raising this limit to 16 or 20 would be >> undesirable? What tradeoffs are involved? > > Each arity of foreign functions gets a little VM program stub that > checks the argument count then actually does the call. We statically > generate the first N of those arities (currently 10), and then for the > rest we should dynamically allocate the objcode stubs. Dynamic > allocation is currently unimplemented. I've attached a patch that implements dynamic allocation of objcode stubs for larger arities. What do you think? Thanks, Mark --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Support-calling-foreign-functions-of-10-or-more-argu.patch Content-Description: [PATCH] Support calling foreign functions of 10 or more arguments >From 29aaa7add08849503bde5a9be43b162e492a4297 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 26 Feb 2013 17:25:51 -0500 Subject: [PATCH] Support calling foreign functions of 10 or more arguments. * libguile/foreign.c (large_objcode_trampolines, large_objcode_trampolines_mutex): New static variables. (make_objcode_trampoline, get_objcode_trampoline): New static functions. (cif_to_procedure): Use 'get_objcode_trampoline'. (scm_init_foreign): Initialize 'large_objcode_trampolines'. * test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many): New function. * test-suite/standalone/test-ffi: Add test. --- libguile/foreign.c | 59 ++++++++++++++++++++++++++++++---- test-suite/standalone/test-ffi | 15 +++++++++ test-suite/standalone/test-ffi-lib.c | 17 ++++++++++ 3 files changed, 84 insertions(+), 7 deletions(-) diff --git a/libguile/foreign.c b/libguile/foreign.c index f5819c4..f8b88de 100644 --- a/libguile/foreign.c +++ b/libguile/foreign.c @@ -880,21 +880,64 @@ static const SCM objcode_trampolines[10] = { SCM_PACK (objcode_cells.cells+18), }; +static SCM large_objcode_trampolines; +static scm_i_pthread_mutex_t large_objcode_trampolines_mutex = + SCM_I_PTHREAD_MUTEX_INITIALIZER; + static SCM -cif_to_procedure (SCM cif, SCM func_ptr) +make_objcode_trampoline (unsigned int nargs) { - ffi_cif *c_cif; - unsigned int nargs; - SCM objcode, table, ret; + const int size = sizeof (struct scm_objcode) + 8 + + sizeof (struct scm_objcode) + 32; + const scm_t_uint8 *bytes_0 = raw_bytecode.bytes + 0; + const scm_t_uint8 *bytes_1 = raw_bytecode.bytes + size; + SCM bytecode = scm_c_make_bytevector (size); + scm_t_uint8 *bytes = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bytecode); + int i; + + for (i = 0; i < size; i++) + { + if (bytes_0[i] == bytes_1[i]) + bytes[i] = bytes_0[i]; + else if (bytes_0[i] == 0 && bytes_1[i] == 1) + bytes[i] = nargs; + else + scm_syserror ("make_objcode_trampoline"); + } + return scm_bytecode_to_native_objcode (bytecode); +} - c_cif = (ffi_cif *) SCM_POINTER_VALUE (cif); - nargs = c_cif->nargs; +static SCM +get_objcode_trampoline (unsigned int nargs) +{ + SCM objcode; if (nargs < 10) objcode = objcode_trampolines[nargs]; + else if (nargs < 256) + { + scm_i_scm_pthread_mutex_lock (&large_objcode_trampolines_mutex); + objcode = scm_c_vector_ref (large_objcode_trampolines, nargs); + if (SCM_UNBNDP (objcode)) + scm_c_vector_set_x (large_objcode_trampolines, nargs, + objcode = make_objcode_trampoline (nargs)); + scm_i_pthread_mutex_unlock (&large_objcode_trampolines_mutex); + } else - scm_misc_error ("make-foreign-function", "args >= 10 currently unimplemented", + scm_misc_error ("make-foreign-function", "args >= 256 currently unimplemented", SCM_EOL); + + return objcode; +} + +static SCM +cif_to_procedure (SCM cif, SCM func_ptr) +{ + ffi_cif *c_cif; + SCM objcode, table, ret; + + c_cif = (ffi_cif *) SCM_POINTER_VALUE (cif); + objcode = get_objcode_trampoline (c_cif->nargs); table = scm_c_make_vector (2, SCM_UNDEFINED); SCM_SIMPLE_VECTOR_SET (table, 0, scm_cons (cif, func_ptr)); @@ -1308,6 +1351,8 @@ scm_init_foreign (void) null_pointer = scm_cell (scm_tc7_pointer, 0); scm_define (sym_null, null_pointer); + + large_objcode_trampolines = scm_c_make_vector (256, SCM_UNDEFINED); } void diff --git a/test-suite/standalone/test-ffi b/test-suite/standalone/test-ffi index ad68660..0a91f63 100755 --- a/test-suite/standalone/test-ffi +++ b/test-suite/standalone/test-ffi @@ -170,6 +170,21 @@ exec guile -q -s "$0" "$@" (+ -1 2000 -30000 40000000000)) ;; +;; More than ten arguments +;; +(define f-sum-many + (pointer->procedure int64 (dynamic-func "test_ffi_sum_many" lib) + (list uint8 uint16 uint32 uint64 + int8 int16 int32 int64 + int8 int16 int32 int64))) +(test (f-sum-many 255 65535 4294967295 1844674407370955161 + -1 2000 -30000 40000000000 + 5 -6000 70000 -80000000000) + (+ 255 65535 4294967295 1844674407370955161 + -1 2000 -30000 40000000000 + 5 -6000 70000 -80000000000)) + +;; ;; Structs ;; (define f-sum-struct diff --git a/test-suite/standalone/test-ffi-lib.c b/test-suite/standalone/test-ffi-lib.c index 37d6e43..f265339 100644 --- a/test-suite/standalone/test-ffi-lib.c +++ b/test-suite/standalone/test-ffi-lib.c @@ -194,6 +194,23 @@ scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b, } +scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b, + scm_t_uint32 c, scm_t_uint64 d, + scm_t_int8 e, scm_t_int16 f, + scm_t_int32 g, scm_t_int64 h, + scm_t_int8 i, scm_t_int16 j, + scm_t_int32 k, scm_t_int64 l); +scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b, + scm_t_uint32 c, scm_t_uint64 d, + scm_t_int8 e, scm_t_int16 f, + scm_t_int32 g, scm_t_int64 h, + scm_t_int8 i, scm_t_int16 j, + scm_t_int32 k, scm_t_int64 l) +{ + return l + k + j + i + h + g + f + e + d + c + b + a; +} + + struct foo { scm_t_int8 a; -- 1.7.10.4 --=-=-=-- From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: [PATCH] Support calling foreign functions of 10 or more arguments Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 27 Feb 2013 09:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Mark H Weaver Cc: guile-devel@gnu.org, 13809@debbugs.gnu.org Received: via spool by 13809-submit@debbugs.gnu.org id=B13809.136195726125257 (code B ref 13809); Wed, 27 Feb 2013 09:28:02 +0000 Received: (at 13809) by debbugs.gnu.org; 27 Feb 2013 09:27:41 +0000 Received: from localhost ([127.0.0.1]:52561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdIY-0006ZI-VM for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:27:40 -0500 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:56249 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdIV-0006Z9-Tw for 13809@debbugs.gnu.org; Wed, 27 Feb 2013 04:27:37 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 3E162A200; Wed, 27 Feb 2013 04:25:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=+Y+9yM3DKI54j/UdvHXBfkTBYOQ=; b=VLGlEL tH3aDGk6FaQCB2QV/57n2+F4c8XfUYv11ZalQej9IKOIL9WL/vCnvaYqgYd8pqo3 LD1QESPXDLuXWDi/b7lcVD4/RsQLzkHXd2l81DL3wHkcTExafLMqi6L0X5Qk8jBS Q7MAivmQm16mlbuuRF7dQDw/bjrVGKzbxgVE0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=NMrtQet+gqtvbGCQcHXNH/iN3RzIn6j/ Q5SHrMdFz6qi/jdrKUjQR+Y9hs3i/ZLbXl6DtKvIyl0JsWeCYKNL2H2NN1E/xZbb KtrngcsVq2/2Dj8cFWblGh7ie31c5S6YCAnWFL+fTNistYz8kjV4mYtwHaEEZjWU m7jVumA+CtY= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 36F91A1FF; Wed, 27 Feb 2013 04:25:45 -0500 (EST) Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id B3ECEA1FE; Wed, 27 Feb 2013 04:25:44 -0500 (EST) From: Andy Wingo References: <87621h6xkl.fsf@tines.lan> <87a9qs937u.fsf@pobox.com> <878v6azol2.fsf_-_@tines.lan> Date: Wed, 27 Feb 2013 10:25:42 +0100 In-Reply-To: <878v6azol2.fsf_-_@tines.lan> (Mark H. Weaver's message of "Tue, 26 Feb 2013 17:40:09 -0500") Message-ID: <87fw0ixg4p.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: A9B166A6-80BF-11E2-AAA4-79910E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi! On Tue 26 Feb 2013 23:40, Mark H Weaver writes: > I've attached a patch that implements dynamic allocation of objcode > stubs for larger arities. What do you think? LGTM. Please lazily initialize the vector as well. If you like, CODE and META could probably be reworked as higher-order macros so that they can both generate static objcodes and initialize a non-static byte array. A bit more DRY. As you like. Andy -- http://wingolog.org/ From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: [PATCH] Support calling foreign functions of 10 or more arguments Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 27 Feb 2013 22:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Andy Wingo Cc: guile-devel@gnu.org, 13809@debbugs.gnu.org Received: via spool by 13809-submit@debbugs.gnu.org id=B13809.1362003214404 (code B ref 13809); Wed, 27 Feb 2013 22:14:01 +0000 Received: (at 13809) by debbugs.gnu.org; 27 Feb 2013 22:13:34 +0000 Received: from localhost ([127.0.0.1]:54172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UApFl-00006S-I5 for submit@debbugs.gnu.org; Wed, 27 Feb 2013 17:13:34 -0500 Received: from world.peace.net ([96.39.62.75]:34908) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UApFj-00006J-2f for 13809@debbugs.gnu.org; Wed, 27 Feb 2013 17:13:32 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UApDj-0007m9-Cp; Wed, 27 Feb 2013 17:11:27 -0500 From: Mark H Weaver References: <87621h6xkl.fsf@tines.lan> <87a9qs937u.fsf@pobox.com> <878v6azol2.fsf_-_@tines.lan> <87fw0ixg4p.fsf@pobox.com> Date: Wed, 27 Feb 2013 17:11:18 -0500 In-Reply-To: <87fw0ixg4p.fsf@pobox.com> (Andy Wingo's message of "Wed, 27 Feb 2013 10:25:42 +0100") Message-ID: <87ppzlxv95.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) --=-=-= Content-Type: text/plain Hi Andy, Andy Wingo writes: > On Tue 26 Feb 2013 23:40, Mark H Weaver writes: > >> I've attached a patch that implements dynamic allocation of objcode >> stubs for larger arities. What do you think? > > LGTM. Please lazily initialize the vector as well. Okay. > If you like, CODE and META could probably be reworked as higher-order > macros so that they can both generate static objcodes and initialize a > non-static byte array. A bit more DRY. Although it makes the macros a bit uglier, I agree that this is a superior approach. Done. Also, I've since realized that the new arity limit is 127, not 255 as my previous patch had assumed. Here's a new patch. What do you think? Thanks, Mark --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Support-calling-foreign-functions-of-10-arguments-or.patch Content-Description: [PATCH] Support calling foreign functions of 10 arguments or more >From ee83593fd502c5436025c4d4cfc8da2872c3be6a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 26 Feb 2013 17:25:51 -0500 Subject: [PATCH] Support calling foreign functions of 10 arguments or more. * libguile/foreign.c (OBJCODE_HEADER, META_HEADER, META): Change these into higher-order macros. (GEN_CODE): New higher-order macro based on 'CODE'. (M_STATIC, M_DYNAMIC): New macros. (CODE): Reimplement using 'GEN_CODE' and 'M_STATIC'. (make_objcode_trampoline): New static function. (large_objcode_trampolines, large_objcode_trampolines_mutex): New static variables. (get_objcode_trampoline): New static function. (cif_to_procedure): Use 'get_objcode_trampoline'. * test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many): New function. * test-suite/standalone/test-ffi: Add test. --- libguile/foreign.c | 115 +++++++++++++++++++++++----------- test-suite/standalone/test-ffi | 15 +++++ test-suite/standalone/test-ffi-lib.c | 17 +++++ 3 files changed, 112 insertions(+), 35 deletions(-) diff --git a/libguile/foreign.c b/libguile/foreign.c index f5819c4..90a4fca 100644 --- a/libguile/foreign.c +++ b/libguile/foreign.c @@ -772,37 +772,40 @@ SCM_DEFINE (scm_pointer_to_procedure, "pointer->procedure", 3, 0, 0, /* Pre-generate trampolines for less than 10 arguments. */ #ifdef WORDS_BIGENDIAN -#define OBJCODE_HEADER 0, 0, 0, 8, 0, 0, 0, 40 -#define META_HEADER 0, 0, 0, 32, 0, 0, 0, 0 +#define OBJCODE_HEADER(M) M (0), M (0), M (0), M (8), M (0), M (0), M (0), M (40) +#define META_HEADER(M) M (0), M (0), M (0), M (32), M (0), M (0), M (0), M (0) #else -#define OBJCODE_HEADER 8, 0, 0, 0, 40, 0, 0, 0 -#define META_HEADER 32, 0, 0, 0, 0, 0, 0, 0 +#define OBJCODE_HEADER(M) M (8), M (0), M (0), M (0), M (40), M (0), M (0), M (0) +#define META_HEADER(M) M (32), M (0), M (0), M (0), M (0), M (0), M (0), M (0) #endif -#define CODE(nreq) \ - OBJCODE_HEADER, \ - /* 0 */ scm_op_assert_nargs_ee, 0, nreq, /* assert number of args */ \ - /* 3 */ scm_op_object_ref, 0, /* push the pair with the cif and the function pointer */ \ - /* 5 */ scm_op_foreign_call, nreq, /* and call (will return value as well) */ \ - /* 7 */ scm_op_nop, \ - /* 8 */ META (3, 7, nreq) - -#define META(start, end, nreq) \ - META_HEADER, \ - /* 0 */ scm_op_make_eol, /* bindings */ \ - /* 1 */ scm_op_make_eol, /* sources */ \ - /* 2 */ scm_op_make_int8, start, scm_op_make_int8, end, /* arity: from ip N to ip N */ \ - /* 6 */ scm_op_make_int8, nreq, /* the arity is N required args */ \ - /* 8 */ scm_op_list, 0, 3, /* make a list of those 3 vals */ \ - /* 11 */ scm_op_list, 0, 1, /* and the arities will be a list of that one list */ \ - /* 14 */ scm_op_load_symbol, 0, 0, 4, 'n', 'a', 'm', 'e', /* `name' */ \ - /* 22 */ scm_op_object_ref, 1, /* the name from the object table */ \ - /* 24 */ scm_op_cons, /* make a pair for the properties */ \ - /* 25 */ scm_op_list, 0, 4, /* pack bindings, sources, and arities into list */ \ - /* 28 */ scm_op_return, /* and return */ \ - /* 29 */ scm_op_nop, scm_op_nop, scm_op_nop \ +#define GEN_CODE(M, nreq) \ + OBJCODE_HEADER (M), \ + /* 0 */ M (scm_op_assert_nargs_ee), M (0), M (nreq), /* assert number of args */ \ + /* 3 */ M (scm_op_object_ref), M (0), /* push the pair with the cif and the function pointer */ \ + /* 5 */ M (scm_op_foreign_call), M (nreq), /* and call (will return value as well) */ \ + /* 7 */ M (scm_op_nop), \ + /* 8 */ META (M, 3, 7, nreq) + +#define META(M, start, end, nreq) \ + META_HEADER (M), \ + /* 0 */ M (scm_op_make_eol), /* bindings */ \ + /* 1 */ M (scm_op_make_eol), /* sources */ \ + /* 2 */ M (scm_op_make_int8), M (start), M (scm_op_make_int8), M (end), /* arity: from ip N to ip N */ \ + /* 6 */ M (scm_op_make_int8), M (nreq), /* the arity is N required args */ \ + /* 8 */ M (scm_op_list), M (0), M (3), /* make a list of those 3 vals */ \ + /* 11 */ M (scm_op_list), M (0), M (1), /* and the arities will be a list of that one list */ \ + /* 14 */ M (scm_op_load_symbol), M (0), M (0), M (4), M ('n'), M ('a'), M ('M'), M ('e'), /* `name' */ \ + /* 22 */ M (scm_op_object_ref), M (1), /* the name from the object table */ \ + /* 24 */ M (scm_op_cons), /* make a pair for the properties */ \ + /* 25 */ M (scm_op_list), M (0), M (4), /* pack bindings, sources, and arities into list */ \ + /* 28 */ M (scm_op_return), /* and return */ \ + /* 29 */ M (scm_op_nop), M (scm_op_nop), M (scm_op_nop) \ /* 32 */ +#define M_STATIC(x) (x) +#define CODE(nreq) GEN_CODE (M_STATIC, nreq) + static const struct { scm_t_uint64 dummy; /* ensure 8-byte alignment; perhaps there's a better way */ @@ -816,8 +819,28 @@ static const struct } }; -#undef CODE +static SCM +make_objcode_trampoline (unsigned int nargs) +{ + const int size = sizeof (struct scm_objcode) + 8 + + sizeof (struct scm_objcode) + 32; + SCM bytecode = scm_c_make_bytevector (size); + scm_t_uint8 *bytes = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bytecode); + int i = 0; + +#define M_DYNAMIC(x) (bytes[i++] = (x)) + GEN_CODE (M_DYNAMIC, nargs); +#undef M_DYNAMIC + + if (i != size) + scm_syserror ("make_objcode_trampoline"); + return scm_bytecode_to_native_objcode (bytecode); +} + +#undef GEN_CODE #undef META +#undef M_STATIC +#undef CODE #undef OBJCODE_HEADER #undef META_HEADER @@ -880,21 +903,43 @@ static const SCM objcode_trampolines[10] = { SCM_PACK (objcode_cells.cells+18), }; +static SCM large_objcode_trampolines = SCM_UNDEFINED; +static scm_i_pthread_mutex_t large_objcode_trampolines_mutex = + SCM_I_PTHREAD_MUTEX_INITIALIZER; + static SCM -cif_to_procedure (SCM cif, SCM func_ptr) +get_objcode_trampoline (unsigned int nargs) { - ffi_cif *c_cif; - unsigned int nargs; - SCM objcode, table, ret; - - c_cif = (ffi_cif *) SCM_POINTER_VALUE (cif); - nargs = c_cif->nargs; + SCM objcode; if (nargs < 10) objcode = objcode_trampolines[nargs]; + else if (nargs < 128) + { + scm_i_scm_pthread_mutex_lock (&large_objcode_trampolines_mutex); + if (SCM_UNBNDP (large_objcode_trampolines)) + large_objcode_trampolines = scm_c_make_vector (128, SCM_UNDEFINED); + objcode = scm_c_vector_ref (large_objcode_trampolines, nargs); + if (SCM_UNBNDP (objcode)) + scm_c_vector_set_x (large_objcode_trampolines, nargs, + objcode = make_objcode_trampoline (nargs)); + scm_i_pthread_mutex_unlock (&large_objcode_trampolines_mutex); + } else - scm_misc_error ("make-foreign-function", "args >= 10 currently unimplemented", + scm_misc_error ("make-foreign-function", "args >= 128 currently unimplemented", SCM_EOL); + + return objcode; +} + +static SCM +cif_to_procedure (SCM cif, SCM func_ptr) +{ + ffi_cif *c_cif; + SCM objcode, table, ret; + + c_cif = (ffi_cif *) SCM_POINTER_VALUE (cif); + objcode = get_objcode_trampoline (c_cif->nargs); table = scm_c_make_vector (2, SCM_UNDEFINED); SCM_SIMPLE_VECTOR_SET (table, 0, scm_cons (cif, func_ptr)); diff --git a/test-suite/standalone/test-ffi b/test-suite/standalone/test-ffi index ad68660..0a91f63 100755 --- a/test-suite/standalone/test-ffi +++ b/test-suite/standalone/test-ffi @@ -170,6 +170,21 @@ exec guile -q -s "$0" "$@" (+ -1 2000 -30000 40000000000)) ;; +;; More than ten arguments +;; +(define f-sum-many + (pointer->procedure int64 (dynamic-func "test_ffi_sum_many" lib) + (list uint8 uint16 uint32 uint64 + int8 int16 int32 int64 + int8 int16 int32 int64))) +(test (f-sum-many 255 65535 4294967295 1844674407370955161 + -1 2000 -30000 40000000000 + 5 -6000 70000 -80000000000) + (+ 255 65535 4294967295 1844674407370955161 + -1 2000 -30000 40000000000 + 5 -6000 70000 -80000000000)) + +;; ;; Structs ;; (define f-sum-struct diff --git a/test-suite/standalone/test-ffi-lib.c b/test-suite/standalone/test-ffi-lib.c index 37d6e43..f265339 100644 --- a/test-suite/standalone/test-ffi-lib.c +++ b/test-suite/standalone/test-ffi-lib.c @@ -194,6 +194,23 @@ scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b, } +scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b, + scm_t_uint32 c, scm_t_uint64 d, + scm_t_int8 e, scm_t_int16 f, + scm_t_int32 g, scm_t_int64 h, + scm_t_int8 i, scm_t_int16 j, + scm_t_int32 k, scm_t_int64 l); +scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b, + scm_t_uint32 c, scm_t_uint64 d, + scm_t_int8 e, scm_t_int16 f, + scm_t_int32 g, scm_t_int64 h, + scm_t_int8 i, scm_t_int16 j, + scm_t_int32 k, scm_t_int64 l) +{ + return l + k + j + i + h + g + f + e + d + c + b + a; +} + + struct foo { scm_t_int8 a; -- 1.7.10.4 --=-=-=-- From unknown Mon Jun 23 06:01:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13809: [PATCH] Support calling foreign functions of 10 or more arguments Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 28 Feb 2013 08:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13809 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Mark H Weaver Cc: guile-devel@gnu.org, 13809@debbugs.gnu.org Received: via spool by 13809-submit@debbugs.gnu.org id=B13809.136204097426780 (code B ref 13809); Thu, 28 Feb 2013 08:43:01 +0000 Received: (at 13809) by debbugs.gnu.org; 28 Feb 2013 08:42:54 +0000 Received: from localhost ([127.0.0.1]:55038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAz4l-0006xo-W2 for submit@debbugs.gnu.org; Thu, 28 Feb 2013 03:42:54 -0500 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:54894 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAz4h-0006xf-UW for 13809@debbugs.gnu.org; Thu, 28 Feb 2013 03:42:49 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 54788A9CB; Thu, 28 Feb 2013 03:40:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=b7hX1x4jeiWuh7xBpX5p3bhAq8o=; b=yHhwnk m0ZZPNHbBbv3SRg7cNcmIbxkiTqNsZRfRZs2kwQvTSEw7d9jOw1WrMH2RYLL0txP zZXx0oTY05TaXUSCRe88VgC+yqPdCgxSx7pXCBh41oI+hJfme7T1P1IMdy6FQ+2g iOdL+9XEMs8msGqJDau2vs68Y+Qe75/jOTUzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=KeP+m5NtECqryzDRJW8sXXcmM3o5feDV GhY+4sfIcG1smFWdGwyEUVOqGvK8+7jncMr7PoDJplJYjVTkv8E+xldzMRW8yKB5 gNN8Am/ETjsuFo5Q+kSOAX/Wz31VM3DCIMSraatAogw2slee0Q/lyR42jrOWltDN v06BG92MJ+c= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 46B55A9CA; Thu, 28 Feb 2013 03:40:52 -0500 (EST) Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id BC3DBA9C9; Thu, 28 Feb 2013 03:40:51 -0500 (EST) From: Andy Wingo References: <87621h6xkl.fsf@tines.lan> <87a9qs937u.fsf@pobox.com> <878v6azol2.fsf_-_@tines.lan> <87fw0ixg4p.fsf@pobox.com> <87ppzlxv95.fsf@tines.lan> Date: Thu, 28 Feb 2013 09:40:49 +0100 In-Reply-To: <87ppzlxv95.fsf@tines.lan> (Mark H. Weaver's message of "Wed, 27 Feb 2013 17:11:18 -0500") Message-ID: <87d2vku8z2.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 8EF9DE06-8182-11E2-AD9B-0B410E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Greets :) On Wed 27 Feb 2013 23:11, Mark H Weaver writes: > Also, I've since realized that the new arity limit is 127, not 255 as my > previous patch had assumed. Good catch. > Here's a new patch. What do you think? Looks great, please apply. Thank you! Andy -- http://wingolog.org/ From unknown Mon Jun 23 06:01:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mark H Weaver Subject: bug#13809: closed (Re: [PATCH] Support calling foreign functions of 10 or more arguments) Message-ID: References: <87txowwtrq.fsf@tines.lan> <87621h6xkl.fsf@tines.lan> X-Gnu-PR-Message: they-closed 13809 X-Gnu-PR-Package: guile Reply-To: 13809@debbugs.gnu.org Date: Thu, 28 Feb 2013 11:44:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1362051842-11378-1" This is a multi-part message in MIME format... ------------=_1362051842-11378-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13809: Wishlist: support > 10 args to foreign functions which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13809@debbugs.gnu.org. --=20 13809: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13809 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1362051842-11378-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13809-done) by debbugs.gnu.org; 28 Feb 2013 11:43:09 +0000 Received: from localhost ([127.0.0.1]:55235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB1tE-0002wA-Gw for submit@debbugs.gnu.org; Thu, 28 Feb 2013 06:43:09 -0500 Received: from world.peace.net ([96.39.62.75]:36761) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB1tB-0002w0-KA for 13809-done@debbugs.gnu.org; Thu, 28 Feb 2013 06:43:06 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UB1rE-0000xK-97; Thu, 28 Feb 2013 06:41:04 -0500 From: Mark H Weaver To: 13809-done@debbugs.gnu.org Subject: Re: [PATCH] Support calling foreign functions of 10 or more arguments References: <87621h6xkl.fsf@tines.lan> <87a9qs937u.fsf@pobox.com> <878v6azol2.fsf_-_@tines.lan> <87fw0ixg4p.fsf@pobox.com> <87ppzlxv95.fsf@tines.lan> <87d2vku8z2.fsf@pobox.com> Date: Thu, 28 Feb 2013 06:40:57 -0500 In-Reply-To: <87d2vku8z2.fsf@pobox.com> (Andy Wingo's message of "Thu, 28 Feb 2013 09:40:49 +0100") Message-ID: <87txowwtrq.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13809-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.5 (/) Andy Wingo writes: > Looks great, please apply. Thank you! Pushed. Thanks! Mark ------------=_1362051842-11378-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Feb 2013 00:36:16 +0000 Received: from localhost ([127.0.0.1]:48363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9m3D-0003UZ-Ob for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:36:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54124) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9m3C-0003UR-4A for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:36:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9m1c-00085I-KR for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:34:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:39698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1c-00085D-HV for submit@debbugs.gnu.org; Sun, 24 Feb 2013 19:34:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1b-0007HW-F4 for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9m1Y-00084b-Tv for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:35 -0500 Received: from world.peace.net ([96.39.62.75]:59594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9m1Y-00084R-PY for bug-guile@gnu.org; Sun, 24 Feb 2013 19:34:32 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1U9m1S-00065d-3m; Sun, 24 Feb 2013 19:34:26 -0500 From: Mark H Weaver To: bug-guile@gnu.org Subject: Wishlist: support > 10 args to foreign functions Date: Sun, 24 Feb 2013 19:34:18 -0500 Message-ID: <87621h6xkl.fsf@tines.lan> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit Cc: Andy Wingo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) The current limitation of 10 arguments to foreign functions is proving to be a problem for some libraries, in particular the Allegro game library. Is there a reason why raising this limit to 16 or 20 would be undesirable? What tradeoffs are involved? Thanks, Mark ------------=_1362051842-11378-1--