Re: Re: [PATCHES] s_lock.h cleanup
От | Bruce Momjian |
---|---|
Тема | Re: Re: [PATCHES] s_lock.h cleanup |
Дата | |
Msg-id | 200101192044.PAA09999@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Re: [PATCHES] s_lock.h cleanup (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
> The __asm___ and splitting up the assembly code into multiple string > literals and the consistent formatting of the register addendums are > all fine, because those are read by gcc and this whole code block is > gcc-only. But the assembly code string literal will be spit out > essentially verbatim by gcc to the assembler, and the assembler may > not be nearly as forgiving as you think. > > > Oh, wow, I never suspected gcc could work without gas. Can it? > > Gcc with platform-specific as used to be the standard configuration > on HPUX, and may still be standard on some platforms. > > Bottom line: I see no point in taking any risks, especially not this > late in beta, with code that you cannot test for yourself, and > *especially* not when the change is only for cosmetic reasons. OK, remove semicolons and put back the \n at the end of each line. Patch attached. I wasn't going to mess with this while in beta, but when I found the VAX code broken, it seemed worth making sure they were all OK. The VAX stuff was broken because in 7.0.3 it shows: __asm__(" movl $1, r0 \ bbssi $0, (%1), 1 f \ clrl r0 \ 1: movl r0, %0 " The '1 f' we broken, but also the thing missing here is \n\. With \, it just makes one long line, which certainly can't be asembled. The VAX guy added semicolons, but I can see that \n\ is safer, and have done that. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 ? config.log ? config.cache ? config.status ? GNUmakefile ? src/Makefile.custom ? src/GNUmakefile ? src/Makefile.global ? src/log ? src/crtags ? src/backend/postgres ? src/backend/catalog/global.bki ? src/backend/catalog/global.description ? src/backend/catalog/template1.bki ? src/backend/catalog/template1.description ? src/backend/port/Makefile ? src/bin/initdb/initdb ? src/bin/initlocation/initlocation ? src/bin/ipcclean/ipcclean ? src/bin/pg_config/pg_config ? src/bin/pg_ctl/pg_ctl ? src/bin/pg_dump/pg_dump ? src/bin/pg_dump/pg_restore ? src/bin/pg_dump/pg_dumpall ? src/bin/pg_id/pg_id ? src/bin/pg_passwd/pg_passwd ? src/bin/pgaccess/pgaccess ? src/bin/pgtclsh/Makefile.tkdefs ? src/bin/pgtclsh/Makefile.tcldefs ? src/bin/pgtclsh/pgtclsh ? src/bin/pgtclsh/pgtksh ? src/bin/psql/psql ? src/bin/scripts/createlang ? src/include/config.h ? src/include/stamp-h ? src/interfaces/ecpg/lib/libecpg.so.3.2.0 ? src/interfaces/ecpg/preproc/ecpg ? src/interfaces/libpgeasy/libpgeasy.so.2.1 ? src/interfaces/libpgtcl/libpgtcl.so.2.1 ? src/interfaces/libpq/libpq.so.2.1 ? src/interfaces/perl5/blib ? src/interfaces/perl5/Makefile ? src/interfaces/perl5/pm_to_blib ? src/interfaces/perl5/Pg.c ? src/interfaces/perl5/Pg.bs ? src/pl/plperl/blib ? src/pl/plperl/Makefile ? src/pl/plperl/pm_to_blib ? src/pl/plperl/SPI.c ? src/pl/plperl/plperl.bs ? src/pl/plpgsql/src/libplpgsql.so.1.0 ? src/pl/tcl/Makefile.tcldefs Index: src/backend/storage/buffer/s_lock.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/storage/buffer/s_lock.c,v retrieving revision 1.29 diff -c -r1.29 s_lock.c *** src/backend/storage/buffer/s_lock.c 2001/01/14 05:08:15 1.29 --- src/backend/storage/buffer/s_lock.c 2001/01/19 20:28:20 *************** *** 115,123 **** } } - - - /* * Various TAS implementations that cannot live in s_lock.h as no inline * definition exists (yet). --- 115,120 ---- *************** *** 136,153 **** tas_dummy() /* really means: extern int tas(slock_t * **lock); */ { ! __asm__(" \n\ ! .global _tas \n\ ! _tas: \n\ ! movel sp@(0x4),a0 \n\ ! tas a0@ \n\ ! beq _success \n\ ! moveq #-128,d0 \n\ ! rts \n\ ! _success: \n\ ! moveq #0,d0 \n\ ! rts \n\ ! "); } #endif /* __m68k__ */ --- 133,150 ---- tas_dummy() /* really means: extern int tas(slock_t * **lock); */ { ! __asm__ __volatile__( ! "\ ! .global _tas \n\ ! _tas: \n\ ! movel sp@(0x4),a0 \n\ ! tas a0@ \n\ ! beq _success \n\ ! moveq #-128,d0 \n\ ! rts \n\ ! _success: \n\ ! moveq #0,d0 \n\ ! rts"); } #endif /* __m68k__ */ *************** *** 160,181 **** 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\ "); } --- 157,179 ---- static void tas_dummy() { ! __asm__ __volatile__( ! "\ ! .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\ "); } *************** *** 186,206 **** 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__ */ --- 184,204 ---- static void tas_dummy() { ! __asm__ __volatile__( ! "\ ! .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"); } #endif /* __powerpc__ */ *************** *** 209,230 **** static void tas_dummy() { ! __asm__(" \n\ ! .global tas \n\ ! tas: \n\ ! .frame $sp, 0, $31 \n\ ! ll $14, 0($4) \n\ ! or $15, $14, 1 \n\ ! sc $15, 0($4) \n\ ! beq $15, 0, fail \n\ ! bne $14, 0, fail \n\ ! li $2, 0 \n\ ! .livereg 0x2000FF0E,0x00000FFF \n\ ! j $31 \n\ ! fail: \n\ ! li $2, 1 \n\ ! j $31 \n\ ! "); } #endif /* __mips__ */ --- 207,228 ---- static void tas_dummy() { ! __asm__ _volatile__( ! "\ ! .global tas \n\ ! tas: \n\ ! .frame $sp, 0, $31 \n\ ! ll $14, 0($4) \n\ ! or $15, $14, 1 \n\ ! sc $15, 0($4) \n\ ! beq $15, 0, fail\n\ ! bne $14, 0, fail\n\ ! li $2, 0 \n\ ! .livereg 0x2000FF0E,0x00000FFF \n\ ! j $31 \n\ ! fail: \n\ ! li $2, 1 \n\ ! j $31"); } #endif /* __mips__ */ Index: src/include/storage/s_lock.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/storage/s_lock.h,v retrieving revision 1.82 diff -c -r1.82 s_lock.h *** src/include/storage/s_lock.h 2001/01/19 07:03:53 1.82 --- src/include/storage/s_lock.h 2001/01/19 20:28:21 *************** *** 103,111 **** * Standard _asm format: * * __asm__ __volatile__( ! * "command;" ! * "command;" ! * "command;" * : "=r"(_res) return value, in register * : "r"(lock) argument, 'lock pointer', in register * : "r0"); inline code uses this register --- 103,111 ---- * Standard _asm format: * * __asm__ __volatile__( ! * "command \n" ! * "command \n" ! * "command \n" * : "=r"(_res) return value, in register * : "r"(lock) argument, 'lock pointer', in register * : "r0"); inline code uses this register *************** *** 121,128 **** register slock_t _res = 1; __asm__ __volatile__( ! "lock;" ! "xchgb %0,%1;" : "=q"(_res), "=m"(*lock) : "0"(_res)); return (int) _res; --- 121,128 ---- register slock_t _res = 1; __asm__ __volatile__( ! "lock \n" ! "xchgb %0,%1 \n" : "=q"(_res), "=m"(*lock) : "0"(_res)); return (int) _res; *************** *** 140,146 **** long int ret; __asm__ __volatile__( ! "xchg4 %0=%1,%2;" : "=r"(ret), "=m"(*lock) : "r"(1), "1"(*lock) : "memory"); --- 140,146 ---- long int ret; __asm__ __volatile__( ! "xchg4 %0=%1,%2 \n" : "=r"(ret), "=m"(*lock) : "r"(1), "1"(*lock) : "memory"); *************** *** 160,166 **** register slock_t _res = 1; __asm__ __volatile__( ! "swpb %0, %0, [%3];" : "=r"(_res), "=m"(*lock) : "0"(_res), "r"(lock)); return (int) _res; --- 160,166 ---- register slock_t _res = 1; __asm__ __volatile__( ! "swpb %0, %0, [%3] \n" : "=r"(_res), "=m"(*lock) : "0"(_res), "r"(lock)); return (int) _res; *************** *** 180,190 **** int _res; __asm__ __volatile__( ! "la 1,1;" ! "l 2,%2;" ! "slr 0,0;" ! "cs 0,1,0(2);" ! "lr %1,0;" : "=m"(lock), "=d"(_res) : "m"(lock) : "0", "1", "2"); --- 180,190 ---- int _res; __asm__ __volatile__( ! "la 1,1 \n" ! "l 2,%2 \n" ! "slr 0,0 \n" ! "cs 0,1,0(2) \n" ! "lr %1,0 \n" : "=m"(lock), "=d"(_res) : "m"(lock) : "0", "1", "2"); *************** *** 204,210 **** register slock_t _res = 1; __asm__ __volatile__( ! "ldstub [%2], %0;" : "=r"(_res), "=m"(*lock) : "r"(lock)); return (int) _res; --- 204,210 ---- register slock_t _res = 1; __asm__ __volatile__( ! "ldstub [%2], %0 \n" : "=r"(_res), "=m"(*lock) : "r"(lock)); return (int) _res; *************** *** 222,229 **** register int rv; __asm__ __volatile__( ! "tas %1;" ! "sne %0;" : "=d"(rv), "=m"(*lock) : "1"(*lock) : "cc"); --- 222,229 ---- register int rv; __asm__ __volatile__( ! "tas %1 \n" ! "sne %0 \n" : "=d"(rv), "=m"(*lock) : "1"(*lock) : "cc"); *************** *** 249,258 **** register _res; __asm__ __volatile__( ! "movl $1, r0;" ! "bbssi $0, (%1), 1f;" ! "clrl r0;" ! "1: movl r0, %0;" : "=r"(_res) : "r"(lock) : "r0"); --- 249,258 ---- register _res; __asm__ __volatile__( ! "movl $1, r0 \n" ! "bbssi $0, (%1), 1f \n" ! "clrl r0 \n" ! "1: movl r0, %0 \n" : "=r"(_res) : "r"(lock) : "r0"); *************** *** 271,278 **** register _res; __asm__ __volatile__( ! "sbitb 0, %0;" ! "sfsd %1;" : "=m"(*lock), "=r"(_res)); return (int) _res; } --- 271,278 ---- register _res; __asm__ __volatile__( ! "sbitb 0, %0 \n" ! "sfsd %1 \n" : "=m"(*lock), "=r"(_res)); return (int) _res; } *************** *** 339,354 **** register slock_t _res; __asm__ __volatile__( ! "ldq $0, %0;" ! "bne $0, 2f;" ! "ldq_l %1, %0;" ! "bne %1, 2f;" ! "mov 1, $0;" ! "stq_c $0, %0;" ! "beq $0, 2f;" ! "mb;" ! "br 3f;" ! "2: mov 1, %1;" "3:" : "=m"(*lock), "=r"(_res) : --- 339,354 ---- register slock_t _res; __asm__ __volatile__( ! "ldq $0, %0 \n" ! "bne $0, 2f \n" ! "ldq_l %1, %0 \n" ! "bne %1, 2f \n" ! "mov 1, $0 \n" ! "stq_c $0, %0 \n" ! "beq $0, 2f \n" ! "mb \n" ! "br 3f \n" ! "2: mov 1, %1 \n" "3:" : "=m"(*lock), "=r"(_res) :
В списке pgsql-hackers по дате отправления:
Следующее
От: Thomas LockhartДата:
Сообщение: Re: AW: AW: AW: AW: AW: AW: AW: Re: tinterval - operator proble ms o n AIX