1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* memnodes.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES memory context node definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1999-03-08 00:03:32 +01:00
|
|
|
* $Id: memnodes.h,v 1.11 1999/03/07 23:03:31 tgl Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* XXX the typedefs in this file are different from the other ???nodes.h;
|
1997-09-07 07:04:48 +02:00
|
|
|
* they are pointers to structures instead of the structures themselves.
|
|
|
|
* If you're wondering, this is plain laziness. I don't want to touch
|
|
|
|
* the memory context code which should be revamped altogether some day.
|
|
|
|
* - ay 10/94
|
1996-08-28 03:59:28 +02:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef MEMNODES_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define MEMNODES_H
|
|
|
|
|
1996-11-04 08:59:39 +01:00
|
|
|
#include <lib/fstack.h>
|
|
|
|
#include <utils/memutils.h>
|
|
|
|
#include <nodes/nodes.h>
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-02-14 00:22:53 +01:00
|
|
|
* MemoryContext
|
1997-09-07 07:04:48 +02:00
|
|
|
* A logical context in which memory allocations occur.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* The types of memory contexts can be thought of as members of the
|
|
|
|
* following inheritance hierarchy with properties summarized below.
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Node
|
|
|
|
* |
|
|
|
|
* MemoryContext___
|
|
|
|
* / \
|
|
|
|
* GlobalMemory PortalMemoryContext
|
|
|
|
* / \
|
|
|
|
* PortalVariableMemory PortalHeapMemory
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Flushed at Flushed at Checkpoints
|
|
|
|
* Transaction Portal
|
|
|
|
* Commit Close
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* GlobalMemory n n n
|
|
|
|
* PortalVariableMemory n y n
|
|
|
|
* PortalHeapMemory y y y
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct MemoryContextMethodsData
|
|
|
|
{
|
1997-09-08 23:56:23 +02:00
|
|
|
Pointer (*alloc) ();
|
1997-09-08 04:41:22 +02:00
|
|
|
void (*free_p) (); /* need to use free as a #define, so can't
|
|
|
|
* use free */
|
1997-09-08 23:56:23 +02:00
|
|
|
Pointer (*realloc) ();
|
1997-09-08 04:41:22 +02:00
|
|
|
char *(*getName) ();
|
|
|
|
void (*dump) ();
|
|
|
|
} *MemoryContextMethods;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-02-06 17:50:34 +01:00
|
|
|
typedef struct MemoryContextData
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
1997-09-07 07:04:48 +02:00
|
|
|
MemoryContextMethods method;
|
1999-03-08 00:03:32 +01:00
|
|
|
} MemoryContextData;
|
|
|
|
|
|
|
|
/* utils/mcxt.h contains typedef struct MemoryContextData *MemoryContext */
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* think about doing this right some time but we'll have explicit fields
|
|
|
|
for now -ay 10/94 */
|
1999-02-06 17:50:34 +01:00
|
|
|
typedef struct GlobalMemoryData
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
1997-09-07 07:04:48 +02:00
|
|
|
MemoryContextMethods method;
|
1997-09-08 04:41:22 +02:00
|
|
|
AllocSetData setData;
|
|
|
|
char *name;
|
1997-09-07 07:04:48 +02:00
|
|
|
OrderedElemData elemData;
|
1999-03-08 00:03:32 +01:00
|
|
|
} GlobalMemoryData;
|
|
|
|
|
|
|
|
/* utils/mcxt.h contains typedef struct GlobalMemoryData *GlobalMemory */
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-03-08 00:03:32 +01:00
|
|
|
typedef struct MemoryContextData *PortalMemoryContext;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-02-06 17:50:34 +01:00
|
|
|
typedef struct PortalVariableMemoryData
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
1997-09-07 07:04:48 +02:00
|
|
|
MemoryContextMethods method;
|
1997-09-08 04:41:22 +02:00
|
|
|
AllocSetData setData;
|
|
|
|
} *PortalVariableMemory;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-02-06 17:50:34 +01:00
|
|
|
typedef struct PortalHeapMemoryData
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
1997-09-07 07:04:48 +02:00
|
|
|
MemoryContextMethods method;
|
1997-09-08 04:41:22 +02:00
|
|
|
Pointer block;
|
|
|
|
FixedStackData stackData;
|
|
|
|
} *PortalHeapMemory;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-02-14 00:22:53 +01:00
|
|
|
* MemoryContextIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff memory context is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define MemoryContextIsValid(context) \
|
1997-09-07 07:04:48 +02:00
|
|
|
(IsA(context,MemoryContext) || IsA(context,GlobalMemory) || \
|
|
|
|
IsA(context,PortalVariableMemory) || IsA(context,PortalHeapMemory))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* MEMNODES_H */
|