Exemple #1
0
 /**
 The useable size of the buffer will be p_bufferSize - sizeof(StaticData).
 Each object will allocate sizeof(T) + sizeof(CircleBufferHeader) each
 */
 void Initialize(const size_t& p_bufferSize, IO::Mutex* p_mutex = nullptr)
 {
     AssertInitialize(p_bufferSize);
     m_rawBufferSize = p_bufferSize;
     m_mutex = p_mutex;
     m_rawBufferPointerStart = malloc(m_rawBufferSize);
     SetupVariables();
 }
 void ArbitrarySizeCirclebuffer::Initialize(const uint32_t& p_bufferSize, IO::Mutex* p_sharedMemoryMutex)
 {
     AssertInitialize(p_bufferSize);
     m_rawBufferSize = p_bufferSize;
     m_rawBufferPointerStart = malloc(m_rawBufferSize);
     m_metaDataMutex = p_sharedMemoryMutex;
     SetupVariables();
 }
Exemple #3
0
 /**
 The useable size of the buffer will be p_bufferSize - sizeof(StaticData)
 Each object will allocate sizeof(T) + sizeof(CircleBufferHeader) each
 */
 void Initialize(void* const p_preAllocatedBuffer, const size_t& p_bufferSize, IO::Mutex* p_mutex = nullptr)
 {
     AssertInitialize(p_bufferSize);
     m_rawBufferSize = p_bufferSize;
     m_rawBufferPointerStart = p_preAllocatedBuffer;
     m_mutex = p_mutex;
     m_internalMemoryManagement = false;
     SetupVariables();
 }
 void ArbitrarySizeCirclebuffer::Initialize(void* const p_preAllocatedBuffer, const uint32_t& p_bufferSize, IO::Mutex* p_sharedMemoryMutex)
 {
     AssertInitialize(p_bufferSize);
     m_rawBufferSize = p_bufferSize;
     m_rawBufferPointerStart = p_preAllocatedBuffer;
     m_internalMemoryManagement = false;
     m_metaDataMutex = p_sharedMemoryMutex;
     SetupVariables();
 }
Exemple #5
0
EXPRESSION *doinline(FUNCTIONCALL *params, SYMBOL *funcsp)
{
    static SYMBOL *curfunc;
    STATEMENT *stmt = NULL, **stp = &stmt;
    EXPRESSION *newExpression;
    BOOL allocated = FALSE;
    if (funcsp)
        curfunc = funcsp;
    if (!isfunction(params->functp))
        return NULL;
    if (params->sp->linkage != lk_inline)
        return NULL;
    if (!params->sp->inlineFunc.syms)
        return NULL;

    if (!localNameSpace->syms)
    {
        allocated = TRUE;
        AllocateLocalContext(NULL, NULL);
    }
    stmt = SetupArguments(params);
    SetupVariables(params->sp);

    while (*stp)
        stp = &(*stp)->next;
    *stp = inlinestmt(params->sp->inlineFunc.stmt);
    newExpression = exprNode(en_stmt, NULL, NULL);
    newExpression->v.stmt = stmt;
    
    if (params->sp->retcount == 1)
    {
        /* optimization for simple inline functions that only have
         * one return statement, don't save to an intermediate variable
         */
        newExpression->left = scanReturn(stmt, basetype(params->sp->tp)->btp);
    }
    else
    {
        newExpression->left = newReturn(basetype(params->sp->tp)->btp);
        reduceReturns(stmt, params->sp->tp->btp, newExpression->left);
    }

    if (params->sp->storage_class == sc_virtual || params->sp->storage_class == sc_member)
        thisptrs = thisptrs->next;
        
    if (allocated)
    {
        FreeLocalContext(NULL, NULL);
    }
    if (funcsp)
        curfunc = NULL;
    return newExpression;
}