Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitceb4f5e

Browse files
committed
> > I'll re-check that with the ppc architecture guy here.
>> ... he is now about to write an inlined version that can go into> s_lock.h . I'll send the new patch later on...OK, here it comes:An inlined version of tas(), that works for both, powerpc andpowerpc64. The patch is against 7.3b5 and passes the test suite onboth architectures.Reinhard Max
1 parent50e726a commitceb4f5e

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

‎src/backend/storage/lmgr/s_lock.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/s_lock.c,v 1.9 2002/09/21 00:14:05 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/s_lock.c,v 1.10 2002/11/10 00:33:43 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -144,31 +144,6 @@ success:\n\
144144
}
145145
#endif/* __APPLE__ && __ppc__ */
146146

147-
#if defined(__powerpc__)
148-
/* Note: need a nice gcc constrained asm version so it can be inlined */
149-
staticvoid
150-
tas_dummy()
151-
{
152-
__asm____volatile__(
153-
"\
154-
.global tas \n\
155-
tas:\n\
156-
lwarx5,0,3\n\
157-
cmpwi 5,0 \n\
158-
bne fail\n\
159-
addi 5,5,1\n\
160-
stwcx.5,0,3\n\
161-
beq success \n\
162-
fail:li3,1 \n\
163-
blr \n\
164-
success:\n\
165-
isync\n\
166-
li 3,0\n\
167-
blr\n\
168-
");
169-
}
170-
#endif/* __powerpc__ */
171-
172147
#if defined(__mips__)&& !defined(__sgi)
173148
staticvoid
174149
tas_dummy()

‎src/include/port/linux.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ typedef unsigned char slock_t;
1414

1515
#defineHAS_TEST_AND_SET
1616

17+
#elif defined(__powerpc64__)
18+
typedefunsigned longslock_t;
19+
20+
#defineHAS_TEST_AND_SET
21+
1722
#elif defined(__powerpc__)
1823
typedefunsignedintslock_t;
1924

‎src/include/storage/s_lock.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
6464
* Portions Copyright (c) 1994, Regents of the University of California
6565
*
66-
* $Id: s_lock.h,v 1.101 2002/09/21 00:14:05 tgl Exp $
66+
* $Id: s_lock.h,v 1.102 2002/11/10 00:33:43 momjian Exp $
6767
*
6868
*-------------------------------------------------------------------------
6969
*/
@@ -194,6 +194,35 @@ tas(volatile slock_t *lock)
194194

195195
#endif/* __sparc__ */
196196

197+
#if defined(__powerpc__)|| defined(__powerpc64__)
198+
static __inline__int
199+
tas(volatileslock_t*lock)
200+
{
201+
slock_t_t;
202+
int_res;
203+
204+
__asm__ __volatile__(
205+
"lwarx %0,0,%3\n"
206+
"cmpwi %0,0\n"
207+
"bne 1f\n"
208+
"addi %0,%0,1\n"
209+
"stwcx. %0,0,%3\n"
210+
"isync\n"
211+
"beq 2f \n"
212+
"1:li %2,1\n"
213+
"b3f\n"
214+
"2:\n"
215+
"li %2,0\n"
216+
"3:\n"
217+
218+
:"=&r" (_t),"=m" (lock),"=r" (_res)
219+
:"r" (lock)
220+
:"cc","memory"
221+
);
222+
return_res;
223+
}
224+
#endif
225+
197226

198227
#if defined(__mc68000__)&& defined(__linux__)
199228
#defineTAS(lock) tas(lock)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp