Changeset 110 for NEWT0/trunk/contrib

Show
Ignore:
Timestamp:
06/03/07 22:31:59 (19 months ago)
Author:
gnue
Message:

Fix Objective-C message sending when structure is returned on Intel Mac.
Replace _objc_methodCallv_stret by _objc_msgSendv_stret based.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • NEWT0/trunk/contrib/NewtObjC/objc-runtime-x/objc-runtime-x-i386.s

    r61 r110  
    2222/* 
    2323 * 2006-06-16   Creation of the file from code of objc-msg-i386.s 
     24 * 2007-05-30   Replace _objc_methodCallv_stret by _objc_msgSendv_stret based 
    2425 */ 
    2526////////////////////////////////////////////////////////////////////// 
     
    6364    marg_size       = 16 
    6465    marg_list       = 20 
     66 
     67    struct_addr     = 4 
     68 
     69    self_stret      = 8 
     70    selector_stret  = 12 
     71    method_stret    = 16 
     72    marg_size_stret = 20 
     73    marg_list_stret = 24 
    6574 
    6675/******************************************************************** 
     
    121130 
    122131/******************************************************************** 
    123  * double objc_methodCallv_stret( 
    124                 id self, 
    125                 SEL _cmd, 
    126                 IMP method, 
    127                 unsigned size, 
    128                 marg_list frame); 
     132 * void objc_methodCallv_stret( 
     133                void* stretAddr, 
     134                id self, 
     135                SEL _cmd, 
     136                IMP method, 
     137                unsigned arg_size, 
     138                marg_list arg_frame); 
    129139 * 
    130140 * On entry: 
    131  *      (sp+4)  is the message receiver, 
    132  *      (sp+8)  is the selector, 
    133  *      (sp+12) is the method to call, 
    134  *      (sp+16) is the size of the marg_list, in bytes, 
    135  *      (sp+20) is the address of the marg_list 
     141 *      (sp+4)  is the address in which the returned struct is put, 
     142 *      (sp+8)  is the message receiver, 
     143 *      (sp+12) is the selector, 
     144 *      (sp+26) is the method to call, 
     145 *      (sp+20) is the size of the marg_list, in bytes, 
     146 *      (sp+24) is the address of the marg_list 
    136147 * 
    137148 ********************************************************************/ 
     
    141152    pushl   %ebp 
    142153    movl    %esp, %ebp 
    143     // stack is currently aligned assuming no extra arguments 
    144     movl    (marg_list+4)(%ebp), %edx 
     154    subl    $12, %esp   // align stack assuming no extra arguments 
     155    movl    (marg_list_stret+4)(%ebp), %edx 
    145156    addl    $8, %edx            // skip self & selector 
    146     movl    (marg_size+4)(%ebp), %ecx 
    147     subl    $8, %ecx            // skip self & selector 
     157    movl    (marg_size_stret+4)(%ebp), %ecx 
     158    subl    $5, %ecx            // skip self & selector 
    148159    shrl    $2, %ecx 
    149     je      FpretArgsOK 
     160    je      StretArgsOK 
    150161 
    151162    // %esp = %esp - (16 - ((numVariableArguments & 3) << 2)) 
     
    156167    addl    %eax, %esp 
    157168 
    158 FpretArgLoop: 
     169StretArgLoop: 
    159170    decl    %ecx 
    160171    movl    0(%edx, %ecx, 4), %eax 
    161172    pushl   %eax 
    162     jg  FpretArgLoop 
     173    jg  StretArgLoop 
    163174 
    164 FpretArgsOK: 
    165     movl    (selector+4)(%ebp), %ecx 
     175StretArgsOK: 
     176    movl    (selector_stret+4)(%ebp), %ecx 
    166177    pushl   %ecx 
    167     movl    (self+4)(%ebp),%ecx 
     178    movl    (self_stret+4)(%ebp),%ecx 
    168179    pushl   %ecx 
    169     movl    (method+4)(%ebp),%ecx 
     180    movl    (struct_addr+4)(%ebp),%ecx 
     181    pushl   %ecx 
     182    movl    (method_stret+4)(%ebp),%ecx 
    170183    call    %ecx 
    171184    movl    %ebp,%esp