Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4cbfeef

Browse files
committed
Inline some small functions called for every row.
1 parent 7500a96 commit 4cbfeef

File tree

11 files changed

+179
-205
lines changed

11 files changed

+179
-205
lines changed

src/backend/access/transam/xid.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.14 1998/04/07 18:10:01 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.15 1998/04/24 14:41:39 momjian Exp $
1111
*
1212
* OLD COMMENTS
1313
* XXX WARNING
@@ -53,16 +53,6 @@ xidout(TransactionId transactionId)
5353

5454
}
5555

56-
/* ----------------------------------------------------------------
57-
* TransactionIdEquals
58-
* ----------------------------------------------------------------
59-
*/
60-
bool
61-
TransactionIdEquals(TransactionId id1, TransactionId id2)
62-
{
63-
return ((bool) (id1 == id2));
64-
}
65-
6656
/* ----------------------------------------------------------------
6757
* TransactionIdIsLessThan
6858
* ----------------------------------------------------------------

src/backend/executor/execTuples.c

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.17 1998/02/26 04:31:14 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.18 1998/04/24 14:41:46 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -40,10 +40,10 @@
4040
* ExecSetNewSlotDescriptor - set a desc and the is-new-flag all at once
4141
* ExecSlotBuffer - return buffer of tuple in slot
4242
* ExecSetSlotBuffer - set the buffer for tuple in slot
43-
* ExecIncrSlotBufferRefcnt - bump the refcnt of the slot buffer
43+
* ExecIncrSlotBufferRefcnt - bump the refcnt of the slot buffer(Macro)
4444
*
4545
* SLOT STATUS PREDICATES
46-
* TupIsNull - true when slot contains no tuple
46+
* TupIsNull - true when slot contains no tuple(Macro)
4747
* ExecSlotDescriptorIsNew - true if we're now storing a different
4848
* type of tuple in a slot
4949
*
@@ -566,59 +566,11 @@ ExecSetSlotBuffer(TupleTableSlot *slot, /* slot to change */
566566

567567
#endif
568568

569-
/* --------------------------------
570-
* ExecIncrSlotBufferRefcnt
571-
*
572-
* When we pass around buffers in the tuple table, we have to
573-
* be careful to increment reference counts appropriately.
574-
* This is used mainly in the mergejoin code.
575-
* --------------------------------
576-
*/
577-
void
578-
ExecIncrSlotBufferRefcnt(TupleTableSlot *slot) /* slot to bump refcnt */
579-
{
580-
/* Buffer b = SlotBuffer((TupleTableSlot*) slot); */
581-
Buffer b = slot->ttc_buffer;
582-
583-
if (BufferIsValid(b))
584-
IncrBufferRefCount(b);
585-
}
586-
587569
/* ----------------------------------------------------------------
588570
* tuple table slot status predicates
589571
* ----------------------------------------------------------------
590572
*/
591573

592-
/* ----------------
593-
* TupIsNull
594-
*
595-
* This is used mainly to detect when there are no more
596-
* tuples to process.
597-
* ----------------
598-
*/
599-
bool /* return: true if tuple in slot is NULL */
600-
TupIsNull(TupleTableSlot *slot) /* slot to check */
601-
{
602-
HeapTuple tuple; /* contents of slot (returned) */
603-
604-
/* ----------------
605-
* if the slot itself is null then we return true
606-
* ----------------
607-
*/
608-
if (slot == NULL)
609-
return true;
610-
611-
/* ----------------
612-
* get information from the slot and return true or
613-
* false depending on the contents of the slot.
614-
* ----------------
615-
*/
616-
tuple = slot->val;
617-
618-
return
619-
(tuple == NULL ? true : false);
620-
}
621-
622574
/* --------------------------------
623575
* ExecSlotDescriptorIsNew
624576
*

src/backend/executor/nodeTee.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* ExecEndTee
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.16 1998/02/26 04:31:33 momjian Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.17 1998/04/24 14:41:55 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -27,7 +27,7 @@
2727
#include "utils/palloc.h"
2828
#include "utils/relcache.h"
2929
#include "utils/mcxt.h"
30-
#include "storage/bufmgr.h" /* for IncrBufferRefCount */
30+
#include "storage/bufmgr.h"
3131
#include "storage/smgr.h"
3232
#include "optimizer/internal.h"
3333
#include "executor/executor.h"

