]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorAndrew Haley <aph@gcc.gnu.org>
Fri, 12 Jun 2009 15:57:58 +0000 (15:57 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Fri, 12 Jun 2009 15:57:58 +0000 (15:57 +0000)
2009-06-12  Andrew Haley  <aph@redhat.com>

* ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
testsuite/libffi.call/cls_align_uint64.c,
testsuite/libffi.call/cls_ulonglong.c,
testsuite/libffi.call/return_ll1.c,
testsuite/libffi.call/stret_medium2.c: Fix printf format
specifiers.
testsuite/libffi.special/unwindtest.cc: include stdint.h.

2009-06-11  Timothy Wall  <twall@users.sf.net>

* Makefile.am,
        configure.ac,
        include/ffi.h.in,
        include/ffi_common.h,
        src/closures.c,
        src/dlmalloc.c,
        src/x86/ffi.c,
        src/x86/ffitarget.h,
        src/x86/win64.S (new),
README: Added win64 support (mingw or MSVC)
        * Makefile.in,
        include/Makefile.in,
        man/Makefile.in,
        testsuite/Makefile.in,
        configure,
        aclocal.m4: Regenerated
        * ltcf-c.sh: properly escape cygwin/w32 path
        * man/ffi_call.3: Clarify size requirements for return value.
        * src/x86/ffi64.c: Fix filename in comment.
        * src/x86/win32.S: Remove unused extern.

        * testsuite/libffi.call/closure_fn0.c,
        testsuite/libffi.call/closure_fn1.c,
        testsuite/libffi.call/closure_fn2.c,
        testsuite/libffi.call/closure_fn3.c,
        testsuite/libffi.call/closure_fn4.c,
        testsuite/libffi.call/closure_fn5.c,
        testsuite/libffi.call/closure_fn6.c,
testsuite/libffi.call/closure_stdcall.c,
testsuite/libffi.call/cls_12byte.c,
testsuite/libffi.call/cls_16byte.c,
testsuite/libffi.call/cls_18byte.c,
testsuite/libffi.call/cls_19byte.c,
testsuite/libffi.call/cls_1_1byte.c,
testsuite/libffi.call/cls_20byte.c,
testsuite/libffi.call/cls_20byte1.c,
testsuite/libffi.call/cls_24byte.c,
testsuite/libffi.call/cls_2byte.c,
testsuite/libffi.call/cls_3_1byte.c,
testsuite/libffi.call/cls_3byte1.c,
  testsuite/libffi.call/cls_3byte2.c,
  testsuite/libffi.call/cls_4_1byte.c,
  testsuite/libffi.call/cls_4byte.c,
  testsuite/libffi.call/cls_5_1_byte.c,
  testsuite/libffi.call/cls_5byte.c,
  testsuite/libffi.call/cls_64byte.c,
  testsuite/libffi.call/cls_6_1_byte.c,
  testsuite/libffi.call/cls_6byte.c,
  testsuite/libffi.call/cls_7_1_byte.c,
  testsuite/libffi.call/cls_7byte.c,
  testsuite/libffi.call/cls_8byte.c,
  testsuite/libffi.call/cls_9byte1.c,
  testsuite/libffi.call/cls_9byte2.c,
  testsuite/libffi.call/cls_align_double.c,
  testsuite/libffi.call/cls_align_float.c,
  testsuite/libffi.call/cls_align_longdouble.c,
  testsuite/libffi.call/cls_align_longdouble_split.c,
  testsuite/libffi.call/cls_align_longdouble_split2.c,
  testsuite/libffi.call/cls_align_pointer.c,
  testsuite/libffi.call/cls_align_sint16.c,
  testsuite/libffi.call/cls_align_sint32.c,
  testsuite/libffi.call/cls_align_sint64.c,
  testsuite/libffi.call/cls_align_uint16.c,
  testsuite/libffi.call/cls_align_uint32.c,
  testsuite/libffi.call/cls_align_uint64.c,
  testsuite/libffi.call/cls_dbls_struct.c,
  testsuite/libffi.call/cls_double.c,
  testsuite/libffi.call/cls_double_va.c,
  testsuite/libffi.call/cls_float.c,
  testsuite/libffi.call/cls_longdouble.c,
  testsuite/libffi.call/cls_longdouble_va.c,
  testsuite/libffi.call/cls_multi_schar.c,
  testsuite/libffi.call/cls_multi_sshort.c,
  testsuite/libffi.call/cls_multi_sshortchar.c,
  testsuite/libffi.call/cls_multi_uchar.c,
  testsuite/libffi.call/cls_multi_ushort.c,
  testsuite/libffi.call/cls_multi_ushortchar.c,
  testsuite/libffi.call/cls_pointer.c,
  testsuite/libffi.call/cls_pointer_stack.c,
  testsuite/libffi.call/cls_schar.c,
  testsuite/libffi.call/cls_sint.c,
  testsuite/libffi.call/cls_sshort.c,
  testsuite/libffi.call/cls_uchar.c,
  testsuite/libffi.call/cls_uint.c,
  testsuite/libffi.call/cls_ulonglong.c,
  testsuite/libffi.call/cls_ushort.c,
  testsuite/libffi.call/err_bad_abi.c,
  testsuite/libffi.call/err_bad_typedef.c,
  testsuite/libffi.call/float2.c,
  testsuite/libffi.call/huge_struct.c,
  testsuite/libffi.call/nested_struct.c,
  testsuite/libffi.call/nested_struct1.c,
  testsuite/libffi.call/nested_struct10.c,
  testsuite/libffi.call/nested_struct2.c,
  testsuite/libffi.call/nested_struct3.c,
  testsuite/libffi.call/nested_struct4.c,
  testsuite/libffi.call/nested_struct5.c,
  testsuite/libffi.call/nested_struct6.c,
  testsuite/libffi.call/nested_struct7.c,
  testsuite/libffi.call/nested_struct8.c,
  testsuite/libffi.call/nested_struct9.c,
  testsuite/libffi.call/problem1.c,
  testsuite/libffi.call/return_ldl.c,
  testsuite/libffi.call/return_ll1.c,
  testsuite/libffi.call/stret_large.c,
  testsuite/libffi.call/stret_large2.c,
  testsuite/libffi.call/stret_medium.c,
  testsuite/libffi.call/stret_medium2.c,
        testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
        of checking for MMAP.  Use intptr_t instead of long casts.

2009-06-12  Andrew Haley  <aph@redhat.com>

* Makefile.am: Remove info_TEXINFOS.

From-SVN: r148433

104 files changed:
libffi/ChangeLog
libffi/Makefile.am
libffi/Makefile.in
libffi/README
libffi/configure.ac
libffi/include/Makefile.in
libffi/include/ffi.h.in
libffi/include/ffi_common.h
libffi/man/Makefile.in
libffi/man/ffi_call.3
libffi/src/closures.c
libffi/src/dlmalloc.c
libffi/src/x86/ffi.c
libffi/src/x86/ffi64.c
libffi/src/x86/ffitarget.h
libffi/src/x86/win32.S
libffi/src/x86/win64.S [new file with mode: 0644]
libffi/testsuite/Makefile.in
libffi/testsuite/libffi.call/closure_fn0.c
libffi/testsuite/libffi.call/closure_fn1.c
libffi/testsuite/libffi.call/closure_fn2.c
libffi/testsuite/libffi.call/closure_fn3.c
libffi/testsuite/libffi.call/closure_fn4.c
libffi/testsuite/libffi.call/closure_fn5.c
libffi/testsuite/libffi.call/closure_fn6.c
libffi/testsuite/libffi.call/closure_stdcall.c
libffi/testsuite/libffi.call/cls_12byte.c
libffi/testsuite/libffi.call/cls_16byte.c
libffi/testsuite/libffi.call/cls_18byte.c
libffi/testsuite/libffi.call/cls_19byte.c
libffi/testsuite/libffi.call/cls_1_1byte.c
libffi/testsuite/libffi.call/cls_20byte.c
libffi/testsuite/libffi.call/cls_20byte1.c
libffi/testsuite/libffi.call/cls_24byte.c
libffi/testsuite/libffi.call/cls_2byte.c
libffi/testsuite/libffi.call/cls_3_1byte.c
libffi/testsuite/libffi.call/cls_3byte1.c
libffi/testsuite/libffi.call/cls_3byte2.c
libffi/testsuite/libffi.call/cls_4_1byte.c
libffi/testsuite/libffi.call/cls_4byte.c
libffi/testsuite/libffi.call/cls_5_1_byte.c
libffi/testsuite/libffi.call/cls_5byte.c
libffi/testsuite/libffi.call/cls_64byte.c
libffi/testsuite/libffi.call/cls_6_1_byte.c
libffi/testsuite/libffi.call/cls_6byte.c
libffi/testsuite/libffi.call/cls_7_1_byte.c
libffi/testsuite/libffi.call/cls_7byte.c
libffi/testsuite/libffi.call/cls_8byte.c
libffi/testsuite/libffi.call/cls_9byte1.c
libffi/testsuite/libffi.call/cls_9byte2.c
libffi/testsuite/libffi.call/cls_align_double.c
libffi/testsuite/libffi.call/cls_align_float.c
libffi/testsuite/libffi.call/cls_align_longdouble.c
libffi/testsuite/libffi.call/cls_align_longdouble_split.c
libffi/testsuite/libffi.call/cls_align_longdouble_split2.c
libffi/testsuite/libffi.call/cls_align_pointer.c
libffi/testsuite/libffi.call/cls_align_sint16.c
libffi/testsuite/libffi.call/cls_align_sint32.c
libffi/testsuite/libffi.call/cls_align_sint64.c
libffi/testsuite/libffi.call/cls_align_uint16.c
libffi/testsuite/libffi.call/cls_align_uint32.c
libffi/testsuite/libffi.call/cls_align_uint64.c
libffi/testsuite/libffi.call/cls_dbls_struct.c
libffi/testsuite/libffi.call/cls_double.c
libffi/testsuite/libffi.call/cls_double_va.c
libffi/testsuite/libffi.call/cls_float.c
libffi/testsuite/libffi.call/cls_longdouble.c
libffi/testsuite/libffi.call/cls_longdouble_va.c
libffi/testsuite/libffi.call/cls_multi_schar.c
libffi/testsuite/libffi.call/cls_multi_sshort.c
libffi/testsuite/libffi.call/cls_multi_sshortchar.c
libffi/testsuite/libffi.call/cls_multi_uchar.c
libffi/testsuite/libffi.call/cls_multi_ushort.c
libffi/testsuite/libffi.call/cls_multi_ushortchar.c
libffi/testsuite/libffi.call/cls_pointer.c
libffi/testsuite/libffi.call/cls_pointer_stack.c
libffi/testsuite/libffi.call/cls_schar.c
libffi/testsuite/libffi.call/cls_sint.c
libffi/testsuite/libffi.call/cls_sshort.c
libffi/testsuite/libffi.call/cls_uchar.c
libffi/testsuite/libffi.call/cls_uint.c
libffi/testsuite/libffi.call/cls_ulonglong.c
libffi/testsuite/libffi.call/cls_ushort.c
libffi/testsuite/libffi.call/err_bad_abi.c
libffi/testsuite/libffi.call/err_bad_typedef.c
libffi/testsuite/libffi.call/float2.c
libffi/testsuite/libffi.call/nested_struct.c
libffi/testsuite/libffi.call/nested_struct1.c
libffi/testsuite/libffi.call/nested_struct10.c
libffi/testsuite/libffi.call/nested_struct2.c
libffi/testsuite/libffi.call/nested_struct3.c
libffi/testsuite/libffi.call/nested_struct4.c
libffi/testsuite/libffi.call/nested_struct5.c
libffi/testsuite/libffi.call/nested_struct6.c
libffi/testsuite/libffi.call/nested_struct7.c
libffi/testsuite/libffi.call/nested_struct8.c
libffi/testsuite/libffi.call/nested_struct9.c
libffi/testsuite/libffi.call/problem1.c
libffi/testsuite/libffi.call/return_ldl.c
libffi/testsuite/libffi.call/stret_large.c
libffi/testsuite/libffi.call/stret_large2.c
libffi/testsuite/libffi.call/stret_medium.c
libffi/testsuite/libffi.call/stret_medium2.c
libffi/testsuite/libffi.special/unwindtest.cc

index ee29111817785727b81e98e5fc235548a2551312..02e16ea35aea036e9be85fd953c128f3e7a85ef2 100644 (file)
@@ -1,3 +1,253 @@
+2009-06-12  Andrew Haley  <aph@redhat.com>
+
+       * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_medium2.c: Fix printf format
+       specifiers.
+       testsuite/libffi.special/unwindtest.cc: include stdint.h.
+
+2009-06-11  Timothy Wall  <twall@users.sf.net>
+
+       * Makefile.am,
+        configure.ac,
+        include/ffi.h.in,
+        include/ffi_common.h,
+        src/closures.c,
+        src/dlmalloc.c,
+        src/x86/ffi.c,
+        src/x86/ffitarget.h,
+        src/x86/win64.S (new),
+       README: Added win64 support (mingw or MSVC)
+        * Makefile.in,
+        include/Makefile.in,
+        man/Makefile.in,
+        testsuite/Makefile.in,
+        configure,
+        aclocal.m4: Regenerated
+        * ltcf-c.sh: properly escape cygwin/w32 path
+        * man/ffi_call.3: Clarify size requirements for return value.
+        * src/x86/ffi64.c: Fix filename in comment.
+        * src/x86/win32.S: Remove unused extern.
+
+        * testsuite/libffi.call/closure_fn0.c,
+        testsuite/libffi.call/closure_fn1.c,
+        testsuite/libffi.call/closure_fn2.c,
+        testsuite/libffi.call/closure_fn3.c,
+        testsuite/libffi.call/closure_fn4.c,
+        testsuite/libffi.call/closure_fn5.c,
+        testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/closure_stdcall.c,
+       testsuite/libffi.call/cls_12byte.c,
+       testsuite/libffi.call/cls_16byte.c,
+       testsuite/libffi.call/cls_18byte.c,
+       testsuite/libffi.call/cls_19byte.c,
+       testsuite/libffi.call/cls_1_1byte.c,
+       testsuite/libffi.call/cls_20byte.c,
+       testsuite/libffi.call/cls_20byte1.c,
+       testsuite/libffi.call/cls_24byte.c,
+       testsuite/libffi.call/cls_2byte.c,
+       testsuite/libffi.call/cls_3_1byte.c,
+       testsuite/libffi.call/cls_3byte1.c,
+       testsuite/libffi.call/cls_3byte2.c,
+       testsuite/libffi.call/cls_4_1byte.c,
+       testsuite/libffi.call/cls_4byte.c,
+       testsuite/libffi.call/cls_5_1_byte.c,
+       testsuite/libffi.call/cls_5byte.c,
+       testsuite/libffi.call/cls_64byte.c,
+       testsuite/libffi.call/cls_6_1_byte.c,
+       testsuite/libffi.call/cls_6byte.c,
+       testsuite/libffi.call/cls_7_1_byte.c,
+       testsuite/libffi.call/cls_7byte.c,
+       testsuite/libffi.call/cls_8byte.c,
+       testsuite/libffi.call/cls_9byte1.c,
+       testsuite/libffi.call/cls_9byte2.c,
+       testsuite/libffi.call/cls_align_double.c,
+       testsuite/libffi.call/cls_align_float.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_align_longdouble_split.c,
+       testsuite/libffi.call/cls_align_longdouble_split2.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_align_sint16.c,
+       testsuite/libffi.call/cls_align_sint32.c,
+       testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint16.c,
+       testsuite/libffi.call/cls_align_uint32.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_dbls_struct.c,
+       testsuite/libffi.call/cls_double.c,
+       testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_float.c,
+       testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_multi_schar.c,
+       testsuite/libffi.call/cls_multi_sshort.c,
+       testsuite/libffi.call/cls_multi_sshortchar.c,
+       testsuite/libffi.call/cls_multi_uchar.c,
+       testsuite/libffi.call/cls_multi_ushort.c,
+       testsuite/libffi.call/cls_multi_ushortchar.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c,
+       testsuite/libffi.call/cls_schar.c,
+       testsuite/libffi.call/cls_sint.c,
+       testsuite/libffi.call/cls_sshort.c,
+       testsuite/libffi.call/cls_uchar.c,
+       testsuite/libffi.call/cls_uint.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/cls_ushort.c,
+       testsuite/libffi.call/err_bad_abi.c,
+       testsuite/libffi.call/err_bad_typedef.c,
+       testsuite/libffi.call/float2.c,
+       testsuite/libffi.call/huge_struct.c,
+       testsuite/libffi.call/nested_struct.c,
+       testsuite/libffi.call/nested_struct1.c,
+       testsuite/libffi.call/nested_struct10.c,
+       testsuite/libffi.call/nested_struct2.c,
+       testsuite/libffi.call/nested_struct3.c,
+       testsuite/libffi.call/nested_struct4.c,
+       testsuite/libffi.call/nested_struct5.c,
+       testsuite/libffi.call/nested_struct6.c,
+       testsuite/libffi.call/nested_struct7.c,
+       testsuite/libffi.call/nested_struct8.c,
+       testsuite/libffi.call/nested_struct9.c,
+       testsuite/libffi.call/problem1.c,
+       testsuite/libffi.call/return_ldl.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_large.c,
+       testsuite/libffi.call/stret_large2.c,
+       testsuite/libffi.call/stret_medium.c,
+       testsuite/libffi.call/stret_medium2.c,
+        testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
+        of checking for MMAP.  Use intptr_t instead of long casts.
+
+2009-06-12  Andrew Haley  <aph@redhat.com>
+
+       * Makefile.am: Remove info_TEXINFOS.
+
+2009-06-12  Andrew Haley  <aph@redhat.com>
+
+       * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_medium2.c: Fix printf format
+       specifiers.
+       testsuite/libffi.special/unwindtest.cc: include stdint.h.
+
+2009-06-11  Timothy Wall  <twall@users.sf.net>
+
+       * Makefile.am,
+        configure.ac,
+        include/ffi.h.in,
+        include/ffi_common.h,
+        src/closures.c,
+        src/dlmalloc.c,
+        src/x86/ffi.c,
+        src/x86/ffitarget.h,
+        src/x86/win64.S (new),
+       README: Added win64 support (mingw or MSVC)
+        * Makefile.in,
+        include/Makefile.in,
+        man/Makefile.in,
+        testsuite/Makefile.in,
+        configure,
+        aclocal.m4: Regenerated
+        * ltcf-c.sh: properly escape cygwin/w32 path
+        * man/ffi_call.3: Clarify size requirements for return value.
+        * src/x86/ffi64.c: Fix filename in comment.
+        * src/x86/win32.S: Remove unused extern.
+
+        * testsuite/libffi.call/closure_fn0.c,
+        testsuite/libffi.call/closure_fn1.c,
+        testsuite/libffi.call/closure_fn2.c,
+        testsuite/libffi.call/closure_fn3.c,
+        testsuite/libffi.call/closure_fn4.c,
+        testsuite/libffi.call/closure_fn5.c,
+        testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/closure_stdcall.c,
+       testsuite/libffi.call/cls_12byte.c,
+       testsuite/libffi.call/cls_16byte.c,
+       testsuite/libffi.call/cls_18byte.c,
+       testsuite/libffi.call/cls_19byte.c,
+       testsuite/libffi.call/cls_1_1byte.c,
+       testsuite/libffi.call/cls_20byte.c,
+       testsuite/libffi.call/cls_20byte1.c,
+       testsuite/libffi.call/cls_24byte.c,
+       testsuite/libffi.call/cls_2byte.c,
+       testsuite/libffi.call/cls_3_1byte.c,
+       testsuite/libffi.call/cls_3byte1.c,
+       testsuite/libffi.call/cls_3byte2.c,
+       testsuite/libffi.call/cls_4_1byte.c,
+       testsuite/libffi.call/cls_4byte.c,
+       testsuite/libffi.call/cls_5_1_byte.c,
+       testsuite/libffi.call/cls_5byte.c,
+       testsuite/libffi.call/cls_64byte.c,
+       testsuite/libffi.call/cls_6_1_byte.c,
+       testsuite/libffi.call/cls_6byte.c,
+       testsuite/libffi.call/cls_7_1_byte.c,
+       testsuite/libffi.call/cls_7byte.c,
+       testsuite/libffi.call/cls_8byte.c,
+       testsuite/libffi.call/cls_9byte1.c,
+       testsuite/libffi.call/cls_9byte2.c,
+       testsuite/libffi.call/cls_align_double.c,
+       testsuite/libffi.call/cls_align_float.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_align_longdouble_split.c,
+       testsuite/libffi.call/cls_align_longdouble_split2.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_align_sint16.c,
+       testsuite/libffi.call/cls_align_sint32.c,
+       testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint16.c,
+       testsuite/libffi.call/cls_align_uint32.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_dbls_struct.c,
+       testsuite/libffi.call/cls_double.c,
+       testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_float.c,
+       testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_multi_schar.c,
+       testsuite/libffi.call/cls_multi_sshort.c,
+       testsuite/libffi.call/cls_multi_sshortchar.c,
+       testsuite/libffi.call/cls_multi_uchar.c,
+       testsuite/libffi.call/cls_multi_ushort.c,
+       testsuite/libffi.call/cls_multi_ushortchar.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c,
+       testsuite/libffi.call/cls_schar.c,
+       testsuite/libffi.call/cls_sint.c,
+       testsuite/libffi.call/cls_sshort.c,
+       testsuite/libffi.call/cls_uchar.c,
+       testsuite/libffi.call/cls_uint.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/cls_ushort.c,
+       testsuite/libffi.call/err_bad_abi.c,
+       testsuite/libffi.call/err_bad_typedef.c,
+       testsuite/libffi.call/float2.c,
+       testsuite/libffi.call/huge_struct.c,
+       testsuite/libffi.call/nested_struct.c,
+       testsuite/libffi.call/nested_struct1.c,
+       testsuite/libffi.call/nested_struct10.c,
+       testsuite/libffi.call/nested_struct2.c,
+       testsuite/libffi.call/nested_struct3.c,
+       testsuite/libffi.call/nested_struct4.c,
+       testsuite/libffi.call/nested_struct5.c,
+       testsuite/libffi.call/nested_struct6.c,
+       testsuite/libffi.call/nested_struct7.c,
+       testsuite/libffi.call/nested_struct8.c,
+       testsuite/libffi.call/nested_struct9.c,
+       testsuite/libffi.call/problem1.c,
+       testsuite/libffi.call/return_ldl.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_large.c,
+       testsuite/libffi.call/stret_large2.c,
+       testsuite/libffi.call/stret_medium.c,
+       testsuite/libffi.call/stret_medium2.c,
+        testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
+        of checking for MMAP.  Use intptr_t instead of long casts.
+
 2009-06-11  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * testsuite/libffi.call/cls_longdouble_va.c: Add xfail sh*-*-linux-*.
index 775961353dd41d0699e5becae14dd57cf08e566b..9705c8f4a9e55b3ffb814c19847116be8adb86f5 100644 (file)
@@ -31,8 +31,6 @@ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
        src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
        src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c
 
-info_TEXINFOS = doc/libffi.texi
-
 ## ################################################################
 
 ##
@@ -98,6 +96,9 @@ endif
 if X86_WIN32
 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S
 endif
+if X86_WIN64
+nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S
+endif
 if X86_DARWIN
 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
 endif
index e15f8aa792c0baa52c42d04501846f82ddafd9c7..32f1ebbfa6296ff372b8627b7f336ce62db3c935 100644 (file)
@@ -41,33 +41,33 @@ target_triplet = @target@
 @X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S
 @X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S
 @X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S
-@X86_DARWIN_TRUE@am__append_5 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
-@SPARC_TRUE@am__append_6 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
-@ALPHA_TRUE@am__append_7 = src/alpha/ffi.c src/alpha/osf.S
-@IA64_TRUE@am__append_8 = src/ia64/ffi.c src/ia64/unix.S
-@M32R_TRUE@am__append_9 = src/m32r/sysv.S src/m32r/ffi.c
-@M68K_TRUE@am__append_10 = src/m68k/ffi.c src/m68k/sysv.S
-@POWERPC_TRUE@am__append_11 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
-@POWERPC_AIX_TRUE@am__append_12 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
-@POWERPC_DARWIN_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
-@POWERPC_FREEBSD_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
-@ARM_TRUE@am__append_15 = src/arm/sysv.S src/arm/ffi.c
-@LIBFFI_CRIS_TRUE@am__append_16 = src/cris/sysv.S src/cris/ffi.c
-@FRV_TRUE@am__append_17 = src/frv/eabi.S src/frv/ffi.c
-@S390_TRUE@am__append_18 = src/s390/sysv.S src/s390/ffi.c
-@X86_64_TRUE@am__append_19 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
-@SH_TRUE@am__append_20 = src/sh/sysv.S src/sh/ffi.c
-@SH64_TRUE@am__append_21 = src/sh64/sysv.S src/sh64/ffi.c
-@PA_LINUX_TRUE@am__append_22 = src/pa/linux.S src/pa/ffi.c
-@PA_HPUX_TRUE@am__append_23 = src/pa/hpux32.S src/pa/ffi.c
+@X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S
+@X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
+@SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
+@ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S
+@IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S
+@M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c
+@M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S
+@POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
+@POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
+@POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
+@POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
+@ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c
+@LIBFFI_CRIS_TRUE@am__append_17 = src/cris/sysv.S src/cris/ffi.c
+@FRV_TRUE@am__append_18 = src/frv/eabi.S src/frv/ffi.c
+@S390_TRUE@am__append_19 = src/s390/sysv.S src/s390/ffi.c
+@X86_64_TRUE@am__append_20 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
+@SH_TRUE@am__append_21 = src/sh/sysv.S src/sh/ffi.c
+@SH64_TRUE@am__append_22 = src/sh64/sysv.S src/sh64/ffi.c
+@PA_LINUX_TRUE@am__append_23 = src/pa/linux.S src/pa/ffi.c
+@PA_HPUX_TRUE@am__append_24 = src/pa/hpux32.S src/pa/ffi.c
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
        $(srcdir)/../config.guess $(srcdir)/../config.sub \
        $(srcdir)/../depcomp $(srcdir)/../install-sh \
        $(srcdir)/../ltmain.sh $(srcdir)/../missing \
        $(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
-       $(srcdir)/doc/version.texi $(srcdir)/fficonfig.h.in \
-       $(top_srcdir)/configure ChangeLog mdate-sh texinfo.tex
+       $(srcdir)/Makefile.in $(srcdir)/fficonfig.h.in \
+       $(top_srcdir)/configure ChangeLog
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
@@ -92,7 +92,7 @@ am__vpath_adj = case $$p in \
     *) f=$$p;; \
   esac;
 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)"
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
 toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 libffi_la_LIBADD =
