1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Inline some small functions called for every row.

This commit is contained in:
Bruce Momjian
1998-04-24 14:43:33 +00:00
parent 7500a961f1
commit 4cbfeef912
11 changed files with 179 additions and 205 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.14 1998/04/07 18:10:01 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.15 1998/04/24 14:41:39 momjian Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -53,16 +53,6 @@ xidout(TransactionId transactionId)
}
/* ----------------------------------------------------------------
* TransactionIdEquals
* ----------------------------------------------------------------
*/
bool
TransactionIdEquals(TransactionId id1, TransactionId id2)
{
return ((bool) (id1 == id2));
}
/* ----------------------------------------------------------------
* TransactionIdIsLessThan
* ----------------------------------------------------------------

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.17 1998/02/26 04:31:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.18 1998/04/24 14:41:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,10 +40,10 @@
* ExecSetNewSlotDescriptor - set a desc and the is-new-flag all at once
* ExecSlotBuffer - return buffer of tuple in slot
* ExecSetSlotBuffer - set the buffer for tuple in slot
* ExecIncrSlotBufferRefcnt - bump the refcnt of the slot buffer
* ExecIncrSlotBufferRefcnt - bump the refcnt of the slot buffer(Macro)
*
* SLOT STATUS PREDICATES
* TupIsNull - true when slot contains no tuple
* TupIsNull - true when slot contains no tuple(Macro)
* ExecSlotDescriptorIsNew - true if we're now storing a different
* type of tuple in a slot
*
@@ -566,59 +566,11 @@ ExecSetSlotBuffer(TupleTableSlot *slot, /* slot to change */
#endif
/* --------------------------------
* ExecIncrSlotBufferRefcnt
*
* When we pass around buffers in the tuple table, we have to
* be careful to increment reference counts appropriately.
* This is used mainly in the mergejoin code.
* --------------------------------
*/
void
ExecIncrSlotBufferRefcnt(TupleTableSlot *slot) /* slot to bump refcnt */
{
/* Buffer b = SlotBuffer((TupleTableSlot*) slot); */
Buffer b = slot->ttc_buffer;
if (BufferIsValid(b))
IncrBufferRefCount(b);
}
/* ----------------------------------------------------------------
* tuple table slot status predicates
* ----------------------------------------------------------------
*/
/* ----------------
* TupIsNull
*
* This is used mainly to detect when there are no more
* tuples to process.
* ----------------
*/
bool /* return: true if tuple in slot is NULL */
TupIsNull(TupleTableSlot *slot) /* slot to check */
{
HeapTuple tuple; /* contents of slot (returned) */
/* ----------------
* if the slot itself is null then we return true
* ----------------
*/
if (slot == NULL)
return true;
/* ----------------
* get information from the slot and return true or
* false depending on the contents of the slot.
* ----------------
*/
tuple = slot->val;
return
(tuple == NULL ? true : false);
}
/* --------------------------------
* ExecSlotDescriptorIsNew
*

View File

@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.16 1998/02/26 04:31:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.17 1998/04/24 14:41:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@
#include "utils/palloc.h"
#include "utils/relcache.h"
#include "utils/mcxt.h"
#include "storage/bufmgr.h" /* for IncrBufferRefCount */
#include "storage/bufmgr.h"
#include "storage/smgr.h"
#include "optimizer/internal.h"
#include "executor/executor.h"

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.36 1998/04/05 21:04:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.37 1998/04/24 14:42:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1262,25 +1262,6 @@ FlushBufferPool(int StableMainMemoryFlag)
}
}
/*
* BufferIsValid --
* True iff the refcnt of the local buffer is > 0
* Note:
* BufferIsValid(InvalidBuffer) is False.
* BufferIsValid(UnknownBuffer) is False.
*/
bool
BufferIsValid(Buffer bufnum)
{
if (BufferIsLocal(bufnum))
return (bufnum >= -NLocBuffer && LocalRefCount[-bufnum - 1] > 0);
if (BAD_BUFFER_ID(bufnum))
return (false);
return ((bool) (PrivateRefCount[bufnum - 1] > 0));
}
/*
* BufferGetBlockNumber --
* Returns the block number associated with a buffer.
@@ -1413,24 +1394,6 @@ RelationGetNumberOfBlocks(Relation relation)
smgrnblocks(DEFAULT_SMGR, relation));
}
/*
* BufferGetBlock --
* Returns a reference to a disk page image associated with a buffer.
*
* Note:
* Assumes buffer is valid.
*/
Block
BufferGetBlock(Buffer buffer)
{
Assert(BufferIsValid(buffer));
if (BufferIsLocal(buffer))
return ((Block) MAKE_PTR(LocalBufferDescriptors[-buffer - 1].data));
else
return ((Block) MAKE_PTR(BufferDescriptors[buffer - 1].data));
}
/* ---------------------------------------------------------------------
* ReleaseRelationBuffers
*
@@ -1679,25 +1642,8 @@ BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
return (0);
}
#undef IncrBufferRefCount
#undef ReleaseBuffer
void
IncrBufferRefCount(Buffer buffer)
{
if (BufferIsLocal(buffer))
{
Assert(LocalRefCount[-buffer - 1] >= 0);
LocalRefCount[-buffer - 1]++;
}
else
{
Assert(!BAD_BUFFER_ID(buffer));
Assert(PrivateRefCount[buffer - 1] >= 0);
PrivateRefCount[buffer - 1]++;
}
}
/*
* ReleaseBuffer -- remove the pin on a buffer without
* marking it dirty.

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.16 1998/04/06 02:38:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.17 1998/04/24 14:42:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -225,27 +225,6 @@ PageRestoreTempPage(Page tempPage, Page oldPage)
pfree(tempPage);
}
/*
* PageGetMaxOffsetNumber --
* Returns the maximum offset number used by the given page.
*
* NOTE: The offset is invalid if the page is non-empty.
* Test whether PageIsEmpty before calling this routine
* and/or using its return value.
*/
OffsetNumber
PageGetMaxOffsetNumber(Page page)
{
LocationIndex low;
OffsetNumber i;
low = ((PageHeader) page)->pd_lower;
i = (low - (sizeof(PageHeaderData) - sizeof(ItemIdData)))
/ sizeof(ItemIdData);
return (i);
}
/* ----------------
* itemid stuff for PageRepairFragmentation
* ----------------

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.14 1998/02/26 04:38:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.15 1998/04/24 14:42:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,8 +31,8 @@ extern bool PostgresIsInitialized;
*/
#ifndef GOODAMI
static TransactionId HeapSpecialTransactionId = InvalidTransactionId;
static CommandId HeapSpecialCommandId = FirstCommandId;
TransactionId HeapSpecialTransactionId = InvalidTransactionId;
CommandId HeapSpecialCommandId = FirstCommandId;
void
setheapoverride(bool on)
@@ -49,54 +49,11 @@ setheapoverride(bool on)
}
}
/* static, but called in debug macro */
bool
heapisoverride()
{
if (!TransactionIdIsValid(HeapSpecialTransactionId))
{
return (false);
}
if (!TransactionIdEquals(GetCurrentTransactionId(),
HeapSpecialTransactionId) ||
GetCurrentCommandId() != HeapSpecialCommandId)
{
HeapSpecialTransactionId = InvalidTransactionId;
return (false);
}
return (true);
}
#endif /* !defined(GOODAMI) */
/*
* XXX Transaction system override hacks end here
*/
static bool HeapTupleSatisfiesItself(HeapTuple tuple);
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
/*
* HeapTupleSatisfiesScope --
* True iff heap tuple satsifies a time qual.
*
* Note:
* Assumes heap tuple is valid.
*/
bool
HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
{
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
return (false);
if (seeself == true || heapisoverride())
return (HeapTupleSatisfiesItself(tuple));
else
return (HeapTupleSatisfiesNow(tuple));
}
/*
* HeapTupleSatisfiesItself --
* True iff heap tuple is valid for "itself."
@@ -119,7 +76,7 @@ HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
* (Xmax != my-transaction && the row was deleted by another transaction
* Xmax is not committed))) that has not been committed
*/
static bool
bool
HeapTupleSatisfiesItself(HeapTuple tuple)
{
@@ -215,7 +172,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
* the serializability guarantees we provide don't extend to xacts
* that do catalog accesses. this is unfortunate, but not critical.
*/
static bool
bool
HeapTupleSatisfiesNow(HeapTuple tuple)
{
if (AMI_OVERRIDE)