8335147: Serial: Refactor TenuredGeneration::promote
Reviewed-by: tschatzl, iwalulya
This commit is contained in:
parent
a537e87d2d
commit
dd74e7f8c1
src/hotspot/share/gc/serial
@ -768,25 +768,25 @@ oop DefNewGeneration::copy_to_survivor_space(oop old) {
|
||||
bool new_obj_is_tenured = false;
|
||||
// Otherwise try allocating obj tenured
|
||||
if (obj == nullptr) {
|
||||
obj = _old_gen->promote(old, s);
|
||||
obj = _old_gen->allocate_for_promotion(old, s);
|
||||
if (obj == nullptr) {
|
||||
handle_promotion_failure(old);
|
||||
return old;
|
||||
}
|
||||
|
||||
ContinuationGCSupport::transform_stack_chunk(obj);
|
||||
|
||||
new_obj_is_tenured = true;
|
||||
} else {
|
||||
// Prefetch beyond obj
|
||||
const intx interval = PrefetchCopyIntervalInBytes;
|
||||
Prefetch::write(obj, interval);
|
||||
}
|
||||
|
||||
// Copy obj
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), s);
|
||||
// Prefetch beyond obj
|
||||
const intx interval = PrefetchCopyIntervalInBytes;
|
||||
Prefetch::write(obj, interval);
|
||||
|
||||
ContinuationGCSupport::transform_stack_chunk(obj);
|
||||
// Copy obj
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), s);
|
||||
|
||||
ContinuationGCSupport::transform_stack_chunk(obj);
|
||||
|
||||
if (!new_obj_is_tenured) {
|
||||
// Increment age if obj still in new generation
|
||||
obj->incr_age();
|
||||
age_table()->add(obj, s);
|
||||
|
@ -387,7 +387,7 @@ bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes)
|
||||
return res;
|
||||
}
|
||||
|
||||
oop TenuredGeneration::promote(oop obj, size_t obj_size) {
|
||||
oop TenuredGeneration::allocate_for_promotion(oop obj, size_t obj_size) {
|
||||
assert(obj_size == obj->size(), "bad obj_size passed in");
|
||||
|
||||
#ifndef PRODUCT
|
||||
@ -401,15 +401,9 @@ oop TenuredGeneration::promote(oop obj, size_t obj_size) {
|
||||
if (result == nullptr) {
|
||||
// Promotion of obj into gen failed. Try to expand and allocate.
|
||||
result = expand_and_allocate(obj_size, false);
|
||||
if (result == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy to new location.
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(obj), result, obj_size);
|
||||
oop new_obj = cast_to_oop<HeapWord*>(result);
|
||||
return new_obj;
|
||||
return cast_to_oop<HeapWord*>(result);
|
||||
}
|
||||
|
||||
HeapWord*
|
||||
|
@ -163,12 +163,11 @@ public:
|
||||
bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
|
||||
|
||||
// "obj" is the address of an object in young-gen. Allocate space for "obj"
|
||||
// in the old-gen, and copy "obj" into the newly allocated space, if
|
||||
// possible, returning the result (or null if the allocation failed).
|
||||
// in the old-gen, returning the result (or null if the allocation failed).
|
||||
//
|
||||
// The "obj_size" argument is just obj->size(), passed along so the caller can
|
||||
// avoid repeating the virtual call to retrieve it.
|
||||
oop promote(oop obj, size_t obj_size);
|
||||
oop allocate_for_promotion(oop obj, size_t obj_size);
|
||||
|
||||
virtual void verify();
|
||||
virtual void print_on(outputStream* st) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user