Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/lamont/src/compiler/c-target/fragments/queryPool.in
ViewVC logotype

Annotation of /branches/lamont/src/compiler/c-target/fragments/queryPool.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3274 - (view) (download)

1 : lamonts 2562 //! \brief initialize and allocate memory for the query pool
2 : lamonts 3273 void Diderot_Init_QueryListPool(QueryListPool_t * queryPool)
3 : lamonts 2201 {
4 : lamonts 3273 queryPool->size = QUERY_LIST_POOL_SIZE;
5 : lamonts 2201 queryPool->handle = 0;
6 : lamonts 3274 queryPool->initHandler = 0;
7 : lamonts 3273 queryPool->pool = (QueryList_t *)CheckedAlloc(sizeof(QueryList_t)*QUERY_LIST_POOL_SIZE);
8 : lamonts 2201 }
9 : lamonts 3273 //! \brief initialize and allocate memory for the query pool
10 :     void Diderot_Init_QueryList(QueryList_t * list)
11 :     {
12 :     list->size = QUERY_LIST_POOL_SIZE;
13 :     list->handle = 0;
14 :     list->pool = (@STRANDTY@ **)CheckedAlloc(sizeof(@STRANDTY@ *)*QUERY_LIST_POOL_SIZE);
15 :     }
16 : lamonts 2201 //! \brief allocate memory for the query pool
17 :     //! \return the query pool structure
18 : lamonts 3273 QueryList_t * Diderot_Grab_QueryList(QueryListPool_t * listPool)
19 : lamonts 2201 {
20 : lamonts 3273 if(listPool->handle >= listPool->size)
21 : lamonts 2201 {
22 : lamonts 3273 listPool->pool = CheckedReAlloc(listPool->pool,sizeof(QueryList_t)* (QUERY_LIST_POOL_SIZE + listPool->size));
23 :     listPool->size += QUERY_LIST_POOL_SIZE;
24 : lamonts 2201 }
25 : lamonts 3273 uint32_t newIdx = (listPool->handle)++;
26 :     QueryList_t * list = &(listPool->pool[newIdx]);
27 : lamonts 3274 if(newIdx <= listPool->initHandler) {
28 :     Diderot_Init_QueryList(list);
29 :     listPool->initHandler++;
30 :     }else {
31 :     list->handle = 0;
32 :     }
33 : lamonts 3273 return list;
34 : lamonts 2201 }
35 : lamonts 3273 //! \brief allocate memory for the query pool
36 :     //! \return the query pool structure
37 :     void Diderot_QueryList_Add(@STRANDTY@ * strandPtr, QueryList_t * list)
38 :     {
39 :     if(list->handle >= list->size)
40 :     {
41 :     list->pool = CheckedReAlloc(list->pool,sizeof(@STRANDTY@ *)* (QUERY_LIST_POOL_SIZE + list->size));
42 :     list->size += QUERY_LIST_POOL_SIZE;
43 :     }
44 :     uint32_t newIdx = (list->handle)++;
45 :     list->pool[newIdx] = strandPtr;
46 :     }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0