Skip to content
Permalink
Browse files

8237637: Remove dubious type conversions from oop

Reviewed-by: kbarrett, dholmes, mdoerr
  • Loading branch information
stefank committed Jan 24, 2020
1 parent b223907 commit 46423b0f7095acca596de6c83c6dfef7d7e64a6b
Showing with 163 additions and 215 deletions.
  1. +1 −1 src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
  2. +0 −9 src/hotspot/cpu/s390/assembler_s390.hpp
  3. +1 −1 src/hotspot/share/ci/ciInstanceKlass.cpp
  4. +1 −1 src/hotspot/share/code/nmethod.cpp
  5. +1 −1 src/hotspot/share/code/relocInfo.hpp
  6. +4 −4 src/hotspot/share/compiler/oopMap.cpp
  7. +3 −3 src/hotspot/share/gc/g1/g1Allocator.inline.hpp
  8. +6 −5 src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp
  9. +2 −3 src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
  10. +9 −11 src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp
  11. +1 −1 src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp
  12. +1 −1 src/hotspot/share/gc/g1/g1EvacFailure.cpp
  13. +2 −2 src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
  14. +1 −1 src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
  15. +1 −1 src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp
  16. +1 −1 src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
  17. +1 −1 src/hotspot/share/gc/g1/g1ParScanThreadState.hpp
  18. +1 −1 src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp
  19. +4 −4 src/hotspot/share/gc/g1/g1RemSet.cpp
  20. +3 −3 src/hotspot/share/gc/g1/heapRegion.cpp
  21. +2 −2 src/hotspot/share/gc/g1/heapRegion.hpp
  22. +4 −4 src/hotspot/share/gc/g1/heapRegion.inline.hpp
  23. +4 −4 src/hotspot/share/gc/parallel/parMarkBitMap.cpp
  24. +2 −2 src/hotspot/share/gc/parallel/parMarkBitMap.inline.hpp
  25. +1 −1 src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp
  26. +3 −3 src/hotspot/share/gc/parallel/psOldGen.cpp
  27. +1 −1 src/hotspot/share/gc/parallel/psParallelCompact.cpp
  28. +3 −3 src/hotspot/share/gc/parallel/psParallelCompact.hpp
  29. +1 −1 src/hotspot/share/gc/parallel/psPromotionLAB.cpp
  30. +2 −2 src/hotspot/share/gc/parallel/psPromotionManager.hpp
  31. +5 −5 src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp
  32. +1 −1 src/hotspot/share/gc/parallel/psScavenge.hpp
  33. +1 −1 src/hotspot/share/gc/parallel/psScavenge.inline.hpp
  34. +2 −2 src/hotspot/share/gc/serial/defNewGeneration.cpp
  35. +1 −1 src/hotspot/share/gc/serial/defNewGeneration.inline.hpp
  36. +1 −1 src/hotspot/share/gc/shared/cardTableBarrierSet.cpp
  37. +1 −1 src/hotspot/share/gc/shared/cardTableRS.cpp
  38. +2 −2 src/hotspot/share/gc/shared/genCollectedHeap.cpp
  39. +5 −5 src/hotspot/share/gc/shared/genOopClosures.inline.hpp
  40. +1 −1 src/hotspot/share/gc/shared/generation.cpp
  41. +1 −1 src/hotspot/share/gc/shared/locationPrinter.inline.hpp
  42. +1 −0 src/hotspot/share/gc/shared/markBitMap.hpp
  43. +7 −3 src/hotspot/share/gc/shared/markBitMap.inline.hpp
  44. +2 −2 src/hotspot/share/gc/shared/memAllocator.cpp
  45. +1 −1 src/hotspot/share/gc/shared/memAllocator.hpp
  46. +1 −1 src/hotspot/share/gc/shared/space.cpp
  47. +1 −1 src/hotspot/share/gc/shared/space.hpp
  48. +1 −1 src/hotspot/share/gc/shared/space.inline.hpp
  49. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
  50. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp
  51. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp
  52. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp
  53. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp
  54. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp
  55. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp
  56. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp
  57. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
  58. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp
  59. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.hpp
  60. +2 −2 src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp
  61. +3 −3 src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
  62. +1 −1 src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp
  63. +4 −5 src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp
  64. +3 −4 src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp
  65. +0 −28 src/hotspot/share/interpreter/abstractInterpreter.hpp
  66. +2 −2 src/hotspot/share/jfr/jni/jfrJavaCall.cpp
  67. +3 −3 src/hotspot/share/jfr/jni/jfrJavaSupport.cpp
  68. +1 −1 src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp
  69. +3 −3 src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
  70. +2 −2 src/hotspot/share/memory/filemap.cpp
  71. +2 −2 src/hotspot/share/memory/heapShared.cpp
  72. +1 −17 src/hotspot/share/oops/oopsHierarchy.hpp
  73. +1 −1 src/hotspot/share/opto/runtime.cpp
  74. +1 −1 src/hotspot/share/prims/jvm.cpp
  75. +1 −1 src/hotspot/share/prims/jvmtiImpl.cpp
  76. +5 −5 src/hotspot/share/prims/jvmtiTagMap.cpp
  77. +3 −3 src/hotspot/share/prims/unsafe.cpp
  78. +1 −1 src/hotspot/share/runtime/javaCalls.cpp
  79. +2 −2 src/hotspot/share/runtime/reflection.cpp
  80. +1 −1 src/hotspot/share/runtime/stackValue.cpp
  81. +1 −1 src/hotspot/share/runtime/vframe_hp.cpp
  82. +1 −1 src/hotspot/share/services/heapDumper.cpp
  83. +1 −1 test/hotspot/gtest/gc/g1/test_heapRegion.cpp
