public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Timothy Wall <twalljava@dev.java.net>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: libffi stdcall closures
Date: Tue, 13 Nov 2007 23:28:00 -0000	[thread overview]
Message-ID: <m3abphetve.fsf@fleche.redhat.com> (raw)
In-Reply-To: <6F9E5081-D1B5-4D4C-9FC1-D90D22709C9D@dev.java.net> (Timothy Wall's message of "Thu\, 08 Nov 2007 18\:24\:44 -0500")

>>>>> "Timothy" == Timothy Wall <twalljava@dev.java.net> writes:

Timothy> Here's the patch for stdcall closures, including a basic test.  The
Timothy> diff is against the JNA repo; I can probably do one against a gcc
Timothy> checkout if necessary.

I'm not really an x86 expert, so perhaps a port maintainer could look
it over.  The test case also looked good at first blush, but Andreas
is really the person for that...

I have a couple nits to pick, but nothing major.

Timothy> BTW, the lack of support came up as people were trying to install
Timothy> Java callbacks into various windows API functions (services, keyboard
Timothy> hooks, etc).  Some would work fine, others would crash.  I wasn't
Timothy> aware that libffi didn't have stdcall closure support since the few
Timothy> simple tests and examples I wrote just happened to work.

FWIW there are other areas where you may run into problems.  The
biggest one is varargs -- libffi basically doesn't support this at
all.  I'm sure there are more obscure ones, too, involving any new ABI
additions... maybe vectors, or decimal float, or I don't know what.

Timothy> +#ifdef X86_WIN32
Timothy> +  if (cif->abi == FFI_STDCALL) {
Timothy> +    FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0],    \
Timothy> +                                 &ffi_closure_STDCALL,  \
Timothy> +                                 (void*)closure, cif->bytes);
Timothy> +  }
Timothy> +#endif

You don't need the backslashes here.  I see them elsewhere in the
file, but they are bogus.  Also the "{" should be on its own line.

Also, it looks to me as though there's a missing 'else' in
here... shouldn't we call either FFI_INIT_TRAMPOLINE_STDCALL or
FFI_INIT_TRAMPOLINE, but not both?

thanks,
Tom

  reply	other threads:[~2007-11-13 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08 16:09 Timothy Wall
2007-11-08 19:11 ` Tom Tromey
2007-11-08 22:19   ` Timothy Wall
2007-11-09  1:07   ` Timothy Wall
2007-11-13 23:28     ` Tom Tromey [this message]
2007-11-13 23:32       ` Timothy Wall

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=m3abphetve.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=twalljava@dev.java.net \
    /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).