< prev index next >
src/share/vm/gc/parallel/psPromotionManager.inline.hpp
Print this page
*** 209,219 ****
// Copy obj
Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size);
// Now we have to CAS in the header.
! if (o->cas_forward_to(new_obj, test_mark)) {
// We won any races, we "own" this object.
assert(new_obj == o->forwardee(), "Sanity");
// Increment age if obj still in new generation. Now that
// we're dealing with a markOop that cannot change, it is
--- 209,219 ----
// Copy obj
Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size);
// Now we have to CAS in the header.
! if (o->cas_forward_to(new_obj, test_mark, memory_order_relaxed)) {
// We won any races, we "own" this object.
assert(new_obj == o->forwardee(), "Sanity");
// Increment age if obj still in new generation. Now that
// we're dealing with a markOop that cannot change, it is
*** 236,245 ****
--- 236,252 ----
TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes);
} else {
// we'll just push its contents
push_contents(new_obj);
}
+
+ // This code must come after the CAS test, or it will print incorrect
+ // information.
+ log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
+ should_scavenge(&new_obj) ? "copying" : "tenuring",
+ new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj),
+ new_obj->size());
} else {
// We lost, someone else "owns" this object
guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed.");
// Try to deallocate the space. If it was directly allocated we cannot
*** 253,273 ****
CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
}
// don't update this before the unallocation!
new_obj = o->forwardee();
}
} else {
assert(o->is_forwarded(), "Sanity");
new_obj = o->forwardee();
! }
!
! // This code must come after the CAS test, or it will print incorrect
! // information.
! log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
should_scavenge(&new_obj) ? "copying" : "tenuring",
! new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
return new_obj;
}
// Attempt to "claim" oop at p via CAS, push the new obj if successful
--- 260,283 ----
CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
}
// don't update this before the unallocation!
new_obj = o->forwardee();
+
+ // fields in new_obj may not be synchronized.
+ log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT "}",
+ should_scavenge(&new_obj) ? "copying" : "tenuring",
+ o->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj));
}
} else {
assert(o->is_forwarded(), "Sanity");
new_obj = o->forwardee();
! // fields in new_obj may not be synchronized.
! log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT "}",
should_scavenge(&new_obj) ? "copying" : "tenuring",
! o->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj));
! }
return new_obj;
}
// Attempt to "claim" oop at p via CAS, push the new obj if successful
*** 276,295 ****
template <class T, bool promote_immediately>
inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) {
assert(should_scavenge(p, true), "revisiting object?");
oop o = oopDesc::load_decode_heap_oop_not_null(p);
! oop new_obj = o->is_forwarded()
! ? o->forwardee()
! : copy_to_survivor_space<promote_immediately>(o);
// This code must come after the CAS test, or it will print incorrect
// information.
if (log_develop_is_enabled(Trace, gc, scavenge) && o->is_forwarded()) {
log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding",
! new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
}
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
// We cannot mark without test, as some code passes us pointers
--- 286,315 ----
template <class T, bool promote_immediately>
inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) {
assert(should_scavenge(p, true), "revisiting object?");
oop o = oopDesc::load_decode_heap_oop_not_null(p);
! oop new_obj;
+ if (o->is_forwarded()) {
+ new_obj = o->forwardee();
+ // fields in new_obj may not be synchronized.
+ if (log_develop_is_enabled(Trace, gc, scavenge) && o->is_forwarded()) {
+ log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT "}",
+ "forwarding",
+ o->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj));
+ }
+ } else {
+ new_obj = copy_to_survivor_space<promote_immediately>(o);
// This code must come after the CAS test, or it will print incorrect
// information.
if (log_develop_is_enabled(Trace, gc, scavenge) && o->is_forwarded()) {
log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding",
! new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj),
! new_obj->size());
! }
}
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
// We cannot mark without test, as some code passes us pointers
< prev index next >