8263723: [BACKOUT] MoveAndUpdateClosure::do_addr calls function with side-effects in an assert
Reviewed-by: tschatzl
This commit is contained in:
parent
86e9cd989d
commit
a707fcb515
@ -780,7 +780,7 @@ bool ParallelCompactData::summarize(SplitInfo& split_info,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr, ParCompactionManager* cm, bool use_block_table) const {
|
HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr, ParCompactionManager* cm) const {
|
||||||
assert(addr != NULL, "Should detect NULL oop earlier");
|
assert(addr != NULL, "Should detect NULL oop earlier");
|
||||||
assert(ParallelScavengeHeap::heap()->is_in(addr), "not in heap");
|
assert(ParallelScavengeHeap::heap()->is_in(addr), "not in heap");
|
||||||
assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "not marked");
|
assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "not marked");
|
||||||
@ -801,39 +801,24 @@ HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr, ParCompactionMan
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, the new location is region->destination + #live words to left
|
// Otherwise, the new location is region->destination + block offset + the
|
||||||
// of addr in this region. Calculating #live words naively means walking the
|
// number of live words in the Block that are (a) to the left of addr and (b)
|
||||||
// mark bitmap from the start of this region. Block table can be used to
|
// due to objects that start in the Block.
|
||||||
// speed up this process, but it would incur some side-effect. In debug-only
|
|
||||||
// code (such as asserts), we prefer the slower but side-effect free version,
|
|
||||||
// to avoid side effects that would not occur for release code and could
|
|
||||||
// potentially affect future calculations.
|
|
||||||
if (use_block_table) {
|
|
||||||
// #live words = block offset + #live words in the Block that are
|
|
||||||
// (a) to the left of addr and (b) due to objects that start in the Block.
|
|
||||||
|
|
||||||
// Fill in the block table if necessary. This is unsynchronized, so multiple
|
// Fill in the block table if necessary. This is unsynchronized, so multiple
|
||||||
// threads may fill the block table for a region (harmless, since it is
|
// threads may fill the block table for a region (harmless, since it is
|
||||||
// idempotent).
|
// idempotent).
|
||||||
if (!region_ptr->blocks_filled()) {
|
if (!region_ptr->blocks_filled()) {
|
||||||
PSParallelCompact::fill_blocks(addr_to_region_idx(addr));
|
PSParallelCompact::fill_blocks(addr_to_region_idx(addr));
|
||||||
region_ptr->set_blocks_filled();
|
region_ptr->set_blocks_filled();
|
||||||
}
|
|
||||||
|
|
||||||
HeapWord* const search_start = block_align_down(addr);
|
|
||||||
const size_t block_offset = addr_to_block_ptr(addr)->offset();
|
|
||||||
|
|
||||||
const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap();
|
|
||||||
const size_t live = bitmap->live_words_in_range(cm, search_start, oop(addr));
|
|
||||||
result += block_offset + live;
|
|
||||||
} else {
|
|
||||||
guarantee(trueInDebug, "Only in debug build");
|
|
||||||
|
|
||||||
const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap();
|
|
||||||
const size_t live = bitmap->live_words_in_range(cm, region_align_down(addr), oop(addr));
|
|
||||||
result += region_ptr->partial_obj_size() + live;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeapWord* const search_start = block_align_down(addr);
|
||||||
|
const size_t block_offset = addr_to_block_ptr(addr)->offset();
|
||||||
|
|
||||||
|
const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap();
|
||||||
|
const size_t live = bitmap->live_words_in_range(cm, search_start, oop(addr));
|
||||||
|
result += block_offset + live;
|
||||||
DEBUG_ONLY(PSParallelCompact::check_new_location(addr, result));
|
DEBUG_ONLY(PSParallelCompact::check_new_location(addr, result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -3296,7 +3281,7 @@ MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
|
|||||||
assert(bitmap()->obj_size(addr) == words, "bad size");
|
assert(bitmap()->obj_size(addr) == words, "bad size");
|
||||||
|
|
||||||
_source = addr;
|
_source = addr;
|
||||||
assert(PSParallelCompact::summary_data().calc_new_pointer(source(), compaction_manager(), false) ==
|
assert(PSParallelCompact::summary_data().calc_new_pointer(source(), compaction_manager()) ==
|
||||||
destination(), "wrong destination");
|
destination(), "wrong destination");
|
||||||
|
|
||||||
if (words > words_remaining()) {
|
if (words > words_remaining()) {
|
||||||
|
@ -480,9 +480,7 @@ public:
|
|||||||
HeapWord* partial_obj_end(size_t region_idx) const;
|
HeapWord* partial_obj_end(size_t region_idx) const;
|
||||||
|
|
||||||
// Return the location of the object after compaction.
|
// Return the location of the object after compaction.
|
||||||
HeapWord* calc_new_pointer(HeapWord* addr,
|
HeapWord* calc_new_pointer(HeapWord* addr, ParCompactionManager* cm) const;
|
||||||
ParCompactionManager* cm,
|
|
||||||
bool use_block_table = true) const;
|
|
||||||
|
|
||||||
HeapWord* calc_new_pointer(oop p, ParCompactionManager* cm) const {
|
HeapWord* calc_new_pointer(oop p, ParCompactionManager* cm) const {
|
||||||
return calc_new_pointer(cast_from_oop<HeapWord*>(p), cm);
|
return calc_new_pointer(cast_from_oop<HeapWord*>(p), cm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user