[Python-checkins] r60949 - python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffi.c python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffitarget.h python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/sysv.S

thomas.heller python-checkins at python.org
Fri Feb 22 09:29:00 CET 2008


Author: thomas.heller
Date: Fri Feb 22 09:28:59 2008
New Revision: 60949

Modified:
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/sysv.S
Log:
More files from libffi-3.0.2.

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffi.c	Fri Feb 22 09:28:59 2008
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2000 Software AG
+   ffi.c - Copyright (c) 2000, 2007 Software AG
  
    S390 Foreign Function Interface
  
@@ -207,6 +207,12 @@
       void *arg = *p_argv;
       int type = (*ptr)->type;
 
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+      /* 16-byte long double is passed like a struct.  */
+      if (type == FFI_TYPE_LONGDOUBLE)
+	type = FFI_TYPE_STRUCT;
+#endif
+
       /* Check how a structure type is passed.  */
       if (type == FFI_TYPE_STRUCT)
 	{
@@ -364,6 +370,12 @@
 	cif->flags = FFI390_RET_DOUBLE;
 	break;
 
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+      case FFI_TYPE_LONGDOUBLE:
+	cif->flags = FFI390_RET_STRUCT;
+	n_gpr++;
+	break;
+#endif
       /* Integer values are returned in gpr 2 (and gpr 3
 	 for 64-bit values on 31-bit machines).  */
       case FFI_TYPE_UINT64:
@@ -400,6 +412,12 @@
     {
       int type = (*ptr)->type;
 
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+      /* 16-byte long double is passed like a struct.  */
+      if (type == FFI_TYPE_LONGDOUBLE)
+	type = FFI_TYPE_STRUCT;
+#endif
+
       /* Check how a structure type is passed.  */
       if (type == FFI_TYPE_STRUCT)
 	{
@@ -562,6 +580,12 @@
       int deref_struct_pointer = 0;
       int type = (*ptr)->type;
 
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+      /* 16-byte long double is passed like a struct.  */
+      if (type == FFI_TYPE_LONGDOUBLE)
+	type = FFI_TYPE_STRUCT;
+#endif
+
       /* Check how a structure type is passed.  */
       if (type == FFI_TYPE_STRUCT)
 	{
@@ -662,6 +686,9 @@
       /* Void is easy, and so is struct.  */
       case FFI_TYPE_VOID:
       case FFI_TYPE_STRUCT:
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+      case FFI_TYPE_LONGDOUBLE:
+#endif
 	break;
 
       /* Floating point values are returned in fpr 0.  */
@@ -709,17 +736,18 @@
 
 /*====================================================================*/
 /*                                                                    */
-/* Name     - ffi_prep_closure.                                       */
+/* Name     - ffi_prep_closure_loc.                                   */
 /*                                                                    */
 /* Function - Prepare a FFI closure.                                  */
 /*                                                                    */
 /*====================================================================*/
  
 ffi_status
-ffi_prep_closure (ffi_closure *closure,
-                  ffi_cif *cif,
-                  void (*fun) (ffi_cif *, void *, void **, void *),
-                  void *user_data)
+ffi_prep_closure_loc (ffi_closure *closure,
+		      ffi_cif *cif,
+		      void (*fun) (ffi_cif *, void *, void **, void *),
+		      void *user_data,
+		      void *codeloc)
 {
   FFI_ASSERT (cif->abi == FFI_SYSV);
 
@@ -728,7 +756,7 @@
   *(short *)&closure->tramp [2] = 0x9801;   /* lm %r0,%r1,6(%r1) */
   *(short *)&closure->tramp [4] = 0x1006;
   *(short *)&closure->tramp [6] = 0x07f1;   /* br %r1 */
-  *(long  *)&closure->tramp [8] = (long)closure;
+  *(long  *)&closure->tramp [8] = (long)codeloc;
   *(long  *)&closure->tramp[12] = (long)&ffi_closure_SYSV;
 #else
   *(short *)&closure->tramp [0] = 0x0d10;   /* basr %r1,0 */
@@ -736,7 +764,7 @@
   *(short *)&closure->tramp [4] = 0x100e;
   *(short *)&closure->tramp [6] = 0x0004;
   *(short *)&closure->tramp [8] = 0x07f1;   /* br %r1 */
-  *(long  *)&closure->tramp[16] = (long)closure;
+  *(long  *)&closure->tramp[16] = (long)codeloc;
   *(long  *)&closure->tramp[24] = (long)&ffi_closure_SYSV;
 #endif 
  

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/ffitarget.h	Fri Feb 22 09:28:59 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/sysv.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/sysv.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/s390/sysv.S	Fri Feb 22 09:28:59 2008
@@ -17,7 +17,8 @@
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+	ANY CLAIM, DAMAGES OR
    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.


More information about the Python-checkins mailing list