public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: libffi-discuss@sourceware.org
Cc: Richard Henderson <rth@redhat.com>
Subject: [PATCH 15/16] aarch64: Move x8 out of call_context
Date: Tue, 28 Oct 2014 18:54:00 -0000	[thread overview]
Message-ID: <1414522393-19169-16-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1414522393-19169-1-git-send-email-rth@twiddle.net>

From: Richard Henderson <rth@redhat.com>

Reduces stack size.  It was only used by the closure, and there
are available argument registers.
---
 src/aarch64/ffi.c      | 5 ++---
 src/aarch64/internal.h | 2 +-
 src/aarch64/sysv.S     | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
index 4f85140..f546ab2 100644
--- a/src/aarch64/ffi.c
+++ b/src/aarch64/ffi.c
@@ -52,7 +52,6 @@ struct call_context
 {
   struct _v v[N_V_ARG_REG];
   UINT64 x[N_X_ARG_REG];
-  UINT64 x8;
 };
 
 #if defined (__clang__) && defined (__APPLE__)
@@ -766,7 +765,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
 			void (*fun)(ffi_cif*,void*,void**,void*),
 			void *user_data,
 			struct call_context *context,
-			void *stack, void *rvalue)
+			void *stack, void *rvalue, void *struct_rvalue)
 {
   void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
   int i, h, nargs, flags;
@@ -861,7 +860,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
 
   flags = cif->flags;
   if (flags & AARCH64_RET_IN_MEM)
-    rvalue = (void *)(uintptr_t)context->x8;
+    rvalue = struct_rvalue;
 
   fun (cif, rvalue, avalue, user_data);
 
diff --git a/src/aarch64/internal.h b/src/aarch64/internal.h
index a3070db..9c3e077 100644
--- a/src/aarch64/internal.h
+++ b/src/aarch64/internal.h
@@ -64,4 +64,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 
 #define N_X_ARG_REG		8
 #define N_V_ARG_REG		8
-#define CALL_CONTEXT_SIZE	(N_V_ARG_REG * 16 + N_X_ARG_REG * 8 + 16)
+#define CALL_CONTEXT_SIZE	(N_V_ARG_REG * 16 + N_X_ARG_REG * 8)
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
index abd848d..7f00a3f 100644
--- a/src/aarch64/sysv.S
+++ b/src/aarch64/sysv.S
@@ -241,7 +241,6 @@ CNAME(ffi_closure_SYSV):
 	stp     x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16]
 	stp     x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32]
 	stp     x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48]
-	str     x8,     [sp, #16 + 16*N_V_ARG_REG + 64]
 
 	/* Load ffi_closure_inner arguments.  */
 	ldp	x0, x1, [x17, #FFI_TRAMPOLINE_SIZE]	/* load cif, fn */
@@ -249,6 +248,7 @@ CNAME(ffi_closure_SYSV):
 	add	x3, sp, #16				/* load context */
 	add	x4, sp, #ffi_closure_SYSV_FS		/* load stack */
 	add	x5, sp, #16+CALL_CONTEXT_SIZE		/* load rvalue */
+	mov	x6, x8					/* load struct_rval */
 	bl      CNAME(ffi_closure_SYSV_inner)
 
 	/* Load the return value as directed.  */
-- 
1.9.3

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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 18:53 [PATCH 00/16] Go closures for aarch64 Richard Henderson
2014-10-28 18:53 ` [PATCH 01/16] aarch64: Fix non-apple compilation Richard Henderson
2014-10-28 18:53 ` [PATCH 03/16] aarch64: Always distinguish LONGDOUBLE Richard Henderson
2014-10-28 18:54 ` [PATCH 06/16] aarch64: Use correct return registers Richard Henderson
2014-10-28 18:54 ` [PATCH 09/16] aarch64: Merge prep_args with ffi_call Richard Henderson
2014-10-28 18:54 ` [PATCH 16/16] aarch64: Add support for Go closures Richard Henderson
2014-10-28 18:54 ` [PATCH 02/16] aarch64: Improve is_hfa Richard Henderson
2014-10-28 18:54 ` [PATCH 13/16] aarch64: Remove aarch64_flags Richard Henderson
2014-10-28 18:54 ` [PATCH 05/16] aarch64: Reduce the size of register_context Richard Henderson
2014-10-28 18:54 ` [PATCH 10/16] aarch64: Move return value handling into ffi_call_SYSV Richard Henderson
2014-10-28 18:54 ` Richard Henderson [this message]
2014-10-28 18:54 ` [PATCH 07/16] aarch64: Treat void return as not passed in registers Richard Henderson
2014-10-28 18:54 ` [PATCH 04/16] aarch64: Simplify AARCH64_STACK_ALIGN Richard Henderson
2014-10-28 18:54 ` [PATCH 08/16] aarch64: Tidy up abi manipulation Richard Henderson
2017-09-17 14:24   ` Andreas Schwab
2014-10-28 18:54 ` [PATCH 14/16] aarch64: Add support for complex types Richard Henderson
2014-10-28 18:54 ` [PATCH 11/16] aarch64: Move return value handling into ffi_closure_SYSV Richard Henderson
2014-10-28 18:54 ` [PATCH 12/16] aarch64: Unify scalar fp and hfa handling Richard Henderson
2014-11-10 10:12 ` [PATCH 00/16] Go closures for aarch64 James Greenhalgh
2014-11-10 13:22   ` 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=1414522393-19169-16-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=libffi-discuss@sourceware.org \
    --cc=rth@redhat.com \
    /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).