[ctypes-commit] ctypes/source/libffi/src/sh64 ffi.c,1.1.2.1,1.1.2.2 sysv.S,1.1.2.1,1.1.2.2
Brought to you by:
theller
From: Hye-Shik C. <pe...@us...> - 2006-02-01 20:32:04
|
Update of /cvsroot/ctypes/ctypes/source/libffi/src/sh64 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9598/source/libffi/src/sh64 Modified Files: Tag: branch_1_0 ffi.c sysv.S Log Message: Update libffi to gcc head as of 2006/02/01. This fixes several unittest failures on 64bit platforms. Index: sysv.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/src/sh64/Attic/sysv.S,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** sysv.S 31 Jan 2006 19:44:37 -0000 1.1.2.1 --- sysv.S 1 Feb 2006 20:31:52 -0000 1.1.2.2 *************** *** 1,4 **** /* ----------------------------------------------------------------------- ! sysv.S - Copyright (c) 2003 Kaz Kojima SuperH SHmedia Foreign Function Interface --- 1,4 ---- /* ----------------------------------------------------------------------- ! sysv.S - Copyright (c) 2003, 2004 Kaz Kojima SuperH SHmedia Foreign Function Interface *************** *** 65,70 **** st.l r15, 4, r18 st.l r15, 0, r14 - add.l r15, r63, r14 .LCFI1: # add r4, r63, r28 add r5, r63, r29 --- 65,71 ---- st.l r15, 4, r18 st.l r15, 0, r14 .LCFI1: + add.l r15, r63, r14 + .LCFI2: # add r4, r63, r28 add r5, r63, r29 *************** *** 253,260 **** --- 254,268 ---- beqi/l r29, FFI_TYPE_INT, tr0 + beqi/l r29, FFI_TYPE_UINT32, tr0 beqi/l r29, FFI_TYPE_SINT64, tr1 beqi/l r29, FFI_TYPE_UINT64, tr1 beqi/l r29, FFI_TYPE_DOUBLE, tr2 beqi/l r29, FFI_TYPE_FLOAT, tr3 + + pt/l .L_ret_q, tr0 + pt/l .L_ret_h, tr1 + + beqi/l r29, FFI_TYPE_UINT8, tr0 + beqi/l r29, FFI_TYPE_UINT16, tr1 blink tr4, r63 *************** *** 271,274 **** --- 279,290 ---- blink tr4, r63 + .L_ret_q: + st.b r31, 0, r2 + blink tr4, r63 + + .L_ret_h: + st.w r31, 0, r2 + blink tr4, r63 + .L_ret_i: st.l r31, 0, r2 *************** *** 298,307 **** .LFB2: addi.l r15, -136, r15 ! .LCFI2: st.l r15, 12, r18 st.l r15, 8, r14 st.l r15, 4, r12 add r15, r63, r14 ! .LCFI3: /* Stack layout: ... --- 314,324 ---- .LFB2: addi.l r15, -136, r15 ! .LCFI3: st.l r15, 12, r18 st.l r15, 8, r14 st.l r15, 4, r12 + .LCFI4: add r15, r63, r14 ! .LCFI5: /* Stack layout: ... *************** *** 419,428 **** .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ .ascii "zR\0" /* CIE Augmentation */ .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x12 /* CIE RA Column */ .uleb128 0x1 /* Augmentation size */ ! .byte 0x1b /* FDE Encoding (pcrel sdata4) */ .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0xf --- 436,451 ---- .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ + #ifdef PIC .ascii "zR\0" /* CIE Augmentation */ + #else + .byte 0x0 /* CIE Augmentation */ + #endif .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x12 /* CIE RA Column */ + #ifdef PIC .uleb128 0x1 /* Augmentation size */ ! .byte 0x10 /* FDE Encoding (pcrel) */ ! #endif .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0xf *************** *** 434,439 **** .LASFDE1: .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ ! .4byte datalabel .LFB1-. /* FDE initial location */ .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI0-datalabel .LFB1 --- 457,469 ---- .LASFDE1: .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ ! #ifdef PIC ! .4byte .LFB1-. /* FDE initial location */ ! #else ! .4byte .LFB1 /* FDE initial location */ ! #endif .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ + #ifdef PIC + .uleb128 0x0 /* Augmentation size */ + #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI0-datalabel .LFB1 *************** *** 456,459 **** --- 486,491 ---- .byte 0xa0 /* DW_CFA_offset, column 0x20 */ .uleb128 0x2 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI2-datalabel .LCFI1 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe *************** *** 465,476 **** .LASFDE3: .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ ! .4byte datalabel .LFB2-. /* FDE initial location */ .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ .byte 0x4 /* DW_CFA_advance_loc4 */ ! .4byte datalabel .LCFI2-datalabel .LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x88 .byte 0x4 /* DW_CFA_advance_loc4 */ ! .4byte datalabel .LCFI3-datalabel .LCFI2 .byte 0x8c /* DW_CFA_offset, column 0xc */ .uleb128 0x21 --- 497,515 ---- .LASFDE3: .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ ! #ifdef PIC ! .4byte .LFB2-. /* FDE initial location */ ! #else ! .4byte .LFB2 /* FDE initial location */ ! #endif .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ + #ifdef PIC + .uleb128 0x0 /* Augmentation size */ + #endif .byte 0x4 /* DW_CFA_advance_loc4 */ ! .4byte datalabel .LCFI3-datalabel .LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x88 .byte 0x4 /* DW_CFA_advance_loc4 */ ! .4byte datalabel .LCFI4-datalabel .LCFI3 .byte 0x8c /* DW_CFA_offset, column 0xc */ .uleb128 0x21 *************** *** 479,482 **** --- 518,523 ---- .byte 0x92 /* DW_CFA_offset, column 0x12 */ .uleb128 0x1f + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI5-datalabel .LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/src/sh64/Attic/ffi.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ffi.c 31 Jan 2006 19:44:37 -0000 1.1.2.1 --- ffi.c 1 Feb 2006 20:31:52 -0000 1.1.2.2 *************** *** 1,4 **** /* ----------------------------------------------------------------------- ! ffi.c - Copyright (c) 2003 Kaz Kojima SuperH SHmedia Foreign Function Interface --- 1,4 ---- /* ----------------------------------------------------------------------- ! ffi.c - Copyright (c) 2003, 2004 Kaz Kojima SuperH SHmedia Foreign Function Interface *************** *** 32,77 **** #define NFREGARG 12 - /* If the structure has essentialy an unique element, return its type. */ - static int - simple_type (ffi_type *arg) - { - if (arg->type != FFI_TYPE_STRUCT) - return arg->type; - else if (arg->elements[1]) - return FFI_TYPE_STRUCT; - - return simple_type (arg->elements[0]); - } - static int return_type (ffi_type *arg) { - unsigned short type; if (arg->type != FFI_TYPE_STRUCT) return arg->type; - type = simple_type (arg->elements[0]); - if (! arg->elements[1]) - { - switch (type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - return FFI_TYPE_UINT64; - - default: - return type; - } - } - /* gcc uses r2 if the result can be packed in on register. */ ! if (arg->size <= sizeof (UINT64)) return FFI_TYPE_UINT64; --- 32,50 ---- #define NFREGARG 12 static int return_type (ffi_type *arg) { if (arg->type != FFI_TYPE_STRUCT) return arg->type; /* gcc uses r2 if the result can be packed in on register. */ ! if (arg->size <= sizeof (UINT8)) ! return FFI_TYPE_UINT8; ! else if (arg->size <= sizeof (UINT16)) ! return FFI_TYPE_UINT16; ! else if (arg->size <= sizeof (UINT32)) ! return FFI_TYPE_UINT32; ! else if (arg->size <= sizeof (UINT64)) return FFI_TYPE_UINT64; *************** *** 106,111 **** --- 79,86 ---- { size_t z; + int align; z = (*p_arg)->size; + align = (*p_arg)->alignment; if (z < sizeof (UINT32)) { *************** *** 129,133 **** case FFI_TYPE_STRUCT: ! *(UINT64 *) argp = (UINT64) *(UINT32 *)(*p_argv); break; --- 104,108 ---- case FFI_TYPE_STRUCT: ! memcpy (argp, *p_argv, z); break; *************** *** 137,146 **** argp += sizeof (UINT64); } ! else if (z == sizeof (UINT32)) { ! *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); argp += sizeof (UINT64); } ! else if (z == sizeof (UINT64)) { *(UINT64 *) argp = *(UINT64 *) (*p_argv); --- 112,140 ---- argp += sizeof (UINT64); } ! else if (z == sizeof (UINT32) && align == sizeof (UINT32)) { ! switch ((*p_arg)->type) ! { ! case FFI_TYPE_INT: ! case FFI_TYPE_SINT32: ! *(SINT64 *) argp = (SINT64) *(SINT32 *) (*p_argv); ! break; ! ! case FFI_TYPE_FLOAT: ! case FFI_TYPE_POINTER: ! case FFI_TYPE_UINT32: ! case FFI_TYPE_STRUCT: ! *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); ! break; ! ! default: ! FFI_ASSERT(0); ! break; ! } argp += sizeof (UINT64); } ! else if (z == sizeof (UINT64) ! && align == sizeof (UINT64) ! && ((int) *p_argv & (sizeof (UINT64) - 1)) == 0) { *(UINT64 *) argp = *(UINT64 *) (*p_argv); *************** *** 255,258 **** --- 249,253 ---- { extended_cif ecif; + UINT64 trvalue; ecif.cif = cif; *************** *** 262,266 **** /* value address then we need to make one */ ! if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { --- 257,264 ---- /* value address then we need to make one */ ! if (cif->rtype->type == FFI_TYPE_STRUCT ! && return_type (cif->rtype) != FFI_TYPE_STRUCT) ! ecif.rvalue = &trvalue; ! else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { *************** *** 284,287 **** --- 282,290 ---- break; } + + if (rvalue + && cif->rtype->type == FFI_TYPE_STRUCT + && return_type (cif->rtype) != FFI_TYPE_STRUCT) + memcpy (rvalue, &trvalue, cif->rtype->size); } *************** *** 354,358 **** /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ ! if (cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = *pgr; --- 357,361 ---- /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ ! if (return_type (cif->rtype) == FFI_TYPE_STRUCT) { rvalue = *pgr; *************** *** 444,448 **** /* Tell ffi_closure_SYSV how to perform return type promotions. */ ! return cif->rtype->type; } --- 447,451 ---- /* Tell ffi_closure_SYSV how to perform return type promotions. */ ! return return_type (cif->rtype); } |