libxmp/libxmpf in Omni Compiler  1.3.4
_xmpco_alloc.h
Go to the documentation of this file.
1 // only for xmpco_alloc.c
2 
3 #ifndef _XMPCO_ALLOC_H
4 #define _XMPCO_ALLOC_H
5 
6 #include "xmpco_internal.h"
7 #include "_xmpco_alloc.h"
8 
9 /*****************************************\
10  macro definitions
11 \*****************************************/
12 #define _SortedChunkTableInitSize 256
13 
14 #define DIV_CEILING(m,n) (((m)-1)/(n)+1)
15 
16 #define forallMemoryChunkOrder(cp) for(MemoryChunkOrder_t *_cp1_=((cp)=_mallocStack.head->next)->next; \
17  _cp1_ != NULL; \
18  (cp)=_cp1_, _cp1_=_cp1_->next)
19 
20 #define forallMemoryChunkOrderRev(cp) for(MemoryChunkOrder_t *_cp1_=((cp)=_mallocStack.tail->prev)->prev; \
21  _cp1_ != NULL; \
22  (cp)=_cp1_, _cp1_=_cp1_->prev)
23 
24 
25 #define forallResourceSet(rs) for(ResourceSet_t *_rs1_=((rs)=_headResourceSet->next)->next; \
26  _rs1_ != NULL; \
27  (rs)=_rs1_, _rs1_=_rs1_->next)
28 
29 #define forallResourceSetRev(rs) for(ResourceSet_t *_rs1_=((rs)=_tailResourceSet->prev)->prev; \
30  _rs1_ != NULL; \
31  (rs)=_rs1_, _rs1_=_rs1_->prev)
32 
33 #define forallMemoryChunk(chk,rs) for(MemoryChunk_t *_chk1_=((chk)=(rs)->headChunk->next)->next; \
34  _chk1_ != NULL; \
35  (chk)=_chk1_, _chk1_=_chk1_->next)
36 
37 #define forallMemoryChunkRev(chk,rs) for(MemoryChunk_t *_chk1_=((chk)=(rs)->tailChunk->prev)->prev; \
38  _chk1_ != NULL; \
39  (chk) = _chk1_, _chk1_=_chk1_->prev)
40 
41 #define forallCoarrayInfo(ci,chk) for(CoarrayInfo_t *_ci1_ = ((ci)=(chk)->headCoarray->next)->next; \
42  _ci1_ != NULL; \
43  (ci) = _ci1_, _ci1_=_ci1_->next)
44 
45 #define IsFirstCoarrayInfo(ci) ((ci)->prev->prev == NULL)
46 #define IsLastCoarrayInfo(ci) ((ci)->next->next == NULL)
47 #define IsOnlyCoarrayInfo(ci) (IsFirstCoarrayInfo(ci) && IsLastCoarrayInfo(ci))
48 
49 #define IsFirstMemoryChunk(chk) ((chk)->prev->prev == NULL)
50 #define IsLastMemoryChunk(chk) ((chk)->next->next == NULL)
51 #define IsEmptyMemoryChunk(chk) ((chk)->headCoarray->next->next == NULL)
52 
53 #define IsEmptyResourceSet(rs) ((rs)->headChunk->next->next == NULL)
54 
55 
56 /*****************************************\
57  inernal structures
58 \*****************************************/
59 
65  char *name; // procedure name (for debug message)
68 };
69 
70 
80  BOOL isGarbage; // true if already encountered DEALLOCATE stmt
81  char *orgAddr; // local address of the allocated memory
82  size_t nbytes; // allocated size of memory [bytes]
83  void *desc; // descriptor in the lower-layer library
86 };
87 
96  char *name; // name of the variable (for debug message)
97  char *baseAddr; // local address of the coarray (cray pointer)
98  size_t size; // size of the coarray [bytes]
99  int corank; // number of codimensions
100  int *lcobound; // array of lower cobounds [0..(corank-1)]
101  int *ucobound; // array of upper cobounds [0..(corank-1)]
102  int *cosize; // cosize[k] = max(ucobound[k]-lcobound[k]+1, 0)
103  _XMP_nodes_t *nodes; // XMP descriptor for the mapping nodes (if any)
104 };
105 
106 
107 
115 };
116 
117 
122  unsigned long orgAddr;
124 };
125 
126 
127 #endif
_resourceSet_t
MEMORY MANAGEMENT STRUCTURE-I (for automatic deallocation) runtime resource corresponding to a proced...
Definition: _xmpco_alloc.h:64
_sortedChunkTable_t
MEMORY MANAGEMENT STRUCTURE-III (for binary search for memory chunk) table of memory chunks sorted in...
Definition: _xmpco_alloc.h:121
_memoryChunk_t::nbytes
size_t nbytes
Definition: _xmpco_alloc.h:82
_memoryChunkOrder_t::chunk
MemoryChunk_t * chunk
Definition: _xmpco_alloc.h:114
_coarrayInfo_t::corank
int corank
Definition: _xmpco_alloc.h:99
_resourceSet_t::name
char * name
Definition: _xmpco_alloc.h:65
_memoryChunk_t::headCoarray
CoarrayInfo_t * headCoarray
Definition: _xmpco_alloc.h:84
_memoryChunkOrder_t::prev
MemoryChunkOrder_t * prev
Definition: _xmpco_alloc.h:112
_coarrayInfo_t::baseAddr
char * baseAddr
Definition: _xmpco_alloc.h:97
_coarrayInfo_t::size
size_t size
Definition: _xmpco_alloc.h:98
_memoryChunk_t::isGarbage
BOOL isGarbage
Definition: _xmpco_alloc.h:80
_memoryChunk_t::tailCoarray
CoarrayInfo_t * tailCoarray
Definition: _xmpco_alloc.h:85
_memoryChunk_t::desc
void * desc
Definition: _xmpco_alloc.h:83
xmpco_internal.h
_resourceSet_t::tailChunk
MemoryChunk_t * tailChunk
Definition: _xmpco_alloc.h:67
_coarrayInfo_t::name
char * name
Definition: _xmpco_alloc.h:96
_memoryChunk_t::parent
ResourceSet_t * parent
Definition: _xmpco_alloc.h:79
_coarrayInfo_t::prev
CoarrayInfo_t * prev
Definition: _xmpco_alloc.h:93
_coarrayInfo_t::cosize
int * cosize
Definition: _xmpco_alloc.h:102
BOOL
#define BOOL
Definition: xmpco_internal.h:14
_sortedChunkTable_t::chunk
MemoryChunk_t * chunk
Definition: _xmpco_alloc.h:123
_coarrayInfo_t::nodes
_XMP_nodes_t * nodes
Definition: _xmpco_alloc.h:103
_memoryChunk_t::orgAddr
char * orgAddr
Definition: _xmpco_alloc.h:81
_resourceSet_t::headChunk
MemoryChunk_t * headChunk
Definition: _xmpco_alloc.h:66
_memoryChunk_t
structure for each malloc/free call Every memory chunk is linked both:
Definition: _xmpco_alloc.h:76
_xmpco_alloc.h
_memoryChunk_t::next
MemoryChunk_t * next
Definition: _xmpco_alloc.h:78
_memoryChunkOrder_t::next
MemoryChunkOrder_t * next
Definition: _xmpco_alloc.h:113
_memoryChunkOrder_t
MEMORY MANAGEMENT STRUCTURE-II (for dynamic ALLOCATE/DEALLOCATE stmts.
Definition: _xmpco_alloc.h:111
_XMP_nodes_type
Definition: xmp_data_struct.h:40
_memoryChunk_t::prev
MemoryChunk_t * prev
Definition: _xmpco_alloc.h:77
_coarrayInfo_t::next
CoarrayInfo_t * next
Definition: _xmpco_alloc.h:94
_coarrayInfo_t
structure for each coarray variable One or more coarrays can be linked from a single memory chunk and...
Definition: _xmpco_alloc.h:92
_sortedChunkTable_t::orgAddr
unsigned long orgAddr
Definition: _xmpco_alloc.h:122
_coarrayInfo_t::parent
MemoryChunk_t * parent
Definition: _xmpco_alloc.h:95
_coarrayInfo_t::lcobound
int * lcobound
Definition: _xmpco_alloc.h:100
_coarrayInfo_t::ucobound
int * ucobound
Definition: _xmpco_alloc.h:101