src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
changeset 59249 29b0d0b61615
parent 59247 56bf71d64d51
child 59250 a6deb69743d4
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
   618   assert_heaplock_or_safepoint();
   618   assert_heaplock_or_safepoint();
   619   _committed -= bytes;
   619   _committed -= bytes;
   620 }
   620 }
   621 
   621 
   622 void ShenandoahHeap::increase_used(size_t bytes) {
   622 void ShenandoahHeap::increase_used(size_t bytes) {
   623   Atomic::add(bytes, &_used);
   623   Atomic::add(&_used, bytes);
   624 }
   624 }
   625 
   625 
   626 void ShenandoahHeap::set_used(size_t bytes) {
   626 void ShenandoahHeap::set_used(size_t bytes) {
   627   Atomic::release_store_fence(&_used, bytes);
   627   Atomic::release_store_fence(&_used, bytes);
   628 }
   628 }
   631   assert(used() >= bytes, "never decrease heap size by more than we've left");
   631   assert(used() >= bytes, "never decrease heap size by more than we've left");
   632   Atomic::sub(bytes, &_used);
   632   Atomic::sub(bytes, &_used);
   633 }
   633 }
   634 
   634 
   635 void ShenandoahHeap::increase_allocated(size_t bytes) {
   635 void ShenandoahHeap::increase_allocated(size_t bytes) {
   636   Atomic::add(bytes, &_bytes_allocated_since_gc_start);
   636   Atomic::add(&_bytes_allocated_since_gc_start, bytes);
   637 }
   637 }
   638 
   638 
   639 void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) {
   639 void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) {
   640   size_t bytes = words * HeapWordSize;
   640   size_t bytes = words * HeapWordSize;
   641   if (!waste) {
   641   if (!waste) {
  1348   void work(uint worker_id) {
  1348   void work(uint worker_id) {
  1349     size_t stride = ShenandoahParallelRegionStride;
  1349     size_t stride = ShenandoahParallelRegionStride;
  1350 
  1350 
  1351     size_t max = _heap->num_regions();
  1351     size_t max = _heap->num_regions();
  1352     while (_index < max) {
  1352     while (_index < max) {
  1353       size_t cur = Atomic::add(stride, &_index) - stride;
  1353       size_t cur = Atomic::add(&_index, stride) - stride;
  1354       size_t start = cur;
  1354       size_t start = cur;
  1355       size_t end = MIN2(cur + stride, max);
  1355       size_t end = MIN2(cur + stride, max);
  1356       if (start >= max) break;
  1356       if (start >= max) break;
  1357 
  1357 
  1358       for (size_t i = cur; i < end; i++) {
  1358       for (size_t i = cur; i < end; i++) {