@@ -61,7 +61,7 @@ void CodeInstaller::pd_patch_OopConstant(int pc_offset, JVMCIObject constant, JV
#endif // ASSERT
Handle obj = jvmci_env()->asConstant(constant, JVMCI_CHECK);
jobject value = JNIHandles::make_local(obj());
MacroAssembler::patch_oop(pc, (address)obj());
MacroAssembler::patch_oop(pc, cast_from_oop<address>(obj()));
int oop_index = _oop_recorder->find_index(value);
RelocationHolder rspec = oop_Relocation::spec(oop_index);
_instructions->relocate(pc, rspec);
@@ -351,14 +351,6 @@ class AddressLiteral {
: _address((address) addr),
_rspec(rspec_from_rtype(rtype, (address) addr)) {}

AddressLiteral(oop addr, relocInfo::relocType rtype = relocInfo::none)
: _address((address) addr),
_rspec(rspec_from_rtype(rtype, (address) addr)) {}

AddressLiteral(oop* addr, relocInfo::relocType rtype = relocInfo::none)
: _address((address) addr),
_rspec(rspec_from_rtype(rtype, (address) addr)) {}

AddressLiteral(float* addr, relocInfo::relocType rtype = relocInfo::none)
: _address((address) addr),
_rspec(rspec_from_rtype(rtype, (address) addr)) {}
@@ -390,7 +382,6 @@ class ExternalAddress: public AddressLiteral {

public:
ExternalAddress(address target) : AddressLiteral(target, reloc_for_target( target)) {}
ExternalAddress(oop* target) : AddressLiteral(target, reloc_for_target((address) target)) {}
};

// Argument is an abstraction used to represent an outgoing actual
@@ -315,7 +315,7 @@ bool ciInstanceKlass::is_in_package_impl(const char* packagename, int len) {
// Implementation of the print method.
void ciInstanceKlass::print_impl(outputStream* st) {
ciKlass::print_impl(st);
GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i(loader()));)
if (is_loaded()) {
st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
bool_to_str(is_initialized()),
@@ -1047,7 +1047,7 @@ void nmethod::fix_oop_relocations(address begin, address end, bool initialize_im
oop_Relocation* reloc = iter.oop_reloc();
if (initialize_immediates && reloc->oop_is_immediate()) {
oop* dest = reloc->oop_addr();
initialize_immediate_oop(dest, (jobject) *dest);
initialize_immediate_oop(dest, cast_from_oop<jobject>(*dest));
}
// Refresh the oop-related bits of this instruction.
reloc->fix_oop_relocation();
@@ -935,7 +935,7 @@ class oop_Relocation : public DataRelocation {

void verify_oop_relocation();

address value() { return (address) *oop_addr(); }
address value() { return cast_from_oop<address>(*oop_addr()); }

bool oop_is_immediate() { return oop_index() == 0; }

@@ -367,7 +367,7 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
omv.print();
tty->print_cr("register r");
omv.reg()->print();
tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
tty->print_cr("loc = %p *loc = %p\n", loc, cast_from_oop<address>(*loc));
// do the real assert.
assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer");
}
@@ -770,7 +770,7 @@ void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
"Add derived pointer@" INTPTR_FORMAT
" - Derived: " INTPTR_FORMAT
" Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
p2i(derived_loc), p2i(*derived_loc), p2i(*base_loc), p2i(base_loc), offset
);
}
// Set derived oop location to point to base.
@@ -792,13 +792,13 @@ void DerivedPointerTable::update_pointers() {
oop base = **(oop**)derived_loc;
assert(Universe::heap()->is_in_or_null(base), "must be an oop");

*derived_loc = (oop)(((address)base) + offset);
*derived_loc = (oop)(cast_from_oop<address>(base) + offset);
assert(value_of_loc(derived_loc) - value_of_loc(&base) == offset, "sanity check");

if (TraceDerivedPointers) {
tty->print_cr("Updating derived pointer@" INTPTR_FORMAT
" - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")",
p2i(derived_loc), p2i((address)*derived_loc), p2i((address)base), offset);
p2i(derived_loc), p2i(*derived_loc), p2i(base), offset);
}

// Delete entry
@@ -158,11 +158,11 @@ inline void G1ArchiveAllocator::clear_range_archive(MemRegion range) {

// Check if an object is in a closed archive region using the _archive_region_map.
inline bool G1ArchiveAllocator::in_closed_archive_range(oop object) {
return _archive_region_map.get_by_address((HeapWord*)object) == G1ArchiveRegionMap::ClosedArchive;
return _archive_region_map.get_by_address(cast_from_oop<HeapWord*>(object)) == G1ArchiveRegionMap::ClosedArchive;
}

inline bool G1ArchiveAllocator::in_open_archive_range(oop object) {
return _archive_region_map.get_by_address((HeapWord*)object) == G1ArchiveRegionMap::OpenArchive;
return _archive_region_map.get_by_address(cast_from_oop<HeapWord*>(object)) == G1ArchiveRegionMap::OpenArchive;
}

// Check if archive object checking is enabled, to avoid calling in_open/closed_archive_range
@@ -181,7 +181,7 @@ inline bool G1ArchiveAllocator::is_open_archive_object(oop object) {

inline bool G1ArchiveAllocator::is_archived_object(oop object) {
return archive_check_enabled() &&
(_archive_region_map.get_by_address((HeapWord*)object) != G1ArchiveRegionMap::NoArchive);
(_archive_region_map.get_by_address(cast_from_oop<HeapWord*>(object)) != G1ArchiveRegionMap::NoArchive);
}

#endif // SHARE_GC_G1_G1ALLOCATOR_INLINE_HPP
@@ -33,6 +33,7 @@
#include "gc/g1/heapRegionManager.inline.hpp"
#include "gc/g1/heapRegionRemSet.hpp"
#include "gc/g1/heapRegionSet.inline.hpp"
#include "gc/shared/markBitMap.inline.hpp"
#include "gc/shared/taskqueue.inline.hpp"

G1GCPhaseTimes* G1CollectedHeap::phase_times() const {
@@ -89,7 +90,7 @@ inline HeapRegion* G1CollectedHeap::heap_region_containing(const T addr) const {
assert(is_in_g1_reserved((const void*) addr),
"Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()));
return _hrm->addr_to_region((HeapWord*) addr);
return _hrm->addr_to_region((HeapWord*)(void*) addr);
}

template <class T>
@@ -143,11 +144,11 @@ inline RefToScanQueue* G1CollectedHeap::task_queue(uint i) const {
}

inline bool G1CollectedHeap::is_marked_next(oop obj) const {
return _cm->next_mark_bitmap()->is_marked((HeapWord*)obj);
return _cm->next_mark_bitmap()->is_marked(obj);
}

inline bool G1CollectedHeap::is_in_cset(oop obj) {
return is_in_cset((HeapWord*)obj);
return is_in_cset(cast_from_oop<HeapWord*>(obj));
}

inline bool G1CollectedHeap::is_in_cset(HeapWord* addr) {
@@ -159,7 +160,7 @@ bool G1CollectedHeap::is_in_cset(const HeapRegion* hr) {
}

bool G1CollectedHeap::is_in_cset_or_humongous(const oop obj) {
return _region_attr.is_in_cset_or_humongous((HeapWord*)obj);
return _region_attr.is_in_cset_or_humongous(cast_from_oop<HeapWord*>(obj));
}

G1HeapRegionAttr G1CollectedHeap::region_attr(const void* addr) const {
@@ -303,7 +304,7 @@ inline void G1CollectedHeap::set_has_humongous_reclaim_candidate(bool value) {
}

inline void G1CollectedHeap::set_humongous_is_live(oop obj) {
uint region = addr_to_region((HeapWord*)obj);
uint region = addr_to_region(cast_from_oop<HeapWord*>(obj));
// Clear the flag in the humongous_reclaim_candidates table. Also
// reset the entry in the region attribute table so that subsequent references
// to the same humongous object do not go into the slow path again.
@@ -1728,9 +1728,8 @@ class G1ObjectCountIsAliveClosure: public BoolObjectClosure {
G1ObjectCountIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { }

bool do_object_b(oop obj) {
HeapWord* addr = (HeapWord*)obj;
return addr != NULL &&
(!_g1h->is_in_g1_reserved(addr) || !_g1h->is_obj_dead(obj));
return obj != NULL &&
(!_g1h->is_in_g1_reserved(obj) || !_g1h->is_obj_dead(obj));
}
};

@@ -72,9 +72,7 @@ inline bool G1ConcurrentMark::mark_in_next_bitmap(uint const worker_id, HeapRegi
// Can't assert that this is a valid object at this point, since it might be in the process of being copied by another thread.
assert(!hr->is_continues_humongous(), "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above nTAMS " PTR_FORMAT, p2i(obj), hr->hrm_index(), p2i(hr->next_top_at_mark_start()));

HeapWord* const obj_addr = (HeapWord*)obj;

bool success = _next_mark_bitmap->par_mark(obj_addr);
bool success = _next_mark_bitmap->par_mark(obj);
if (success) {
add_to_liveness(worker_id, obj, obj->size());
}
@@ -112,7 +110,7 @@ inline void G1CMTask::push(G1TaskQueueEntry task_entry) {
assert(task_entry.is_array_slice() || !_g1h->is_on_master_free_list(
_g1h->heap_region_containing(task_entry.obj())), "invariant");
assert(task_entry.is_array_slice() || !_g1h->is_obj_ill(task_entry.obj()), "invariant"); // FIXME!!!
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()), "invariant");
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked(cast_from_oop<HeapWord*>(task_entry.obj())), "invariant");

if (!_task_queue->push(task_entry)) {
// The local task queue looks full. We need to push some entries
@@ -135,7 +133,7 @@ inline bool G1CMTask::is_below_finger(oop obj, HeapWord* global_finger) const {
// of checking both vs only checking the global finger is that the
// local check will be more accurate and so result in fewer pushes,
// but may also be a little slower.
HeapWord* objAddr = (HeapWord*)obj;
HeapWord* objAddr = cast_from_oop<HeapWord*>(obj);
if (_finger != NULL) {
// We have a current region.

@@ -160,7 +158,7 @@ inline bool G1CMTask::is_below_finger(oop obj, HeapWord* global_finger) const {
template<bool scan>
inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) {
assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray");
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()),
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked(cast_from_oop<HeapWord*>(task_entry.obj())),
"Any stolen object should be a slice or marked");

if (scan) {
@@ -203,7 +201,7 @@ inline void G1ConcurrentMark::update_top_at_rebuild_start(HeapRegion* r) {
}

inline void G1CMTask::update_liveness(oop const obj, const size_t obj_size) {
_mark_stats_cache.add_live_words(_g1h->addr_to_region((HeapWord*)obj), obj_size);
_mark_stats_cache.add_live_words(_g1h->addr_to_region(cast_from_oop<HeapWord*>(obj)), obj_size);
}

inline void G1ConcurrentMark::add_to_liveness(uint worker_id, oop const obj, size_t size) {
@@ -270,18 +268,18 @@ inline bool G1CMTask::deal_with_reference(T* p) {
}

inline void G1ConcurrentMark::mark_in_prev_bitmap(oop p) {
assert(!_prev_mark_bitmap->is_marked((HeapWord*) p), "sanity");
_prev_mark_bitmap->mark((HeapWord*) p);
assert(!_prev_mark_bitmap->is_marked(p), "sanity");
_prev_mark_bitmap->mark(p);
}

bool G1ConcurrentMark::is_marked_in_prev_bitmap(oop p) const {
assert(p != NULL && oopDesc::is_oop(p), "expected an oop");
return _prev_mark_bitmap->is_marked((HeapWord*)p);
return _prev_mark_bitmap->is_marked(cast_from_oop<HeapWord*>(p));
}

bool G1ConcurrentMark::is_marked_in_next_bitmap(oop p) const {
assert(p != NULL && oopDesc::is_oop(p), "expected an oop");
return _next_mark_bitmap->is_marked((HeapWord*)p);
return _next_mark_bitmap->is_marked(cast_from_oop<HeapWord*>(p));
}

inline bool G1ConcurrentMark::do_yield_check() {
@@ -45,7 +45,7 @@ size_t G1CMObjArrayProcessor::process_array_slice(objArrayOop obj, HeapWord* sta
size_t G1CMObjArrayProcessor::process_obj(oop obj) {
assert(should_be_sliced(obj), "Must be an array object %d and large " SIZE_FORMAT, obj->is_objArray(), (size_t)obj->size());

return process_array_slice(objArrayOop(obj), (HeapWord*)obj, (size_t)objArrayOop(obj)->size());
return process_array_slice(objArrayOop(obj), cast_from_oop<HeapWord*>(obj), (size_t)objArrayOop(obj)->size());
}

size_t G1CMObjArrayProcessor::process_slice(HeapWord* slice) {
@@ -106,7 +106,7 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
// as they have either been dead or evacuated (which are unreferenced now, i.e.
// dead too) already.
void do_object(oop obj) {
HeapWord* obj_addr = (HeapWord*) obj;
HeapWord* obj_addr = cast_from_oop<HeapWord*>(obj);
assert(_hr->is_in(obj_addr), "sanity");

if (obj->is_forwarded() && obj->forwardee() == obj) {
@@ -61,14 +61,14 @@ class G1ResetHumongousClosure : public HeapRegionClosure {

size_t G1FullGCCompactTask::G1CompactRegionClosure::apply(oop obj) {
size_t size = obj->size();
HeapWord* destination = (HeapWord*)obj->forwardee();
HeapWord* destination = cast_from_oop<HeapWord*>(obj->forwardee());
if (destination == NULL) {
// Object not moving
return size;
}

// copy object and reinit its mark
HeapWord* obj_addr = (HeapWord*) obj;
HeapWord* obj_addr = cast_from_oop<HeapWord*>(obj);
assert(obj_addr != destination, "everything in this pass should be moving");
Copy::aligned_conjoint_words(obj_addr, destination, size);
oop(destination)->init_mark_raw();
@@ -102,7 +102,7 @@ void G1FullGCCompactionPoint::forward(oop object, size_t size) {
}

// Store a forwarding pointer if the object should be moved.
if ((HeapWord*)object != _compaction_top) {
if (cast_from_oop<HeapWord*>(object) != _compaction_top) {
object->forward_to(oop(_compaction_top));
} else {
if (object->forwardee() != NULL) {
@@ -77,7 +77,7 @@ template <class T> void G1VerifyOopClosure::do_oop_work(T* p) {
p2i(obj));
} else {
HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
HeapRegion* to = _g1h->heap_region_containing(obj);
yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
print_object(&yy, _containing_obj);
@@ -284,7 +284,7 @@ oop G1ParScanThreadState::copy_to_survivor_space(G1HeapRegionAttr const region_a
const oop obj = oop(obj_ptr);
const oop forward_ptr = old->forward_to_atomic(obj, old_mark, memory_order_relaxed);
if (forward_ptr == NULL) {
Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), obj_ptr, word_sz);

const uint young_index = from_region->young_index_in_cset();

@@ -129,7 +129,7 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
assert(!_g1h->heap_region_containing(p)->is_young(), "Should have filtered out from-young references already.");

#ifdef ASSERT
HeapRegion* const hr_obj = _g1h->heap_region_containing((HeapWord*)o);
HeapRegion* const hr_obj = _g1h->heap_region_containing(o);
assert(region_attr.needs_remset_update() == hr_obj->rem_set()->is_tracked(),
"State flag indicating remset tracking disagrees (%s) with actual remembered set (%s) for region %u",
BOOL_TO_STR(region_attr.needs_remset_update()),
@@ -46,7 +46,7 @@ template <class T> void G1ParScanThreadState::do_oop_evac(T* p) {
// as they are not added to the collection set due to above precondition.
assert(!region_attr.is_humongous(),
"Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
p2i(obj), _g1h->addr_to_region(cast_from_oop<HeapWord*>(obj)), p2i(p));

if (!region_attr.is_in_cset()) {
// In this case somebody else already did all the work.
@@ -1467,14 +1467,14 @@ class G1RebuildRemSetTask: public AbstractGangTask {
size_t const obj_size = obj->size();
// All non-objArrays and objArrays completely within the mr
// can be scanned without passing the mr.
if (!obj->is_objArray() || mr.contains(MemRegion((HeapWord*)obj, obj_size))) {
if (!obj->is_objArray() || mr.contains(MemRegion(cast_from_oop<HeapWord*>(obj), obj_size))) {
obj->oop_iterate(&_update_cl);
return obj_size;
}
// This path is for objArrays crossing the given MemRegion. Only scan the
// area within the MemRegion.
obj->oop_iterate(&_update_cl, mr);
return mr.intersection(MemRegion((HeapWord*)obj, obj_size)).word_size();
return mr.intersection(MemRegion(cast_from_oop<HeapWord*>(obj), obj_size)).word_size();
}

// A humongous object is live (with respect to the scanning) either
@@ -1579,7 +1579,7 @@ class G1RebuildRemSetTask: public AbstractGangTask {
assert(hr->top() == top_at_mark_start || hr->top() == top_at_rebuild_start,
"More than one object in the humongous region?");
humongous_obj->oop_iterate(&_update_cl, mr);
return top_at_mark_start != hr->bottom() ? mr.intersection(MemRegion((HeapWord*)humongous_obj, humongous_obj->size())).byte_size() : 0;
return top_at_mark_start != hr->bottom() ? mr.intersection(MemRegion(cast_from_oop<HeapWord*>(humongous_obj), humongous_obj->size())).byte_size() : 0;
} else {
return 0;
}
@@ -1588,7 +1588,7 @@ class G1RebuildRemSetTask: public AbstractGangTask {
for (LiveObjIterator it(bitmap, top_at_mark_start, mr, hr->block_start(mr.start())); it.has_next(); it.move_to_next()) {
oop obj = it.next();
size_t scanned_size = scan_for_references(obj, mr);
if ((HeapWord*)obj < top_at_mark_start) {
if (cast_from_oop<HeapWord*>(obj) < top_at_mark_start) {
marked_words += scanned_size;
}
}
@@ -357,7 +357,7 @@ class VerifyStrongCodeRootOopClosure: public OopClosure {
// current region. We only look at those which are.
if (_hr->is_in(obj)) {
// Object is in the region. Check that its less than top
if (_hr->top() <= (HeapWord*)obj) {
if (_hr->top() <= cast_from_oop<HeapWord*>(obj)) {
// Object is above top
log_error(gc, verify)("Object " PTR_FORMAT " in region " HR_FORMAT " is above top ",
p2i(obj), HR_FORMAT_PARAMS(_hr));
@@ -566,7 +566,7 @@ class VerifyLiveClosure : public G1VerificationClosure {
p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
} else {
HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
HeapRegion* to = _g1h->heap_region_containing(obj);
log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
LogStream ls(log.error());
@@ -737,7 +737,7 @@ void HeapRegion::verify(VerifyOption vo,

if (is_region_humongous) {
oop obj = oop(this->humongous_start_region()->bottom());
if ((HeapWord*)obj > bottom() || (HeapWord*)obj + obj->size() < bottom()) {
if (cast_from_oop<HeapWord*>(obj) > bottom() || cast_from_oop<HeapWord*>(obj) + obj->size() < bottom()) {
log_error(gc, verify)("this humongous region is not part of its' humongous object " PTR_FORMAT, p2i(obj));
*failures = true;
return;

0 comments on commit 46423b0

Please sign in to comment.