public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ronald Oussoren <oussoren@cistron.nl>
To: Andreas Tobler <toa@pop.agri.ch>
Cc: Dale Johannesen <dalej@apple.com>, gcc@gcc.gnu.org
Subject: Re: Libffi problem on darwin (MacOSX)
Date: Sun, 25 May 2003 20:49:00 -0000	[thread overview]
Message-ID: <6AD0ED77-8EF1-11D7-AD55-0003931CFE24@cistron.nl> (raw)
In-Reply-To: <3EC65389.9040302@pop.agri.ch>


On Saturday, May 17, 2003, at 17:21 Europe/Amsterdam, Andreas Tobler  
wrote:

>> I just noticed that this might well be stupidity on my part, I tried  
>> to write a minimal program that demonstrates the problem and that  
>> runs without problems. Our real code builds ffi_cifs and ffi_closures  
>> at runtime, and maybe that code is bogus.
>
> Could be, but if I remember right, I didn't complete the structure  
> passings. Maybe it works, but if not, then I certainly have to check  
> again. Well, I'll do that anyway.

The following hack seems to work for the limited tests that I've done.  
Note that this is *not* based on any understanding of the PPC calling  
conventions, and therefore likely incorrect.

Ronald

***  
/Volumes/Data/Users/ronald/Python-CVS/gcc/libffi/src/powerpc/ 
ffi_darwin.c   Sat Feb 22 20:10:14 2003
--- ffi_darwin.c        Sat May 24 22:02:44 2003
***************
*** 612,619 ****
--- 612,633 ----
           case FFI_TYPE_SINT32:
           case FFI_TYPE_UINT32:
           case FFI_TYPE_POINTER:
+ //        case FFI_TYPE_STRUCT:
+         /* there are 8 gpr registers used to pass values */
+           if (ng < 8) {
+              avalue[i] = pgr;
+              ng++;
+              pgr++;
+           } else {
+              avalue[i] = pst;
+              pst++;
+           }
+           break;
+
           case FFI_TYPE_STRUCT:
           /* there are 8 gpr registers used to pass values */
+       {
+           int left = (arg_types[i]->size);
             if (ng < 8) {
                avalue[i] = pgr;
                ng++;
***************
*** 622,627 ****
--- 636,654 ----
                avalue[i] = pst;
                pst++;
             }
+
+         /* Structs are in registers, skip values */
+         left -= sizeof(long);
+         while (left > 0) {
+                 if (ng < 8) {
+                    ng++;
+                    pgr++;
+                 } else {
+                    pst++;
+                 }
+                 left -= sizeof(long);
+         }
+       }
             break;

           case FFI_TYPE_SINT64:

  reply	other threads:[~2003-05-25 20:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-16 20:56 Ronald Oussoren
2003-05-16 21:42 ` Dale Johannesen
2003-05-17  6:03   ` Andreas Tobler
2003-05-17 10:17     ` Ronald Oussoren
2003-05-17 15:39       ` Andreas Tobler
2003-05-25 20:49         ` Ronald Oussoren [this message]
2003-05-26  5:24           ` Andreas Tobler
2003-05-26 10:01             ` Ronald Oussoren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6AD0ED77-8EF1-11D7-AD55-0003931CFE24@cistron.nl \
    --to=oussoren@cistron.nl \
    --cc=dalej@apple.com \
    --cc=gcc@gcc.gnu.org \
    --cc=toa@pop.agri.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).