< prev index next >
src/hotspot/share/gc/parallel/psParallelCompact.hpp
Print this page
rev 56967 : [mq]: 8220465-parallel-gc-haoyu-li
rev 56968 : [mq]: 8220465-suggestions
*** 330,348 ****
inline void decrement_destination_count();
inline bool claim();
// Possible values of _shadow_state, and transition is as follows
// Normal Path:
! // UNUSED -> try_push() -> FINISHED
// Steal Path:
! // UNUSED -> try_steal() -> SHADOW -> mark_filled() -> FILLED -> try_copy() -> FINISHED
! static const int UNUSED; // Original state
! static const int SHADOW; // Stolen by an idle thread, and a shadow region is created for it
! static const int FILLED; // Its shadow region has been filled and ready to be copied back
! static const int FINISH; // Work has been done
! // Preempt the region to avoid double processes
inline bool try_push();
inline bool try_steal();
// Mark the region as filled and ready to be copied back
inline void mark_filled();
// Preempt the region to copy the shadow region content back
--- 330,348 ----
inline void decrement_destination_count();
inline bool claim();
// Possible values of _shadow_state, and transition is as follows
// Normal Path:
! // UnusedShadow -> try_push() -> FinishedShadow
// Steal Path:
! // UnusedShadow -> try_steal() -> Shadow -> mark_filled() -> FilledShadow -> try_copy() -> FinishedShadow
! static const int UnusedShadow = 0; // Original state
! static const int Shadow = 1; // Stolen by an idle thread, and a shadow region is created for it
! static const int FilledShadow = 2; // Its shadow region has been filled and ready to be copied back
! static const int FinishedShadow = 3; // Work has been done
! // Reserve the region to avoid double processing
inline bool try_push();
inline bool try_steal();
// Mark the region as filled and ready to be copied back
inline void mark_filled();
// Preempt the region to copy the shadow region content back
*** 624,652 ****
const region_sz_t old = Atomic::cmpxchg(dc_claimed | los, &_dc_and_los, los);
return old == los;
}
inline bool ParallelCompactData::RegionData::try_push() {
! return Atomic::cmpxchg(FINISH, &_shadow_state, UNUSED) == UNUSED;
}
inline bool ParallelCompactData::RegionData::try_steal() {
! return Atomic::cmpxchg(SHADOW, &_shadow_state, UNUSED) == UNUSED;
}
inline void ParallelCompactData::RegionData::mark_filled() {
! int old = Atomic::cmpxchg(FILLED, &_shadow_state, SHADOW);
! assert(old == SHADOW, "Fail to mark the region as filled");
}
inline bool ParallelCompactData::RegionData::try_copy() {
! return Atomic::cmpxchg(FINISH, &_shadow_state, FILLED) == FILLED;
}
void ParallelCompactData::RegionData::mark_normal() {
! int old = Atomic::cmpxchg(FINISH, &_shadow_state, SHADOW);
! assert(old == SHADOW, "Fail to mark the region as finish");
}
inline ParallelCompactData::RegionData*
ParallelCompactData::region(size_t region_idx) const
{
--- 624,652 ----
const region_sz_t old = Atomic::cmpxchg(dc_claimed | los, &_dc_and_los, los);
return old == los;
}
inline bool ParallelCompactData::RegionData::try_push() {
! return Atomic::cmpxchg(FinishedShadow, &_shadow_state, UnusedShadow) == UnusedShadow;
}
inline bool ParallelCompactData::RegionData::try_steal() {
! return Atomic::cmpxchg(Shadow, &_shadow_state, UnusedShadow) == UnusedShadow;
}
inline void ParallelCompactData::RegionData::mark_filled() {
! int old = Atomic::cmpxchg(FilledShadow, &_shadow_state, Shadow);
! assert(old == Shadow, "Fail to mark the region as filled");
}
inline bool ParallelCompactData::RegionData::try_copy() {
! return Atomic::cmpxchg(FinishedShadow, &_shadow_state, FilledShadow) == FilledShadow;
}
void ParallelCompactData::RegionData::mark_normal() {
! int old = Atomic::cmpxchg(FinishedShadow, &_shadow_state, Shadow);
! assert(old == Shadow, "Fail to mark the region as finish");
}
inline ParallelCompactData::RegionData*
ParallelCompactData::region(size_t region_idx) const
{
*** 1232,1251 ****
static void fill_region(ParCompactionManager* cm, MoveAndUpdateClosure& closure, size_t region);
static void fill_and_update_region(ParCompactionManager* cm, size_t region);
static bool steal_shadow_region(ParCompactionManager* cm, size_t& region_idx);
! static void fill_shadow_region(ParCompactionManager* cm, size_t region_idx);
! static void fill_and_update_shadow_region(ParCompactionManager* cm, size_t region) {
! fill_shadow_region(cm, region);
! }
// Copy the content of a shadow region back to its corresponding heap region
static void copy_back(HeapWord* shadow_addr, HeapWord* region_addr);
// Initialize the steal record of a GC thread
static void initialize_steal_record(uint which);
// Reuse the empty heap regions as shadow regions, like to-space regions
! static void enqueue_shadow_region();
// Fill in the block table for the specified region.
static void fill_blocks(size_t region_idx);
// Update the deferred objects in the space.
--- 1232,1248 ----
static void fill_region(ParCompactionManager* cm, MoveAndUpdateClosure& closure, size_t region);
static void fill_and_update_region(ParCompactionManager* cm, size_t region);
static bool steal_shadow_region(ParCompactionManager* cm, size_t& region_idx);
! static void fill_and_update_shadow_region(ParCompactionManager* cm, size_t region);
// Copy the content of a shadow region back to its corresponding heap region
static void copy_back(HeapWord* shadow_addr, HeapWord* region_addr);
// Initialize the steal record of a GC thread
static void initialize_steal_record(uint which);
// Reuse the empty heap regions as shadow regions, like to-space regions
! static void initialize_shadow_regions();
// Fill in the block table for the specified region.
static void fill_blocks(size_t region_idx);
// Update the deferred objects in the space.
*** 1351,1382 ****
decrement_words_remaining(words);
_source += words;
_destination += words;
}
! class ShadowClosure: public MoveAndUpdateClosure {
inline size_t calculate_shadow_offset(size_t region_idx, size_t shadow_idx);
public:
! inline ShadowClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm,
size_t region, size_t shadow);
virtual void complete_region(ParCompactionManager* cm, HeapWord* dest_addr,
PSParallelCompact::RegionData* region_ptr);
private:
size_t _shadow;
};
! inline size_t ShadowClosure::calculate_shadow_offset(size_t region_idx, size_t shadow_idx) {
ParallelCompactData& sd = PSParallelCompact::summary_data();
HeapWord* dest_addr = sd.region_to_addr(region_idx);
HeapWord* shadow_addr = sd.region_to_addr(shadow_idx);
return pointer_delta(shadow_addr, dest_addr);
}
inline
! ShadowClosure::ShadowClosure(ParMarkBitMap *bitmap,
ParCompactionManager *cm,
size_t region,
size_t shadow) :
MoveAndUpdateClosure(bitmap, cm, region),
_shadow(shadow) {
--- 1348,1379 ----
decrement_words_remaining(words);
_source += words;
_destination += words;
}
! class MoveAndUpdateShadowClosure: public MoveAndUpdateClosure {
inline size_t calculate_shadow_offset(size_t region_idx, size_t shadow_idx);
public:
! inline MoveAndUpdateShadowClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm,
size_t region, size_t shadow);
virtual void complete_region(ParCompactionManager* cm, HeapWord* dest_addr,
PSParallelCompact::RegionData* region_ptr);
private:
size_t _shadow;
};
! inline size_t MoveAndUpdateShadowClosure::calculate_shadow_offset(size_t region_idx, size_t shadow_idx) {
ParallelCompactData& sd = PSParallelCompact::summary_data();
HeapWord* dest_addr = sd.region_to_addr(region_idx);
HeapWord* shadow_addr = sd.region_to_addr(shadow_idx);
return pointer_delta(shadow_addr, dest_addr);
}
inline
! MoveAndUpdateShadowClosure::MoveAndUpdateShadowClosure(ParMarkBitMap *bitmap,
ParCompactionManager *cm,
size_t region,
size_t shadow) :
MoveAndUpdateClosure(bitmap, cm, region),
_shadow(shadow) {
< prev index next >