< prev index next > src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
Print this page
#include "gc/g1/g1FullCollector.inline.hpp"
#include "gc/g1/g1FullGCCompactionPoint.hpp"
#include "gc/g1/g1FullGCCompactTask.hpp"
#include "gc/g1/g1HeapRegion.inline.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
#include "logging/log.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/ticks.hpp"
void G1FullGCCompactTask::G1CompactRegionClosure::clear_in_bitmap(oop obj) {
_bitmap->clear(obj);
}
size_t G1FullGCCompactTask::G1CompactRegionClosure::apply(oop obj) {
size_t size = obj->size();
! if (obj->is_forwarded()) {
G1FullGCCompactTask::copy_object_to_new_location(obj);
}
// Clear the mark for the compacted object to allow reuse of the
// bitmap without an additional clearing step.
clear_in_bitmap(obj);
return size;
}
void G1FullGCCompactTask::copy_object_to_new_location(oop obj) {
! assert(obj->is_forwarded(), "Sanity!");
! assert(obj->forwardee() != obj, "Object must have a new location");
size_t size = obj->size();
// Copy object and reinit its mark.
HeapWord* obj_addr = cast_from_oop<HeapWord*>(obj);
! HeapWord* destination = cast_from_oop<HeapWord*>(obj->forwardee());
Copy::aligned_conjoint_words(obj_addr, destination, size);
// There is no need to transform stack chunks - marking already did that.
cast_to_oop(destination)->init_mark();
assert(cast_to_oop(destination)->klass() != nullptr, "should have a class");
_bitmap->clear(obj);
}
size_t G1FullGCCompactTask::G1CompactRegionClosure::apply(oop obj) {
size_t size = obj->size();
! if (SlidingForwarding::is_forwarded(obj)) {
G1FullGCCompactTask::copy_object_to_new_location(obj);
}
// Clear the mark for the compacted object to allow reuse of the
// bitmap without an additional clearing step.
clear_in_bitmap(obj);
return size;
}
void G1FullGCCompactTask::copy_object_to_new_location(oop obj) {
! assert(SlidingForwarding::is_forwarded(obj), "Sanity!");
! assert(SlidingForwarding::forwardee(obj) != obj, "Object must have a new location");
size_t size = obj->size();
// Copy object and reinit its mark.
HeapWord* obj_addr = cast_from_oop<HeapWord*>(obj);
! HeapWord* destination = cast_from_oop<HeapWord*>(SlidingForwarding::forwardee(obj));
Copy::aligned_conjoint_words(obj_addr, destination, size);
// There is no need to transform stack chunks - marking already did that.
cast_to_oop(destination)->init_mark();
assert(cast_to_oop(destination)->klass() != nullptr, "should have a class");
oop obj = cast_to_oop(src_hr->bottom());
size_t word_size = obj->size();
uint num_regions = (uint)G1CollectedHeap::humongous_obj_size_in_regions(word_size);
! HeapWord* destination = cast_from_oop<HeapWord*>(obj->forwardee());
assert(collector()->mark_bitmap()->is_marked(obj), "Should only compact marked objects");
collector()->mark_bitmap()->clear(obj);
copy_object_to_new_location(obj);
oop obj = cast_to_oop(src_hr->bottom());
size_t word_size = obj->size();
uint num_regions = (uint)G1CollectedHeap::humongous_obj_size_in_regions(word_size);
! HeapWord* destination = cast_from_oop<HeapWord*>(SlidingForwarding::forwardee(obj));
assert(collector()->mark_bitmap()->is_marked(obj), "Should only compact marked objects");
collector()->mark_bitmap()->clear(obj);
copy_object_to_new_location(obj);
< prev index next >