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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3274 - (download) (annotate)
Sun Oct 11 20:45:48 2015 UTC (5 years, 1 month ago) by lamonts
File size: 1700 byte(s)
Modified query pool code for resetting after an update run
//! \brief initialize and allocate memory for the query pool
void Diderot_Init_QueryListPool(QueryListPool_t * queryPool) 
{
    queryPool->size = QUERY_LIST_POOL_SIZE; 
    queryPool->handle = 0; 
    queryPool->initHandler = 0; 
    queryPool->pool = (QueryList_t *)CheckedAlloc(sizeof(QueryList_t)*QUERY_LIST_POOL_SIZE); 
} 
//! \brief initialize and allocate memory for the query pool
void Diderot_Init_QueryList(QueryList_t * list) 
{
    list->size = QUERY_LIST_POOL_SIZE; 
    list->handle = 0; 
    list->pool = (@STRANDTY@ **)CheckedAlloc(sizeof(@STRANDTY@ *)*QUERY_LIST_POOL_SIZE); 
} 
//! \brief allocate memory for the query pool
//! \return the query pool structure 
QueryList_t * Diderot_Grab_QueryList(QueryListPool_t * listPool)
{ 
    if(listPool->handle >= listPool->size) 
    {
        listPool->pool = CheckedReAlloc(listPool->pool,sizeof(QueryList_t)* (QUERY_LIST_POOL_SIZE  + listPool->size)); 
        listPool->size += QUERY_LIST_POOL_SIZE; 
    }   
    uint32_t newIdx = (listPool->handle)++; 
    QueryList_t * list = &(listPool->pool[newIdx]); 
    if(newIdx <= listPool->initHandler) {
        Diderot_Init_QueryList(list); 
        listPool->initHandler++; 
    }else {
        list->handle = 0; 
    }
    return list;  
} 
//! \brief allocate memory for the query pool
//! \return the query pool structure 
void Diderot_QueryList_Add(@STRANDTY@ * strandPtr, QueryList_t * list)
{ 
    if(list->handle >= list->size) 
    {
        list->pool = CheckedReAlloc(list->pool,sizeof(@STRANDTY@ *)* (QUERY_LIST_POOL_SIZE  + list->size)); 
        list->size += QUERY_LIST_POOL_SIZE; 
    }   
    uint32_t newIdx = (list->handle)++; 
    list->pool[newIdx] = strandPtr; 
} 

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