@@ -104,37 +104,38 @@ am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
 @X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo
 @X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo
 @X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo
-@X86_DARWIN_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/darwin.lo \
+@X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo
+@X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \
 @X86_DARWIN_TRUE@      src/x86/ffi64.lo src/x86/darwin64.lo
-@SPARC_TRUE@am__objects_6 = src/sparc/ffi.lo src/sparc/v8.lo \
+@SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \
 @SPARC_TRUE@   src/sparc/v9.lo
-@ALPHA_TRUE@am__objects_7 = src/alpha/ffi.lo src/alpha/osf.lo
-@IA64_TRUE@am__objects_8 = src/ia64/ffi.lo src/ia64/unix.lo
-@M32R_TRUE@am__objects_9 = src/m32r/sysv.lo src/m32r/ffi.lo
-@M68K_TRUE@am__objects_10 = src/m68k/ffi.lo src/m68k/sysv.lo
-@POWERPC_TRUE@am__objects_11 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
+@ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo
+@IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo
+@M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo
+@M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo
+@POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
 @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \
 @POWERPC_TRUE@ src/powerpc/linux64.lo \
 @POWERPC_TRUE@ src/powerpc/linux64_closure.lo
-@POWERPC_AIX_TRUE@am__objects_12 = src/powerpc/ffi_darwin.lo \
+@POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \
 @POWERPC_AIX_TRUE@     src/powerpc/aix.lo \
 @POWERPC_AIX_TRUE@     src/powerpc/aix_closure.lo
-@POWERPC_DARWIN_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \
+@POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \
 @POWERPC_DARWIN_TRUE@  src/powerpc/darwin.lo \
 @POWERPC_DARWIN_TRUE@  src/powerpc/darwin_closure.lo
-@POWERPC_FREEBSD_TRUE@am__objects_14 = src/powerpc/ffi.lo \
+@POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \
 @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \
 @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo
-@ARM_TRUE@am__objects_15 = src/arm/sysv.lo src/arm/ffi.lo
-@LIBFFI_CRIS_TRUE@am__objects_16 = src/cris/sysv.lo src/cris/ffi.lo
-@FRV_TRUE@am__objects_17 = src/frv/eabi.lo src/frv/ffi.lo
-@S390_TRUE@am__objects_18 = src/s390/sysv.lo src/s390/ffi.lo
-@X86_64_TRUE@am__objects_19 = src/x86/ffi64.lo src/x86/unix64.lo \
+@ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo
+@LIBFFI_CRIS_TRUE@am__objects_17 = src/cris/sysv.lo src/cris/ffi.lo
+@FRV_TRUE@am__objects_18 = src/frv/eabi.lo src/frv/ffi.lo
+@S390_TRUE@am__objects_19 = src/s390/sysv.lo src/s390/ffi.lo
+@X86_64_TRUE@am__objects_20 = src/x86/ffi64.lo src/x86/unix64.lo \
 @X86_64_TRUE@  src/x86/ffi.lo src/x86/sysv.lo
