Ejemplo n.º 1
0
void cDefinitions::unload()
{
	QStringList oldAISections = getSections( WPDT_AI );
	QStringList::iterator it;
	for ( it = oldAISections.begin(); it != oldAISections.end(); ++it )
	{
		AIFactory::instance()->unregisterType( *it );
	}

	// Clear the nodes
	unsigned int i;
	for ( i = 0; i < WPDT_COUNT; ++i )
	{
		impl->unique[i].clear();
		impl->nonunique[i].clear();
	}

	impl->imports.clear();
	CharBaseDefs::instance()->reset();
	ItemBaseDefs::instance()->reset();
	listcache_.clear();

	// Free the memory allocated by our nodes.
	QValueList<cElement*>::iterator eit;
	for (eit = elements.begin(); eit != elements.end(); ++eit) {
		delete *eit;
	}
	elements.clear();

	cComponent::unload();
}
int Interpreter::getArgs(const ProcInfo *info, ArgList *argList)
{
    int i;
    QString label, desc, procInfo(info->procInfo);
    QStringList sections, words;

    if (info->argTypes==NULL)
        return -1;

    sections = getSections("@p", procInfo);
    for (i=0; info->argTypes[i]; i++)
    {
        if (i<sections.size())
        {
            words = sections[i].split(QRegExp("\\s+"));
            label = words[0];
            desc = sections[i];
            desc.remove(QRegExp("^\\s+")); // remove leading whitespace
            desc.remove(QRegExp("^" + label)); // remove id
            desc.remove(QRegExp("^\\s+")); // remove leading whitespace
            argList->push_back(Arg(label, desc));
            // if argument is a type hint, we need to skip the 4-byte (32-bit) int, error if we run out of args
            if (info->argTypes[i]==CRP_TYPE_HINT &&
                    (!info->argTypes[++i] || !info->argTypes[++i] || !info->argTypes[++i] || !info->argTypes[++i]))
                return -1;
        }
        else
            argList->push_back(Arg(QString("arg")+QString::number(i), ""));
    }
    return 0;
}
Ejemplo n.º 3
0
void cDefinitions::unload()
{
    QStringList oldAISections = getSections( WPDT_AI );
    QStringList::iterator it;
    for ( it = oldAISections.begin(); it != oldAISections.end(); ++it )
    {
        AIFactory::instance()->unregisterType( *it );
    }

    // Clear the nodes
    unsigned int i;
    for ( i = 0; i < WPDT_COUNT; ++i )
    {
        QMap<QString, cElement*>::iterator it2;
        for ( it2 = impl->unique[i].begin(); it2 != impl->unique[i].end(); ++it2 )
            delete it2.data();

        impl->unique[i].clear();

        QValueVector<cElement*>::iterator it;
        for ( it = impl->nonunique[i].begin(); it != impl->nonunique[i].end(); ++it )
            delete * it;

        impl->nonunique[i].clear();
    }

    impl->imports.clear();
    CharBaseDefs::instance()->reset();
    ItemBaseDefs::instance()->reset();
    listcache_.clear();
    cComponent::unload();
}
Ejemplo n.º 4
0
void Dbtup::copyProcedure(Signal* signal,
                          TablerecPtr regTabPtr,
                          Operationrec* regOperPtr) 
{
  /* We create a stored procedure for the fragment copy scan
   * This is done by trimming a 'read all columns in order'
   * program to the correct length for this table and
   * using that to create the procedure
   * This assumes that there is only one fragment copy going
   * on at any time, which is verified by checking 
   * cCopyLastSeg == RNIL before starting each copy
   *
   * If the table has extra per-row metainformation that
   * needs copied then we add that to the copy procedure
   * as well.
   */
  prepareCopyProcedure(regTabPtr.p->m_no_of_attributes,
                       regTabPtr.p->m_bits);

  SectionHandle handle(this);
  handle.m_cnt=1;
  handle.m_ptr[0].i= cCopyProcedure;
  getSections(handle.m_cnt, handle.m_ptr);

  scanProcedure(signal,
                regOperPtr,
                &handle,
                true); // isCopy
}//Dbtup::copyProcedure()
Ejemplo n.º 5
0
inline
SectionHandle::SectionHandle(SimulatedBlock* b, Uint32 ptr)
  : m_cnt(1),
    m_block(b)
{
  m_ptr[0].i = ptr;
  getSections(1, m_ptr);
}
Ejemplo n.º 6
0
//returns the first section with a particular name
ConfSection* ConfFile::getSection(const std::string& section) {

    ConfSectionList* sectionlist = getSections(section);

    if(sectionlist==0 || sectionlist->size()==0) return 0;

    return sectionlist->front();
}
Ejemplo n.º 7
0
void ConfFile::addSection(ConfSection* section) {

    ConfSectionList* sectionlist = getSections(section->getName());

    if(sectionlist==0) {
        sectionmap[section->getName()] = sectionlist = new ConfSectionList;
    }

    section->setConfFile(this);
    sectionlist->push_back(section);
}
QString Interpreter::printProc(const ProcInfo *info, int level)
{
    ArgList list;
    QString print;
    QStringList sections;
    int i, j;

    print = QString(info->procName) + "(";
    if (getArgs(info, &list)<0)
        return "";
    for (i=0; i<(int)list.size(); i++)
    {
        if (i>0)
            print +=  ", ";
	j = i;
        print += printArgType(&info->argTypes[i], i) + " " + list[j].first;
    }
    print += ")\n";

    if (level>0)
    {
        sections = getSections("", info->procInfo);
        if (sections.size()>0)
            print += sections[0] + "\n";
        print += "Parameters:\n";
        if (list.size()==0)
            print += "<NONE>\n";
        for (i=0; i<(int)list.size(); i++)
        {
            print += "   " + list[i].first + ": ";
            print += list[i].second + "\n";
        }
        sections = getSections("@r", info->procInfo);
        print += "Returns:\n";
        for (i=0; i<sections.size(); i++)
            print += "   " + sections[i] + "\n";
    }

    return print;
}
Ejemplo n.º 9
0
int ConfFile::countSection(const std::string& section) {
    ConfSectionList* sectionlist = getSections(section);

    if(sectionlist==0) return 0;

    int count = 0;

    for(ConfSectionList::iterator sit = sectionlist->begin(); sit != sectionlist->end(); sit++) {
        count++;
    }

    return count;
}
Ejemplo n.º 10
0
void ConfFile::setSection(ConfSection* section) {

    ConfSectionList* sectionlist = getSections(section->getName());

    if(sectionlist==0) {
        sectionmap[section->getName()] = sectionlist = new ConfSectionList;
    }

    if(sectionlist->size() != 0) {
        ConfSection* front = sectionlist->front();
        sectionlist->pop_front();
        delete front;
    }

    sectionlist->push_back(section);
}
Ejemplo n.º 11
0
inline
SectionHandle::SectionHandle(SimulatedBlock* b, Signal* s)
  : m_cnt(s->header.m_noOfSections),
    m_block(b)
{
  Uint32 * ptr = s->m_sectionPtrI;
  Uint32 ptr0 = * ptr++;
  Uint32 ptr1 = * ptr++;
  Uint32 ptr2 = * ptr++;

  m_ptr[0].i = ptr0;
  m_ptr[1].i = ptr1;
  m_ptr[2].i = ptr2;

  getSections(m_cnt, m_ptr);

  s->header.m_noOfSections = 0;
}
Ejemplo n.º 12
0
//------------------------------------------------------------------------
// sendPacked is executed at the end of the loop.
// To ensure that we don't send any messages before executing all local
// packed signals we do another turn in the loop (unless we have already
// executed too many signals in the loop).
//------------------------------------------------------------------------
void 
FastScheduler::doJob()
{
  Uint32 loopCount = 0;
  Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB;
  Uint32 TloopMax = (Uint32)globalData.loopMax;
  if (TminLoops < TloopMax) {
    TloopMax = TminLoops;
  }//if
  if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) {
    TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB;
  }//if
  register Signal* signal = getVMSignals();
  register Uint32 tHighPrio= globalData.highestAvailablePrio;
  do{
    while ((tHighPrio < LEVEL_IDLE) && (loopCount < TloopMax)) {
      // signal->garbage_register(); 
      // To ensure we find bugs quickly
      register Uint32 gsnbnr = theJobBuffers[tHighPrio].retrieve(signal);
      register BlockNumber reg_bnr = gsnbnr & 0xFFF;
      register GlobalSignalNumber reg_gsn = gsnbnr >> 16;
      globalData.incrementWatchDogCounter(1);
      if (reg_bnr > 0) {
        Uint32 tJobCounter = globalData.JobCounter;
        Uint32 tJobLap = globalData.JobLap;
        SimulatedBlock* b = globalData.getBlock(reg_bnr);
        theJobPriority[tJobCounter] = (Uint8)tHighPrio;
        globalData.JobCounter = (tJobCounter + 1) & 4095;
        globalData.JobLap = tJobLap + 1;
	
#ifdef VM_TRACE_TIME
	Uint32 us1, us2;
	Uint64 ms1, ms2;
	NdbTick_CurrentMicrosecond(&ms1, &us1);
	b->m_currentGsn = reg_gsn;
#endif
	
	getSections(signal->header.m_noOfSections, signal->m_sectionPtr);
#ifdef VM_TRACE
        {
          if (globalData.testOn) {
	    signal->header.theVerId_signalNumber = reg_gsn;
	    signal->header.theReceiversBlockNumber = reg_bnr;
	    
            globalSignalLoggers.executeSignal(signal->header,
					      tHighPrio,
					      &signal->theData[0], 
					      globalData.ownId,
                                              signal->m_sectionPtr,
                                              signal->header.m_noOfSections);
          }//if
        }
#endif
        b->executeFunction(reg_gsn, signal);
	releaseSections(signal->header.m_noOfSections, signal->m_sectionPtr);
	signal->header.m_noOfSections = 0;
#ifdef VM_TRACE_TIME
	NdbTick_CurrentMicrosecond(&ms2, &us2);
	Uint64 diff = ms2;
	diff -= ms1;
	diff *= 1000000;
	diff += us2;
	diff -= us1;
	b->addTime(reg_gsn, diff);
#endif
        tHighPrio = globalData.highestAvailablePrio;
      } else {
        tHighPrio++;
        globalData.highestAvailablePrio = tHighPrio;
      }//if
      loopCount++;
    }//while
    sendPacked();
    tHighPrio = globalData.highestAvailablePrio;
    if(getBOccupancy() > MAX_OCCUPANCY)
    {
      if(loopCount != TloopMax)
	abort();
      assert( loopCount == TloopMax );
      TloopMax += 512;
    }
  } while ((getBOccupancy() > MAX_OCCUPANCY) ||
           ((loopCount < TloopMax) &&
            (tHighPrio < LEVEL_IDLE)));

  theDoJobCallCounter ++;
  theDoJobTotalCounter += loopCount;
  if (theDoJobCallCounter == 8192) {
    reportDoJobStatistics(theDoJobTotalCounter >> 13);
    theDoJobCallCounter = 0;
    theDoJobTotalCounter = 0;
  }//if