Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276301: G1: Refine implementation of G1CardSetFreePool::memory_sizes()

Changes from all commits
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -140,13 +140,6 @@ G1CardSetMemoryStats::G1CardSetMemoryStats() {

G1CardSetMemoryStats::G1CardSetMemoryStats(void(*fn)(const void*,uint,size_t&,size_t&), const void* context) {
for (uint i = 0; i < num_pools(); i++) {
fn(context, i, _num_mem_sizes[i], _num_buffers[i]);

void G1CardSetMemoryStats::clear() {
for (uint i = 0; i < num_pools(); i++) {
_num_mem_sizes[i] = 0;
@@ -277,17 +270,14 @@ G1CardSetFreePool::~G1CardSetFreePool() {
FREE_C_HEAP_ARRAY(mtGC, _free_lists);

static void collect_mem_sizes(const void* context, uint i, size_t& mem_size, size_t& num_buffers) {
((G1CardSetFreePool*)context)->get_size(i, mem_size, num_buffers);

void G1CardSetFreePool::get_size(uint i, size_t& mem_size, size_t& num_buffers) const {
mem_size = _free_lists[i].mem_size();
num_buffers = _free_lists[i].num_buffers();

G1CardSetMemoryStats G1CardSetFreePool::memory_sizes() const {
return G1CardSetMemoryStats(collect_mem_sizes, this);
G1CardSetMemoryStats free_list_stats;
assert(free_list_stats.num_pools() == num_free_lists(), "must be");
for (uint i = 0; i < num_free_lists(); i++) {
free_list_stats._num_mem_sizes[i] = _free_lists[i].mem_size();
free_list_stats._num_buffers[i] = _free_lists[i].num_buffers();
return free_list_stats;

size_t G1CardSetFreePool::mem_size() const {
@@ -149,9 +149,6 @@ class G1CardSetMemoryStats {

// Returns all-zero statistics.
// For every element in the set (indicated by i), call fn to provide the
// memory size and number of buffers for that i'th buffer list.
G1CardSetMemoryStats(void (*fn)(const void* context, uint i, size_t& mem_size, size_t& num_buffers), const void* context);

void add(G1CardSetMemoryStats const other) {
STATIC_ASSERT(ARRAY_SIZE(_num_buffers) == ARRAY_SIZE(_num_mem_sizes));
@@ -171,7 +168,7 @@ class G1CardSetFreePool {
// The global free pool.
static G1CardSetFreePool _freelist_pool;

uint _num_free_lists;
const uint _num_free_lists;
G1CardSetBufferList* _free_lists;

@@ -193,9 +190,6 @@ class G1CardSetFreePool {

uint num_free_lists() const { return _num_free_lists; }

// Return sizes for free list i in this free list pool.
void get_size(uint i, size_t& mem_size, size_t& num_buffers) const;

G1CardSetMemoryStats memory_sizes() const;
size_t mem_size() const;