-@SH_TRUE@am__objects_20 = src/sh/sysv.lo src/sh/ffi.lo
-@SH64_TRUE@am__objects_21 = src/sh64/sysv.lo src/sh64/ffi.lo
-@PA_LINUX_TRUE@am__objects_22 = src/pa/linux.lo src/pa/ffi.lo
-@PA_HPUX_TRUE@am__objects_23 = src/pa/hpux32.lo src/pa/ffi.lo
+@SH_TRUE@am__objects_21 = src/sh/sysv.lo src/sh/ffi.lo
+@SH64_TRUE@am__objects_22 = src/sh64/sysv.lo src/sh64/ffi.lo
+@PA_LINUX_TRUE@am__objects_23 = src/pa/linux.lo src/pa/ffi.lo
+@PA_HPUX_TRUE@am__objects_24 = src/pa/hpux32.lo src/pa/ffi.lo
 nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
        $(am__objects_3) $(am__objects_4) $(am__objects_5) \
        $(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -142,22 +143,23 @@ nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
        $(am__objects_12) $(am__objects_13) $(am__objects_14) \
        $(am__objects_15) $(am__objects_16) $(am__objects_17) \
        $(am__objects_18) $(am__objects_19) $(am__objects_20) \
-       $(am__objects_21) $(am__objects_22) $(am__objects_23)
+       $(am__objects_21) $(am__objects_22) $(am__objects_23) \
+       $(am__objects_24)
 libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
        $(nodist_libffi_la_OBJECTS)
 libffi_convenience_la_LIBADD =
-am__objects_24 = src/debug.lo src/prep_cif.lo src/types.lo \
+am__objects_25 = src/debug.lo src/prep_cif.lo src/types.lo \
        src/raw_api.lo src/java_raw_api.lo src/closures.lo
-am_libffi_convenience_la_OBJECTS = $(am__objects_24)
-am__objects_25 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+am_libffi_convenience_la_OBJECTS = $(am__objects_25)
+am__objects_26 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
        $(am__objects_4) $(am__objects_5) $(am__objects_6) \
        $(am__objects_7) $(am__objects_8) $(am__objects_9) \
        $(am__objects_10) $(am__objects_11) $(am__objects_12) \
        $(am__objects_13) $(am__objects_14) $(am__objects_15) \
        $(am__objects_16) $(am__objects_17) $(am__objects_18) \
        $(am__objects_19) $(am__objects_20) $(am__objects_21) \
-       $(am__objects_22) $(am__objects_23)
-nodist_libffi_convenience_la_OBJECTS = $(am__objects_25)
+       $(am__objects_22) $(am__objects_23) $(am__objects_24)
+nodist_libffi_convenience_la_OBJECTS = $(am__objects_26)
 libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
        $(nodist_libffi_convenience_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
@@ -184,18 +186,6 @@ MULTIDIRS =
 MULTISUBDIR = 
 MULTIDO = true
 MULTICLEAN = true
-INFO_DEPS = $(srcdir)/doc/libffi.info
-am__TEXINFO_TEX_DIR = $(srcdir)
-DVIS = doc/libffi.dvi
-PDFS = doc/libffi.pdf
-PSS = doc/libffi.ps
-HTMLS = doc/libffi.html
-TEXINFOS = doc/libffi.texi
-TEXI2DVI = texi2dvi
-TEXI2PDF = $(TEXI2DVI) --pdf --batch
-MAKEINFOHTML = $(MAKEINFO) --html
-AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
-DVIPS = dvips
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
        html-recursive info-recursive install-data-recursive \
        install-exec-recursive install-info-recursive \
@@ -333,6 +323,8 @@ X86_FREEBSD_TRUE = @X86_FREEBSD_TRUE@
 X86_TRUE = @X86_TRUE@
 X86_WIN32_FALSE = @X86_WIN32_FALSE@
 X86_WIN32_TRUE = @X86_WIN32_TRUE@
+X86_WIN64_FALSE = @X86_WIN64_FALSE@
+X86_WIN64_TRUE = @X86_WIN64_TRUE@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
@@ -414,10 +406,8 @@ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
        src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \
        src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
        src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
-       src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \
-       libtool-version ChangeLog.libffi
+       src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c
 
-info_TEXINFOS = doc/libffi.texi
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
@@ -469,7 +459,8 @@ nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
        $(am__append_12) $(am__append_13) $(am__append_14) \
        $(am__append_15) $(am__append_16) $(am__append_17) \
        $(am__append_18) $(am__append_19) $(am__append_20) \
-       $(am__append_21) $(am__append_22) $(am__append_23)
+       $(am__append_21) $(am__append_22) $(am__append_23) \
+       $(am__append_24)
 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
 AM_CFLAGS = -Wall -g -fexceptions
@@ -481,7 +472,7 @@ all: fficonfig.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .S .c .dvi .lo .o .obj .ps
+.SUFFIXES: .S .c .lo .o .obj
 am--refresh:
        @:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -606,6 +597,8 @@ src/x86/freebsd.lo: src/x86/$(am__dirstamp) \
        src/x86/$(DEPDIR)/$(am__dirstamp)
 src/x86/win32.lo: src/x86/$(am__dirstamp) \
        src/x86/$(DEPDIR)/$(am__dirstamp)
+src/x86/win64.lo: src/x86/$(am__dirstamp) \
+       src/x86/$(DEPDIR)/$(am__dirstamp)
 src/x86/darwin.lo: src/x86/$(am__dirstamp) \
        src/x86/$(DEPDIR)/$(am__dirstamp)
 src/x86/ffi64.lo: src/x86/$(am__dirstamp) \
@@ -875,6 +868,8 @@ mostlyclean-compile:
        -rm -f src/x86/unix64.lo
        -rm -f src/x86/win32.$(OBJEXT)
        -rm -f src/x86/win32.lo
+       -rm -f src/x86/win64.$(OBJEXT)
+       -rm -f src/x86/win64.lo
 
 distclean-compile:
        -rm -f *.tab.c
@@ -977,127 +972,7 @@ distclean-multi:
        $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
 maintainer-clean-multi:
        $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
-doc/$(am__dirstamp):
-       @$(mkdir_p) doc
-       @: > doc/$(am__dirstamp)
-
-$(srcdir)/doc/libffi.info: doc/libffi.texi $(srcdir)/doc/version.texi
-       restore=: && backupdir="$(am__leading_dot)am$$$$" && \
-       am__cwd=`pwd` && cd $(srcdir) && \
-       rm -rf $$backupdir && mkdir $$backupdir && \
-       if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
-         for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
-           if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
-         done; \
-       else :; fi && \
-       cd "$$am__cwd"; \
-       if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
-        -o $@ $(srcdir)/doc/libffi.texi; \
-       then \
-         rc=0; \
-         cd $(srcdir); \
-       else \
-         rc=$$?; \
-         cd $(srcdir) && \
-         $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
-       fi; \
-       rm -rf $$backupdir; exit $$rc
-
-doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
-       $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi
-
-doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
-       $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi
-
-doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
-       rm -rf $(@:.html=.htp)
-       if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
-        -o $(@:.html=.htp) `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi; \
-       then \
-         rm -rf $@; \
-         if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
-           mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
-       else \
-         if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
-           rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
-         exit 1; \
-       fi
-$(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti
-$(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure
-       test -f doc/$(am__dirstamp) || $(MAKE) doc/$(am__dirstamp)
-       @(dir=.; test -f ./doc/libffi.texi || dir=$(srcdir); \
-       set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/libffi.texi`; \
-       echo "@set UPDATED $$1 $$2 $$3"; \
-       echo "@set UPDATED-MONTH $$2 $$3"; \
-       echo "@set EDITION $(VERSION)"; \
-       echo "@set VERSION $(VERSION)") > vti.tmp
-       @cmp -s vti.tmp $(srcdir)/doc/version.texi \
-         || (echo "Updating $(srcdir)/doc/version.texi"; \
-             cp vti.tmp $(srcdir)/doc/version.texi)
-       -@rm -f vti.tmp
-       @cp $(srcdir)/doc/version.texi $@
-
-mostlyclean-vti:
-       -rm -f vti.tmp
-
-maintainer-clean-vti:
-@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi
-.dvi.ps:
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       $(DVIPS) -o $@ $<
-
 uninstall-info-am:
-       @$(PRE_UNINSTALL)
-       @if (install-info --version && \
-            install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
-         list='$(INFO_DEPS)'; \
-         for file in $$list; do \
-           relfile=`echo "$$file" | sed 's|^.*/||'`; \
-           echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
-           install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
-         done; \
-       else :; fi
-       @$(NORMAL_UNINSTALL)
-       @list='$(INFO_DEPS)'; \
-       for file in $$list; do \
-         relfile=`echo "$$file" | sed 's|^.*/||'`; \
-         relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
-         (if cd "$(DESTDIR)$(infodir)"; then \
-            echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
-            rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
-          else :; fi); \
-       done
-
-dist-info: $(INFO_DEPS)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-       list='$(INFO_DEPS)'; \
-       for base in $$list; do \
-         case $$base in \
-           $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
-         esac; \
-         if test -f $$base; then d=.; else d=$(srcdir); fi; \
-         for file in $$d/$$base*; do \
-           relfile=`expr "$$file" : "$$d/\(.*\)"`; \
-           test -f $(distdir)/$$relfile || \
-             cp -p $$file $(distdir)/$$relfile; \
-         done; \
-       done
-
-mostlyclean-aminfo:
-       -rm -rf libffi.aux libffi.cp libffi.cps libffi.fn libffi.ky libffi.log \
-         libffi.pg libffi.tmp libffi.toc libffi.tp libffi.vr \
-         doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html
-
-maintainer-clean-aminfo:
-       @list='$(INFO_DEPS)'; for i in $$list; do \
-         i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
-         echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
-         rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
-       done
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -1234,7 +1109,7 @@ distclean-tags:
 distdir: $(DISTFILES)
        $(am__remove_distdir)
        mkdir $(distdir)
-       $(mkdir_p) $(distdir)/.. $(distdir)/../config $(distdir)/doc $(distdir)/include $(distdir)/src $(distdir)/src/alpha $(distdir)/src/arm $(distdir)/src/cris $(distdir)/src/frv $(distdir)/src/ia64 $(distdir)/src/m32r $(distdir)/src/m68k $(distdir)/src/mips $(distdir)/src/pa $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh $(distdir)/src/sh64 $(distdir)/src/sparc $(distdir)/src/x86
+       $(mkdir_p) $(distdir)/.. $(distdir)/../config $(distdir)/include $(distdir)/src $(distdir)/src/alpha $(distdir)/src/arm $(distdir)/src/cris $(distdir)/src/frv $(distdir)/src/ia64 $(distdir)/src/m32r $(distdir)/src/m68k $(distdir)/src/mips $(distdir)/src/pa $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh $(distdir)/src/sh64 $(distdir)/src/sparc $(distdir)/src/x86
        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
        list='$(DISTFILES)'; for file in $$list; do \
@@ -1276,9 +1151,6 @@ distdir: $(DISTFILES)
              || exit 1; \
          fi; \
        done
-       $(MAKE) $(AM_MAKEFLAGS) \
-         top_distdir="$(top_distdir)" distdir="$(distdir)" \
-         dist-info
        -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
          ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
@@ -1378,10 +1250,10 @@ distcleancheck: distclean
               exit 1; } >&2
 check-am: all-am
 check: check-recursive
-all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) all-multi fficonfig.h
+all-am: Makefile $(LTLIBRARIES) all-multi fficonfig.h
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)"; do \
+       for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
          test -z "$$dir" || $(mkdir_p) "$$dir"; \
        done
 install: install-recursive
@@ -1404,7 +1276,6 @@ clean-generic:
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -rm -f doc/$(am__dirstamp)
        -rm -f src/$(DEPDIR)/$(am__dirstamp)
        -rm -f src/$(am__dirstamp)
        -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp)
@@ -1455,52 +1326,20 @@ distclean-am: clean-am distclean-compile distclean-generic \
 
 dvi: dvi-recursive
 
-dvi-am: $(DVIS)
+dvi-am:
 
 html: html-recursive
 
-html-am: $(HTMLS)
-
 info: info-recursive
 
-info-am: $(INFO_DEPS)
+info-am:
 
-install-data-am: install-info-am
+install-data-am:
 
 install-exec-am: install-multi install-toolexeclibLTLIBRARIES
 
 install-info: install-info-recursive
 
-install-info-am: $(INFO_DEPS)
-       @$(NORMAL_INSTALL)
-       test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
-       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-       list='$(INFO_DEPS)'; \
-       for file in $$list; do \
-         case $$file in \
-           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-         esac; \
-         if test -f $$file; then d=.; else d=$(srcdir); fi; \
-         file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
-         for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
-                       $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
-           if test -f $$ifile; then \
-             relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
-             echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
-             $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
-           else : ; fi; \
-         done; \
-       done
-       @$(POST_INSTALL)
-       @if (install-info --version && \
-            install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
-         list='$(INFO_DEPS)'; \
-         for file in $$list; do \
-           relfile=`echo "$$file" | sed 's|^.*/||'`; \
-           echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
-           install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
-         done; \
-       else : ; fi
 install-man:
 
 installcheck-am:
@@ -1510,21 +1349,20 @@ maintainer-clean: maintainer-clean-multi maintainer-clean-recursive
        -rm -rf $(top_srcdir)/autom4te.cache
        -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
        -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-aminfo \
-       maintainer-clean-generic maintainer-clean-vti
+maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-multi mostlyclean-recursive
 
-mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool mostlyclean-vti
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
 
 pdf: pdf-recursive
 
-pdf-am: $(PDFS)
+pdf-am:
 
 ps: ps-recursive
 
-ps-am: $(PSS)
+ps-am:
 
 uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES
 
@@ -1534,23 +1372,21 @@ uninstall-info: uninstall-info-recursive
        am--refresh check check-am clean clean-generic clean-libtool \
        clean-multi clean-noinstLTLIBRARIES clean-recursive \
        clean-toolexeclibLTLIBRARIES ctags ctags-recursive dist \
-       dist-all dist-bzip2 dist-gzip dist-info dist-shar dist-tarZ \
-       dist-zip distcheck distclean distclean-compile \
-       distclean-generic distclean-hdr distclean-libtool \
-       distclean-multi distclean-recursive distclean-tags \
-       distcleancheck distdir distuninstallcheck dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-exec install-exec-am install-info \
-       install-info-am install-man install-multi install-strip \
-       install-toolexeclibLTLIBRARIES installcheck installcheck-am \
-       installdirs installdirs-am maintainer-clean \
-       maintainer-clean-aminfo maintainer-clean-generic \
-       maintainer-clean-multi maintainer-clean-recursive \
-       maintainer-clean-vti mostlyclean mostlyclean-aminfo \
+       dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \
+       distcheck distclean distclean-compile distclean-generic \
+       distclean-hdr distclean-libtool distclean-multi \
+       distclean-recursive distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-multi install-strip install-toolexeclibLTLIBRARIES \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic \
+       maintainer-clean-multi maintainer-clean-recursive mostlyclean \
        mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-       mostlyclean-multi mostlyclean-recursive mostlyclean-vti pdf \
-       pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
-       uninstall-info-am uninstall-toolexeclibLTLIBRARIES
+       mostlyclean-multi mostlyclean-recursive pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am uninstall-info-am \
+       uninstall-toolexeclibLTLIBRARIES
 
 
 # No install-html or install-pdf support in automake yet
index ef2dc719c9137ae0ee7dfcab91235952ccd147d3..f102612d11ce5cddcf5c4e5b83fed2a04133ede8 100644 (file)
@@ -61,6 +61,7 @@ release was only tested on:
      x86 linux
      x86 openbsd
      x86 solaris
+     x86-64 mingw
      x86-64 darwin
      x86-64 linux
      x86-64 OS X
index c0b42542bcb06b450855b153b1dfe6473685270c..fe3a5fb075a9f87c6e45ddb57ce99c74bbaae3ef 100644 (file)
@@ -146,6 +146,7 @@ case "$host" in
        TARGET=X86_DARWIN; TARGETDIR=x86
        ;;
   x86_64-*-cygwin* | x86_64-*-mingw*)
+       TARGET=X86_WIN64; TARGETDIR=x86
        ;;
   x86_64-*-*)
        TARGET=X86_64; TARGETDIR=x86
@@ -163,6 +164,7 @@ AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
 AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
+AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
 AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
index e18baecc11b58604b1fbb6316005a6ff4eda6d4a..a81fb1aacd4575bec291c413338289f9e84f24fe 100644 (file)
@@ -186,6 +186,8 @@ X86_FREEBSD_TRUE = @X86_FREEBSD_TRUE@
 X86_TRUE = @X86_TRUE@
 X86_WIN32_FALSE = @X86_WIN32_FALSE@
 X86_WIN32_TRUE = @X86_WIN32_TRUE@
+X86_WIN64_FALSE = @X86_WIN64_FALSE@
+X86_WIN64_TRUE = @X86_WIN64_TRUE@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
index 1a015ae50f19047da7c4b58e0015cbff93d60ae1..a06d626c2d7b6a3725a2dcf824d1afd31f6f29ce 100644 (file)
@@ -65,6 +65,10 @@ extern "C" {
 
 #ifndef LIBFFI_ASM
 
+#ifdef _MSC_VER
+#define __attribute__(X)
+#endif
+
 #include <stddef.h>
 #include <limits.h>
 
index 6af4b5f21fa0e6b7a126ba63249e9e3c3338deaf..16c5f8859f7515912929fe48b555037a8b21c55d 100644 (file)
@@ -18,7 +18,10 @@ extern "C" {
 /* Do not move this. Some versions of AIX are very picky about where
    this is positioned. */
 #ifdef __GNUC__
+/* mingw64 defines this already in malloc.h. */
+#ifndef alloca
 # define alloca __builtin_alloca
+#endif
 # define MAYBE_UNUSED __attribute__((__unused__))
 #else
 # define MAYBE_UNUSED
@@ -29,7 +32,11 @@ extern "C" {
  #pragma alloca
 #  else
 #   ifndef alloca /* predefined by HP cc +Olibcalls */
+#    ifdef _MSC_VER
+#     define alloca _alloca
+#    else
 char *alloca ();
+#    endif
 #   endif
 #  endif
 # endif
@@ -77,6 +84,16 @@ typedef struct
 } extended_cif;
 
 /* Terse sized type definitions.  */
+#ifdef _MSC_VER
+typedef unsigned char UINT8;
+typedef signed char   SINT8;
+typedef unsigned short UINT16;
+typedef signed short   SINT16;
+typedef unsigned int UINT32;
+typedef signed int   SINT32;
+typedef unsigned __int64 UINT64;
+typedef signed __int64   SINT64;
+#else
 typedef unsigned int UINT8  __attribute__((__mode__(__QI__)));
 typedef signed int   SINT8  __attribute__((__mode__(__QI__)));
 typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
@@ -85,6 +102,7 @@ typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
 typedef signed int   SINT32 __attribute__((__mode__(__SI__)));
 typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
 typedef signed int   SINT64 __attribute__((__mode__(__DI__)));
+#endif
 
 typedef float FLOAT32;
 
index e5e36bb4f1a3147adbf0f31206093fccbdf9175a..65d575cf2f736f36aaf00ebc7d5de76c4ee85f08 100644 (file)
@@ -177,6 +177,8 @@ X86_FREEBSD_TRUE = @X86_FREEBSD_TRUE@
 X86_TRUE = @X86_TRUE@
 X86_WIN32_FALSE = @X86_WIN32_FALSE@
 X86_WIN32_TRUE = @X86_WIN32_TRUE@
+X86_WIN64_FALSE = @X86_WIN64_FALSE@
+X86_WIN64_TRUE = @X86_WIN64_TRUE@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
index 1979a5ea99b8dd1aebdf0aba02b8c46a544f9e16..0b692c50002b2f9e603a1e34c82cd182c7c5dc3c 100644 (file)
@@ -34,8 +34,8 @@ before it is used with
 .Nm ffi_call .
 .Pp
 .Fa rvalue
-must point to storage that is sizeof(long) or larger. For smaller
-return value sizes, the
+must point to storage that is sizeof(ffi_arg) or larger for non-floating point
+types. For smaller-sized return value types, the
 .Nm ffi_arg
 or
 .Nm ffi_sarg
index ff9c174c32e2880d760acc8707bb6ac93a5505a4..7692c857162630b0c4abe7e021c2ee163ad41477 100644 (file)
    locations in the virtual memory space, one location writable and
    another executable.  */
 #  define FFI_MMAP_EXEC_WRIT 1
+#  define HAVE_MNTENT 1
+# endif
+# if defined(X86_WIN32) || defined(X86_WIN64)
+/* Windows systems may have Data Execution Protection (DEP) enabled, 
+   which requires the use of VirtualMalloc/VirtualFree to alloc/free
+   executable memory. */
+#  define FFI_MMAP_EXEC_WRIT 1
 # endif
 #endif
 
 
 #define USE_LOCKS 1
 #define USE_DL_PREFIX 1
+#ifdef __GNUC__
+#ifndef USE_BUILTIN_FFS
 #define USE_BUILTIN_FFS 1
+#endif
+#endif
 
 /* We need to use mmap, not sbrk.  */
 #define HAVE_MORECORE 0
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <stdio.h>
+#if !defined(X86_WIN32) && !defined(X86_WIN64)
+#ifdef HAVE_MNTENT
 #include <mntent.h>
+#endif /* HAVE_MNTENT */
 #include <sys/param.h>
 #include <pthread.h>
 
@@ -150,6 +166,7 @@ selinux_enabled_check (void)
 #define is_selinux_enabled() 0
 
 #endif
+#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
 
 /* Declare all functions defined in dlmalloc.c as static.  */
 static void *dlmalloc(size_t);
@@ -168,9 +185,11 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED;
 static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
 static void dlmalloc_stats(void) MAYBE_UNUSED;
 
+#if !defined(X86_WIN32) && !defined(X86_WIN64)
 /* Use these for mmap and munmap within dlmalloc.c.  */
 static void *dlmmap(void *, size_t, int, int, int, off_t);
 static int dlmunmap(void *, size_t);
+#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
 
 #define mmap dlmmap
 #define munmap dlmunmap
@@ -180,6 +199,8 @@ static int dlmunmap(void *, size_t);
 #undef mmap
 #undef munmap
 
+#if !defined(X86_WIN32) && !defined(X86_WIN64)
+
 /* A mutex used to synchronize access to *exec* variables in this file.  */
 static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -232,6 +253,7 @@ open_temp_exec_file_env (const char *envvar)
   return open_temp_exec_file_dir (value);
 }
 
+#ifdef HAVE_MNTENT
 /* Open a temporary file in an executable and writable mount point
    listed in the mounts file.  Subsequent calls with the same mounts
    keep searching for mount points in the same file.  Providing NULL
@@ -278,6 +300,7 @@ open_temp_exec_file_mnt (const char *mounts)
        return fd;
     }
 }
+#endif /* HAVE_MNTENT */
 
 /* Instructions to look for a location to hold a temporary file that
    can be mapped in for execution.  */
@@ -292,8 +315,10 @@ static struct
   { open_temp_exec_file_dir, "/var/tmp", 0 },
   { open_temp_exec_file_dir, "/dev/shm", 0 },
   { open_temp_exec_file_env, "HOME", 0 },
+#ifdef HAVE_MNTENT
   { open_temp_exec_file_mnt, "/etc/mtab", 1 },
   { open_temp_exec_file_mnt, "/proc/mounts", 1 },
+#endif /* HAVE_MNTENT */
 };
 
 /* Current index into open_temp_exec_file_opts.  */
