From: Dan McGuirk <mcguirk@indirect.com>

Subject: [HACKERS] linux/alpha patches

These patches lay the groundwork for a Linux/Alpha port.  The port doesn't
actually work unless you tweak the linker to put all the pointers in the
first 32 bits of the address space, but it's at least a start.  It
implements the test-and-set instruction in Alpha assembly, and also fixes
a lot of pointer-to-integer conversions, which is probably good anyway.
This commit is contained in:
Marc G. Fournier 1997-03-12 21:00:17 +00:00
parent 127826978a
commit b66569e41f
6 changed files with 50 additions and 24 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.12 1996/11/10 02:56:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.13 1997/03/12 20:56:32 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -62,13 +62,13 @@ index_keytest(IndexTuple tuple,
}
if (key[0].sk_flags & SK_COMMUTE) {
test = (int) (*(key[0].sk_func))
test = (*(key[0].sk_func))
(DatumGetPointer(key[0].sk_argument),
datum);
datum) ? 1 : 0;
} else {
test = (int) (*(key[0].sk_func))
test = (*(key[0].sk_func))
(datum,
DatumGetPointer(key[0].sk_argument));
DatumGetPointer(key[0].sk_argument)) ? 1 : 0;
}
if (!test == !(key[0].sk_flags & SK_NEGATE)) {

View File

@ -250,14 +250,14 @@ gistindex_keytest(IndexTuple tuple,
}
if (key[0].sk_flags & SK_COMMUTE) {
test = (int) (*(key[0].sk_func))
test = (*(key[0].sk_func))
(DatumGetPointer(key[0].sk_argument),
&de, key[0].sk_procedure);
&de, key[0].sk_procedure) ? 1 : 0;
} else {
test = (int) (*(key[0].sk_func))
test = (*(key[0].sk_func))
(&de,
DatumGetPointer(key[0].sk_argument),
key[0].sk_procedure);
key[0].sk_procedure) ? 1 : 0;
}
if (!test == !(key[0].sk_flags & SK_NEGATE)) {

View File

@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.15 1997/01/24 22:42:30 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.16 1997/03/12 20:57:33 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -485,7 +485,7 @@ boot_openrel(char *relname)
if (!Quiet)
printf("Amopen: relation %s. attrsize %d\n", relname,
ATTRIBUTE_TUPLE_SIZE);
(int)ATTRIBUTE_TUPLE_SIZE);
reldesc = heap_openr(relname);
Assert(reldesc);

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.6 1997/01/22 05:26:50 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.7 1997/03/12 20:58:26 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -905,7 +905,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
for (i=0; i < numIndices; i++) {
Oid indexOid;
indexOid = (Oid)nth(i, indxid);
indexOid = (Oid)nthi(i, indxid);
if (indexOid != 0) {
ExecOpenScanR(indexOid, /* relation */

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.2 1996/12/20 20:31:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.3 1997/03/12 20:59:27 scrappy Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
@ -65,12 +65,27 @@ lcons(void *obj, List *list)
return l;
}
List *
lconsi(int datum, List *list)
{
List *l = makeNode(List);
lfirsti(l) = datum;
lnext(l) = list;
return l;
}
List *
lappend(List *list, void *obj)
{
return nconc(list, lcons(obj, NIL));
}
List *
lappendi(List *list, int datum)
{
return nconc(list, lconsi(datum, NIL));
}
Value *
makeInteger(long i)
{
@ -110,6 +125,17 @@ nth(int n, List *l)
return lfirst(l);
}
int
nthi(int n, List *l)
{
/* XXX assume list is long enough */
while(n > 0) {
l = lnext(l);
n--;
}
return lfirsti(l);
}
/* this is here solely for rt_store. Get rid of me some day! */
void
set_nth(List *l, int n, void *elem)
@ -244,7 +270,7 @@ same(List *foo, List *bar)
return (foo==NULL);
if (length(foo) == length(bar)) {
foreach (temp,foo) {
if (!intMember((int)lfirst(temp),bar))
if (!intMember(lfirsti(temp),bar))
return(false);
}
return(true);
@ -297,7 +323,7 @@ LispUnioni(List *foo, List *bar)
foreach (i,foo) {
foreach (j,bar) {
if (lfirsti(i) != lfirsti(j)) {
retval = lappendi(retval,lfirst(i));
retval = lappendi(retval,lfirsti(i));
break;
}
}
@ -329,7 +355,7 @@ intMember(int foo, List *bar)
{
List *i;
foreach (i,bar)
if (foo == (int)lfirst(i))
if (foo == lfirsti(i))
return(true);
return(false);
}
@ -388,13 +414,13 @@ intLispRemove(int elem, List *list)
List *temp = NIL;
List *prev = NIL;
if (elem == (int)lfirst(list))
if (elem == lfirsti(list))
return lnext(list);
temp = lnext(list);
prev = list;
while(temp!=NIL) {
if (elem == (int)lfirst(temp)) {
if (elem == lfirsti(temp)) {
lnext(prev) = lnext(temp);
break;
}
@ -431,7 +457,7 @@ set_differencei(List *list1, List *list2)
foreach (temp1, list1) {
if (!intMember(lfirsti(temp1), list2))
result = lappendi(result, lfirst(temp1));
result = lappendi(result, lfirsti(temp1));
}
return(result);
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.5 1997/01/22 06:25:42 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.6 1997/03/12 21:00:17 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -1045,7 +1045,7 @@ index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
index_selectivity(lfirsti(index->relids),
index->classlist,
get_opnos(clausegroup),
getrelid((int)lfirst(rel->relids),
getrelid(lfirsti(rel->relids),
root->rtable),
attnos,
values,
@ -1061,7 +1061,7 @@ index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
pathnode->path.joinid = ((CInfo*)lfirst(clausegroup))->cinfojoinid;
pathnode->path.path_cost =
cost_index((Oid)lfirst(index->relids),
cost_index((Oid)lfirsti(index->relids),
(int)temp_pages,
temp_selec,
rel->pages,
@ -1150,7 +1150,7 @@ add_index_paths(List *indexpaths, List *new_indexpaths)
static bool
function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
{
Oid heapRelid = (Oid)lfirst(rel->relids);
Oid heapRelid = (Oid)lfirsti(rel->relids);
Func *function;
List *funcargs;
int *indexKeys = index->indexkeys;