Skip to content
Permalink
Browse files

8242229: Shenandoah: inline ShenandoahHeapRegion liveness-related met…

…hods

Reviewed-by: rkennke
  • Loading branch information
shipilev committed Apr 6, 2020
1 parent e3aae42 commit c1016d5de25c1b8e331ae180cf9601ba007b54d7
@@ -27,7 +27,7 @@
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "utilities/quickSort.hpp"
@@ -26,7 +26,7 @@

#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "runtime/os.hpp"
@@ -27,7 +27,7 @@
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"

@@ -26,7 +26,7 @@

#include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp"
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"

@@ -27,7 +27,7 @@
#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp"
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"

@@ -26,6 +26,7 @@

#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "runtime/atomic.hpp"
@@ -44,7 +44,7 @@
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahIUMode.hpp"
#include "gc/shenandoah/shenandoahMarkCompact.hpp"
@@ -299,10 +299,6 @@ void ShenandoahHeapRegion::make_committed_bypass() {
}
}

void ShenandoahHeapRegion::clear_live_data() {
Atomic::release_store_fence(&_live_data, (size_t)0);
}

void ShenandoahHeapRegion::reset_alloc_metadata() {
_tlab_allocs = 0;
_gclab_allocs = 0;
@@ -325,26 +321,6 @@ void ShenandoahHeapRegion::set_live_data(size_t s) {
_live_data = (s >> LogHeapWordSize);
}

size_t ShenandoahHeapRegion::get_live_data_words() const {
return Atomic::load_acquire(&_live_data);
}

size_t ShenandoahHeapRegion::get_live_data_bytes() const {
return get_live_data_words() * HeapWordSize;
}

bool ShenandoahHeapRegion::has_live() const {
return get_live_data_words() != 0;
}

size_t ShenandoahHeapRegion::garbage() const {
assert(used() >= get_live_data_bytes(), "Live Data must be a subset of used() live: " SIZE_FORMAT " used: " SIZE_FORMAT,
get_live_data_bytes(), used());

size_t result = used() - get_live_data_bytes();
return result;
}

void ShenandoahHeapRegion::print_on(outputStream* st) const {
st->print("|");
st->print(SIZE_FORMAT_W(5), this->_index);
@@ -335,7 +335,7 @@ class ShenandoahHeapRegion {
// Allocation (return NULL if full)
inline HeapWord* allocate(size_t word_size, ShenandoahAllocRequest::Type type);

void clear_live_data();
inline void clear_live_data();
void set_live_data(size_t s);

// Increase live data for newly allocated region
@@ -344,13 +344,13 @@ class ShenandoahHeapRegion {
// Increase live data for region scanned with GC
inline void increase_live_data_gc_words(size_t s);

bool has_live() const;
size_t get_live_data_bytes() const;
size_t get_live_data_words() const;
inline bool has_live() const;
inline size_t get_live_data_bytes() const;
inline size_t get_live_data_words() const;

void print_on(outputStream* st) const;
inline size_t garbage() const;

size_t garbage() const;
void print_on(outputStream* st) const;

void recycle();

@@ -89,4 +89,29 @@ inline void ShenandoahHeapRegion::internal_increase_live_data(size_t s) {
#endif
}

inline void ShenandoahHeapRegion::clear_live_data() {
Atomic::release_store_fence(&_live_data, (size_t)0);
}

inline size_t ShenandoahHeapRegion::get_live_data_words() const {
return Atomic::load_acquire(&_live_data);
}

inline size_t ShenandoahHeapRegion::get_live_data_bytes() const {
return get_live_data_words() * HeapWordSize;
}

inline bool ShenandoahHeapRegion::has_live() const {
return get_live_data_words() != 0;
}

inline size_t ShenandoahHeapRegion::garbage() const {
assert(used() >= get_live_data_bytes(),
"Live Data must be a subset of used() live: " SIZE_FORMAT " used: " SIZE_FORMAT,
get_live_data_bytes(), used());

size_t result = used() - get_live_data_bytes();
return result;
}

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGION_INLINE_HPP
@@ -24,7 +24,7 @@

#include "precompiled.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahHeapRegionCounters.hpp"
#include "memory/resourceArea.hpp"
@@ -28,7 +28,7 @@
#include "gc/shenandoah/shenandoahCollectionSet.inline.hpp"
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeuristics.hpp"
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
#include "logging/log.hpp"
@@ -36,6 +36,7 @@
#include "gc/shenandoah/shenandoahMarkCompact.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeuristics.hpp"
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
@@ -29,6 +29,7 @@
#include "gc/shenandoah/shenandoahForwarding.inline.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahRootProcessor.hpp"
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"

0 comments on commit c1016d5

Please sign in to comment.