Пример #1
0
nmethod* zone::allocate(int size) {
  // CSect cs(profilerSemaphore); // for profiler
  // must get method ID here! (because reclaim might change firstFree)
  // (compiler may have used peekID to get ID of new nmethod for LRU stuff)
  if (needsSweep()) doSweep();

  nmethod* n = (nmethod*) methodHeap->allocate(size);
  
  if (n == NULL) {
    // allocation failed so flush zombies and retry
    flushZombies();
    n = (nmethod*) methodHeap->allocate(size);
    if (n == NULL) {
      print();
      fatal("cannot allocate enough space for nmethod");
    }
  }

  verify_if_often();
  return n;
}
Пример #2
0
void IncrementalSweeper::doWork()
{
    doSweep(WTF::monotonicallyIncreasingTime());
}
    void runTemperatureRound(double t_parameter) {
    
      AbstractAlgorithm::runTemperatureRound(t_parameter);
      
      if(start) {
        for(int i = 0; i < lattice->getN(); i++) {
          spins[i] = bool(gsl_rng_uniform_int(generator, 2));
        }

        energy  = calculateEnergy();
        spinSum = calculateSpinSum();
        start = false;
      }
    
      for(long i = 0; i < runCount; i++) {
      
        if(i > runCount - measureCount) {
          energyMeasurements[i - runCount + measureCount]                   = energy / lattice->getN();
          magnetisationMeasurements[i - runCount + measureCount]            = double(spinSum) / lattice->getN();
          absoluteMagnetisationMeasurements[i - runCount + measureCount]    = fabs(double(spinSum) / lattice->getN());
        }
        
        doSweep();
        
      }

      IsingEnergyAnalyzer *isingEnergyAnalyzer = new IsingEnergyAnalyzer(this, lattice);
      isingEnergyAnalyzer->analyze();
      averageEnergy = isingEnergyAnalyzer->getAverage();
      errorOfEnergy = isingEnergyAnalyzer->getError();
      autoCorrelationTimeOfEnergy = isingEnergyAnalyzer->getAutoCorrelationTime();
      delete isingEnergyAnalyzer;

      IsingHeatCapacityAnalyzer *isingHeatCapacityAnalyzer = new IsingHeatCapacityAnalyzer(this, lattice);
      isingHeatCapacityAnalyzer->analyze();
      averageHeatCapacity = isingHeatCapacityAnalyzer->getAverage();
      errorOfHeatCapacity = isingHeatCapacityAnalyzer->getError();
      autoCorrelationTimeOfHeatCapacity = isingHeatCapacityAnalyzer->getAutoCorrelationTime();
      delete isingHeatCapacityAnalyzer;

      IsingMagnetisationAnalyzer *isingMagnetisationAnalyzer = new IsingMagnetisationAnalyzer(this, lattice);
      isingMagnetisationAnalyzer->analyze();
      averageMagnetisation = isingMagnetisationAnalyzer->getAverage();
      errorOfMagnetisation = isingMagnetisationAnalyzer->getError();
      autoCorrelationTimeOfMagnetisation = isingMagnetisationAnalyzer->getAutoCorrelationTime();
      delete isingMagnetisationAnalyzer;

      IsingSusceptibilityAnalyzer *isingSusceptibilityAnalyzer = new IsingSusceptibilityAnalyzer(this, lattice);
      isingSusceptibilityAnalyzer->analyze();
      averageSusceptibility = isingSusceptibilityAnalyzer->getAverage();
      errorOfSusceptibility = isingSusceptibilityAnalyzer->getError();
      autoCorrelationTimeOfSusceptibility = isingSusceptibilityAnalyzer->getAutoCorrelationTime();
      delete isingSusceptibilityAnalyzer;

      IsingAbsoluteMagnetisationAnalyzer *isingAbsoluteMagnetisationAnalyzer = new IsingAbsoluteMagnetisationAnalyzer(this, lattice);
      isingAbsoluteMagnetisationAnalyzer->analyze();
      averageAbsoluteMagnetisation = isingAbsoluteMagnetisationAnalyzer->getAverage();
      errorOfAbsoluteMagnetisation = isingAbsoluteMagnetisationAnalyzer->getError();
      autoCorrelationTimeOfAbsoluteMagnetisation = isingAbsoluteMagnetisationAnalyzer->getAutoCorrelationTime();
      delete isingAbsoluteMagnetisationAnalyzer;

      IsingAbsoluteSusceptibilityAnalyzer *isingAbsoluteSusceptibilityAnalyzer = new IsingAbsoluteSusceptibilityAnalyzer(this, lattice);
      isingAbsoluteSusceptibilityAnalyzer->analyze();
      averageAbsoluteSusceptibility = isingAbsoluteSusceptibilityAnalyzer->getAverage();
      errorOfAbsoluteSusceptibility = isingAbsoluteSusceptibilityAnalyzer->getError();
      autoCorrelationTimeOfAbsoluteSusceptibility = isingAbsoluteSusceptibilityAnalyzer->getAutoCorrelationTime();
      delete isingAbsoluteSusceptibilityAnalyzer;
      
    };