Ejemplo n.º 1
0
void GenCollectorPolicy::initialize_flags() {
  // All sizes must be multiples of the generation granularity.
  set_min_alignment((uintx) Generation::GenGrain);
  set_max_alignment(compute_max_alignment());
  assert(max_alignment() >= min_alignment() &&
         max_alignment() % min_alignment() == 0,
         "invalid alignment constraints");

  CollectorPolicy::initialize_flags();

  // All generational heaps have a youngest gen; handle those flags here.

  // Adjust max size parameters
  if (NewSize > MaxNewSize) {
    MaxNewSize = NewSize;
  }
  NewSize = align_size_down(NewSize, min_alignment());
  MaxNewSize = align_size_down(MaxNewSize, min_alignment());

  // Check validity of heap flags
  assert(NewSize     % min_alignment() == 0, "eden space alignment");
  assert(MaxNewSize  % min_alignment() == 0, "survivor space alignment");

  if (NewSize < 3*min_alignment()) {
     // make sure there room for eden and two survivor spaces
    vm_exit_during_initialization("Too small new size specified");
  }
  if (SurvivorRatio < 1 || NewRatio < 1) {
    vm_exit_during_initialization("Invalid heap ratio specified");
  }
}
Ejemplo n.º 2
0
void CollectorPolicy::initialize_flags() {
  if (PermSize > MaxPermSize) {
    MaxPermSize = PermSize;
  }
  PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment()));
  MaxPermSize = align_size_up(MaxPermSize, max_alignment());

  MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment()));
  MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment()));

  MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment());

  SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment());
  SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment());
  SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment());

  assert(PermSize    % min_alignment() == 0, "permanent space alignment");
  assert(MaxPermSize % max_alignment() == 0, "maximum permanent space alignment");
  assert(SharedReadOnlySize % max_alignment() == 0, "read-only space alignment");
  assert(SharedReadWriteSize % max_alignment() == 0, "read-write space alignment");
  assert(SharedMiscDataSize % max_alignment() == 0, "misc-data space alignment");
  if (PermSize < M) {
    vm_exit_during_initialization("Too small initial permanent heap");
  }
}
Ejemplo n.º 3
0
/**
 * 检查/调整永久代的内存配置
 */
void CollectorPolicy::initialize_flags() {
  if (PermSize > MaxPermSize) {
    MaxPermSize = PermSize;
  }

  PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment()));
  // Don't increase Perm size limit above specified.
  MaxPermSize = align_size_down(MaxPermSize, max_alignment());
  if (PermSize > MaxPermSize) {
    PermSize = MaxPermSize;
  }

  MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment()));
  MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment()));

  MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment());

  SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment());
  SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment());
  SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment());

  assert(PermSize    % min_alignment() == 0, "permanent space alignment");
  assert(MaxPermSize % max_alignment() == 0, "maximum permanent space alignment");
  assert(SharedReadOnlySize % max_alignment() == 0, "read-only space alignment");
  assert(SharedReadWriteSize % max_alignment() == 0, "read-write space alignment");
  assert(SharedMiscDataSize % max_alignment() == 0, "misc-data space alignment");
  if (PermSize < M) {
	printf("%s[%d] [tid: %lu]: 永久代配置太小: PermSize(%lu) < M(%lu).\n", __FILE__, __LINE__, pthread_self(), PermSize, M);
    vm_exit_during_initialization("Too small initial permanent heap");
  }

}
Ejemplo n.º 4
0
void TwoGenerationCollectorPolicy::initialize_flags() {
  GenCollectorPolicy::initialize_flags();

  OldSize = align_size_down(OldSize, min_alignment());
  if (NewSize + OldSize > MaxHeapSize) {
    MaxHeapSize = NewSize + OldSize;
  }
  MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());

  always_do_update_barrier = UseConcMarkSweepGC;

  // Check validity of heap flags
  assert(OldSize     % min_alignment() == 0, "old space alignment");
  assert(MaxHeapSize % max_alignment() == 0, "maximum heap alignment");
}
Ejemplo n.º 5
0
void TwoGenerationCollectorPolicy::initialize_size_info() {
  // User inputs from -mx and ms are aligned
  MaxNewSize = align_size_down(MaxNewSize, min_alignment());
  uintx initial_heap_size = align_size_up(Arguments::initial_heap_size(), min_alignment());
  uintx max_heap_size     = align_size_up(MaxHeapSize, max_alignment());

#ifndef COMPILER2    // Don't degrade server performance for footprint
  if (FLAG_IS_DEFAULT(UseMPSS) && max_heap_size < LargePageHeapSizeThreshold) {
    // No need for large granularity pages w/small heaps.
    UseMPSS = false;
  }
#endif

  // Check validity of heap parameters from launcher
  if (initial_heap_size == 0) {
    initial_heap_size = NewSize + OldSize;
  } else {
    Universe::check_alignment(initial_heap_size, min_alignment(), "initial heap");
  }

  // Check heap parameter properties
  if (initial_heap_size < M) {
    vm_exit_during_initialization("Too small initial heap");
  }
  if (initial_heap_size <= NewSize) {
     // make sure there is at least some room in old space
    vm_exit_during_initialization("Too small initial heap for new size specified");
  }
  if (max_heap_size < initial_heap_size) {
    vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified");
  }

  // Minimum sizes of the generations may be different than
  // the initial sizes.
  _min_gen0_size = NewSize;
  _min_gen1_size = OldSize;

  // Parameters are valid, compute area sizes.
  size_t max_new_size = align_size_down(max_heap_size / (NewRatio+1),
					min_alignment());
  max_new_size = MIN2(MAX2(max_new_size, _min_gen0_size), MaxNewSize);

  size_t desired_new_size = align_size_down(initial_heap_size / (NewRatio+1),
					    min_alignment());

  size_t new_size = MIN2(MAX2(desired_new_size, _min_gen0_size), max_new_size);
  // I'm putting this in to make sure the compilation of the code above is
  // correct.  At times, it hasn't been. -dld 04/00.
  guarantee(new_size <= max_new_size &&
	    new_size <= MAX2(desired_new_size, _min_gen0_size),
	    "Or what gives");


  _initial_gen0_size = new_size;
  _max_gen0_size = max_new_size;

  _initial_gen1_size = initial_heap_size - new_size;
  _max_gen1_size = max_heap_size - max_new_size;
}
Ejemplo n.º 6
0
void CollectorPolicy::initialize_size_info() {
  // User inputs from -mx and ms are aligned
  set_initial_heap_byte_size(InitialHeapSize);
  if (initial_heap_byte_size() == 0) {
    set_initial_heap_byte_size(NewSize + OldSize);
  }
  set_initial_heap_byte_size(align_size_up(_initial_heap_byte_size,
                                           min_alignment()));

  set_min_heap_byte_size(Arguments::min_heap_size());
  if (min_heap_byte_size() == 0) {
    set_min_heap_byte_size(NewSize + OldSize);
  }
  set_min_heap_byte_size(align_size_up(_min_heap_byte_size,
                                       min_alignment()));

  set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment()));

  // Check heap parameter properties
  if (initial_heap_byte_size() < M) {
    vm_exit_during_initialization("Too small initial heap");
  }
  // Check heap parameter properties
  if (min_heap_byte_size() < M) {
    vm_exit_during_initialization("Too small minimum heap");
  }
  if (initial_heap_byte_size() <= NewSize) {
     // make sure there is at least some room in old space
    vm_exit_during_initialization("Too small initial heap for new size specified");
  }
  if (max_heap_byte_size() < min_heap_byte_size()) {
    vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified");
  }
  if (initial_heap_byte_size() < min_heap_byte_size()) {
    vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified");
  }
  if (max_heap_byte_size() < initial_heap_byte_size()) {
    vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified");
  }

  if (PrintGCDetails && Verbose) {
    gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT "  Initial heap "
      SIZE_FORMAT "  Maximum heap " SIZE_FORMAT,
      min_heap_byte_size(), initial_heap_byte_size(), max_heap_byte_size());
  }
}
Ejemplo n.º 7
0
void TwoGenerationCollectorPolicy::initialize_flags() {
  // All space sizes must be multiples of car size in order for the
  // CarTable to work.  Similarly with the should_scavenge region size.
  set_min_alignment(MAX2((uintx) CarSpace::car_size(), (uintx) Generation::GenGrain));

  // The card marking array and the offset arrays for old generations are
  // committed in os pages as well. Make sure they are entirely full (to
  // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
  // byte entry and the os page size is 4096, the maximum heap size should
  // be 512*4096 = 2MB aligned.
  set_max_alignment(GenRemSet::max_alignment_constraint(rem_set_name()));
  assert(max_alignment() >= min_alignment() && max_alignment() % min_alignment() == 0, "invalid alignment constraints");

  // Adjust max size parameters
  if (NewSize > MaxNewSize) {
    MaxNewSize = NewSize;
  }
  NewSize = align_size_down(NewSize, min_alignment());
  MaxNewSize = align_size_down(MaxNewSize, min_alignment());

  OldSize = align_size_down(OldSize, min_alignment());
  if (NewSize + OldSize > MaxHeapSize) {
    MaxHeapSize = NewSize + OldSize;
  }
  MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());

  if (PermSize > MaxPermSize) {
    MaxPermSize = PermSize;
  }
  PermSize = align_size_down(PermSize, min_alignment());
  MaxPermSize = align_size_down(MaxPermSize, max_alignment());

  MinPermHeapExpansion = align_size_down(MinPermHeapExpansion, min_alignment());
  MaxPermHeapExpansion = align_size_down(MaxPermHeapExpansion, min_alignment());

  MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment());

  always_do_update_barrier = UseConcMarkSweepGC;
  BlockOffsetArrayUseUnallocatedBlock |= ParallelGCThreads > 0;

  SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment());
  SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment());
  SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment());

  // Check validity of heap flags
  assert(NewSize     % min_alignment() == 0, "eden space alignment");
  assert(MaxNewSize  % min_alignment() == 0, "survivor space alignment");
  assert(OldSize     % min_alignment() == 0, "old space alignment");
  assert(MaxHeapSize % max_alignment() == 0, "maximum heap alignment");
  assert(PermSize    % min_alignment() == 0, "permanent space alignment");
  assert(MaxPermSize % max_alignment() == 0, "maximum permanent space alignment");
  assert(SharedReadOnlySize % max_alignment() == 0, "read-only space alignment");
  assert(SharedReadWriteSize % max_alignment() == 0, "read-write space alignment");
  assert(SharedMiscDataSize % max_alignment() == 0, "misc-data space alignment");

  if (NewSize < 3*min_alignment()) {
     // make sure there room for eden and two survivor spaces
    vm_exit_during_initialization("Too small new size specified");
  }
  if (PermSize < M) {
    vm_exit_during_initialization("Too small initial permanent heap");
  }
  if (SurvivorRatio < 1 || NewRatio < 1) {
    vm_exit_during_initialization("Invalid heap ratio specified");
  }
}
Ejemplo n.º 8
0
void CollectorPolicy::initialize_flags() {
  assert(max_alignment() >= min_alignment(),
      err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT,
          max_alignment(), min_alignment()));
  assert(max_alignment() % min_alignment() == 0,
      err_msg("max_alignment: " SIZE_FORMAT " not aligned by min_alignment: " SIZE_FORMAT,
          max_alignment(), min_alignment()));

  if (PermSize > MaxPermSize) {
    MaxPermSize = PermSize;
  }
  PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment()));
  // Don't increase Perm size limit above specified.
  MaxPermSize = align_size_down(MaxPermSize, max_alignment());
  if (PermSize > MaxPermSize) {
    PermSize = MaxPermSize;
  }

  MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment()));
  MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment()));

  MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment());

  SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment());
  SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment());
  SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment());

  assert(PermSize    % min_alignment() == 0, "permanent space alignment");
  assert(MaxPermSize % max_alignment() == 0, "maximum permanent space alignment");
  assert(SharedReadOnlySize % max_alignment() == 0, "read-only space alignment");
  assert(SharedReadWriteSize % max_alignment() == 0, "read-write space alignment");
  assert(SharedMiscDataSize % max_alignment() == 0, "misc-data space alignment");
  if (PermSize < M) {
    vm_exit_during_initialization("Too small initial permanent heap");
  }
}