@@ -489,6 +514,8 @@ segment_holding_code (mstate m, char* addr)
 }
 #endif
 
+#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
+
 /* Allocate a chunk of memory with the given size.  Returns a pointer
    to the writable address, and sets *CODE to the executable
    corresponding virtual address.  */
index c95e64a7e37c3d229567c7f723f2a5bbe753db65..783c5c2a6f978852200a8a9d307c11b40761d579 100644 (file)
@@ -1140,9 +1140,9 @@ int mspace_mallopt(int, int);
 
 /*------------------------------ internal #includes ---------------------- */
 
-#ifdef WIN32
+#ifdef _MSC_VER
 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
-#endif /* WIN32 */
+#endif /* _MSC_VER */
 
 #include <stdio.h>       /* for printing in malloc_stats */
 
@@ -1315,14 +1315,14 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
 
 /* Win32 MMAP via VirtualAlloc */
 static void* win32mmap(size_t size) {
-  void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
+  void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
   return (ptr != 0)? ptr: MFAIL;
 }
 
 /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
 static void* win32direct_mmap(size_t size) {
   void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
-                           PAGE_READWRITE);
+                           PAGE_EXECUTE_READWRITE);
   return (ptr != 0)? ptr: MFAIL;
 }
 
index 767effb8380a709c95ef69321eacdda4b5678c3f..c89c8fc747568a6c96bd9b86831d5743bfa2856a 100644 (file)
@@ -3,7 +3,7 @@
            Copyright (c) 2002  Ranjit Mathew
            Copyright (c) 2002  Bo Thorsen
            Copyright (c) 2002  Roger Sayle
-          Copyright (C) 2008  Free Software Foundation, Inc.
+           Copyright (C) 2008  Free Software Foundation, Inc.
 
    x86 Foreign Function Interface
 
    DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
-#ifndef __x86_64__
+#if !defined(__x86_64__) || defined(_WIN64)
+
+#ifdef _WIN64
+#include <windows.h>
+#endif
 
 #include <ffi.h>
 #include <ffi_common.h>
@@ -47,10 +51,15 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
 
   argp = stack;
 
-  if (ecif->cif->flags == FFI_TYPE_STRUCT)
+  if (ecif->cif->flags == FFI_TYPE_STRUCT
+#ifdef X86_WIN64
+      && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2
+          && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8)
+#endif
+      )
     {
       *(void **) argp = ecif->rvalue;
-      argp += 4;
+      argp += sizeof(void*);
     }
 
   p_argv = ecif->avalue;
@@ -62,53 +71,75 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
       size_t z;
 
       /* Align if necessary */
-      if ((sizeof(int) - 1) & (unsigned) argp)
-       argp = (char *) ALIGN(argp, sizeof(int));
+      if ((sizeof(void*) - 1) & (size_t) argp)
+        argp = (char *) ALIGN(argp, sizeof(void*));
 
       z = (*p_arg)->size;
-      if (z < sizeof(int))
-       {
-         z = sizeof(int);
-         switch ((*p_arg)->type)
-           {
-           case FFI_TYPE_SINT8:
-             *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_UINT8:
-             *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_SINT16:
-             *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_UINT16:
-             *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_SINT32:
-             *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_UINT32:
-             *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-             break;
-
-           case FFI_TYPE_STRUCT:
-             *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-             break;
-
-           default:
-             FFI_ASSERT(0);
-           }
-       }
+#ifdef X86_WIN64
+      if (z > sizeof(ffi_arg)
+          || ((*p_arg)->type == FFI_TYPE_STRUCT
+              && (z != 1 && z != 2 && z != 4 && z != 8))
+#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
+          || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE)
+#endif
+          )
+        {
+          z = sizeof(ffi_arg);
+          *(void **)argp = *p_argv;
+        }
+      else if ((*p_arg)->type == FFI_TYPE_FLOAT)
+        {
+          memcpy(argp, *p_argv, z);
+        }
       else
-       {
-         memcpy(argp, *p_argv, z);
-       }
+#endif
+      if (z < sizeof(ffi_arg))
+        {
+          z = sizeof(ffi_arg);
+          switch ((*p_arg)->type)
+            {
+            case FFI_TYPE_SINT8:
+              *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_UINT8:
+              *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_SINT16:
+              *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_UINT16:
+              *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_SINT32:
+              *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_UINT32:
+              *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv);
+              break;
+
+            case FFI_TYPE_STRUCT:
+              *(ffi_arg *) argp = *(ffi_arg *)(* p_argv);
+              break;
+
+            default:
+              FFI_ASSERT(0);
+            }
+        }
+      else
+        {
+          memcpy(argp, *p_argv, z);
+        }
       p_argv++;
+#ifdef X86_WIN64
+      argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
+#else
       argp += z;
+#endif
     }
   
   return;
@@ -124,21 +155,32 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
 #ifdef X86
     case FFI_TYPE_STRUCT:
 #endif
-#if defined(X86) || defined(X86_DARWIN)
+#if defined(X86) || defined(X86_DARWIN) || defined(X86_WIN64)
     case FFI_TYPE_UINT8:
     case FFI_TYPE_UINT16:
     case FFI_TYPE_SINT8:
     case FFI_TYPE_SINT16:
 #endif
+#ifdef X86_WIN64
+    case FFI_TYPE_UINT32:
+    case FFI_TYPE_SINT32:
+#endif
 
     case FFI_TYPE_SINT64:
     case FFI_TYPE_FLOAT:
     case FFI_TYPE_DOUBLE:
+#ifndef X86_WIN64
+#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
     case FFI_TYPE_LONGDOUBLE:
+#endif
+#endif
       cif->flags = (unsigned) cif->rtype->type;
       break;
 
     case FFI_TYPE_UINT64:
+#ifdef X86_WIN64
+    case FFI_TYPE_POINTER:
+#endif
       cif->flags = FFI_TYPE_SINT64;
       break;
 
@@ -154,7 +196,11 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
         }
       else if (cif->rtype->size == 4)
         {
+#ifdef X86_WIN64
+          cif->flags = FFI_TYPE_SMALL_STRUCT_4B;
+#else
           cif->flags = FFI_TYPE_INT; /* same as int type */
+#endif
         }
       else if (cif->rtype->size == 8)
         {
@@ -163,12 +209,23 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
       else
         {
           cif->flags = FFI_TYPE_STRUCT;
+#ifdef X86_WIN64
+          // allocate space for return value pointer
+          cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
+#endif
         }
       break;
 #endif
 
     default:
+#ifdef X86_WIN64
+      cif->flags = FFI_TYPE_SINT64;
+      break;
+    case FFI_TYPE_INT:
+      cif->flags = FFI_TYPE_SINT32;
+#else
       cif->flags = FFI_TYPE_INT;
+#endif
       break;
     }
 
@@ -176,17 +233,38 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
   cif->bytes = (cif->bytes + 15) & ~0xF;
 #endif
 
+#ifdef X86_WIN64
+  {
+    unsigned int i;
+    ffi_type **ptr;
+
+    for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
+      {
+        if (((*ptr)->alignment - 1) & cif->bytes)
+          cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment);
+        cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
+      }
+  }
+  // ensure space for storing four registers
+  cif->bytes += 4 * sizeof(ffi_arg);
+#endif
+
   return FFI_OK;
 }
 
 extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
-                         unsigned, unsigned, unsigned *, void (*fn)(void));
+                          unsigned, unsigned, unsigned *, void (*fn)(void));
 
 #ifdef X86_WIN32
 extern void ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *,
-                         unsigned, unsigned, unsigned *, void (*fn)(void));
+                          unsigned, unsigned, unsigned *, void (*fn)(void));
 
 #endif /* X86_WIN32 */
+#ifdef X86_WIN64
+extern int
+ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *,
+               unsigned, unsigned, unsigned *, void (*fn)(void));
+#endif
 
 void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
@@ -195,30 +273,66 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
   ecif.cif = cif;
   ecif.avalue = avalue;
   
-  /* If the return value is a struct and we don't have a return        */
-  /* value address then we need to make one                    */
-
-  if ((rvalue == NULL) && 
-      (cif->flags == FFI_TYPE_STRUCT))
+  /* If the return value is a struct and we don't have a return */
+  /* value address then we need to make one                     */
+
+#ifdef X86_WIN64
+  if (rvalue == NULL
+      && cif->flags == FFI_TYPE_STRUCT
+      && cif->rtype->size != 1 && cif->rtype->size != 2
+      && cif->rtype->size != 4 && cif->rtype->size != 8)
+    {
+      ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF);
+    }
+#else
+  if (rvalue == NULL
+      && cif->flags == FFI_TYPE_STRUCT)
     {
       ecif.rvalue = alloca(cif->rtype->size);
     }
+#endif
   else
     ecif.rvalue = rvalue;
     
   
   switch (cif->abi) 
     {
+#ifdef X86_WIN64
+    case FFI_WIN64:
+      {
+        // Make copies of all struct arguments
+        // NOTE: not sure if responsibility should be here or in caller
+        unsigned int i;
+        for (i=0; i < cif->nargs;i++) {
+          size_t size = cif->arg_types[i]->size;
+          if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT
+               && (size != 1 && size != 2 && size != 4 && size != 8))
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+              || cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE
+#endif
+              )
+            {
+              void *local = alloca(size);
+              memcpy(local, avalue[i], size);
+              avalue[i] = local;
+            }
+        }
+        ffi_call_win64(ffi_prep_args, &ecif, cif->bytes,
+                       cif->flags, ecif.rvalue, fn);
+      }
+      break;
+#else
     case FFI_SYSV:
       ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue,
-                   fn);
+                    fn);
       break;
 #ifdef X86_WIN32
     case FFI_STDCALL:
       ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes, cif->flags,
-                      ecif.rvalue, fn);
+                       ecif.rvalue, fn);
       break;
 #endif /* X86_WIN32 */
+#endif /* X86_WIN64 */
     default:
       FFI_ASSERT(0);
       break;
@@ -229,7 +343,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 /** private members **/
 
 static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
-                                        void** args, ffi_cif* cif);
+                                         void** args, ffi_cif* cif);
 void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)
      __attribute__ ((regparm(1)));
 unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
@@ -240,9 +354,42 @@ void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
 void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *)
      __attribute__ ((regparm(1)));
 #endif
+#ifdef X86_WIN64
+void FFI_HIDDEN ffi_closure_win64 (ffi_closure *);
+#endif
 
 /* This function is jumped to by the trampoline */
 
+#ifdef X86_WIN64
+void * FFI_HIDDEN
+ffi_closure_win64_inner (ffi_closure *closure, void *args) {
+  ffi_cif       *cif;
+  void         **arg_area;
+  void          *result;
+  void          *resp = &result;
+
+  cif         = closure->cif;
+  arg_area    = (void**) alloca (cif->nargs * sizeof (void*));  
+
+  /* this call will initialize ARG_AREA, such that each
+   * element in that array points to the corresponding 
+   * value on the stack; and if the function returns
+   * a structure, it will change RESP to point to the
+   * structure return address.  */
+
+  ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif);
+  
+  (closure->fun) (cif, resp, arg_area, closure->user_data);
+
+  /* The result is returned in rax.  This does the right thing for
+     result types except for floats; we have to 'mov xmm0, rax' in the
+     caller to correct this.
+     TODO: structure sizes of 3 5 6 7 are returned by reference, too!!!
+  */
+  return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp;
+}
+
+#else
 unsigned int FFI_HIDDEN
 ffi_closure_SYSV_inner (closure, respp, args)
      ffi_closure *closure;
@@ -259,7 +406,7 @@ ffi_closure_SYSV_inner (closure, respp, args)
   /* this call will initialize ARG_AREA, such that each
    * element in that array points to the corresponding 
    * value on the stack; and if the function returns
-   * a structure, it will re-set RESP to point to the
+   * a structure, it will change RESP to point to the
    * structure return address.  */
 
   ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
@@ -268,10 +415,11 @@ ffi_closure_SYSV_inner (closure, respp, args)
 
   return cif->flags;
 }
+#endif /* !X86_WIN64 */
 
 static void
 ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
-                           ffi_cif *cif)
+                            ffi_cif *cif)
 {
   register unsigned int i;
   register void **p_argv;
@@ -280,10 +428,20 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
 
   argp = stack;
 
+#ifdef X86_WIN64
+  if (cif->rtype->size > sizeof(ffi_arg)
+      || (cif->flags == FFI_TYPE_STRUCT
+          && (cif->rtype->size != 1 && cif->rtype->size != 2
+              && cif->rtype->size != 4 && cif->rtype->size != 8))) {
+    *rvalue = *(void **) argp;
+    argp += sizeof(void *);
+  }
+#else
   if ( cif->flags == FFI_TYPE_STRUCT ) {
     *rvalue = *(void **) argp;
-    argp += 4;
+    argp += sizeof(void *);
   }
+#endif
 
   p_argv = avalue;
 
@@ -292,30 +450,65 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
       size_t z;
 
       /* Align if necessary */
-      if ((sizeof(int) - 1) & (unsigned) argp) {
-       argp = (char *) ALIGN(argp, sizeof(int));
+      if ((sizeof(void*) - 1) & (size_t) argp) {
+        argp = (char *) ALIGN(argp, sizeof(void*));
       }
 
-      z = (*p_arg)->size;
-
-      /* because we're little endian, this is what it turns into.   */
-
-      *p_argv = (void*) argp;
-
+#ifdef X86_WIN64
+      if ((*p_arg)->size > sizeof(ffi_arg)
+          || ((*p_arg)->type == FFI_TYPE_STRUCT
+              && ((*p_arg)->size != 1 && (*p_arg)->size != 2
+                  && (*p_arg)->size != 4 && (*p_arg)->size != 8)))
+        {
+          z = sizeof(void *);
+          *p_argv = *(void **)argp;
+        }
+      else
+#endif
+        {
+          z = (*p_arg)->size;
+          
+          /* because we're little endian, this is what it turns into.   */
+          
+          *p_argv = (void*) argp;
+        }
+          
       p_argv++;
+#ifdef X86_WIN64
+      argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
+#else
       argp += z;
+#endif
     }
   
   return;
 }
 
