/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "gc_implementation/shared/markSweep.inline.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "oops/instanceRefKlass.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/preserveException.hpp"
#ifndef SERIALGC
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "oops/oop.pcgc.inline.hpp"
#endif
template <class T>
if(TraceReferenceGC && PrintGCDetails) {
}
)
if (!referent->is_gc_marked() &&
// reference was discovered, referent will be traversed later
if(TraceReferenceGC && PrintGCDetails) {
}
)
return;
} else {
// treat referent as normal oop
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
}
// Treat discovered as normal oop, if ref is not "active",
// i.e. if next is non-NULL.
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
} else {
#ifdef ASSERT
// In the case of older JDKs which do not use the discovered
// field for the pending list, an inactive ref (next != NULL)
// must always have a NULL discovered field.
#endif
}
// treat next as normal oop. next is a link in the reference queue.
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
if (UseCompressedOops) {
} else {
}
}
#ifndef SERIALGC
template <class T>
if(TraceReferenceGC && PrintGCDetails) {
}
)
// reference already enqueued, referent will be traversed later
if(TraceReferenceGC && PrintGCDetails) {
}
)
return;
} else {
// treat referent as normal oop
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
}
// Treat discovered as normal oop, if ref is not "active",
// i.e. if next is non-NULL.
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
} else {
#ifdef ASSERT
// In the case of older JDKs which do not use the discovered
// field for the pending list, an inactive ref (next != NULL)
// must always have a NULL discovered field.
#endif
}
}
if (UseCompressedOops) {
} else {
}
}
#endif // SERIALGC
#ifdef ASSERT
T* referent_addr,
T* next_addr,
T* discovered_addr) {
if(TraceReferenceGC && PrintGCDetails) {
}
}
#endif
}
if (UseCompressedOops) {
} else {
}
return size;
}
if (closure->apply_to_weak_ref_discovered_field()) { \
} \
\
return size; \
} else if (contains(referent_addr)) { \
/* treat referent as normal oop */ \
} \
} \
if (ReferenceProcessor::pending_list_uses_discovered_field()) { \
/* Treat discovered as normal oop, if ref is not "active" (next non-NULL) */\
/* i.e. ref is not "active" */ \
debug_only( \
if(TraceReferenceGC && PrintGCDetails) { \
INTPTR_FORMAT, disc_addr); \
} \
) \
} \
} else { \
/* In the case of older JDKs which do not use the discovered field for */ \
/* the pending list, an inactive ref (next != NULL) must always have a */ \
/* NULL discovered field. */ \
debug_only( \
) \
} \
/* treat next as normal oop */ \
} \
return size; \
template <class T> bool contains(T *t) { return true; }
// Macro to define instanceRefKlass::oop_oop_iterate for virtual/nonvirtual for
// all closures. Macros calling macros above for each oop size.
\
int instanceRefKlass:: \
/* Get size before changing pointers */ \
\
\
if (UseCompressedOops) { \
} else { \
} \
}
#ifndef SERIALGC
\
int instanceRefKlass:: \
/* Get size before changing pointers */ \
\
\
if (UseCompressedOops) { \
} else { \
} \
}
#endif // !SERIALGC
\
int instanceRefKlass:: \
\
if (UseCompressedOops) { \
} else { \
} \
}
#ifndef SERIALGC
#endif // SERIALGC
#ifndef SERIALGC
template <class T>
// reference already enqueued, referent and next will be traversed later
return;
} else {
// treat referent as normal oop
}
}
// Treat discovered as normal oop, if ref is not "active",
// i.e. if next is non-NULL.
if(TraceReferenceGC && PrintGCDetails) {
}
)
}
}
} else {
#ifdef ASSERT
// In the case of older JDKs which do not use the discovered
// field for the pending list, an inactive ref (next != NULL)
// must always have a NULL discovered field.
#endif
}
// Treat next as normal oop; next is a link in the reference queue.
}
}
if (UseCompressedOops) {
} else {
}
}
template <class T>
}
if (UseCompressedOops) {
} else {
}
return size_helper();
}
#endif // SERIALGC
// Clear the nonstatic oop-map entries corresponding to referent
// and nextPending field. They are treated specially by the
// garbage collector.
// The discovered field is used only by the garbage collector
// and is also treated specially.
// Check that we have the right class
debug_only(static bool first_time = true);
"Invalid update of maps");
debug_only(first_time = false);
// Check that the current map is (2,4) - currently points at field with
// offset 2 (words) and has 4 map entries.
if (UseSharedSpaces) {
} else {
"just checking");
// Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
}
}
// Verification
// Verify referent field
// We should make this general to all heaps
}
// Verify next field
}
}
}
// we may enter this with pending exception set
PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument
// Create a HandleMark in case we retry a GC multiple times.
// Each time we attempt the GC, we allocate the handle below
// to hold the pending list lock. We want to free this handle.
"Locking should have succeeded");
}
// we may enter this with pending exception set
PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument
// Create a HandleMark in case we retry a GC multiple times.
// Each time we attempt the GC, we allocate the handle below
// to hold the pending list lock. We want to free this handle.
"Lock should be held");
// Notify waiters on pending lists lock if there is any reference.
}
}