Commit c528d5b45e248f47b5af6f16bfcafc779b196ed1

Anthony Green 2022-05-29T11:22:38

Fix windows arg passing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c
index 81d41bf..263aa5b 100644
--- a/src/x86/ffiw64.c
+++ b/src/x86/ffiw64.c
@@ -125,7 +125,6 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
   struct win64_call_frame *frame;
   ffi_type **arg_types = cif->arg_types;
   int nargs = cif->nargs;
-  const int max_reg_struct_size = cif->abi == FFI_GNUW64 ? 8 : 16;
 
   FFI_ASSERT(cif->abi == FFI_GNUW64 || cif->abi == FFI_WIN64);
 
@@ -135,7 +134,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
     {
       ffi_type *at = arg_types[i];
       int size = at->size;
-      if (at->type == FFI_TYPE_STRUCT && size > max_reg_struct_size)
+      if (at->type == FFI_TYPE_STRUCT && size > 8)
         {
           char *argcopy = alloca (size);
           memcpy (argcopy, avalue[i], size);