+#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \
+{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
+   void*  __fun = (void*)(FUN); \
+   void*  __ctx = (void*)(CTX); \
+   *(unsigned char*) &__tramp[0] = 0x41; \
+   *(unsigned char*) &__tramp[1] = 0xbb; \
+   *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \
+   *(unsigned char*) &__tramp[6] = 0x48; \
+   *(unsigned char*) &__tramp[7] = 0xb8; \
+   *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \
+   *(unsigned char *)  &__tramp[16] = 0x49; \
+   *(unsigned char *)  &__tramp[17] = 0xba; \
+   *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \
+   *(unsigned char *)  &__tramp[26] = 0x41; \
+   *(unsigned char *)  &__tramp[27] = 0xff; \
+   *(unsigned char *)  &__tramp[28] = 0xe2; /* jmp %r10 */ \
+ }
+
 /* How to make a trampoline.  Derived from gcc/config/i386/i386.c. */
 
 #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
 ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
    unsigned int  __fun = (unsigned int)(FUN); \
    unsigned int  __ctx = (unsigned int)(CTX); \
-   unsigned int  __dis = __fun - (__ctx + 10); \
+   unsigned int  __dis = __fun - (__ctx + 10);  \
    *(unsigned char*) &__tramp[0] = 0xb8; \
    *(unsigned int*)  &__tramp[1] = __ctx; /* movl __ctx, %eax */ \
    *(unsigned char *)  &__tramp[5] = 0xe9; \
@@ -340,11 +533,23 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
 
 ffi_status
 ffi_prep_closure_loc (ffi_closure* closure,
-                     ffi_cif* cif,
-                     void (*fun)(ffi_cif*,void*,void**,void*),
-                     void *user_data,
-                     void *codeloc)
+                      ffi_cif* cif,
+                      void (*fun)(ffi_cif*,void*,void**,void*),
+                      void *user_data,
+                      void *codeloc)
 {
+#ifdef X86_WIN64
+#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE)
+#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0)
+  if (cif->abi == FFI_WIN64) 
+    {
+      int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3);
+      FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0],
+                                 &ffi_closure_win64,
+                                 codeloc, mask);
+      /* make sure we can execute here */
+    }
+#else
   if (cif->abi == FFI_SYSV)
     {
       FFI_INIT_TRAMPOLINE (&closure->tramp[0],
@@ -358,7 +563,8 @@ ffi_prep_closure_loc (ffi_closure* closure,
                                    &ffi_closure_STDCALL,
                                    (void*)codeloc, cif->bytes);
     }
-#endif
+#endif /* X86_WIN32 */
+#endif /* !X86_WIN64 */
   else
     {
       return FFI_BAD_ABI;
@@ -377,10 +583,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
 
 ffi_status
 ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
-                         ffi_cif* cif,
-                         void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
-                         void *user_data,
-                         void *codeloc)
+                          ffi_cif* cif,
+                          void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+                          void *user_data,
+                          void *codeloc)
 {
   int i;
 
@@ -401,7 +607,7 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
   
 
   FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
-                      codeloc);
+                       codeloc);
     
   closure->cif  = cif;
   closure->user_data = user_data;
@@ -423,12 +629,12 @@ ffi_prep_args_raw(char *stack, extended_cif *ecif)
 
 extern void
 ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, 
-             unsigned, unsigned *, void (*fn)(void));
+              unsigned, unsigned *, void (*fn)(void));
 
 #ifdef X86_WIN32
 extern void
 ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, unsigned,
-                unsigned, unsigned *, void (*fn)(void));
+                 unsigned, unsigned *, void (*fn)(void));
 #endif /* X86_WIN32 */
 
 void
@@ -440,8 +646,8 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
   ecif.cif = cif;
   ecif.avalue = avalue;
   
-  /* If the return value is a struct and we don't have a return        */
-  /* value address then we need to make one                    */
+  /* If the return value is a struct and we don't have a return */
+  /* value address then we need to make one                     */
 
   if ((rvalue == NULL) && 
       (cif->rtype->type == FFI_TYPE_STRUCT))
@@ -456,12 +662,12 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
     {
     case FFI_SYSV:
       ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,
-                   ecif.rvalue, fn);
+                    ecif.rvalue, fn);
       break;
 #ifdef X86_WIN32
     case FFI_STDCALL:
       ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,
-                      ecif.rvalue, fn);
+                       ecif.rvalue, fn);
       break;
 #endif /* X86_WIN32 */
     default:
@@ -472,4 +678,5 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
 
 #endif
 
-#endif /* __x86_64__  */
+#endif /* !__x86_64__  || X86_WIN64 */
+
index 2896ae4c53f1af727f28178bbeb54b84bbbdc80a..116c636598d82daf5c4ebfceacbffdf359e07afc 100644 (file)
@@ -1,6 +1,6 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2002, 2007  Bo Thorsen <bo@suse.de>
-           Copyright (c) 2008  Red Hat, Inc.
+   ffi64.c - Copyright (c) 2002, 2007  Bo Thorsen <bo@suse.de>
+             Copyright (c) 2008  Red Hat, Inc.
    
    x86-64 Foreign Function Interface 
 
index 8178d0648213ac1dc6acca5abad632c6ab60e46d..b1d3df88f14afdf03a1035f87a166200662124cf 100644 (file)
 #define X86
 #endif
 
+#ifdef X86_WIN64
+#define FFI_SIZEOF_ARG 8
+#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 
+#endif
+
 /* ---- Generic type definitions ----------------------------------------- */
 
 #ifndef LIBFFI_ASM
+#ifdef X86_WIN64
+#ifdef _MSC_VER
+typedef unsigned __int64       ffi_arg;
+typedef __int64                ffi_sarg;
+#else
+typedef unsigned long long     ffi_arg;
+typedef long long              ffi_sarg;
+#endif
+#else
 typedef unsigned long          ffi_arg;
 typedef signed long            ffi_sarg;
+#endif
 
 typedef enum ffi_abi {
   FFI_FIRST_ABI = 0,
@@ -53,6 +68,11 @@ typedef enum ffi_abi {
   FFI_DEFAULT_ABI = FFI_SYSV,
 #endif
 
+#ifdef X86_WIN64
+  FFI_WIN64,
+  FFI_DEFAULT_ABI = FFI_WIN64,
+#else
+
   /* ---- Intel x86 and AMD x86-64 - */
 #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
   FFI_SYSV,
@@ -63,6 +83,7 @@ typedef enum ffi_abi {
   FFI_DEFAULT_ABI = FFI_UNIX64,
 #endif
 #endif
+#endif /* X86_WIN64 */
 
   FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
 } ffi_abi;
@@ -73,6 +94,7 @@ typedef enum ffi_abi {
 #define FFI_CLOSURES 1
 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
 #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
+#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
 
 #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
 #define FFI_TRAMPOLINE_SIZE 24
@@ -81,10 +103,18 @@ typedef enum ffi_abi {
 #ifdef X86_WIN32
 #define FFI_TRAMPOLINE_SIZE 13
 #else
+#ifdef X86_WIN64
+#define FFI_TRAMPOLINE_SIZE 29
+#define FFI_NATIVE_RAW_API 0
+#define FFI_NO_RAW_API 1
+#else
 #define FFI_TRAMPOLINE_SIZE 10
 #endif
+#endif
+#ifndef X86_WIN64
 #define FFI_NATIVE_RAW_API 1   /* x86 has native raw api support */
 #endif
+#endif
 
 #endif
 
index a6c9c0da101c5b4e5cc050284ba7b9b77b0ca380..a1de858d96ae041a80415e0147082ca13fbbae5b 100644 (file)
@@ -34,8 +34,6 @@
  
        .text
  
-       .extern ffi_prep_args
         # This assumes we are using gas.
         .balign 16
        .globl  _ffi_call_SYSV
diff --git a/libffi/src/x86/win64.S b/libffi/src/x86/win64.S
new file mode 100644 (file)
index 0000000..ae56c2e
--- /dev/null
@@ -0,0 +1,462 @@
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+       
+/* Constants for ffi_call_win64 */     
+#define STACK 0
+#define PREP_ARGS_FN 32
+#define ECIF 40
+#define CIF_BYTES 48
+#define CIF_FLAGS 56
+#define RVALUE 64
+#define FN 72
+
+/* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *),
+                   extended_cif *ecif, unsigned bytes, unsigned flags,
+                   unsigned *rvalue, void (*fn)());
+ */
+
+#ifdef _MSC_VER
+PUBLIC ffi_call_win64
+
+EXTRN  __chkstk:NEAR
+EXTRN  ffi_closure_win64_inner:NEAR
+
+_TEXT  SEGMENT
+
+;;; ffi_closure_win64 will be called with these registers set:
+;;;    rax points to 'closure'
+;;;    r11 contains a bit mask that specifies which of the
+;;;    first four parameters are float or double
+;;;
+;;; It must move the parameters passed in registers to their stack location,
+;;; call ffi_closure_win64_inner for the actual work, then return the result.
+;;; 
+ffi_closure_win64 PROC FRAME
+       ;; copy register arguments onto stack
+       test    r11, 1
+       jne     first_is_float  
+       mov     QWORD PTR [rsp+8], rcx
+       jmp     second
+first_is_float:
+       movlpd  QWORD PTR [rsp+8], xmm0
+
+second:
+       test    r11, 2
+       jne     second_is_float 
+       mov     QWORD PTR [rsp+16], rdx
+       jmp     third
+second_is_float:
+       movlpd  QWORD PTR [rsp+16], xmm1
+
+third:
+       test    r11, 4
+       jne     third_is_float  
+       mov     QWORD PTR [rsp+24], r8
+       jmp     fourth
+third_is_float:
+       movlpd  QWORD PTR [rsp+24], xmm2
+
+fourth:
+       test    r11, 8
+       jne     fourth_is_float 
+       mov     QWORD PTR [rsp+32], r9
+       jmp     done
+fourth_is_float:
+       movlpd  QWORD PTR [rsp+32], xmm3
+
+done:
+        .ALLOCSTACK 40
+       sub     rsp, 40
+        .ENDPROLOG
+       mov     rcx, rax        ; context is first parameter
+       mov     rdx, rsp        ; stack is second parameter
+       add     rdx, 48         ; point to start of arguments
+       mov     rax, ffi_closure_win64_inner
+       call    rax             ; call the real closure function
+       add     rsp, 40
+       movd    xmm0, rax       ; If the closure returned a float,
+                                ; ffi_closure_win64_inner wrote it to rax
+       ret     0
+ffi_closure_win64 ENDP
+
+ffi_call_win64 PROC FRAME
+        ;; copy registers onto stack
+       mov     QWORD PTR [rsp+32], r9
+       mov     QWORD PTR [rsp+24], r8
+       mov     QWORD PTR [rsp+16], rdx
+       mov     QWORD PTR [rsp+8], rcx
+        .PUSHREG rbp
+       push    rbp
+        .ALLOCSTACK 48
+       sub     rsp, 48                                 ; 00000030H
+        .SETFRAME rbp, 32
+       lea     rbp, QWORD PTR [rsp+32]
+        .ENDPROLOG
+
+       mov     eax, DWORD PTR CIF_BYTES[rbp]
+       add     rax, 15
+       and     rax, -16
+       call    __chkstk
+       sub     rsp, rax
+       lea     rax, QWORD PTR [rsp+32]
+       mov     QWORD PTR STACK[rbp], rax
+
+       mov     rdx, QWORD PTR ECIF[rbp]
+       mov     rcx, QWORD PTR STACK[rbp]
+       call    QWORD PTR PREP_ARGS_FN[rbp]
+
+       mov     rsp, QWORD PTR STACK[rbp]
+
+       movlpd  xmm3, QWORD PTR [rsp+24]
+       movd    r9, xmm3
+
+       movlpd  xmm2, QWORD PTR [rsp+16]
+       movd    r8, xmm2
+
+       movlpd  xmm1, QWORD PTR [rsp+8]
+       movd    rdx, xmm1
+
+       movlpd  xmm0, QWORD PTR [rsp]
+       movd    rcx, xmm0
+
+       call    QWORD PTR FN[rbp]
+ret_struct4b$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B
+       jne     ret_struct2b$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       mov     DWORD PTR [rcx], eax
+       jmp     ret_void$
+
+ret_struct2b$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B
+       jne     ret_struct1b$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       mov     WORD PTR [rcx], ax
+       jmp     ret_void$
+
+ret_struct1b$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B
+       jne     ret_uint8$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       mov     BYTE PTR [rcx], al
+       jmp     ret_void$
+
+ret_uint8$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8
+       jne     ret_sint8$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       movzx   rax, al
+       mov     QWORD PTR [rcx], rax
+       jmp     ret_void$
+
+ret_sint8$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8
+       jne     ret_uint16$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       movsx   rax, al
+       mov     QWORD PTR [rcx], rax
+       jmp     ret_void$
+
+ret_uint16$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16
+       jne     ret_sint16$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       movzx   rax, ax
+       mov     QWORD PTR [rcx], rax
+       jmp     SHORT ret_void$
+
+ret_sint16$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16
+       jne     ret_uint32$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       movsx   rax, ax
+       mov     QWORD PTR [rcx], rax
+       jmp     SHORT ret_void$
+
+ret_uint32$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32
+       jne     ret_sint32$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       mov     eax, eax
+       mov     QWORD PTR [rcx], rax
+       jmp     SHORT ret_void$
+
+ret_sint32$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32
+       jne     ret_float$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       cdqe
+       mov     QWORD PTR [rcx], rax
+       jmp     SHORT ret_void$
+
+ret_float$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT
+       jne     SHORT ret_double$
+
+       mov     rax, QWORD PTR RVALUE[rbp]
+       movss   DWORD PTR [rax], xmm0
+       jmp     SHORT ret_void$
+
+ret_double$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE
+       jne     SHORT ret_sint64$
+
+       mov     rax, QWORD PTR RVALUE[rbp]
+       movlpd  QWORD PTR [rax], xmm0
+       jmp     SHORT ret_void$
+
+ret_sint64$:
+       cmp     DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64
+       jne     ret_void$
+
+       mov     rcx, QWORD PTR RVALUE[rbp]
+       mov     QWORD PTR [rcx], rax
+       jmp     SHORT ret_void$
+       
+ret_void$:
+       xor     rax, rax
+
+       lea     rsp, QWORD PTR [rbp+16]
+       pop     rbp
+       ret     0
+ffi_call_win64 ENDP
+_TEXT  ENDS
+END
+#else        
+.text
+
+.extern ___chkstk
+.extern _ffi_closure_win64_inner
+
+# ffi_closure_win64 will be called with these registers set:
+#    rax points to 'closure'
+#    r11 contains a bit mask that specifies which of the
+#    first four parameters are float or double
+#
+# It must move the parameters passed in registers to their stack location,
+# call ffi_closure_win64_inner for the actual work, then return the result.
+# 
+       .balign 16
+        .globl _ffi_closure_win64      
+_ffi_closure_win64:     
+       # copy register arguments onto stack
+       test    $1,%r11
+       jne     .Lfirst_is_float        
+       mov     %rcx, 8(%rsp)
+       jmp     .Lsecond
+.Lfirst_is_float:
+       movlpd  %xmm0, 8(%rsp)
+
+.Lsecond:
+       test    $2, %r11
+       jne     .Lsecond_is_float       
+       mov     %rdx, 16(%rsp)
+       jmp     .Lthird
+.Lsecond_is_float:
+       movlpd  %xmm1, 16(%rsp)
+
+.Lthird:
+       test    $4, %r11
+       jne     .Lthird_is_float        
+       mov     %r8,24(%rsp)
+       jmp     .Lfourth
+.Lthird_is_float:
+       movlpd  %xmm2, 24(%rsp)
+
+.Lfourth:
+       test    $8, %r11
+       jne     .Lfourth_is_float       
+       mov     %r9, 32(%rsp)
+       jmp     .Ldone
+.Lfourth_is_float:
+       movlpd  %xmm3, 32(%rsp)
+
+.Ldone:
+#.ALLOCSTACK 40
+       sub     $40, %rsp
+#.ENDPROLOG
+       mov     %rax, %rcx      # context is first parameter
+       mov     %rsp, %rdx      # stack is second parameter
+       add     $48, %rdx       # point to start of arguments
+       mov     $_ffi_closure_win64_inner, %rax
+       callq   *%rax           # call the real closure function
+       add     $40, %rsp
+       movq    %rax, %xmm0     # If the closure returned a float,
+                                # ffi_closure_win64_inner wrote it to rax
+       retq
+.ffi_closure_win64_end:
+
+       .balign 16
+        .globl _ffi_call_win64
+_ffi_call_win64:        
+        # copy registers onto stack
+       mov     %r9,32(%rsp)
+       mov     %r8,24(%rsp)
+       mov     %rdx,16(%rsp)
+       mov     %rcx,8(%rsp)
+        #.PUSHREG rbp
+       push    %rbp
+        #.ALLOCSTACK 48
+       sub     $48,%rsp
+        #.SETFRAME rbp, 32
+       lea     32(%rsp),%rbp
+        #.ENDPROLOG
+
+       mov     CIF_BYTES(%rbp),%eax
+       add     $15, %rax
+       and     $-16, %rax
+       callq   ___chkstk
+       cmpq    $0x1000, %rax
+       jb      Lch_done
+Lch_probe:
+       subq    $0x1000,%rsp
+       orl     $0x0, (%rsp)
+       subq    $0x1000,%rax
+       cmpq    $0x1000,%rax
+       ja      Lch_probe
+Lch_done:
+       subq    %rax, %rsp
+       orl     $0x0, (%rsp)
+       lea     32(%rsp), %rax
+       mov     %rax, STACK(%rbp)
+
+       mov     ECIF(%rbp), %rdx
+       mov     STACK(%rbp), %rcx
+       callq   *PREP_ARGS_FN(%rbp)
+
+       mov     STACK(%rbp), %rsp
+
+       movlpd  24(%rsp), %xmm3
+       movd    %xmm3, %r9
+
+       movlpd  16(%rsp), %xmm2
+       movd    %xmm2, %r8
+
+       movlpd  8(%rsp), %xmm1
+       movd    %xmm1, %rdx
+
+       movlpd  (%rsp), %xmm0
+       movd    %xmm0, %rcx
+
+       callq   *FN(%rbp)
+.Lret_struct4b:
+       cmpl    $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp)
+       jne .Lret_struct2b
+
+       mov     RVALUE(%rbp), %rcx
+       mov     %eax, (%rcx)
+       jmp     .Lret_void
+
+.Lret_struct2b:
+       cmpl    $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp)
+       jne .Lret_struct1b
+       
+       mov     RVALUE(%rbp), %rcx
+       mov     %ax, (%rcx)
+       jmp .Lret_void
+       
+.Lret_struct1b:
+       cmpl    $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp)
+       jne .Lret_uint8
+       
+       mov     RVALUE(%rbp), %rcx
+       mov     %al, (%rcx)
+       jmp .Lret_void
+
+.Lret_uint8:
+       cmpl    $FFI_TYPE_UINT8, CIF_FLAGS(%rbp)
+       jne .Lret_sint8
+       
+        mov     RVALUE(%rbp), %rcx
+        movzbq  %al, %rax
+       movq    %rax, (%rcx)
+       jmp .Lret_void
+
+.Lret_sint8:
+       cmpl    $FFI_TYPE_SINT8, CIF_FLAGS(%rbp)
+       jne .Lret_uint16
+       
+        mov     RVALUE(%rbp), %rcx
+        movsbq  %al, %rax
+       movq    %rax, (%rcx)
+       jmp .Lret_void
+
+.Lret_uint16:
+       cmpl    $FFI_TYPE_UINT16, CIF_FLAGS(%rbp)
+       jne .Lret_sint16
+       
+        mov     RVALUE(%rbp), %rcx
+        movzwq  %ax, %rax
+       movq    %rax, (%rcx)
+       jmp .Lret_void
+
+.Lret_sint16:
+       cmpl    $FFI_TYPE_SINT16, CIF_FLAGS(%rbp)
+       jne .Lret_uint32
+       
+        mov     RVALUE(%rbp), %rcx
+        movswq  %ax, %rax
+       movq    %rax, (%rcx)
+       jmp .Lret_void
+
+.Lret_uint32:
+       cmpl    $FFI_TYPE_UINT32, CIF_FLAGS(%rbp)
+       jne .Lret_sint32
+       
+        mov     RVALUE(%rbp), %rcx
+        movl    %eax, %eax
+       movq    %rax, (%rcx)
+       jmp .Lret_void
+
+.Lret_sint32:
+       cmpl    $FFI_TYPE_SINT32, CIF_FLAGS(%rbp)
+       jne     .Lret_float
+
+       mov     RVALUE(%rbp), %rcx
+       cltq
+       movq    %rax, (%rcx)
+       jmp     .Lret_void
+
+.Lret_float:
+       cmpl    $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp)
+       jne     .Lret_double
+
+       mov     RVALUE(%rbp), %rax
+       movss   %xmm0, (%rax)
+       jmp     .Lret_void
+
+.Lret_double:
+       cmpl    $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp)
+       jne     .Lret_sint64
+
+       mov     RVALUE(%rbp), %rax
+       movlpd  %xmm0, (%rax)
+       jmp     .Lret_void
+
+.Lret_sint64:
+       cmpl    $FFI_TYPE_SINT64, CIF_FLAGS(%rbp)
+       jne     .Lret_void
+
+       mov     RVALUE(%rbp), %rcx
+       mov     %rax, (%rcx)
+       jmp     .Lret_void
+       
+.Lret_void:
+       xor     %rax, %rax
+
+       lea     16(%rbp), %rsp
+       pop     %rbp
+       retq
+.ffi_call_win64_end:
+#endif /* !_MSC_VER */
+
index 03c75e58b10c858f46d6d3385697974353df25d1..c6dd213abd01978c04b91aeb244c643468b53da3 100644 (file)
@@ -175,6 +175,8 @@ X86_FREEBSD_TRUE = @X86_FREEBSD_TRUE@
 X86_TRUE = @X86_TRUE@
 X86_WIN32_FALSE = @X86_WIN32_FALSE@
 X86_WIN32_TRUE = @X86_WIN32_TRUE@
