mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-07 05:28:52 +00:00
8073632: Make auxiliary data structures know their own translation factor
Auxiliary data structures should have knowledge of their own requirements for virtual memory reservations instead of getting these values directly from various places. Reviewed-by: stefank, kbarrett
This commit is contained in:
parent
689d9a58b1
commit
e08169c253
@ -139,6 +139,11 @@ class CMBitMap : public CMBitMapRO {
|
||||
static size_t compute_size(size_t heap_size);
|
||||
// Returns the amount of bytes on the heap between two marks in the bitmap.
|
||||
static size_t mark_distance();
|
||||
// Returns how many bytes (or bits) of the heap a single byte (or bit) of the
|
||||
// mark bitmap corresponds to. This is the same as the mark distance above.
|
||||
static size_t heap_map_factor() {
|
||||
return mark_distance();
|
||||
}
|
||||
|
||||
CMBitMap() : CMBitMapRO(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); }
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -179,6 +179,11 @@ public:
|
||||
return ReservedSpace::allocation_align_size_up(number_of_slots);
|
||||
}
|
||||
|
||||
// Returns how many bytes of the heap a single byte of the BOT corresponds to.
|
||||
static size_t heap_map_factor() {
|
||||
return N_bytes;
|
||||
}
|
||||
|
||||
enum SomePublicConstants {
|
||||
LogN = 9,
|
||||
LogN_words = LogN - LogHeapWordSize,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,6 +39,17 @@ void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_re
|
||||
_counts->clear_range(mr);
|
||||
}
|
||||
|
||||
size_t G1CardCounts::compute_size(size_t mem_region_size_in_words) {
|
||||
// We keep card counts for every card, so the size of the card counts table must
|
||||
// be the same as the card table.
|
||||
return G1SATBCardTableLoggingModRefBS::compute_size(mem_region_size_in_words);
|
||||
}
|
||||
|
||||
size_t G1CardCounts::heap_map_factor() {
|
||||
// See G1CardCounts::compute_size() why we reuse the card table value.
|
||||
return G1SATBCardTableLoggingModRefBS::heap_map_factor();
|
||||
}
|
||||
|
||||
void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
|
||||
if (has_count_table()) {
|
||||
assert(from_card_num < to_card_num,
|
||||
|
||||
@ -101,6 +101,14 @@ class G1CardCounts: public CHeapObj<mtGC> {
|
||||
public:
|
||||
G1CardCounts(G1CollectedHeap* g1h);
|
||||
|
||||
// Return the number of slots needed for a card counts table
|
||||
// that covers mem_region_words words.
|
||||
static size_t compute_size(size_t mem_region_size_in_words);
|
||||
|
||||
// Returns how many bytes of the heap a single byte of the card counts table
|
||||
// corresponds to.
|
||||
static size_t heap_map_factor();
|
||||
|
||||
void initialize(G1RegionToSpaceMapper* mapper);
|
||||
|
||||
// Increments the refinement count for the given card.
|
||||
|
||||
@ -1890,24 +1890,24 @@ jint G1CollectedHeap::initialize() {
|
||||
G1RegionToSpaceMapper* bot_storage =
|
||||
create_aux_memory_mapper("Block offset table",
|
||||
G1BlockOffsetSharedArray::compute_size(g1_rs.size() / HeapWordSize),
|
||||
G1BlockOffsetSharedArray::N_bytes);
|
||||
G1BlockOffsetSharedArray::heap_map_factor());
|
||||
|
||||
ReservedSpace cardtable_rs(G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize));
|
||||
G1RegionToSpaceMapper* cardtable_storage =
|
||||
create_aux_memory_mapper("Card table",
|
||||
G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize),
|
||||
G1BlockOffsetSharedArray::N_bytes);
|
||||
G1SATBCardTableLoggingModRefBS::heap_map_factor());
|
||||
|
||||
G1RegionToSpaceMapper* card_counts_storage =
|
||||
create_aux_memory_mapper("Card counts table",
|
||||
G1BlockOffsetSharedArray::compute_size(g1_rs.size() / HeapWordSize),
|
||||
G1BlockOffsetSharedArray::N_bytes);
|
||||
G1CardCounts::compute_size(g1_rs.size() / HeapWordSize),
|
||||
G1CardCounts::heap_map_factor());
|
||||
|
||||
size_t bitmap_size = CMBitMap::compute_size(g1_rs.size());
|
||||
G1RegionToSpaceMapper* prev_bitmap_storage =
|
||||
create_aux_memory_mapper("Prev Bitmap", bitmap_size, CMBitMap::mark_distance());
|
||||
create_aux_memory_mapper("Prev Bitmap", bitmap_size, CMBitMap::heap_map_factor());
|
||||
G1RegionToSpaceMapper* next_bitmap_storage =
|
||||
create_aux_memory_mapper("Next Bitmap", bitmap_size, CMBitMap::mark_distance());
|
||||
create_aux_memory_mapper("Next Bitmap", bitmap_size, CMBitMap::heap_map_factor());
|
||||
|
||||
_hrm.initialize(heap_storage, prev_bitmap_storage, next_bitmap_storage, bot_storage, cardtable_storage, card_counts_storage);
|
||||
g1_barrier_set()->initialize(cardtable_storage);
|
||||
|
||||
@ -153,6 +153,11 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
|
||||
return ReservedSpace::allocation_align_size_up(number_of_slots);
|
||||
}
|
||||
|
||||
// Returns how many bytes of the heap a single byte of the Card Table corresponds to.
|
||||
static size_t heap_map_factor() {
|
||||
return CardTableModRefBS::card_size;
|
||||
}
|
||||
|
||||
G1SATBCardTableLoggingModRefBS(MemRegion whole_heap);
|
||||
|
||||
virtual void initialize() { }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user