src/backend/storage/buffer/bufmgr.c

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.36 1998/04/05 21:04:22 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.37 1998/04/24 14:42:16 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1262,25 +1262,6 @@ FlushBufferPool(int StableMainMemoryFlag)
12621262
}
12631263
}
12641264

1265-
/*
1266-
* BufferIsValid --
1267-
* True iff the refcnt of the local buffer is > 0
1268-
* Note:
1269-
* BufferIsValid(InvalidBuffer) is False.
1270-
* BufferIsValid(UnknownBuffer) is False.
1271-
*/
1272-
bool
1273-
BufferIsValid(Buffer bufnum)
1274-
{
1275-
if (BufferIsLocal(bufnum))
1276-
return (bufnum >= -NLocBuffer && LocalRefCount[-bufnum - 1] > 0);
1277-
1278-
if (BAD_BUFFER_ID(bufnum))
1279-
return (false);
1280-
1281-
return ((bool) (PrivateRefCount[bufnum - 1] > 0));
1282-
}
1283-
12841265
/*
12851266
* BufferGetBlockNumber --
12861267
* Returns the block number associated with a buffer.
@@ -1413,24 +1394,6 @@ RelationGetNumberOfBlocks(Relation relation)
14131394
smgrnblocks(DEFAULT_SMGR, relation));
14141395
}
14151396

1416-
/*
1417-
* BufferGetBlock --
1418-
* Returns a reference to a disk page image associated with a buffer.
1419-
*
1420-
* Note:
1421-
* Assumes buffer is valid.
1422-
*/
1423-
Block
1424-
BufferGetBlock(Buffer buffer)
1425-
{
1426-
Assert(BufferIsValid(buffer));
1427-
1428-
if (BufferIsLocal(buffer))
1429-
return ((Block) MAKE_PTR(LocalBufferDescriptors[-buffer - 1].data));
1430-
else
1431-
return ((Block) MAKE_PTR(BufferDescriptors[buffer - 1].data));
1432-
}
1433-
14341397
/* ---------------------------------------------------------------------
14351398
* ReleaseRelationBuffers
14361399
*
@@ -1679,25 +1642,8 @@ BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
16791642
return (0);
16801643
}
16811644

1682-
#undef IncrBufferRefCount
16831645
#undef ReleaseBuffer
16841646

1685-
void
1686-
IncrBufferRefCount(Buffer buffer)
1687-
{
1688-
if (BufferIsLocal(buffer))
1689-
{
1690-
Assert(LocalRefCount[-buffer - 1] >= 0);
1691-
LocalRefCount[-buffer - 1]++;
1692-
}
1693-
else
1694-
{
1695-
Assert(!BAD_BUFFER_ID(buffer));
1696-
Assert(PrivateRefCount[buffer - 1] >= 0);
1697-
PrivateRefCount[buffer - 1]++;
1698-
}
1699-
}
1700-
17011647
/*
17021648
* ReleaseBuffer -- remove the pin on a buffer without
17031649
* marking it dirty.

src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 22 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.16 1998/04/06 02:38:17 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.17 1998/04/24 14:42:27 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -225,27 +225,6 @@ PageRestoreTempPage(Page tempPage, Page oldPage)
225225
pfree(tempPage);
226226
}
227227

228-
/*
229-
* PageGetMaxOffsetNumber --
230-
* Returns the maximum offset number used by the given page.
231-
*
232-
* NOTE: The offset is invalid if the page is non-empty.
233-
* Test whether PageIsEmpty before calling this routine
234-
* and/or using its return value.
235-
*/
236-
OffsetNumber
237-
PageGetMaxOffsetNumber(Page page)
238-
{
239-
LocationIndex low;
240-
OffsetNumber i;
241-
242-
low = ((PageHeader) page)->pd_lower;
243-
i = (low - (sizeof(PageHeaderData) - sizeof(ItemIdData)))
244-
/ sizeof(ItemIdData);
245-
246-
return (i);
247-
}
248-
249228
/* ----------------
250229
* itemid stuff for PageRepairFragmentation
251230
* ----------------

src/backend/utils/time/tqual.c

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.14 1998/02/26 04:38:32 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.15 1998/04/24 14:42:42 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -31,8 +31,8 @@ extern bool PostgresIsInitialized;
3131
*/
3232
#ifndef GOODAMI
3333