+X86_WIN64_FALSE = @X86_WIN64_FALSE@
+X86_WIN64_TRUE = @X86_WIN64_TRUE@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
index b42fc20316ff621b8d53cb3b570ecd22b87c0cc6..a579ff6c979f3f219cd5fab04c52678c67cf12f0 100644 (file)
@@ -49,19 +49,11 @@ typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void * code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uint64;
   cl_arg_types[1] = &ffi_type_sint;
   cl_arg_types[2] = &ffi_type_uint64;
@@ -84,10 +76,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
-  res = (*((closure_test_type0)pcl))
+  res = (*((closure_test_type0)code))
     (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13,
      19, 21, 1);
   /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
index 82b9b1d6edb3005089487fdda03005be1fc27a80..91231738c13b5240d2ee07b2d416b0738e9dac7a 100644 (file)
@@ -41,19 +41,11 @@ typedef int (*closure_test_type1)(float, float, float, float, signed short,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_float;
   cl_arg_types[1] = &ffi_type_float;
   cl_arg_types[2] = &ffi_type_float;
@@ -76,10 +68,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1,
-                        (void *) 3 /* userdata */)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1,
+                             (void *) 3 /* userdata */, code)  == FFI_OK);
 
-  res = (*((closure_test_type1)pcl))
+  res = (*((closure_test_type1)code))
     (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
      19, 21, 1);
   /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
index d0ba48e6736e08c9d02d2d37a59cf121c9e6856d..08ff9d92274c317162ec862934e7e226564ada56 100644 (file)
@@ -41,19 +41,11 @@ typedef int (*closure_test_type2)(double, double, double, double, signed short,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_double;
   cl_arg_types[1] = &ffi_type_double;
   cl_arg_types[2] = &ffi_type_double;
@@ -76,10 +68,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn2,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
-  res = (*((closure_test_type2)pcl))
+  res = (*((closure_test_type2)code))
     (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13,
      19.0, 21, 1);
   /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
index be4062d8b6f76511393207d03c66227b5c233ec1..9b54d805c8296ad87dd89502dc158284e90a2927 100644 (file)
@@ -42,19 +42,11 @@ typedef int (*closure_test_type3)(float, float, float, float, float, float,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_float;
   cl_arg_types[1] = &ffi_type_float;
   cl_arg_types[2] = &ffi_type_float;
@@ -77,10 +69,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn3,
-                        (void *) 3 /* userdata */)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3,
+                             (void *) 3 /* userdata */, code)  == FFI_OK);
 
-  res = (*((closure_test_type3)pcl))
+  res = (*((closure_test_type3)code))
     (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13,
      19.19, 21.21, 1);
   /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */
index 9a70b992c700fdf6f928fa02fb0c7fbd4c68b16a..d4a1530b065b21a0cf87a4515cd3ce216b6225db 100644 (file)
@@ -60,19 +60,11 @@ typedef int (*closure_test_type0)(unsigned long long, unsigned long long,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int i, res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   for (i = 0; i < 15; i++) {
     cl_arg_types[i] = &ffi_type_uint64;
   }
@@ -83,10 +75,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
-  res = (*((closure_test_type0)pcl))
+  res = (*((closure_test_type0)code))
     (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL,
      13LL, 19LL, 21LL, 1);
   /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
index c12491e84b6d3cae3c8b70d8461d07e404d39822..99074426c67b5a65e383b48254ea0b8a8950fdda 100644 (file)
@@ -59,17 +59,10 @@ typedef int (*closure_test_type0)(unsigned long long, unsigned long long,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int i, res;
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
 
   for (i = 0; i < 10; i++) {
     cl_arg_types[i] = &ffi_type_uint64;
@@ -85,10 +78,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn5,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
-  res = (*((closure_test_type0)pcl))
+  res = (*((closure_test_type0)code))
     (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL,
      13LL, 19LL, 21LL, 1);
   /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
index 5d9389d17754f8cddb4ac3f8fc63d3f8ee652f15..73c54fd6b16016846b47c10b6d6d2f69da45f73a 100644 (file)
@@ -50,19 +50,11 @@ typedef int (*closure_test_type0)(unsigned long long,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uint64;
   cl_arg_types[1] = &ffi_type_uint64;
   cl_arg_types[2] = &ffi_type_uint64;
@@ -85,10 +77,10 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
-  res = (*((closure_test_type0)pcl))
+  res = (*((closure_test_type0)code))
     (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13,
      19, 21., 1.);
   /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
index 020b469af7a7c73661d5ff5742f49e727056843b..6bfcc1fbb5b342867ddb69cf40f48d63688b3c2d 100644 (file)
@@ -28,22 +28,14 @@ typedef int (__stdcall *closure_test_type0)(int, int, int, int);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
   int res;
   void* sp_pre;
   void* sp_post;
   char buf[1024];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uint;
   cl_arg_types[1] = &ffi_type_uint;
   cl_arg_types[2] = &ffi_type_uint;
@@ -54,11 +46,11 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, closure_test_stdcall,
-                        (void *) 3 /* userdata */) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall,
+                             (void *) 3 /* userdata */, code) == FFI_OK);
 
   asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
-  res = (*(closure_test_type0)pcl)(0, 1, 2, 3);
+  res = (*(closure_test_type0)code)(0, 1, 2, 3);
   asm volatile (" movl %%esp,%0" : "=g" (sp_post));
   /* { dg-output "0 1 2 3: 9" } */
 
index 92530d5ff574374d420062dbd869c73d3cfd446f..f0a334fa797595d6ec684edcf65a3f5ff626be62 100644 (file)
@@ -42,21 +42,13 @@ static void cls_struct_12byte_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,13 +79,13 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 8 9 12" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_12byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK);
 
   res_dbl.a = 0;
   res_dbl.b = 0;
   res_dbl.c = 0;
 
-  res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(pcl))(h_dbl, j_dbl);
+  res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl);
   /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 8 9 12" } */
index f3c314a8760ec1da7b13731d069a96b9a79d7e7c..9b9292ab056c3aa6af43c2e700a5661993125c88 100644 (file)
@@ -43,21 +43,13 @@ static void cls_struct_16byte_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -92,9 +84,9 @@ int main (void)
   res_dbl.b = 0.0;
   res_dbl.c = 0;
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_16byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(pcl))(h_dbl, j_dbl);
+  res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl);
   /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */
   printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 8 17 12" } */
index 901658046958495c2e9620c8c1a9b480b90bd9e0..40c8c6d96a1b1b1c55d0bd0e075db75c591e0cfa 100644 (file)
@@ -47,21 +47,13 @@ cls_struct_18byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -93,9 +85,9 @@ int main (void)
   printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 5 252 250 8" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_18byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */
   printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 5 252 250 8" } */
index 8af583467b1dea72080ba3ceb50f422b3c4f355c..aa6424818f769807d36ca542a39cdb6b9381a0ba 100644 (file)
@@ -50,21 +50,13 @@ cls_struct_19byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[6];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -98,9 +90,9 @@ int main (void)
         res_dbl.d, res_dbl.e);
   /* { dg-output "\nres: 5 252 250 8 239" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_19byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */
   printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
         res_dbl.d, res_dbl.e);
index 0fcc8c6d54caf4bbb237c6e258bc0feb821dbba0..b9402d678adaace5e12aec25a53aa79f5544ade7 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_1_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[2];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -86,9 +78,9 @@ int main (void)
   printf("res: %d\n", res_dbl.a);
   /* { dg-output "\nres: 190" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_1_1byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 178: 190" } */
   printf("res: %d\n", res_dbl.a);
   /* { dg-output "\nres: 190" } */
index fa5f81a88c8c8d56705ed82e7c16cb24bc6dd1d6..80dd7ac931bc18cc7ab45707a5c95acdf6c05b33 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 5 7 10" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */
   printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 5 7 10" } */
index 072bafcafb59ca838bed30baa0bb4da3c44d86f5..50bcbbf831a09bf5ca0147b23d215b128a8c974a 100644 (file)
@@ -45,21 +45,13 @@ cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -90,9 +82,9 @@ int main (void)
   printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 5 7 10" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */
   printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 5 7 10" } */
index 22e169058c5677e5c1f2f71badcf1ce903b8ca60..46a6eb4d31c0f60af7121a16d56abe8d615f87c7 100644 (file)
@@ -54,21 +54,13 @@ cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -106,13 +98,13 @@ int main (void)
   printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 22 15 17 25" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_24byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK);
 
   res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte,
                                   cls_struct_24byte,
                                   cls_struct_24byte,
                                   cls_struct_24byte))
-            (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+            (code))(e_dbl, f_dbl, g_dbl, h_dbl);
   /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */
   printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 22 15 17 25" } */
index 5b91a09a2ccea8aa0cf76a1be73c0e0559ec68ab..101e130a1fc4b4a7db1e55a273e85a55a9b4cf19 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,9 +79,9 @@ int main (void)
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 13 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_2byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 127 1 13: 13 140" } */
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 13 140" } */
index 93fe911d2da9eaf64f90248043c9f62c88689378..fc780c30d6c6787b65a2ed179e7902e11e8fda5a 100644 (file)
@@ -47,21 +47,13 @@ cls_struct_3_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -92,9 +84,9 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 190 192 194" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3_1byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 190 192 194" } */
index b7726917094e39b384816654e1cd72a76c79b5d2..5705ce387980f62a8a226413af6250dec9434e5a 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,9 +79,9 @@ int main (void)
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 13 134" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 119 1 15: 13 134" } */
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 13 134" } */
index 51128cc18effa7bb830e38fd4346f52c753cd75f..01770a0750bc06350cc59a59bed3090cd10d9d84 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_3byte_gn1(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,9 +79,9 @@ int main (void)
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 24 144" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn1, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl);
   /* { dg-output "\n15 125 9 19: 24 144" } */
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 24 144" } */
index a378d194f4215ca59fceb077f1524546a1f255bd..f3806d7ba1c9e764a2f7e939328402fc1a7b9797 100644 (file)
@@ -49,21 +49,13 @@ cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -95,9 +87,9 @@ int main (void)
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 190 192 194 196" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4_1byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 190 192 194 196" } */
index b2c951dbeb5f798ad478c65e9830f417e4d80c42..a1aba3c09d50d9ab50f60d017faa73358afae49d 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_4byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,9 +79,9 @@ int main (void)
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 139 248" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 12 128: 139 248" } */
   printf("res: %d %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 139 248" } */
index 40d2e64eec823cf67bf7ed19ebcf6e4aba289351..2ceba3ddb2dabe94555c169fbdc4ddc2d986c0f1 100644 (file)
@@ -51,21 +51,13 @@ cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[6];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -105,9 +97,9 @@ int main (void)
   res_dbl.d = 0;
   res_dbl.e = 0;
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */
   printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
         res_dbl.d, res_dbl.e);
index 0307e51f6b98dc41278b3f6bc69defe738d15f18..61d595c2bf06a580d541137d977a67bc784024c8 100644 (file)
@@ -46,21 +46,13 @@ cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -95,9 +87,9 @@ int main (void)
   res_dbl.b = 0;
   res_dbl.c = 0;
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 139 248 10" } */
index 1329c6f26aba0d056004b1eeade43ca19c857ea8..576ebe0cc2a4e8206c0ef0931bef532ad266b921 100644 (file)
@@ -59,21 +59,13 @@ cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[9];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -116,13 +108,13 @@ int main (void)
         res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
   /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_64byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK);
 
   res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte,
                                   cls_struct_64byte,
                                   cls_struct_64byte,
                                   cls_struct_64byte))
-            (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+            (code))(e_dbl, f_dbl, g_dbl, h_dbl);
   /* { dg-output "\n22 15 17 25 6 13 19 18" } */
   printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
         res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
