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

Commit5dde558

Browse files
committed
From: Dan McGuirk <mcguirk@indirect.com>
Subject: [HACKERS] linux/alpha patchesThese patches lay the groundwork for a Linux/Alpha port. The port doesn'tactually work unless you tweak the linker to put all the pointers in thefirst 32 bits of the address space, but it's at least a start. Itimplements the test-and-set instruction in Alpha assembly, and also fixesa lot of pointer-to-integer conversions, which is probably good anyway.
1 parentb66569e commit5dde558

File tree

13 files changed

+123
-43
lines changed

13 files changed

+123
-43
lines changed

‎src/backend/optimizer/plan/createplan.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.7 1997/01/10 20:17:56momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.8 1997/03/12 21:05:56scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -292,7 +292,7 @@ create_seqscan_node(Path *best_path, List *tlist, List *scan_clauses)
292292
if(temp==NULL)
293293
elog(WARN,"scanrelid is empty");
294294
else
295-
scan_relid= (Index)lfirst(temp);/* ??? who takes care of lnext? - ay */
295+
scan_relid= (Index)lfirsti(temp);/* ??? who takes care of lnext? - ay */
296296
scan_node=make_seqscan(tlist,
297297
scan_clauses,
298298
scan_relid,
@@ -640,10 +640,10 @@ fix_indxqual_references(Node *clause, Path *index_path)
640640
is_funcclause((Node*)get_leftop((Expr*)clause))&&
641641
((Func*)((Expr*)get_leftop((Expr*)clause))->oper)->funcisindex){
642642
Var*newvar=
643-
makeVar((Index)lfirst(index_path->parent->relids),
643+
makeVar((Index)lfirsti(index_path->parent->relids),
644644
1,/* func indices have one key */
645645
((Func*)((Expr*)clause)->oper)->functype,
646-
(Index)lfirst(index_path->parent->relids),
646+
(Index)lfirsti(index_path->parent->relids),
647647
0);
648648

649649
return

‎src/backend/optimizer/plan/initsplan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.3 1997/02/20 02:53:26 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.4 1997/03/12 21:05:59 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -256,8 +256,8 @@ add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo, List *join_relids)
256256

257257
foreach (rel,join_relids)
258258
{
259-
if ((int)lfirst(rel)!=(int)lfirst(join_relid) )
260-
other_rels=lappendi (other_rels,lfirst(rel));
259+
if (lfirsti(rel)!=lfirsti(join_relid) )
260+
other_rels=lappendi (other_rels,lfirsti(rel));
261261
}
262262

263263
joininfo=

‎src/backend/optimizer/util/plancat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.3 1996/11/06 09:29:24 scrappy Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.4 1997/03/12 21:06:14 scrappy Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -267,12 +267,12 @@ index_selectivity(Oid indid,
267267

268268
i=0;
269269
foreach(xopno,opnos) {
270-
opno_array[i++]=(int)lfirst(xopno);
270+
opno_array[i++]=lfirsti(xopno);
271271
}
272272

273273
i=0;
274274
foreach(xattno,attnos) {
275-
attno_array[i++]=(int)lfirst(xattno);
275+
attno_array[i++]=lfirsti(xattno);
276276
}
277277

278278
i=0;
@@ -282,7 +282,7 @@ index_selectivity(Oid indid,
282282

283283
i=0;
284284
foreach(flag,flags) {
285-
flag_array[i++]=(int)lfirst(flag);
285+
flag_array[i++]=lfirsti(flag);
286286
}
287287

288288
IndexSelectivity(indid,

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

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.11 1997/02/14 04:16:43 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.12 1997/03/12 21:06:48 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -126,7 +126,7 @@ S_LOCK_FREE(slock_t *lock)
126126
* (see storage/ipc.h).
127127
*/
128128

129-
#if defined(alpha)
129+
#if defined(alpha)&& !defined(linuxalpha)
130130

131131
void
132132
S_LOCK(slock_t*lock)
@@ -409,4 +409,48 @@ S_INIT_LOCK(slock_t *lock)
409409
#endif/* NEED_I386_TAS_ASM */
410410

411411

412+
#if defined(linuxalpha)
413+
414+
int
415+
tas(slock_t*m)
416+
{
417+
slock_tres;
418+
__asm__(" ldq $0, %0 \n\
419+
bne $0, already_set \n\
420+
ldq_l $0, %0 \n\
421+
bne $0, already_set \n\
422+
or $31, 1, $0 \n\
423+
stq_c $0, %0 \n\
424+
beq $0, stqc_fail \n\
425+
success: bis $31, $31, %1 \n\
426+
mb \n\
427+
jmp $31, end \n\
428+
stqc_fail: or $31, 1, $0 \n\
429+
already_set: bis $0, $0, %1 \n\
430+
end: nop " :"=m" (*m),"=r" (res) ::"0" );
431+
return(res);
432+
}
433+
434+
void
435+
S_LOCK(slock_t*lock)
436+
{
437+
while (tas(lock))
438+
;
439+
}
440+
441+
void
442+
S_UNLOCK(slock_t*lock)
443+
{
444+
__asm__("mb");
445+
*lock=0;
446+
}
447+
448+
void
449+
S_INIT_LOCK(slock_t*lock)
450+
{
451+
S_UNLOCK(lock);
452+
}
453+
454+
#endif
455+
412456
#endif/* HAS_TEST_AND_SET */

‎src/backend/storage/page/bufpage.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.5 1996/11/24 04:41:29 bryanh Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.6 1997/03/12 21:07:11 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -512,12 +512,13 @@ PageIndexTupleDeleteAdjustLinePointers(PageHeader phdr,
512512
Sizesize)
513513
{
514514
inti;
515+
unsignedoffset;
515516

516517
/* location is an index into the page... */
517-
location-= (int)phdr;
518+
offset= (unsigned)(location- (char*)phdr);
518519

519520
for (i=PageGetMaxOffsetNumber((Page)phdr)-1;i >=0;i--) {
520-
if (phdr->pd_linp[i].lp_off <=(unsigned)location) {
521+
if (phdr->pd_linp[i].lp_off <=offset) {
521522
phdr->pd_linp[i].lp_off+=size;
522523
}
523524
}

‎src/backend/tcop/fastpath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.3 1996/11/08 05:59:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.4 1997/03/12 21:07:50 scrappy Exp $
1111
*
1212
* NOTES
1313
* This cruft is the server side of PQfn.
@@ -93,7 +93,7 @@ SendFunctionResult(Oid fid,/* function id */
9393
pq_putnchar("G",1);
9494
if (retbyval) {/* by-value */
9595
pq_putint(retlen,4);
96-
pq_putint((int)retval,retlen);
96+
pq_putint((int)(Datum)retval,retlen);
9797
}else {/* by-reference ... */
9898
if (retlen<0) {/* ... varlena */
9999
pq_putint(VARSIZE(retval)-VARHDRSZ,4);

‎src/backend/utils/adt/float.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.12 1997/02/19 20:10:49 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.13 1997/03/12 21:09:11 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -100,6 +100,26 @@ extern doubleatof(const char *p);
100100
#defineFLOAT8_MAX DBL_MAX
101101
#defineFLOAT8_MIN DBL_MIN
102102

103+
/*
104+
* if FLOAT8_MIN and FLOAT8_MAX are the limits of the range a
105+
* double can store, then how are we ever going to wind up
106+
* with something stored in a double that is outside those
107+
* limits? (and similarly for FLOAT4_{MIN,MAX}/float.)
108+
* doesn't make sense to me, and it causes a
109+
* floating point exception on linuxalpha, so UNSAFE_FLOATS
110+
* it is.
111+
* (maybe someone wanted to allow for values other than DBL_MIN/
112+
* DBL_MAX for FLOAT8_MIN/FLOAT8_MAX?)
113+
* --djm 12/12/96
114+
* according to Richard Henderson this is a known bug in gcc on
115+
* the Alpha. might as well leave the workaround in
116+
* until the distributions are updated.
117+
* --djm 12/16/96
118+
*/
119+
#if defined(linuxalpha)&& !defined(UNSAFE_FLOATS)
120+
#defineUNSAFE_FLOATS
121+
#endif
122+
103123
/*
104124
check to see if a float4 val is outside of
105125
the FLOAT4_MIN, FLOAT4_MAX bounds.

‎src/backend/utils/adt/oid.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.4 1997/01/10 20:19:45 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.5 1997/03/12 21:09:15 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -37,14 +37,14 @@ Oid *oid8in(char *oidString)
3737
return(NULL);
3838
result= (Oid (*)[])palloc(sizeof(Oid [8]));
3939
if ((nums=sscanf(oidString,"%d%d%d%d%d%d%d%d",
40-
*result,
41-
*result+1,
42-
*result+2,
43-
*result+3,
44-
*result+4,
45-
*result+5,
46-
*result+6,
47-
*result+7))!=8) {
40+
&(*result)[0],
41+
&(*result)[1],
42+
&(*result)[2],
43+
&(*result)[3],
44+
&(*result)[4],
45+
&(*result)[5],
46+
&(*result)[6],
47+
&(*result)[7]))!=8) {
4848
do
4949
(*result)[nums++]=0;
5050
while (nums<8);

‎src/backend/utils/error/elog.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.12 1997/02/14 04:17:57 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.13 1997/03/12 21:10:53 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -49,7 +49,8 @@ elog(int lev, const char *fmt, ... )
4949
externinterrno,sys_nerr;
5050
#if !defined(BSD44_derived)&& \
5151
!defined(bsdi)&& \
52-
!defined(bsdi_2_1)
52+
!defined(bsdi_2_1)&& \
53+
!defined(linuxalpha)
5354
externchar*sys_errlist[];
5455
#endif/* bsd derived */
5556
#ifndefPG_STANDALONE

‎src/backend/utils/error/exc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.9 1996/12/27 13:13:58 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.10 1997/03/12 21:10:56 scrappy Exp $
1111
*
1212
* NOTE
1313
* XXX this code needs improvement--check for state violations and
@@ -95,7 +95,8 @@ ExcPrint(Exception *excP,
9595
externintsys_nerr;
9696
#if !defined(BSD44_derived)&& \
9797
!defined(bsdi)&& \
98-
!defined(bsdi_2_1)
98+
!defined(bsdi_2_1)&& \
99+
!defined(linuxalpha)
99100
externchar*sys_errlist[];
100101
#endif/* ! bsd_derived */
101102

‎src/include/nodes/pg_list.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_list.h,v 1.3 1996/11/04 07:18:19 scrappy Exp $
9+
* $Id: pg_list.h,v 1.4 1997/03/12 21:11:23 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -44,7 +44,10 @@ typedef struct Value {
4444
*/
4545
typedefstructList {
4646
NodeTagtype;
47-
void*elem;
47+
union {
48+
void*ptr_value;
49+
intint_value;
50+
}elem;
4851
structList*next;
4952
}List;
5053

@@ -54,10 +57,15 @@ typedefstruct List {
5457
*accessor macros
5558
* ----------------
5659
*/
57-
#definelfirst(l)((l)->elem)
60+
61+
/* anything that doesn't end in 'i' is assumed to be referring to the */
62+
/* pointer version of the list (where it makes a difference) */
63+
#definelfirst(l)((l)->elem.ptr_value)
5864
#definelnext(l)((l)->next)
5965
#definelsecond(l)(lfirst(lnext(l)))
6066

67+
#definelfirsti(l) ((l)->elem.int_value)
68+
6169
/*
6270
* foreach -
6371
* a convenience macro which loops through the list
@@ -85,13 +93,13 @@ extern void freeList(List *list);
8593
externvoid*nth(intn,List*l);
8694
externvoidset_nth(List*l,intn,void*elem);
8795

88-
/* hack for now */
89-
#definelconsi(i,l)lcons((void*)(int)i,l)
90-
#definelfirsti(l)((int)lfirst(l))
91-
#definelappendi(l,i)lappend(l,(void*)i)
96+
List*lconsi(intdatum,List*list);
97+
List*lappendi(List*list,intdatum);
9298
externboolintMember(int,List*);
9399
externList*intAppend(List*list1,List*list2);
94100

101+
externintnthi(intn,List*l);
102+
95103
externList*nreverse(List*);
96104
externList*set_difference(List*,List*);
97105
externList*set_differencei(List*,List*);

‎src/include/storage/ipc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: ipc.h,v 1.15 1997/03/03 23:34:27 scrappy Exp $
9+
* $Id: ipc.h,v 1.16 1997/03/12 21:12:27 scrappy Exp $
1010
*
1111
* NOTES
1212
* This file is very architecture-specific. This stuff should actually
@@ -32,7 +32,7 @@ extern void S_LOCK(slock_t *lock);
3232
externvoidS_UNLOCK(slock_t*lock);
3333
externvoidS_INIT_LOCK(slock_t*lock);
3434

35-
#if defined(alpha)|| \
35+
#if(defined(alpha)&& !defined(linuxalpha))|| \
3636
defined(hpux)|| \
3737
defined(irix5)|| \
3838
defined(nextstep)

‎src/include/utils/memutils.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Copyright (c) 1994, Regents of the University of California
1717
*
18-
* $Id: memutils.h,v 1.5 1997/03/04 05:32:26 scrappy Exp $
18+
* $Id: memutils.h,v 1.6 1997/03/12 21:13:19 scrappy Exp $
1919
*
2020
* NOTES
2121
* some of the information in this file will be moved to
@@ -67,7 +67,12 @@ s...)
6767
*/
6868
#if defined(sun)&& ! defined(sparc)
6969
#defineLONGALIGN(LEN)SHORTALIGN(LEN)
70-
#elif defined (alpha)
70+
#elif defined (alpha)|| defined(linuxalpha)
71+
/* even though "long alignment" should really be on 8-byte boundaries
72+
* for linuxalpha, we want the strictest alignment to be on 4-byte (int)
73+
* boundaries, because otherwise things break when they try to use the
74+
* FormData_pg_* structures. --djm 12/12/96
75+
*/
7176
#defineLONGALIGN(LEN)\
7277
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
7378
#else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp