mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
6765804: GC "dead ratios" should be unsigned
Reviewed-by: ysr, tonyp
This commit is contained in:
parent
8eb2e02296
commit
401e04572a
6 changed files with 27 additions and 26 deletions
|
@ -90,10 +90,10 @@ void PSMarkSweepDecorator::precompact() {
|
||||||
*/
|
*/
|
||||||
bool skip_dead = ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0);
|
bool skip_dead = ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0);
|
||||||
|
|
||||||
ssize_t allowed_deadspace = 0;
|
size_t allowed_deadspace = 0;
|
||||||
if (skip_dead) {
|
if (skip_dead) {
|
||||||
int ratio = allowed_dead_ratio();
|
const size_t ratio = allowed_dead_ratio();
|
||||||
allowed_deadspace = (space()->capacity_in_bytes() * ratio / 100) / HeapWordSize;
|
allowed_deadspace = space()->capacity_in_words() * ratio / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the current destination decorator
|
// Fetch the current destination decorator
|
||||||
|
@ -271,10 +271,10 @@ void PSMarkSweepDecorator::precompact() {
|
||||||
dest->set_compaction_top(compact_top);
|
dest->set_compaction_top(compact_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PSMarkSweepDecorator::insert_deadspace(ssize_t& allowed_deadspace_words,
|
bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words,
|
||||||
HeapWord* q, size_t deadlength) {
|
HeapWord* q, size_t deadlength) {
|
||||||
allowed_deadspace_words -= deadlength;
|
if (allowed_deadspace_words >= deadlength) {
|
||||||
if (allowed_deadspace_words >= 0) {
|
allowed_deadspace_words -= deadlength;
|
||||||
oop(q)->set_mark(markOopDesc::prototype()->set_marked());
|
oop(q)->set_mark(markOopDesc::prototype()->set_marked());
|
||||||
const size_t aligned_min_int_array_size =
|
const size_t aligned_min_int_array_size =
|
||||||
align_object_size(typeArrayOopDesc::header_size(T_INT));
|
align_object_size(typeArrayOopDesc::header_size(T_INT));
|
||||||
|
|
|
@ -39,14 +39,16 @@ class PSMarkSweepDecorator: public CHeapObj {
|
||||||
HeapWord* _first_dead;
|
HeapWord* _first_dead;
|
||||||
HeapWord* _end_of_live;
|
HeapWord* _end_of_live;
|
||||||
HeapWord* _compaction_top;
|
HeapWord* _compaction_top;
|
||||||
unsigned int _allowed_dead_ratio;
|
size_t _allowed_dead_ratio;
|
||||||
|
|
||||||
bool insert_deadspace(ssize_t& allowed_deadspace_words, HeapWord* q, size_t word_len);
|
bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,
|
||||||
|
size_t word_len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array,
|
PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array,
|
||||||
unsigned int allowed_dead_ratio) :
|
size_t allowed_dead_ratio) :
|
||||||
_space(space), _start_array(start_array), _allowed_dead_ratio(allowed_dead_ratio) { }
|
_space(space), _start_array(start_array),
|
||||||
|
_allowed_dead_ratio(allowed_dead_ratio) { }
|
||||||
|
|
||||||
// During a compacting collection, we need to collapse objects into
|
// During a compacting collection, we need to collapse objects into
|
||||||
// spaces in a given order. We want to fill space A, space B, and so
|
// spaces in a given order. We want to fill space A, space B, and so
|
||||||
|
@ -57,14 +59,14 @@ class PSMarkSweepDecorator: public CHeapObj {
|
||||||
static PSMarkSweepDecorator* destination_decorator();
|
static PSMarkSweepDecorator* destination_decorator();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
MutableSpace* space() { return _space; }
|
MutableSpace* space() { return _space; }
|
||||||
ObjectStartArray* start_array() { return _start_array; }
|
ObjectStartArray* start_array() { return _start_array; }
|
||||||
|
|
||||||
HeapWord* compaction_top() { return _compaction_top; }
|
HeapWord* compaction_top() { return _compaction_top; }
|
||||||
void set_compaction_top(HeapWord* value) { _compaction_top = value; }
|
void set_compaction_top(HeapWord* value) { _compaction_top = value; }
|
||||||
|
|
||||||
unsigned int allowed_dead_ratio() { return _allowed_dead_ratio; }
|
size_t allowed_dead_ratio() { return _allowed_dead_ratio; }
|
||||||
void set_allowed_dead_ratio(unsigned int value) { _allowed_dead_ratio = value; }
|
void set_allowed_dead_ratio(size_t value) { _allowed_dead_ratio = value; }
|
||||||
|
|
||||||
// Work methods
|
// Work methods
|
||||||
void adjust_pointers();
|
void adjust_pointers();
|
||||||
|
|
|
@ -997,11 +997,11 @@ void OffsetTableContigSpace::serialize_block_offset_array_offsets(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TenuredSpace::allowed_dead_ratio() const {
|
size_t TenuredSpace::allowed_dead_ratio() const {
|
||||||
return MarkSweepDeadRatio;
|
return MarkSweepDeadRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ContigPermSpace::allowed_dead_ratio() const {
|
size_t ContigPermSpace::allowed_dead_ratio() const {
|
||||||
return PermMarkSweepDeadRatio;
|
return PermMarkSweepDeadRatio;
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,7 +421,7 @@ public:
|
||||||
|
|
||||||
// The maximum percentage of objects that can be dead in the compacted
|
// The maximum percentage of objects that can be dead in the compacted
|
||||||
// live part of a compacted space ("deadwood" support.)
|
// live part of a compacted space ("deadwood" support.)
|
||||||
virtual int allowed_dead_ratio() const { return 0; };
|
virtual size_t allowed_dead_ratio() const { return 0; };
|
||||||
|
|
||||||
// Some contiguous spaces may maintain some data structures that should
|
// Some contiguous spaces may maintain some data structures that should
|
||||||
// be updated whenever an allocation crosses a boundary. This function
|
// be updated whenever an allocation crosses a boundary. This function
|
||||||
|
@ -507,7 +507,7 @@ protected:
|
||||||
\
|
\
|
||||||
size_t allowed_deadspace = 0; \
|
size_t allowed_deadspace = 0; \
|
||||||
if (skip_dead) { \
|
if (skip_dead) { \
|
||||||
int ratio = allowed_dead_ratio(); \
|
const size_t ratio = allowed_dead_ratio(); \
|
||||||
allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \
|
allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
@ -1079,7 +1079,7 @@ class TenuredSpace: public OffsetTableContigSpace {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
protected:
|
protected:
|
||||||
// Mark sweep support
|
// Mark sweep support
|
||||||
int allowed_dead_ratio() const;
|
size_t allowed_dead_ratio() const;
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
|
TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
|
||||||
|
@ -1094,7 +1094,7 @@ class ContigPermSpace: public OffsetTableContigSpace {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
protected:
|
protected:
|
||||||
// Mark sweep support
|
// Mark sweep support
|
||||||
int allowed_dead_ratio() const;
|
size_t allowed_dead_ratio() const;
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) :
|
ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) :
|
||||||
|
|
|
@ -73,7 +73,6 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
|
||||||
|
|
||||||
// Mark sweep support
|
// Mark sweep support
|
||||||
void compute_new_size();
|
void compute_new_size();
|
||||||
int allowed_dead_ratio() const;
|
|
||||||
|
|
||||||
virtual void gc_prologue(bool full);
|
virtual void gc_prologue(bool full);
|
||||||
virtual void gc_epilogue(bool full);
|
virtual void gc_epilogue(bool full);
|
||||||
|
|
|
@ -2792,7 +2792,7 @@ class CommandLineFlags {
|
||||||
product(intx, TargetSurvivorRatio, 50, \
|
product(intx, TargetSurvivorRatio, 50, \
|
||||||
"Desired percentage of survivor space used after scavenge") \
|
"Desired percentage of survivor space used after scavenge") \
|
||||||
\
|
\
|
||||||
product(intx, MarkSweepDeadRatio, 5, \
|
product(uintx, MarkSweepDeadRatio, 5, \
|
||||||
"Percentage (0-100) of the old gen allowed as dead wood." \
|
"Percentage (0-100) of the old gen allowed as dead wood." \
|
||||||
"Serial mark sweep treats this as both the min and max value." \
|
"Serial mark sweep treats this as both the min and max value." \
|
||||||
"CMS uses this value only if it falls back to mark sweep." \
|
"CMS uses this value only if it falls back to mark sweep." \
|
||||||
|
@ -2801,7 +2801,7 @@ class CommandLineFlags {
|
||||||
"either completely full or completely empty. Par compact also" \
|
"either completely full or completely empty. Par compact also" \
|
||||||
"has a smaller default value; see arguments.cpp.") \
|
"has a smaller default value; see arguments.cpp.") \
|
||||||
\
|
\
|
||||||
product(intx, PermMarkSweepDeadRatio, 20, \
|
product(uintx, PermMarkSweepDeadRatio, 20, \
|
||||||
"Percentage (0-100) of the perm gen allowed as dead wood." \
|
"Percentage (0-100) of the perm gen allowed as dead wood." \
|
||||||
"See MarkSweepDeadRatio for collector-specific comments.") \
|
"See MarkSweepDeadRatio for collector-specific comments.") \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue