当前位置: 首页>>代码示例>>C++>>正文


C++ Generation类代码示例

本文整理汇总了C++中Generation的典型用法代码示例。如果您正苦于以下问题:C++ Generation类的具体用法?C++ Generation怎么用?C++ Generation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Generation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m

void G1MarkSweep::mark_sweep_phase2() {
  // Now all live objects are marked, compute the new object addresses.

  // It is imperative that we traverse perm_gen LAST. If dead space is
  // allowed a range of dead object may get overwritten by a dead int
  // array. If perm_gen is not traversed last a klassOop may get
  // overwritten. This is fine since it is dead, but if the class has dead
  // instances we have to skip them, and in order to find their size we
  // need the klassOop!
  //
  // It is not required that we traverse spaces in the same order in
  // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
  // tracking expects us to do so. See comment under phase4.

  G1CollectedHeap* g1h = G1CollectedHeap::heap();
  Generation* pg = g1h->perm_gen();

  EventMark m("2 compute new addresses");
  TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
  GenMarkSweep::trace("2");

  FindFirstRegionClosure cl;
  g1h->heap_region_iterate(&cl);
  HeapRegion *r = cl.result();
  CompactibleSpace* sp = r;
  if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) {
    sp = r->next_compaction_space();
  }

  G1PrepareCompactClosure blk(sp);
  g1h->heap_region_iterate(&blk);

  CompactPoint perm_cp(pg, NULL, NULL);
  pg->prepare_for_compaction(&perm_cp);
}
开发者ID:ismo1652,项目名称:jvmnotebook,代码行数:35,代码来源:g1MarkSweep.cpp

示例2: clear_into_younger

void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
  GenCollectedHeap* gch = GenCollectedHeap::heap();
  // Generations younger than gen have been evacuated. We can clear
  // card table entries for gen (we know that it has no pointers
  // to younger gens) and for those below. The card tables for
  // the youngest gen need never be cleared, and those for perm gen
  // will be cleared based on the parameter clear_perm.
  // There's a bit of subtlety in the clear() and invalidate()
  // methods that we exploit here and in invalidate_or_clear()
  // below to avoid missing cards at the fringes. If clear() or
  // invalidate() are changed in the future, this code should
  // be revisited. 20040107.ysr
  Generation* g = gen;
  for(Generation* prev_gen = gch->prev_gen(g);
      prev_gen != NULL;
      g = prev_gen, prev_gen = gch->prev_gen(g)) {
    MemRegion to_be_cleared_mr = g->prev_used_region();
    clear(to_be_cleared_mr);
  }
  // Clear perm gen cards if asked to do so.
  if (clear_perm) {
    MemRegion to_be_cleared_mr = gch->perm_gen()->prev_used_region();
    clear(to_be_cleared_mr);
  }
}
开发者ID:AllenWeb,项目名称:jdk7u-hotspot,代码行数:25,代码来源:cardTableRS.cpp

示例3: invalidate_or_clear

void CardTableRS::invalidate_or_clear(Generation* gen, bool younger,
                                      bool perm) {
  GenCollectedHeap* gch = GenCollectedHeap::heap();
  // For each generation gen (and younger and/or perm)
  // invalidate the cards for the currently occupied part
  // of that generation and clear the cards for the
  // unoccupied part of the generation (if any, making use
  // of that generation's prev_used_region to determine that
  // region). No need to do anything for the youngest
  // generation. Also see note#20040107.ysr above.
  Generation* g = gen;
  for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL;
      g = prev_gen, prev_gen = gch->prev_gen(g))  {
    MemRegion used_mr = g->used_region();
    MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
    if (!to_be_cleared_mr.is_empty()) {
      clear(to_be_cleared_mr);
    }
    invalidate(used_mr);
    if (!younger) break;
  }
  // Clear perm gen cards if asked to do so.
  if (perm) {
    g = gch->perm_gen();
    MemRegion used_mr = g->used_region();
    MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
    if (!to_be_cleared_mr.is_empty()) {
      clear(to_be_cleared_mr);
    }
    invalidate(used_mr);
  }
}
开发者ID:AllenWeb,项目名称:jdk7u-hotspot,代码行数:32,代码来源:cardTableRS.cpp

示例4: random_generation

Generation random_generation(int size, int code_length)
{
    Generation gen;

    while (size--)
        //Add a newprogram
        gen.push_back(random_chromosome(code_length));

    return gen;
}
开发者ID:Zenol,项目名称:brainfuck-genetic,代码行数:10,代码来源:Genetic.cpp

示例5: clear_into_gen_and_younger

void CardTableRS::clear_into_gen_and_younger(Generation* gen) {
  GenCollectedHeap* gch = GenCollectedHeap::heap();
  // Gen and all younger have been evacuated. We can clear
  // remembered set entries for the next highest generation
  // (we know that it has no pointers to younger gens) and
  // those below.
  Generation* g = gch->next_gen(gen);
  while (g != NULL) {
    clear(g->reserved());
    g = gch->prev_gen(gen);
  }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:12,代码来源:cardTableRS.cpp

示例6: expand_heap_and_allocate

HeapWord* GenCollectorPolicy::expand_heap_and_allocate(size_t size,
                                                       bool   is_tlab) {
  GenCollectedHeap *gch = GenCollectedHeap::heap();
  HeapWord* result = NULL;
  for (int i = number_of_generations() - 1; i >= 0 && result == NULL; i--) {
    Generation *gen = gch->get_gen(i);
    if (gen->should_allocate(size, is_tlab)) {
      result = gen->expand_and_allocate(size, is_tlab);
    }
  }
  assert(result == NULL || gch->is_in_reserved(result), "result not in heap");
  return result;
}
开发者ID:MyProgrammingStyle,项目名称:hotspot,代码行数:13,代码来源:collectorPolicy.cpp

示例7: gaoptimize

genetic::Cell genetic::gaoptimize()
{
  //srand(seed);
  Generation ancestor;

  for(int g = 0; g < gainput.max_generation; ++g)
  {
    Generation nextgen;
    nextgen.Generate(ancestor);
    ancestor = nextgen;
  }

  return ancestor.Min();
}
开发者ID:qiaoni-chen,项目名称:Block,代码行数:14,代码来源:GAOptimize.C

示例8: _Size

status_t
DynamicThreadVector::_ResizeVector(unsigned minimumSize)
{
	static const unsigned kInitialSize = 4;
	unsigned size = std::max(minimumSize, kInitialSize);
	unsigned oldSize = _Size();
	if (size <= oldSize)
		return B_OK;

	void* newVector = realloc(*fVector, (size + 1) * sizeof(TLSBlock));
	if (newVector == NULL)
		return B_NO_MEMORY;

	*fVector = (TLSBlock*)newVector;
	memset(*fVector + oldSize + 1, 0, (size - oldSize) * sizeof(TLSBlock));
	if (fGeneration == NULL) {
		fGeneration = new Generation;
		if (fGeneration == NULL)
			return B_NO_MEMORY;
	}

	*(Generation**)*fVector = fGeneration;
	fGeneration->SetSize(size);

	return B_OK;
}
开发者ID:looncraz,项目名称:haiku,代码行数:26,代码来源:elf_tls.cpp

示例9: unsigned

unsigned
DynamicThreadVector::_Generation() const
{
	if (fGeneration != NULL)
		return fGeneration->Counter();
	return unsigned(-1);
}
开发者ID:looncraz,项目名称:haiku,代码行数:7,代码来源:elf_tls.cpp

示例10:

TLSBlock&
DynamicThreadVector::operator[](unsigned dso)
{
	unsigned generation = TLSBlockTemplates::Get().GetGeneration(-1);
	if (_Generation() < generation) {
		for (unsigned i = 0; i < _Size(); i++) {
			TLSBlock& block = (*fVector)[i + 1];
			unsigned dsoGeneration
				= TLSBlockTemplates::Get().GetGeneration(dso);
			if (_Generation() < dsoGeneration && dsoGeneration <= generation)
				block.Destroy();
		}

		fGeneration->SetCounter(generation);
	}

	if (_Size() <= dso) {
		status_t result = _ResizeVector(dso + 1);
		if (result != B_OK)
			return fNullBlock;
	}

	TLSBlock& block = (*fVector)[dso + 1];
	if (block.IsInvalid()) {
		status_t result = block.Initialize(dso);
		if (result != B_OK)
			return fNullBlock;
	};

	return block;
}
开发者ID:looncraz,项目名称:haiku,代码行数:31,代码来源:elf_tls.cpp

示例11: score_generation

ScoredGeneration score_generation(const Generation &generation,
                                  std::function<unsigned int(Code)> fitness_fct)
{
    ScoredGeneration scored_generation;
    for (int i = 0; i < generation.size(); i++)
    {
        auto fitness = fitness_fct(generation[i]);
        scored_generation.push_back(std::make_pair(fitness, generation[i]));
    }
    return scored_generation;
}
开发者ID:Zenol,项目名称:brainfuck-genetic,代码行数:11,代码来源:Genetic.cpp

示例12: blk

void CardTableRS::verify() {
  // At present, we only know how to verify the card table RS for
  // generational heaps.
  VerifyCTGenClosure blk(this);
  CollectedHeap* ch = Universe::heap();
  // We will do the perm-gen portion of the card table, too.
  Generation* pg = SharedHeap::heap()->perm_gen();
  HeapWord* pg_boundary = pg->reserved().start();

  if (ch->kind() == CollectedHeap::GenCollectedHeap) {
    GenCollectedHeap::heap()->generation_iterate(&blk, false);
    _ct_bs->verify();

    // If the old gen collections also collect perm, then we are only
    // interested in perm-to-young pointers, not perm-to-old pointers.
    GenCollectedHeap* gch = GenCollectedHeap::heap();
    CollectorPolicy* cp = gch->collector_policy();
    if (cp->is_mark_sweep_policy() || cp->is_concurrent_mark_sweep_policy()) {
      pg_boundary = gch->get_gen(1)->reserved().start();
    }
  }
  VerifyCTSpaceClosure perm_space_blk(this, pg_boundary);
  SharedHeap::heap()->perm_gen()->space_iterate(&perm_space_blk, true);
}
开发者ID:AllenWeb,项目名称:jdk7u-hotspot,代码行数:24,代码来源:cardTableRS.cpp

示例13: expand_heap_and_allocate

HeapWord* GenCollectorPolicy::expand_heap_and_allocate(size_t size,
                                                       bool   is_tlab) {
  GenCollectedHeap *gch = GenCollectedHeap::heap();
  HeapWord* result = NULL;
  Generation *old = gch->old_gen();
  if (old->should_allocate(size, is_tlab)) {
    result = old->expand_and_allocate(size, is_tlab);
  }
  if (result == NULL) {
    Generation *young = gch->young_gen();
    if (young->should_allocate(size, is_tlab)) {
      result = young->expand_and_allocate(size, is_tlab);
    }
  }
  assert(result == NULL || gch->is_in_reserved(result), "result not in heap");
  return result;
}
开发者ID:netroby,项目名称:jdk9-dev,代码行数:17,代码来源:collectorPolicy.cpp

示例14: object_iterate

 virtual void object_iterate(ObjectClosure* cl) {
   Generation* g = as_gen();
   assert(g != NULL, "as_gen() NULL");
   g->object_iterate(cl);
 }
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:5,代码来源:permGen.hpp

示例15: update_counters

 // Performance Counter support
 virtual void update_counters() {
   Generation* g = as_gen();
   assert(g != NULL, "as_gen() NULL");
   g->update_counters();
 }
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:6,代码来源:permGen.hpp


注:本文中的Generation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。