public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Change in libffi behaviour -- large struct args
@ 2022-05-28 13:40 Anthony Green
  2022-05-28 15:38 ` dancol
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Anthony Green @ 2022-05-28 13:40 UTC (permalink / raw)
  To: libffi-discuss

As has been discussed in various github PRs recently, I'd like to
change libffi's behaviour regarding large struct arguments.

When passing a struct by value, most (all?) ABI definitions ask that
you try to fit structs up to a certain size into registers, and if
they are too large, make a copy and pass them on the stack.
Libffi's current behaviour is to fit small structs in registers, but
then if something is too large, pass it by reference, leaving it as an
exercise for the user to make their own copies.   Many libffi users,
like cpython, do this special work themselves.   I don't like this
because it exposes this ABI detail, the threshold for struct sizes, to
the libffi caller.   Libffi should be making this copy itself.

The struct_by_value_big.c test checks for this, and most ports fail
today   Changing this behaviour won't introduce regressions for libffi
users, and eventually they will be able to remove their special
handling of large struct args.

AG

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-31 23:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 13:40 Change in libffi behaviour -- large struct args Anthony Green
2022-05-28 15:38 ` dancol
2022-05-28 15:50   ` Anthony Green
2022-05-29 14:09 ` Anthony Green
2022-05-31 15:53 ` DJ Delorie
2022-05-31 16:47   ` dancol
2022-05-31 16:55     ` Kaz Kylheku
2022-05-31 18:59   ` Anthony Green
2022-05-31 23:16     ` DJ Delorie

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).