JBR-5183 fix problem with _first_dead in serial GC

This commit is contained in:
Vladimir Dvorak
2023-02-05 12:02:11 +01:00
committed by Vitaly Provodin
parent 88eb51b2e3
commit 78f0c0f12e
2 changed files with 17 additions and 8 deletions

View File

@@ -467,14 +467,14 @@ int CompactibleSpace::space_index(oop obj) {
bool CompactibleSpace::must_rescue(oop old_obj, oop new_obj) {
// Only redefined objects can have the need to be rescued.
if (cast_to_oop(old_obj)->klass()->new_version() == NULL) return false;
if (oop(old_obj)->klass()->new_version() == NULL) return false;
//if (old_obj->is_perm()) {
// // This object is in perm gen: Always rescue to satisfy invariant obj->klass() <= obj.
// return true;
//}
int new_size = old_obj->size_given_klass(cast_to_oop(old_obj)->klass()->new_version());
int new_size = old_obj->size_given_klass(oop(old_obj)->klass()->new_version());
int original_size = old_obj->size();
Generation* tenured_gen = GenCollectedHeap::heap()->old_gen();
@@ -592,7 +592,12 @@ void CompactibleSpace::compact() {
if (_first_dead > cur_obj && !cast_to_oop(cur_obj)->is_gc_marked()) {
// All object before _first_dead can be skipped. They should not be moved.
// A pointer to the first live object is stored at the memory location for _first_dead.
cur_obj = *(HeapWord**)(_first_dead);
if (redefinition_run) {
// _first_dead could be living redefined object
cur_obj = _first_dead;
} else {
cur_obj = *(HeapWord**)(_first_dead);
}
}
debug_only(HeapWord* prev_obj = nullptr);
@@ -871,6 +876,12 @@ void TenuredSpace::verify() const {
guarantee(p == top(), "end of last object must match end of space");
}
size_t TenuredSpace::allowed_dead_ratio() const {
return MarkSweepDeadRatio;
}
#endif // INCLUDE_SERIALGC
// Compute the forward sizes and leave out objects whose position could
// possibly overlap other objects.
HeapWord* CompactibleSpace::forward_with_rescue(HeapWord* q, size_t size,
@@ -905,7 +916,6 @@ HeapWord* CompactibleSpace::forward_rescued(CompactPoint* cp, HeapWord* compact_
for (int i=0; i<MarkSweep::_rescued_oops->length(); i++) {
HeapWord* q = MarkSweep::_rescued_oops->at(i);
/* size_t size = cast_to_oop(q)->size(); changing this for cms for perm gen */
size_t size = block_size(q);
// (DCEVM) There is a new version of the class of q => different size
@@ -924,7 +934,3 @@ HeapWord* CompactibleSpace::forward_rescued(CompactPoint* cp, HeapWord* compact_
return compact_top;
}
size_t TenuredSpace::allowed_dead_ratio() const {
return MarkSweepDeadRatio;
}
#endif // INCLUDE_SERIALGC

View File

@@ -649,6 +649,8 @@ void VM_EnhancedRedefineClasses::doit() {
if (objectClosure.needs_instance_update()) {
// Do a full garbage collection to update the instance sizes accordingly
log_trace(redefine, class, obsolete, metadata)("Before redefinition full GC run");
if (log_is_enabled(Info, redefine, class, timer)) {
_timer_heap_full_gc.start();
}
@@ -661,6 +663,7 @@ void VM_EnhancedRedefineClasses::doit() {
Universe::set_redefining_gc_run(false);
_timer_heap_full_gc.stop();
log_trace(redefine, class, obsolete, metadata)("After redefinition full GC run");
}
// Unmark Klass*s as "redefining"