diff options
author | Christian Heimes <christian@cheimes.de> | 2008-03-04 23:39:23 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-03-04 23:39:23 (GMT) |
commit | 7864476afa402a0537c33ba9630e77351720baf8 (patch) | |
tree | cb9113e14d6a0b56696398f4d61d107ea7055e08 /Modules/_ctypes/libffi/src/ia64/ffi.c | |
parent | 227c800f4397764a20b77fd58467e2bb27fbf510 (diff) | |
download | cpython-7864476afa402a0537c33ba9630e77351720baf8.zip cpython-7864476afa402a0537c33ba9630e77351720baf8.tar.gz cpython-7864476afa402a0537c33ba9630e77351720baf8.tar.bz2 |
Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61209 | georg.brandl | 2008-03-03 21:37:55 +0100 (Mon, 03 Mar 2008) | 2 lines
There are now sixteen isfoo functions.
........
r61210 | georg.brandl | 2008-03-03 21:39:00 +0100 (Mon, 03 Mar 2008) | 2 lines
15 -> 16, the 2nd
........
r61211 | georg.brandl | 2008-03-03 22:22:47 +0100 (Mon, 03 Mar 2008) | 2 lines
Actually import itertools.
........
r61212 | georg.brandl | 2008-03-03 22:31:50 +0100 (Mon, 03 Mar 2008) | 2 lines
Expand a bit on genexp scopes.
........
r61213 | raymond.hettinger | 2008-03-03 23:04:55 +0100 (Mon, 03 Mar 2008) | 1 line
Remove dependency on itertools -- a simple genexp suffices.
........
r61214 | raymond.hettinger | 2008-03-03 23:19:58 +0100 (Mon, 03 Mar 2008) | 1 line
Issue 2226: Callable checked for the wrong abstract method.
........
r61217 | andrew.kuchling | 2008-03-04 01:40:32 +0100 (Tue, 04 Mar 2008) | 1 line
Typo fix
........
r61218 | andrew.kuchling | 2008-03-04 02:30:10 +0100 (Tue, 04 Mar 2008) | 1 line
Grammar fix; markup fix
........
r61219 | andrew.kuchling | 2008-03-04 02:47:38 +0100 (Tue, 04 Mar 2008) | 1 line
Fix sentence fragment
........
r61220 | andrew.kuchling | 2008-03-04 02:48:26 +0100 (Tue, 04 Mar 2008) | 1 line
Typo fix
........
r61221 | andrew.kuchling | 2008-03-04 02:49:37 +0100 (Tue, 04 Mar 2008) | 1 line
Add versionadded tags
........
r61222 | andrew.kuchling | 2008-03-04 02:50:32 +0100 (Tue, 04 Mar 2008) | 1 line
Thesis night results: add various items
........
r61224 | raymond.hettinger | 2008-03-04 05:17:08 +0100 (Tue, 04 Mar 2008) | 1 line
Beef-up docs and tests for itertools. Fix-up end-case for product().
........
r61225 | georg.brandl | 2008-03-04 08:25:54 +0100 (Tue, 04 Mar 2008) | 2 lines
Fix some patch attributions.
........
r61226 | georg.brandl | 2008-03-04 08:33:30 +0100 (Tue, 04 Mar 2008) | 2 lines
#2230: document that PyArg_* leaves addresses alone on error.
........
r61233 | neal.norwitz | 2008-03-04 17:22:46 +0100 (Tue, 04 Mar 2008) | 3 lines
Close the file before trying to remove the directory so it works on Windows.
As reported by Trent Nelson on python-dev.
........
r61234 | thomas.heller | 2008-03-04 21:09:11 +0100 (Tue, 04 Mar 2008) | 9 lines
Merged changes from libffi3-branch.
The bundled libffi copy is now in sync with the recently released
libffi3.0.4 version, apart from some small changes to
Modules/_ctypes/libffi/configure.ac.
I gave up on using libffi3 files on os x.
Instead, static configuration with files from pyobjc is used.
........
r61235 | thomas.heller | 2008-03-04 21:21:42 +0100 (Tue, 04 Mar 2008) | 1 line
Try to fix the build for PY_LINUX.
........
r61236 | fred.drake | 2008-03-04 22:14:04 +0100 (Tue, 04 Mar 2008) | 2 lines
fix typo
........
r61237 | raymond.hettinger | 2008-03-04 23:29:44 +0100 (Tue, 04 Mar 2008) | 1 line
Fix refleak in chain().
........
Diffstat (limited to 'Modules/_ctypes/libffi/src/ia64/ffi.c')
-rw-r--r-- | Modules/_ctypes/libffi/src/ia64/ffi.c | 116 |
1 files changed, 67 insertions, 49 deletions
diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c index ca26ca3..3f8fcc5 100644 --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64 Foreign Function Interface @@ -15,13 +15,14 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> @@ -69,24 +70,19 @@ endian_adjust (void *addr, size_t len) #endif } -/* Store VALUE to ADDR in the current cpu implementation's fp spill format. */ +/* Store VALUE to ADDR in the current cpu implementation's fp spill format. + This is a macro instead of a function, so that it works for all 3 floating + point types without type conversions. Type conversion to long double breaks + the denorm support. */ -static inline void -stf_spill(fpreg *addr, __float80 value) -{ +#define stf_spill(addr, value) \ asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); -} /* Load a value from ADDR, which is in the current cpu implementation's - fp spill format. */ + fp spill format. As above, this must also be a macro. */ -static inline __float80 -ldf_fill(fpreg *addr) -{ - __float80 ret; - asm ("ldf.fill %0 = %1%P1" : "=f"(ret) : "m"(*addr)); - return ret; -} +#define ldf_fill(result, addr) \ + asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); /* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ @@ -110,17 +106,20 @@ hfa_type_size (int type) /* Load from ADDR a value indicated by TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ -static __float80 -hfa_type_load (int type, void *addr) +static void +hfa_type_load (fpreg *fpaddr, int type, void *addr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: - return *(float *) addr; + stf_spill (fpaddr, *(float *) addr); + return; case FFI_IA64_TYPE_HFA_DOUBLE: - return *(double *) addr; + stf_spill (fpaddr, *(double *) addr); + return; case FFI_IA64_TYPE_HFA_LDOUBLE: - return *(__float80 *) addr; + stf_spill (fpaddr, *(__float80 *) addr); + return; default: abort (); } @@ -130,19 +129,31 @@ hfa_type_load (int type, void *addr) the FFI_IA64_TYPE_HFA_* values. */ static void -hfa_type_store (int type, void *addr, __float80 value) +hfa_type_store (int type, void *addr, fpreg *fpaddr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: - *(float *) addr = value; - break; + { + float result; + ldf_fill (result, fpaddr); + *(float *) addr = result; + break; + } case FFI_IA64_TYPE_HFA_DOUBLE: - *(double *) addr = value; - break; + { + double result; + ldf_fill (result, fpaddr); + *(double *) addr = result; + break; + } case FFI_IA64_TYPE_HFA_LDOUBLE: - *(__float80 *) addr = value; - break; + { + __float80 result; + ldf_fill (result, fpaddr); + *(__float80 *) addr = result; + break; + } default: abort (); } @@ -351,8 +362,8 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) && offset < size && gp_offset < 8 * 8) { - stf_spill (&stack->fp_regs[fpcount], - hfa_type_load (hfa_type, avalue[i] + offset)); + hfa_type_load (&stack->fp_regs[fpcount], hfa_type, + avalue[i] + offset); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; @@ -387,13 +398,14 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) gp pointer to the closure. This allows the function entry code to both retrieve the user data, and to restire the correct gp pointer. */ -extern void ffi_closure_unix (void); +extern void ffi_closure_unix (); ffi_status -ffi_prep_closure (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data) +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) { /* The layout of a function descriptor. A C function pointer really points to one of these. */ @@ -420,7 +432,7 @@ ffi_prep_closure (ffi_closure* closure, tramp->code_pointer = fd->code_pointer; tramp->real_gp = fd->gp; - tramp->fake_gp = (UINT64)(PTR64)closure; + tramp->fake_gp = (UINT64)(PTR64)codeloc; closure->cif = cif; closure->user_data = user_data; closure->fun = fun; @@ -475,9 +487,11 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) { - void *addr = &stack->fp_regs[fpcount++]; + fpreg *addr = &stack->fp_regs[fpcount++]; + float result; avalue[i] = addr; - *(float *)addr = ldf_fill (addr); + ldf_fill (result, addr); + *(float *)addr = result; } else avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4); @@ -487,9 +501,11 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) { - void *addr = &stack->fp_regs[fpcount++]; + fpreg *addr = &stack->fp_regs[fpcount++]; + double result; avalue[i] = addr; - *(double *)addr = ldf_fill (addr); + ldf_fill (result, addr); + *(double *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; @@ -501,9 +517,11 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, gpcount++; if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) { - void *addr = &stack->fp_regs[fpcount++]; + fpreg *addr = &stack->fp_regs[fpcount++]; + __float80 result; avalue[i] = addr; - *(__float80 *)addr = ldf_fill (addr); + ldf_fill (result, addr); + *(__float80 *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; @@ -533,8 +551,8 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, && offset < size && gp_offset < 8 * 8) { - hfa_type_store (hfa_type, addr + offset, - ldf_fill (&stack->fp_regs[fpcount])); + hfa_type_store (hfa_type, addr + offset, + &stack->fp_regs[fpcount]); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; |