Skip site navigation (1) Skip section navigation (2)

Re: darwin pgsql patches

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Bierman <bierman(at)apple(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: darwin pgsql patches
Date: 2000-11-29 23:07:16
Message-ID: Pine.LNX.4.30.0011300001510.3280-100000@peter.localdomain (view raw or flat)
Thread:
Lists: pgsql-patches
Tom Lane writes:

> > I think it has more to do with Apple's forked gcc than anything
> > else. I don't have a LinuxPPC machine to check if adding the rX syntax
> > there would continue to work.
>
> I do (have a LinuxPPC machine), so if you'd identify exactly what I
> should try, I'll be glad to check this point.  Seems like it'd be smart
> to minimize the number of PPC variants of this routine.

Minimize the differences between

+#if defined(darwin) && defined(__ppc__)
+static void
+tas_dummy()
+{
+       __asm__("               \n\
+               .globl  tas     \n\
+               .globl  _tas    \n\
+_tas:                          \n\
+tas:                           \n\
+               lwarx   r5,0,r3 \n\
+               cmpwi   r5,0    \n\
+               bne     fail    \n\
+               addi    r5,r5,1 \n\
+               stwcx.  r5,0,r3 \n\
+               beq     success \n\
+fail:          li      r3,1    \n\
+               blr             \n\
+success:                       \n\
+               li r3,0         \n\
+               blr             \n\
+       ");
+}
+
+#endif  /* __ppc__ && darwin */

and

[src/backend/storage/buffer/s_lock.c]
#if defined(__powerpc__)
/* Note: need a nice gcc constrained asm version so it can be inlined */
static void
tas_dummy()
{
        __asm__("               \n\
.global         tas             \n\
tas:                            \n\
                lwarx   5,0,3   \n\
                cmpwi   5,0     \n\
                bne     fail    \n\
                addi    5,5,1   \n\
                stwcx.  5,0,3   \n\
                beq     success \n\
fail:           li      3,1     \n\
                blr             \n\
success:                        \n\
                li 3,0          \n\
                blr             \n\
        ");
}

#endif   /* __powerpc__ */

under the constraint that the first version is probably not negotiable.
I'd like to wish that the GNU assembler is a little more forgiving.

-- 
Peter Eisentraut      peter_e(at)gmx(dot)net       http://yi.org/peter-e/


In response to

pgsql-patches by date

Next:From: Thomas LockhartDate: 2000-11-30 05:05:30
Subject: Re: darwin pgsql patches
Previous:From: Tom LaneDate: 2000-11-29 22:35:27
Subject: Re: darwin pgsql patches

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group