public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: libffi-discuss@sourceware.org
Subject: [PATCH 1/8] Add entry points for interacting with Go
Date: Tue, 28 Oct 2014 18:32:00 -0000	[thread overview]
Message-ID: <1414521094-18403-2-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1414521094-18403-1-git-send-email-rth@twiddle.net>

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.
---
 include/ffi.h.in | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/ffi.h.in b/include/ffi.h.in
index f403ae0..c43d52f 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h.in
@@ -428,6 +428,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

  reply	other threads:[~2014-10-28 18:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 18:32 [PATCH 0/8] Go closures for x86_64 Richard Henderson
2014-10-28 18:32 ` Richard Henderson [this message]
2014-10-28 18:32 ` [PATCH 3/8] x86-64: Support go closures Richard Henderson
2014-10-28 18:32 ` [PATCH 7/8] x86_64: Decouple return types from FFI_TYPE constants Richard Henderson
2014-10-28 18:32 ` [PATCH 2/8] Add ffi_cfi.h Richard Henderson
2014-10-28 18:32 ` [PATCH 4/8] win64: Rewrite Richard Henderson
2014-10-28 18:32 ` [PATCH 6/8] x86_64: Fixups for x32 Richard Henderson
2014-10-28 18:32 ` [PATCH 5/8] win64: Remove support from ffi.c Richard Henderson
2014-10-28 18:32 ` [PATCH 8/8] x86_64: Add support for complex types Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414521094-18403-2-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=libffi-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).