From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13320 invoked by alias); 10 Oct 2014 20:43:39 -0000 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 Received: (qmail 13085 invoked by uid 89); 10 Oct 2014 20:43:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=unavailable version=3.3.2 X-HELO: mail-qa0-f45.google.com Received: from mail-qa0-f45.google.com (HELO mail-qa0-f45.google.com) (209.85.216.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 10 Oct 2014 20:43:37 +0000 Received: by mail-qa0-f45.google.com with SMTP id s7so2181507qap.18 for ; Fri, 10 Oct 2014 13:43:35 -0700 (PDT) X-Received: by 10.224.112.3 with SMTP id u3mr12954554qap.17.1412973815413; Fri, 10 Oct 2014 13:43:35 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id s49sm5909008qge.15.2014.10.10.13.43.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Oct 2014 13:43:34 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: libffi-discuss@sourceware.org, gofrontend-dev@googlegroups.com Subject: [PATCH 06/13] libffi: Add entry points for interacting with Go Date: Fri, 10 Oct 2014 20:43:00 -0000 Message-Id: <1412973773-3942-7-git-send-email-rth@redhat.com> In-Reply-To: <1412973773-3942-1-git-send-email-rth@redhat.com> References: <1412973773-3942-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014/txt/msg00100.txt.bz2 A "ffi_go_closure" is intended to be compatible with the function descriptors used by Go, and ffi_call_go sets up the static chain parameter for calling a Go function. The entry points are disabled when a backend has not been updated, much like we do for "normal" closures. --- libffi/include/ffi.h.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in index 380673b..ccd4ac0 100644 --- a/libffi/include/ffi.h.in +++ b/libffi/include/ffi.h.in @@ -390,6 +390,22 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, #endif /* FFI_CLOSURES */ +#if FFI_GO_CLOSURES + +typedef struct { + void *tramp; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); +} ffi_go_closure; + +ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*)); + +void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, + void **avalue, void *closure); + +#endif /* FFI_GO_CLOSURES */ + /* ---- Public interface definition -------------------------------------- */ ffi_status ffi_prep_cif(ffi_cif *cif, -- 1.9.3