< prev index next >
src/share/vm/memory/referenceProcessor.cpp
Print this page
rev 8203 : imported patch remove_config
*** 35,45 ****
#include "runtime/java.hpp"
#include "runtime/jniHandles.hpp"
ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL;
- bool ReferenceProcessor::_pending_list_uses_discovered_field = false;
jlong ReferenceProcessor::_soft_ref_timestamp_clock = 0;
void referenceProcessor_init() {
ReferenceProcessor::init_statics();
}
--- 35,44 ----
*** 61,71 ****
vm_exit_during_initialization("Could not allocate reference policy object");
}
guarantee(RefDiscoveryPolicy == ReferenceBasedDiscovery ||
RefDiscoveryPolicy == ReferentBasedDiscovery,
"Unrecognized RefDiscoveryPolicy");
- _pending_list_uses_discovered_field = JDK_Version::current().pending_list_uses_discovered_field();
}
void ReferenceProcessor::enable_discovery(bool check_no_refs) {
#ifdef ASSERT
// Verify that we're not currently discovering refs
--- 60,69 ----
*** 351,372 ****
// in all places in the reference processor where we manipulate the discovered
// field we make sure to do the barrier here where we anyway iterate through
// all linked Reference objects. Note that it is important to not dirty any
// cards during reference processing since this will cause card table
// verification to fail for G1.
- //
- // BKWRD COMPATIBILITY NOTE: For older JDKs (prior to the fix for 4956777),
- // the "next" field is used to chain the pending list, not the discovered
- // field.
if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr("ReferenceProcessor::enqueue_discovered_reflist list "
INTPTR_FORMAT, p2i(refs_list.head()));
}
oop obj = NULL;
oop next_d = refs_list.head();
- if (pending_list_uses_discovered_field()) { // New behavior
// Walk down the list, self-looping the next field
// so that the References are not considered active.
while (obj != next_d) {
obj = next_d;
assert(obj->is_instanceRef(), "should be reference object");
--- 349,365 ----
*** 389,431 ****
// Need post-barrier on pending_list_addr. See enqueue_discovered_ref_helper() above.
java_lang_ref_Reference::set_discovered_raw(obj, old); // old may be NULL
oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), old);
}
}
- } else { // Old behavior
- // Walk down the list, copying the discovered field into
- // the next field and clearing the discovered field.
- while (obj != next_d) {
- obj = next_d;
- assert(obj->is_instanceRef(), "should be reference object");
- next_d = java_lang_ref_Reference::discovered(obj);
- if (TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
- p2i(obj), p2i(next_d));
- }
- assert(java_lang_ref_Reference::next(obj) == NULL,
- "The reference should not be enqueued");
- if (next_d == obj) { // obj is last
- // Swap refs_list into pending_list_addr and
- // set obj's next to what we read from pending_list_addr.
- oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr);
- // Need oop_check on pending_list_addr above;
- // see special oop-check code at the end of
- // enqueue_discovered_reflists() further below.
- if (old == NULL) {
- // obj should be made to point to itself, since
- // pending list was empty.
- java_lang_ref_Reference::set_next(obj, obj);
- } else {
- java_lang_ref_Reference::set_next(obj, old);
- }
- } else {
- java_lang_ref_Reference::set_next(obj, next_d);
- }
- java_lang_ref_Reference::set_discovered(obj, (oop) NULL);
- }
- }
}
// Parallel enqueue task
class RefProcEnqueueTask: public AbstractRefProcTaskExecutor::EnqueueTask {
public:
--- 382,391 ----
*** 513,538 ****
oop_store_raw(_prev_next, new_next);
NOT_PRODUCT(_removed++);
_refs_list.dec_length(1);
}
- // Make the Reference object active again.
- void DiscoveredListIterator::make_active() {
- // The pre barrier for G1 is probably just needed for the old
- // reference processing behavior. Should we guard this with
- // ReferenceProcessor::pending_list_uses_discovered_field() ?
- if (UseG1GC) {
- HeapWord* next_addr = java_lang_ref_Reference::next_addr(_ref);
- if (UseCompressedOops) {
- oopDesc::bs()->write_ref_field_pre((narrowOop*)next_addr, NULL);
- } else {
- oopDesc::bs()->write_ref_field_pre((oop*)next_addr, NULL);
- }
- }
- java_lang_ref_Reference::set_next_raw(_ref, NULL);
- }
-
void DiscoveredListIterator::clear_referent() {
oop_store_raw(_referent_addr, NULL);
}
// NOTE: process_phase*() are largely similar, and at a high level
--- 473,482 ----
*** 565,576 ****
gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy",
p2i(iter.obj()), iter.obj()->klass()->internal_name());
}
// Remove Reference object from list
iter.remove();
- // Make the Reference object active again
- iter.make_active();
// keep the referent around
iter.make_referent_alive();
iter.move_to_next();
} else {
iter.next();
--- 509,518 ----
< prev index next >