index 7ddb586ea1a2b9080a57e946780ddff24bebe1e5..9f2eff68c1ff91a1e113feb5e587e09b5e72545f 100644 (file)
@@ -53,21 +53,13 @@ cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[7];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -109,9 +101,9 @@ int main (void)
   res_dbl.e = 0;
   res_dbl.f = 0;
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */
   printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
         res_dbl.d, res_dbl.e, res_dbl.f);
index 24fd63baa3742f5d29720720d063bb09c06bba89..73257b0989bb5ec3d8a2a6c3b84d60b190cf5166 100644 (file)
@@ -49,21 +49,13 @@ cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -95,9 +87,9 @@ int main (void)
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 139 248 10 255" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 139 248 10 255" } */
index 0cf1371a77ace02dc2f24179c8ed0055baa7e842..50d09c9da72db12fc784495f76ecb94ff6fa0cba 100644 (file)
@@ -55,21 +55,13 @@ cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[8];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -113,9 +105,9 @@ int main (void)
   res_dbl.f = 0;
   res_dbl.g = 0;
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */
   printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
         res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
index 77858625fa9ff913e59cb205453dbe16643cac5c..f5c00003153dc0f79d00d1d9063760d8c9b0723b 100644 (file)
@@ -48,21 +48,13 @@ cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -94,9 +86,9 @@ int main (void)
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 139 248 10 509" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 139 248 10 509" } */
index 75326b8f70ee55d56e4065529c1014e7c545f6a1..4aa99d12e417c1fb47a6110571a29b917a49d629 100644 (file)
@@ -42,21 +42,13 @@ cls_struct_8byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -85,9 +77,9 @@ int main (void)
   /* { dg-output "1 2 4 5: 5 7" } */
   printf("res: %d %g\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 5 7" } */
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_8byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n1 2 4 5: 5 7" } */
   printf("res: %d %g\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 5 7" } */
index 0b3de9daa93c0374ffa960d814687efee82d703e..cc5e9d6c4e940e5efab1466418c118416873695a 100644 (file)
@@ -43,21 +43,13 @@ static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -87,9 +79,9 @@ int main (void)
   printf("res: %d %g\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 8 17" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl);
+  res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl);
   /* { dg-output "\n7 8 1 9: 8 17" } */
   printf("res: %d %g\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 8 17" } */
index 8cafc8af6c86f6a0c2ba0d4b35e764341057f2c5..5c0ba0d4b8d4a6581ffc8b4e6798e74be756371a 100644 (file)
@@ -43,21 +43,13 @@ static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   /* { dg-output "\nres: 8 17" } */
 
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl);
+  res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl);
   /* { dg-output "\n7 8 1 9: 8 17" } */
   printf("res: %g %d\n", res_dbl.a, res_dbl.b);
   /* { dg-output "\nres: 8 17" } */
index 5ba230154a42e16ffd75d2db558a71f10e544fca..22b94d5a09de1e21b90dad788982b8ded01ad82e 100644 (file)
@@ -45,21 +45,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -90,9 +82,9 @@ int main (void)
   printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index 996e1ab965b67a552ffc376359c8590d31aa18e3..62637f21d182d1c4075bc192e6269ab7157672cb 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index 74cddc3a7e830f90b44f3ce23f37e00d3432c5bf..af380603c99eb8f5c4d6390fd0718f3f67d22d8c 100644 (file)
@@ -4,7 +4,7 @@
    PR:         none.
    Originator: <hos@tamanegi.org> 20031203      */
 
-/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run } */
 
 #include "ffitest.h"
 
@@ -44,21 +44,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -89,9 +81,9 @@ int main (void)
   printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index b350b3df29572b817167c576954bc38666cdc3ac..40326778aee7abd7c411cdc51e3e77ee1fff8d62 100644 (file)
@@ -4,8 +4,10 @@
    PR:         none.
    Originator: <hos@tamanegi.org> 20031203      */
 
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
 #include "ffitest.h"
 
@@ -78,21 +80,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[3];
        ffi_type* cls_struct_fields[8];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -128,9 +122,9 @@ int main (void)
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
        /* { dg-output "\nres: 9 11 13 15 17 19 21" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-       res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+       res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
        /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */
        printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b,
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
index 0e8be3febf047af2d27794a7db1963a484342655..ced41c0b00cd4f1fcaf0d9d1ef3ff318f09c20b1 100644 (file)
@@ -5,8 +5,10 @@
        Originator:             Blake Chaffin   6/18/2007
 */
 
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
 #include "ffitest.h"
 
@@ -58,21 +60,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[3];
        ffi_type* cls_struct_fields[8];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -108,9 +102,9 @@ int main (void)
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
        /* { dg-output "\nres: 9 11 13 15 17 19 21" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-       res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+       res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
        /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */
        printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b,
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
@@ -118,3 +112,6 @@ int main (void)
 
   exit(0);
 }
+
+
+
index 9a79922f561e6e3b280878d6b1b31e3d465f2d38..cbc4f953ff625871d74f67a97da4dde9cd8ea7fe 100644 (file)
@@ -47,21 +47,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -92,9 +84,9 @@ int main (void)
   printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index fe4fe0922150fe3be8d6d9937677a72b82ae0139..383ea41d5a6603987711a010464960111b10ab27 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index c059da8097539caf6ebc1672caa8a25c89ad9c35..705d78cfa84cf12ab0c6ac5c6b9bdb11e31fd4f7 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index f5e9746cab0769f680bdc5a6e341f4c7afd83b9d..d8b73e95783b44af879110d293af08c5100a1103 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index c861bee344d809392691bce0997a7b50c08a0966..cb6b74821ea427d62232512744b5cbaca1778126 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index d680d8a9f8cdb976b87760657cabf47fe2d719f7..e453d3e5d9e0c6a570b493f4a0c95b68ffa63238 100644 (file)
@@ -43,21 +43,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
   printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
index 0737ba2305b942945fdc98e4610cdb9eb882ff6a..a3886f489620532c0887c4d0042c61be121fbf65 100644 (file)
@@ -23,7 +23,7 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
   result.b = a1.b + a2.b;
   result.c = a1.c + a2.c;
 
-  printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
+  printf("%d %llu %d %d %llu %d: %d %llu %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
 
   return  result;
 }
@@ -44,21 +44,13 @@ cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[4];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -86,14 +78,14 @@ int main (void)
 
   ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
   /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
   exit(0);
index c568381cf45f8169585137b7e6518da0a1f6ffac..fcf48b79237d7d0ea3eb6efeed4a82ffb7e71cab 100644 (file)
@@ -30,19 +30,10 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
 {
        ffi_cif cif;
 
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-
-       ffi_closure*    pcl;
+        void *code;
+       ffi_closure*    pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        ffi_type*               cl_arg_types[1];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap(sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        ffi_type        ts1_type;
        ffi_type*       ts1_type_elements[4];
 
@@ -63,9 +54,9 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
        CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                                 &ffi_type_void, cl_arg_types) == FFI_OK);
 
-       CHECK(ffi_prep_closure(pcl, &cif, closure_test_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK);
 
-       ((void*(*)(Dbls))(pcl))(arg);
+       ((void*(*)(Dbls))(code))(arg);
        /* { dg-output "1.0 2.0\n" { xfail x86_64-*-linux-* } } */
 
        closure_test_fn(arg);
index ee77adde6a08e3deb83ba0c03be6714c0c104a07..84ad4cb7d925b69d238bd129ee3601c36a6c547b 100644 (file)
@@ -20,19 +20,11 @@ typedef double (*cls_ret_double)(double);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   double res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_double;
   cl_arg_types[1] = NULL;
 
@@ -40,9 +32,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_double, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_double_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_double)pcl))(21474.789);
+  res = (*((cls_ret_double)code))(21474.789);
   /* { dg-output "21474.789000: 21474.789000" } */
   printf("res: %.6f\n", res);
   /* { dg-output "\nres: 21474.789000" } */
index 4d6d5b71c4045ab51f012518a8d999a0a54b8a6d..45ce9bd7c387745c202fc3c7d999e49124752b4c 100644 (file)
@@ -20,19 +20,11 @@ cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args[3];
        ffi_type* arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap(sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        char*   format          = "%.1f\n";
        double  doubleArg       = 7;
        ffi_arg res                     = 0;
@@ -53,9 +45,9 @@ int main (void)
        printf("res: %d\n", (int) res);
        // { dg-output "\nres: 4" }
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_double_va_fn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
 
-       res     = ((int(*)(char*, double))(pcl))(format, doubleArg);
+       res     = ((int(*)(char*, double))(code))(format, doubleArg);
        // { dg-output "\n7.0" }
        printf("res: %d\n", (int) res);
        // { dg-output "\nres: 4" }
index 8bed628f823d86d6b91bb104aa2857d53c88fcf3..0090fed9063174d0e2e2412280e9841b4ecc86ae 100644 (file)
@@ -21,20 +21,11 @@ typedef float (*cls_ret_float)(float);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   float res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
-
   cl_arg_types[0] = &ffi_type_float;
   cl_arg_types[1] = NULL;
 
@@ -42,8 +33,8 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_float, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_float_fn, NULL)  == FFI_OK);
-  res = ((((cls_ret_float)pcl)(-2122.12)));
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code)  == FFI_OK);
+  res = ((((cls_ret_float)code)(-2122.12)));
   /* { dg-output "\\-2122.12: \\-2122.12" } */
   printf("res: %.6f\n", res);
   /* { dg-output "\nres: \-2122.120117" } */
index a0fafc9f3e8613d92a15b25d07c920ca55a1a2b2..2f50b368e7a96dd73eb1a7fcb00b1f7fb7751058 100644 (file)
@@ -4,8 +4,10 @@
    PR:                 none.
    Originator: Blake Chaffin   */
 
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
 #include "ffitest.h"
 
@@ -47,20 +49,12 @@ cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main(void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure      cl;
-#endif
-       ffi_closure*    pcl;
+        void* code;
+       ffi_closure*    pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void*                   args[9];
        ffi_type*               arg_types[9];
        long double             res     = 0;
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap(sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        long double     arg1    = 1;
        long double     arg2    = 2;
        long double     arg3    = 3;
@@ -98,10 +92,10 @@ int main(void)
        printf("res: %Lg\n", res);
        /* { dg-output "\nres: 36" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_ldouble_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK);
 
        res = ((long double(*)(long double, long double, long double, long double,
-               long double, long double, long double, long double))(pcl))(arg1, arg2,
+               long double, long double, long double, long double))(code))(arg1, arg2,
                arg3, arg4, arg5, arg6, arg7, arg8);
        /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */
        printf("res: %Lg\n", res);
index c3599d7b789aafa908b089ee3ecf3c9a4f384c63..0e910d5bd37305b94837a6b3bfffebe4f22bee24 100644 (file)
@@ -4,7 +4,8 @@
    PR:                 none.
    Originator: Blake Chaffin 6/6/2007   */
 
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* } } */
 #include "ffitest.h"
 
 static void
@@ -20,19 +21,11 @@ cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args[3];
        ffi_type* arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        char*           format  = "%L.1f\n";
        long double     ldArg   = 7;
        ffi_arg         res             = 0;
@@ -53,9 +46,9 @@ int main (void)
        printf("res: %d\n", (int) res);
        // { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* sh*-*-linux-* } }
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_longdouble_va_fn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
 
-       res     = ((int(*)(char*, long double))(pcl))(format, ldArg);
+       res     = ((int(*)(char*, long double))(code))(format, ldArg);
        // { dg-output "\n7.0" }
        printf("res: %d\n", (int) res);
        // { dg-output "\nres: 4" }
index 713c3188d812369994754c6fa05cc55f3d623e4c..71df7b6516e657cee68bcc430d36cbd75f1c17fc 100644 (file)
@@ -36,21 +36,13 @@ typedef signed char (*test_type)(signed char, signed char);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[3];
   ffi_type * cl_arg_types[3];
   ffi_arg res_call;
   signed char a, b, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 2;
   b = 125;
 
@@ -71,9 +63,9 @@ int main (void)
   printf("res: %d\n", (signed char)res_call);
   /* { dg-output "\nres: 127" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(2, 125);
+  res_closure = (*((test_type)code))(2, 125);
   /* { dg-output "\n2 125: 127" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 127" } */
index 852fdf73db7b6ca7526f018d4eb701f85cca6251..4c39153266765ca91376f1c899fcc4e0d7a4dd17 100644 (file)
@@ -36,21 +36,13 @@ typedef signed short (*test_type)(signed short, signed short);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[3];
   ffi_type * cl_arg_types[3];
   ffi_arg res_call;
   unsigned short a, b, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 2;
   b = 32765;
 
@@ -71,9 +63,9 @@ int main (void)
   printf("res: %d\n", (unsigned short)res_call);
   /* { dg-output "\nres: 32767" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(2, 32765);
+  res_closure = (*((test_type)code))(2, 32765);
   /* { dg-output "\n2 32765: 32767" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 32767" } */
index e4e92ef4480507058e88a8bcb72090f7d3a68252..1c3aeb5a66c157292dd1c87af44a9b938b3be3a0 100644 (file)
@@ -41,22 +41,14 @@ typedef signed short (*test_type)(signed char, signed short,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[5];
   ffi_type * cl_arg_types[5];
   ffi_arg res_call;
   signed char a, c;
   signed short b, d, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 1;
   b = 32765;
   c = 127;
@@ -83,9 +75,9 @@ int main (void)
   printf("res: %d\n", (signed short)res_call);
   /* { dg-output "\nres: 32765" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(1, 32765, 127, -128);
+  res_closure = (*((test_type)code))(1, 32765, 127, -128);
   /* { dg-output "\n1 32765 127 -128: 32765" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 32765" } */
index 2c84aef6134c26a1f84a442f8842798ee4dede99..009c02c72ba5360c95122443520595194be3cbb0 100644 (file)
@@ -47,21 +47,13 @@ void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[5];
   ffi_type * cl_arg_types[5];
   ffi_arg res_call;
   unsigned char a, b, c, d, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 1;
   b = 2;
   c = 127;
@@ -88,9 +80,9 @@ int main (void)
   printf("res: %d\n", (unsigned char)res_call);
   /* { dg-output "\nres: 255" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(1, 2, 127, 125);
+  res_closure = (*((test_type)code))(1, 2, 127, 125);
   /* { dg-output "\n1 2 127 125: 255" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 255" } */
index 215fef832a877c78d3dd7f9df06273f273bcf896..dd10ca734685dfb48cc7df9d2309722ba0cb85d1 100644 (file)
@@ -36,21 +36,13 @@ typedef unsigned short (*test_type)(unsigned short, unsigned short);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[3];
   ffi_type * cl_arg_types[3];
   ffi_arg res_call;
   unsigned short a, b, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 2;
   b = 32765;
 
@@ -71,9 +63,9 @@ int main (void)
   printf("res: %d\n", (unsigned short)res_call);
   /* { dg-output "\nres: 32767" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(2, 32765);
+  res_closure = (*((test_type)code))(2, 32765);
   /* { dg-output "\n2 32765: 32767" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 32767" } */
index 1cde84abb5ecee0c4313998410f5447e66979868..2588e97f987fbb5c386f78bc9b80719b674244b1 100644 (file)
@@ -41,22 +41,14 @@ typedef unsigned short (*test_type)(unsigned char, unsigned short,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void * args_dbl[5];
   ffi_type * cl_arg_types[5];
   ffi_arg res_call;
   unsigned char a, c;
   unsigned short b, d, res_closure;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   a = 1;
   b = 2;
   c = 127;
@@ -83,9 +75,9 @@ int main (void)
   printf("res: %d\n", (unsigned short)res_call);
   /* { dg-output "\nres: 258" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code)  == FFI_OK);
 
-  res_closure = (*((test_type)pcl))(1, 2, 127, 128);
+  res_closure = (*((test_type)code))(1, 2, 127, 128);
   /* { dg-output "\n1 2 127 128: 258" } */
   printf("res: %d\n", res_closure);
   /* { dg-output "\nres: 258" } */
index ffc1f6a3544eb7d0cdaae80e639130b8b2a2a570..34e4209640b8e121e8de5e8c26d4b99150162d72 100644 (file)
@@ -32,20 +32,12 @@ cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure      cl;
-#endif
-       ffi_closure*    pcl;
+        void *code;
+       ffi_closure*    pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void*                   args[3];
 //     ffi_type                cls_pointer_type;
        ffi_type*               arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap(sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
 /*     cls_pointer_type.size = sizeof(void*);
        cls_pointer_type.alignment = 0;
        cls_pointer_type.type = FFI_TYPE_POINTER;
@@ -71,9 +63,9 @@ int main (void)
        printf("res: 0x%08x\n", (unsigned int) res);
        /* { dg-output "\nres: 0x9be02467" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
 
-       res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2);
+       res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2);
        /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */
        printf("res: 0x%08x\n", (unsigned int) res);
        /* { dg-output "\nres: 0x9be02467" } */
index c7ab55b37e5671bfacfe3e71c4fcc7273cde5b6e..dd59c6b2c7abefe992a86247c984eab357f98962 100644 (file)
@@ -93,20 +93,12 @@ cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure      cl;
-#endif
-       ffi_closure*    pcl;
+        void *code;
+       ffi_closure*    pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void*                   args[3];
 //     ffi_type                cls_pointer_type;
        ffi_type*               arg_types[3];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap(sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
 /*     cls_pointer_type.size = sizeof(void*);
        cls_pointer_type.alignment = 0;
        cls_pointer_type.type = FFI_TYPE_POINTER;
@@ -135,9 +127,9 @@ int main (void)
        // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" }
        // { dg-output "\nres: 0x8bf258bd" }
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
 
-       res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2);
+       res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2);
 
        printf("res: 0x%08x\n", (unsigned int) res);
        // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" }
index bb1f2c64f3564fae7cab6a6271601583b1f85a30..82986b172c365d2d9bf9313568b056eb922ae821 100644 (file)
@@ -21,19 +21,11 @@ typedef signed char (*cls_ret_schar)(signed char);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   signed char res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_schar;
   cl_arg_types[1] = NULL;
 
@@ -41,9 +33,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_schar, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_schar_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_schar)pcl))(127);
+  res = (*((cls_ret_schar)code))(127);
   /* { dg-output "127: 127" } */
   printf("res: %d\n", res);
   /* { dg-output "\nres: 127" } */
index cf21bf84417521c3b5fb815723d949329620681c..c7e13b73a3bae7e9f6efed156bea48e28e6c1052 100644 (file)
@@ -19,19 +19,11 @@ typedef signed int (*cls_ret_sint)(signed int);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   signed int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_sint;
   cl_arg_types[1] = NULL;
 
@@ -39,9 +31,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sint_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_sint)pcl))(65534);
+  res = (*((cls_ret_sint)code))(65534);
   /* { dg-output "65534: 65534" } */
   printf("res: %d\n",res);
   /* { dg-output "\nres: 65534" } */
index 8d63413318dc8697c34c82197617070d3ed6bbb4..846d57ed1ba553794ae52c4cca7cf952647dfd2e 100644 (file)
@@ -19,19 +19,11 @@ typedef signed short (*cls_ret_sshort)(signed short);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   signed short res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_sshort;
   cl_arg_types[1] = NULL;
 
@@ -39,9 +31,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_sshort, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sshort_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_sshort)pcl))(255);
+  res = (*((cls_ret_sshort)code))(255);
   /* { dg-output "255: 255" } */
   printf("res: %d\n",res);
   /* { dg-output "\nres: 255" } */