34-
static TransactionId HeapSpecialTransactionId = InvalidTransactionId;
35-
static CommandId HeapSpecialCommandId = FirstCommandId;
34+
TransactionId HeapSpecialTransactionId = InvalidTransactionId;
35+
CommandId HeapSpecialCommandId = FirstCommandId;
3636

3737
void
3838
setheapoverride(bool on)
@@ -49,54 +49,11 @@ setheapoverride(bool on)
4949
}
5050
}
5151

52-
/* static, but called in debug macro */
53-
bool
54-
heapisoverride()
55-
{
56-
if (!TransactionIdIsValid(HeapSpecialTransactionId))
57-
{
58-
return (false);
59-
}
60-
61-
if (!TransactionIdEquals(GetCurrentTransactionId(),
62-
HeapSpecialTransactionId) ||
63-
GetCurrentCommandId() != HeapSpecialCommandId)
64-
{
65-
HeapSpecialTransactionId = InvalidTransactionId;
66-
67-
return (false);
68-
}
69-
return (true);
70-
}
71-
7252
#endif /* !defined(GOODAMI) */
7353
/*
7454
* XXX Transaction system override hacks end here
7555
*/
7656

77-
static bool HeapTupleSatisfiesItself(HeapTuple tuple);
78-
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
79-
80-
/*
81-
* HeapTupleSatisfiesScope --
82-
* True iff heap tuple satsifies a time qual.
83-
*
84-
* Note:
85-
* Assumes heap tuple is valid.
86-
*/
87-
bool
88-
HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
89-
{
90-
91-
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
92-
return (false);
93-
94-
if (seeself == true || heapisoverride())
95-
return (HeapTupleSatisfiesItself(tuple));
96-
else
97-
return (HeapTupleSatisfiesNow(tuple));
98-
}
99-
10057
/*
10158
* HeapTupleSatisfiesItself --
10259
* True iff heap tuple is valid for "itself."
@@ -119,7 +76,7 @@ HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
11976
* (Xmax != my-transaction && the row was deleted by another transaction
12077
* Xmax is not committed))) that has not been committed
12178
*/
122-
static bool
79+
bool
12380
HeapTupleSatisfiesItself(HeapTuple tuple)
12481
{
12582

@@ -215,7 +172,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
215172
* the serializability guarantees we provide don't extend to xacts
216173
* that do catalog accesses. this is unfortunate, but not critical.
217174
*/
218-
static bool
175+
bool
219176
HeapTupleSatisfiesNow(HeapTuple tuple)
220177
{
221178
if (AMI_OVERRIDE)

src/include/access/xact.h

Lines changed: 12 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: xact.h,v 1.12 1998/02/26 04:40:32 momjian Exp $
9+
* $Id: xact.h,v 1.13 1998/04/24 14:42:55 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -60,6 +60,17 @@ typedef TransactionStateData *TransactionState;
6060
#define StoreInvalidTransactionId(dest) \
6161
(*((TransactionId*)dest) = NullTransactionId)
6262

63+
64+
/* ----------------------------------------------------------------
65+
* TransactionIdEquals
66+
* ----------------------------------------------------------------
67+
*/
68+
#define TransactionIdEquals(id1, id2) \
69+
( \
70+
((bool) ((id1) == (id2))) \
71+
)
72+
73+
6374
/* ----------------
6475
* extern definitions
6576
* ----------------
@@ -95,7 +106,6 @@ extern TransactionId DisabledTransactionId;
95106
extern TransactionId xidin(char *representation);
96107
extern char *xidout(TransactionId transactionId);
97108
extern bool xideq(TransactionId xid1, TransactionId xid2);
98-
extern bool TransactionIdEquals(TransactionId id1, TransactionId id2);
99109
extern bool TransactionIdIsLessThan(TransactionId id1, TransactionId id2);
100110
extern void TransactionIdAdd(TransactionId *xid, int value);
101111

0 commit comments

Comments
 (0)