8274988: G1: refine G1SegmentedArrayAllocOptions and G1CardSetAllocOptions
Reviewed-by: tschatzl, ayang
This commit is contained in:
parent
c7a80e60e2
commit
a120937e81
@ -39,6 +39,9 @@ class outputStream;
|
|||||||
// Collects G1CardSetAllocator options/heuristics. Called by G1CardSetAllocator
|
// Collects G1CardSetAllocator options/heuristics. Called by G1CardSetAllocator
|
||||||
// to determine the next size of the allocated G1CardSetBuffer.
|
// to determine the next size of the allocated G1CardSetBuffer.
|
||||||
class G1CardSetAllocOptions : public G1SegmentedArrayAllocOptions {
|
class G1CardSetAllocOptions : public G1SegmentedArrayAllocOptions {
|
||||||
|
static const uint MinimumBufferSize = 8;
|
||||||
|
static const uint MaximumBufferSize = UINT_MAX / 2;
|
||||||
|
|
||||||
uint exponential_expand(uint prev_num_elems) const {
|
uint exponential_expand(uint prev_num_elems) const {
|
||||||
return clamp(prev_num_elems * 2, _initial_num_elems, _max_num_elems);
|
return clamp(prev_num_elems * 2, _initial_num_elems, _max_num_elems);
|
||||||
}
|
}
|
||||||
|
@ -115,15 +115,11 @@ public:
|
|||||||
class G1SegmentedArrayAllocOptions {
|
class G1SegmentedArrayAllocOptions {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint _elem_size;
|
const uint _elem_size;
|
||||||
uint _initial_num_elems;
|
const uint _initial_num_elems;
|
||||||
// Defines a limit to the number of elements in the buffer
|
// Defines a limit to the number of elements in the buffer
|
||||||
uint _max_num_elems;
|
const uint _max_num_elems;
|
||||||
uint _alignment;
|
const uint _alignment;
|
||||||
|
|
||||||
static const uint BufferAlignment = 4;
|
|
||||||
static const uint MinimumBufferSize = 8;
|
|
||||||
static const uint MaximumBufferSize = UINT_MAX / 2;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
G1SegmentedArrayAllocOptions(uint elem_size, uint initial_num_elems, uint max_num_elems, uint alignment) :
|
G1SegmentedArrayAllocOptions(uint elem_size, uint initial_num_elems, uint max_num_elems, uint alignment) :
|
||||||
@ -131,6 +127,10 @@ public:
|
|||||||
_initial_num_elems(initial_num_elems),
|
_initial_num_elems(initial_num_elems),
|
||||||
_max_num_elems(max_num_elems),
|
_max_num_elems(max_num_elems),
|
||||||
_alignment(alignment) {
|
_alignment(alignment) {
|
||||||
|
assert(_elem_size > 0, "Must be");
|
||||||
|
assert(_initial_num_elems > 0, "Must be");
|
||||||
|
assert(_max_num_elems > 0, "Must be");
|
||||||
|
assert(_alignment > 0, "Must be");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint next_num_elems(uint prev_num_elems) const {
|
virtual uint next_num_elems(uint prev_num_elems) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user