index ea78ce5840a26de7d10efd80fc4e2ba3f670dadc..c1317e795fd65d1b9d5328c449a4b38ca41c2c64 100644 (file)
@@ -19,19 +19,11 @@ typedef unsigned char (*cls_ret_uchar)(unsigned char);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   unsigned char res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uchar;
   cl_arg_types[1] = NULL;
 
@@ -39,9 +31,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_uchar, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uchar_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_uchar)pcl))(127);
+  res = (*((cls_ret_uchar)code))(127);
   /* { dg-output "127: 127" } */
   printf("res: %d\n",res);
   /* { dg-output "\nres: 127" } */
index e31e41aacf25587881958c69f55c5a3acf0d6bfe..885cff5c3146831c3a2736ebf885afdea0c1f03d 100644 (file)
@@ -20,19 +20,11 @@ typedef unsigned int (*cls_ret_uint)(unsigned int);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   unsigned int res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uint;
   cl_arg_types[1] = NULL;
 
@@ -40,9 +32,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_uint, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uint_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_uint)pcl))(2147483647);
+  res = (*((cls_ret_uint)code))(2147483647);
   /* { dg-output "2147483647: 2147483647" } */
   printf("res: %d\n",res);
   /* { dg-output "\nres: 2147483647" } */
index 1cc0a389332f7c7daa1f410a2b41184c1ea2b13e..ed891e35a2b0168e27b2cecfa06e1accd34dc1c5 100644 (file)
@@ -20,34 +20,26 @@ typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   unsigned long long res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_uint64;
   cl_arg_types[1] = NULL;
 
   /* Initialize the cif */
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_uint64, cl_arg_types) == FFI_OK);
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ulonglong_fn, NULL)  == FFI_OK);
-  res = (*((cls_ret_ulonglong)pcl))(214LL);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code)  == FFI_OK);
+  res = (*((cls_ret_ulonglong)code))(214LL);
   /* { dg-output "214: 214" } */
-  printf("res: %lld\n", res);
+  printf("res: %llu\n", res);
   /* { dg-output "\nres: 214" } */
 
-  res = (*((cls_ret_ulonglong)pcl))(9223372035854775808LL);
+  res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
   /* { dg-output "\n9223372035854775808: 9223372035854775808" } */
-  printf("res: %lld\n", res);
+  printf("res: %llu\n", res);
   /* { dg-output "\nres: 9223372035854775808" } */
 
   exit(0);
index 81f984862a35cfd9bb9aaf46aab61f0cb5e29d35..a00100e07f8c954f7a15a08ee5a873754d8558d5 100644 (file)
@@ -20,19 +20,11 @@ typedef unsigned short (*cls_ret_ushort)(unsigned short);
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[2];
   unsigned short res;
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cl_arg_types[0] = &ffi_type_ushort;
   cl_arg_types[1] = NULL;
 
@@ -40,9 +32,9 @@ int main (void)
   CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_ushort, cl_arg_types) == FFI_OK);
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ushort_fn, NULL)  == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code)  == FFI_OK);
 
-  res = (*((cls_ret_ushort)pcl))(65535);
+  res = (*((cls_ret_ushort)code))(65535);
   /* { dg-output "65535: 65535" } */
   printf("res: %d\n",res);
   /* { dg-output "\nres: 65535" } */
index 03d7e96a452f11280127b9bc4a63fbb4fe515ba2..4f121859dadcdfe10316494a05945f4662576fc9 100644 (file)
@@ -15,19 +15,11 @@ dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args[1];
        ffi_type* arg_types[1];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        arg_types[0] = NULL;
        args[0] = NULL;
 
@@ -39,7 +31,7 @@ int main (void)
 
        cif.abi= 255;
 
-       CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI);
 
        exit(0);
 }
index 0f84fe557a4031783d21b273e9f1a1cb54fc3407..7ec2728eb1007d952c3ccb6077a113307fb33cbd 100644 (file)
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
        ffi_type* arg_types[1];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        arg_types[0] = NULL;
 
        ffi_type        badType = ffi_type_void;
index fa9dd311d69990fd0c9dccd4750ef3a89fcc8437..a0b296cf4b9437648701c2b617d8023fe34de498 100644 (file)
@@ -4,7 +4,8 @@
    PR:         none.
    Originator: From the original ffitest.c  */
 
-/* { dg-do run } */
+/* { dg-excess-errors "fails" { target x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
 #include "ffitest.h"
 #include "float.h"
index adce7ba434f3cd5e89e5bf32d021035aeb9b5c5d..8aa527ede4e40077e43ffe0a8c124d69cc7c73f6 100644 (file)
@@ -68,10 +68,8 @@ cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type* cls_struct_fields1[5];
@@ -79,12 +77,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -143,12 +135,12 @@ int main (void)
   CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
   CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK);
 
   res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1,
                                     cls_struct_16byte2,
                                     cls_struct_combined))
-            (pcl))(e_dbl, f_dbl, g_dbl);
+            (code))(e_dbl, f_dbl, g_dbl);
   /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */
   CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a));
   CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b));
index f7fe72e59022f28f03768008a4ce7256ddfee6a1..2a9f515cdedaf60d15169b57388e9cbc2ebe0f57 100644 (file)
@@ -72,10 +72,8 @@ cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type* cls_struct_fields1[5];
@@ -83,12 +81,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -150,13 +142,13 @@ int main (void)
   CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
   CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK);
 
   res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1,
                                     cls_struct_16byte2,
                                     cls_struct_combined,
                                     cls_struct_16byte1))
-            (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+            (code))(e_dbl, f_dbl, g_dbl, h_dbl);
   /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */
   CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a));
   CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b));
index 8d9aba2acdc75f17204a19ec71b4e8d752faf400..d6a718bdd019c9979796921a030dacbfb843d1ec 100644 (file)
@@ -58,10 +58,8 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[4];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[4];
@@ -69,12 +67,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[4];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -129,9 +121,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+  res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
   /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
index 821fcc40f6b613f1b0e0b4d2556a27dbf7c9a9d8..de1584c18a1ac138427474424dfe410bd8e9675d 100644 (file)
@@ -49,22 +49,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
   ffi_type cls_struct_type, cls_struct_type1;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -106,9 +98,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+  res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
   /* { dg-output "\n1 7 12 127 99: 13 233 134" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
index f11aff49b943fb920bebd78b6cfa14d108692d65..58aa85362e8463615b4891fd4677f6482b9665c9 100644 (file)
@@ -50,22 +50,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
   ffi_type cls_struct_type, cls_struct_type1;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -108,9 +100,9 @@ int main (void)
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
 
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+  res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
   /* { dg-output "\n1 7 12 127 99: 13 233 134" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
index 0553ce88166b387a7098338ee963fd343a001057..98e491e65cfae5ab85c7458b8d4f0c7c93b6080d 100644 (file)
@@ -50,22 +50,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
   ffi_type cls_struct_type, cls_struct_type1;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -107,9 +99,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+  res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
   /* { dg-output "\n1 7 12 127 99: 13 233 134" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
index a77931b59b8f3f82f98d7d1dcc04ea1ac8bada60..d8e3537d5a0903216ce6662141eade5d5d0e95b8 100644 (file)
@@ -50,22 +50,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
   ffi_type cls_struct_type, cls_struct_type1;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -108,9 +100,9 @@ int main (void)
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
 
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+  res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
   /* { dg-output "\n1 7 12 127 99: 13 233 134" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
index af2821c769f6e88ce0653ec72f7a9a5c59f796a9..2f2b25a15db14e43a241b4da9c2fad2288bb0239 100644 (file)
@@ -57,10 +57,8 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[4];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
@@ -68,12 +66,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[4];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -127,9 +119,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+  res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
   /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
index c7dd4f7347e03be97c60ec52fb3587fcdf2d1bac..14c70239eb29025d4db59a44b3045e3e9944f369 100644 (file)
@@ -50,22 +50,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[3];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
   ffi_type cls_struct_type, cls_struct_type1;
   ffi_type* dbl_arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -107,9 +99,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+  res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
   /* { dg-output "\n1 7 12 127 99: 13 233 134" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
index 775ff70fdaf577776bd5cbe6e7b57d6e23e52d49..bb77ead8d328f49f101a2b2e59d111c4f2d0c237 100644 (file)
@@ -57,10 +57,8 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[4];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
@@ -68,12 +66,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[4];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -127,9 +119,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+  res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
   /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
index 70332de890b0e537bea1b8b55053a78551f3d469..e9f541c83a85cde3d7e7380a86deccc07eb0dbc7 100644 (file)
@@ -57,10 +57,8 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[4];
   ffi_type* cls_struct_fields[3];
   ffi_type* cls_struct_fields1[3];
@@ -68,12 +66,6 @@ int main (void)
   ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
   ffi_type* dbl_arg_types[4];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -127,9 +119,9 @@ int main (void)
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
   CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
 
-  CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+  res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
   /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
   CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
   CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
index ca70cc8d77315cc904347e46d7cb9ba4a704d924..6a91555a1fa8ddaf285b777774a9564358b19ee5 100644 (file)
@@ -45,19 +45,11 @@ int main(void)
   ffi_type* my_ffi_struct_fields[4];
   ffi_type my_ffi_struct_type;
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args[4];
   ffi_type* arg_types[3];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   struct my_ffi_struct g = { 1.0, 2.0, 3.0 };
   struct my_ffi_struct f = { 1.0, 2.0, 3.0 };
   struct my_ffi_struct res;
@@ -87,9 +79,9 @@ int main(void)
   printf("res: %g %g %g\n", res.a, res.b, res.c);
   /* { dg-output "\nres: 2 4 6" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK);
 
-  res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f);
+  res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f);
   /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */
   printf("res: %g %g %g\n", res.a, res.b, res.c);
   /* { dg-output "\nres: 2 4 6" } */
index 413bf94a67d14ca2046f8fc5b65674a2b4134b78..5c2fe65aece065619036fea6248a92967942f10f 100644 (file)
@@ -4,7 +4,7 @@
    PR:         none.
    Originator: <andreast@gcc.gnu.org> 20071113  */
 
-/* { dg-do run } */
+/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 #include "ffitest.h"
 
 static long double return_ldl(long double ldl)
index 3327ac1b2ca1fb580567d28c2d41e3eb4b4b7024..12819cf467d4ae59187e70a4f054fd50b8dcdba9 100644 (file)
@@ -75,21 +75,13 @@ cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* us
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[5];
        ffi_type* cls_struct_fields[15];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -139,10 +131,10 @@ int main (void)
                res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n);
        /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_108byte_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK);
 
        res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte,
-               struct_108byte, struct_108byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+               struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
        /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */
        printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b,
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i,
index 8550ab17cb0916c161085813792a98bcb27e94a3..e63bb67923afa091cdf1fd31e54bcff78d3df7e8 100644 (file)
@@ -77,21 +77,13 @@ cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* us
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[5];
        ffi_type* cls_struct_fields[16];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -142,10 +134,10 @@ int main (void)
                res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o);
        /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_116byte_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK);
 
        res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte,
-               struct_116byte, struct_116byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+               struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
        /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */
        printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b,
                res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i,
index 74863d8bc296b4b079a8462e42f45fe3d9ecf264..13c4464ffac856d7eae5ed2288b7f629eb1164b1 100644 (file)
@@ -61,21 +61,13 @@ cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* use
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[5];
        ffi_type* cls_struct_fields[10];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -119,10 +111,10 @@ int main (void)
                res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
        /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK);
 
        res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
-               struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+               struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
        /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
        printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
                res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
index 6319982c3c89d46898f25097264ca2bc7b3cabdb..43703b21dd5b5457615ed5b4789f934bd3ba8527 100644 (file)
@@ -61,21 +61,13 @@ cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* use
 int main (void)
 {
        ffi_cif cif;
-#ifndef USING_MMAP
-       static ffi_closure cl;
-#endif
-       ffi_closure *pcl;
+        void *code;
+       ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
        void* args_dbl[5];
        ffi_type* cls_struct_fields[10];
        ffi_type cls_struct_type;
        ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-       pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-       pcl = &cl;
-#endif
-
        cls_struct_type.size = 0;
        cls_struct_type.alignment = 0;
        cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -119,10 +111,10 @@ int main (void)
                res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
        /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
 
-       CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK);
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK);
 
        res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
-               struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+               struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
        /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
        printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c,
                res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
index a3d803780abd88ef96318be3b44332d8fcd7e7ba..723871626d180c73171e312a4f61738b09fdca72 100644 (file)
@@ -6,6 +6,7 @@
 
 /* { dg-do run } */
 #include "ffitestcxx.h"
+#include <stdint.h>
 
 void
 closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,
@@ -27,7 +28,7 @@ void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp,
       (int)(*(double*)args[8]) + (int)*(int *)args[9] +
       (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
       (int)*(int *)args[12] + (int)(*(int *)args[13]) +
-      (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
+      (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata;
 
     printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
           (int)*(float *)args[0], (int)(*(float *)args[1]),
@@ -38,7 +39,7 @@ void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp,
           (int)(*(int *)args[10]), (int)(*(float *)args[11]),
           (int)*(int *)args[12], (int)(*(int *)args[13]),
           (int)(*(int *)args[14]), *(int *)args[15],
-          (int)(long)userdata, (int)*(ffi_arg*)resp);
+          (int)(intptr_t)userdata, (int)*(ffi_arg*)resp);
 
     throw (int)*(ffi_arg*)resp;
 }
@@ -50,27 +51,20 @@ typedef int (*closure_test_type1)(float, float, float, float, signed short,
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code);
   ffi_type * cl_arg_types[17];
-#ifdef USING_MMAP
-  pcl = (ffi_closure *) allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
 
   {
     cl_arg_types[1] = NULL;
 
     CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0,
                       &ffi_type_void, cl_arg_types) == FFI_OK);
-    CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn, NULL) == FFI_OK);
+    CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK);
 
     try
       {
-       (*((closure_test_type)(pcl)))();
+       (*((closure_test_type)(code)))();
       } catch (int exception_code)
       {
        CHECK(exception_code == 9);
@@ -104,11 +98,11 @@ int main (void)
       CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
                         &ffi_type_sint, cl_arg_types) == FFI_OK);
 
-      CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1,
-                            (void *) 3 /* userdata */)  == FFI_OK);
+      CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1,
+                                 (void *) 3 /* userdata */, code)  == FFI_OK);
       try
        {
-         (*((closure_test_type1)pcl))
+         (*((closure_test_type1)code))
            (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
             19, 21, 1);
          /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */