This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: use R2 as local reg on Darwin


David Edelsohn wrote:
> 
>         The patch itself is okay, but I am surprised that Apple wants to
> make this change.
> 
> How can Darwin run MacOS code, which was based on the AIX ABI using R2, in
> a compatibility box if R2 is trashed by the rest of the system?  How can
> one mix code produced by GCC and IBM's compiler in Darwin?

Heh, "Classic mode" (the compatibility box) involves much more than
register handling - for instance, every classic Mac app's windows are
on a single global list available to every other application, and
this is important because it's how old Mac apps make floating palettes
work for instance.  Much footwork is going on behind the scenes
just to make that work.  Classic Mac apps all run inside a single
special process, and never interact directly with OS X / Darwin apps.

>         Is this an effort to prevent all other PowerPC OSes from running
> Darwin apps?

No need, NeXT took care of that years ago when they defined a PowerPC
ABI unlike all others. :-)  (It was designed to work similarly to
NeXT's other supported architectures.)

But your underlying question is a fair one - should the Darwin ABI
be more or less like other ABIs, or does it matter?  Although Darwin
doesn't have or use a TOC (thus the interest in making R2 available
for normal allocation), the stack frame is laid out the same as for
AIX, complete with a reserved place for the TOC, even though it will
never be filled on a Darwin system.  In other ways the Darwin ABI is
more like SVR4.

Given that Darwin is already a somewhat of a mixed bag, my answer is
that we need to preserve backward compatibility, produce better
code, and attempt to share backend functionality with other ABIs
whenever possible, but that there's no reason to be bound by other
ABIs.  The use of R2 seems to me to fit the criteria I've listed.

(It *is* kind of a weird situation, but it's what we've inherited.
We would have to move heaven and earth to get Apple to adopt
either the SVR4 or AIX ABIs - a dramatic improvement in code
quality would be the Archimedean lever that could make it happen,
but as of yet no one has produced compelling evidence for major
speedups.)

Stan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]