Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1310:d66fc88471be
Date: 2013-08-01 15:23 +0200
http://bitbucket.org/cffi/cffi/changeset/d66fc88471be/

Log:    hg merge win64

diff --git a/c/libffi_msvc/ffi.c b/c/libffi_msvc/ffi.c
--- a/c/libffi_msvc/ffi.c
+++ b/c/libffi_msvc/ffi.c
@@ -221,8 +221,7 @@
 #else
     case FFI_SYSV:
       /*@-usedef@*/
-      /* Function call needs at least 40 bytes stack size, on win64 AMD64 */
-      return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes ? cif->bytes : 40,
+      return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes,
                           cif->flags, ecif.rvalue, fn);
       /*@=usedef@*/
       break;
@@ -247,7 +246,7 @@
 #else
 static void __fastcall
 #endif
-ffi_closure_SYSV (ffi_closure *closure, int *argp)
+ffi_closure_SYSV (ffi_closure *closure, char *argp)
 {
   // this is our return value storage
   long double    res;
@@ -257,7 +256,7 @@
   void         **arg_area;
   unsigned short rtype;
   void          *resp = (void*)&res;
-  void *args = &argp[1];
+  void *args = argp + sizeof(void *);
 
   cif         = closure->cif;
   arg_area    = (void**) alloca (cif->nargs * sizeof (void*));  
@@ -378,6 +377,11 @@
 
       /* because we're little endian, this is what it turns into.   */
 
+#ifdef _WIN64
+      if (z > 8)
+          *p_argv = *((void**) argp);   /* indirect */
+      else
+#endif
       *p_argv = (void*) argp;
 
       p_argv++;
diff --git a/c/libffi_msvc/prep_cif.c b/c/libffi_msvc/prep_cif.c
--- a/c/libffi_msvc/prep_cif.c
+++ b/c/libffi_msvc/prep_cif.c
@@ -168,6 +168,12 @@
 #endif
     }
 
+#ifdef _WIN64
+  /* Function call needs at least 40 bytes stack size, on win64 AMD64 */
+  if (bytes < 40)
+      bytes = 40;
+#endif
+
   cif->bytes = bytes;
 
   /* Perform machine dependent cif processing */
diff --git a/c/libffi_msvc/types.c b/c/libffi_msvc/types.c
--- a/c/libffi_msvc/types.c
+++ b/c/libffi_msvc/types.c
@@ -43,7 +43,7 @@
 FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
 
 #if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \
-    || defined IA64
+    || defined IA64 || defined _WIN64
 
 FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to