instanceRefKlass.hpp revision 1472
395N/A/*
2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
395N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
395N/A *
395N/A * This code is free software; you can redistribute it and/or modify it
395N/A * under the terms of the GNU General Public License version 2 only, as
395N/A * published by the Free Software Foundation.
395N/A *
395N/A * This code is distributed in the hope that it will be useful, but WITHOUT
395N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
395N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
395N/A * version 2 for more details (a copy is included in the LICENSE file that
395N/A * accompanied this code).
395N/A *
395N/A * You should have received a copy of the GNU General Public License version
395N/A * 2 along with this work; if not, write to the Free Software Foundation,
395N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
395N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
395N/A *
395N/A */
395N/A
395N/A// An instanceRefKlass is a specialized instanceKlass for Java
395N/A// classes that are subclasses of java/lang/ref/Reference.
395N/A//
395N/A// These classes are used to implement soft/weak/final/phantom
395N/A// references and finalization, and need special treatment by the
395N/A// garbage collector.
395N/A//
395N/A// During GC discovered reference objects are added (chained) to one
395N/A// of the four lists below, depending on the type of reference.
395N/A// The linked occurs through the next field in class java/lang/ref/Reference.
395N/A//
395N/A// Afterwards, the discovered references are processed in decreasing
395N/A// order of reachability. Reference objects eligible for notification
395N/A// are linked to the static pending_list in class java/lang/ref/Reference,
395N/A// and the pending list lock object in the same class is notified.
395N/A
395N/A
395N/Aclass instanceRefKlass: public instanceKlass {
395N/A public:
395N/A // Type testing
395N/A bool oop_is_instanceRef() const { return true; }
395N/A
395N/A // Casting from klassOop
395N/A static instanceRefKlass* cast(klassOop k) {
395N/A assert(k->klass_part()->oop_is_instanceRef(), "cast to instanceRefKlass");
395N/A return (instanceRefKlass*) k->klass_part();
395N/A }
395N/A
395N/A // allocation
395N/A DEFINE_ALLOCATE_PERMANENT(instanceRefKlass);
395N/A
// Garbage collection
int oop_adjust_pointers(oop obj);
void oop_follow_contents(oop obj);
// Parallel Scavenge and Parallel Old
PARALLEL_GC_DECLS
int oop_oop_iterate(oop obj, OopClosure* blk) {
return oop_oop_iterate_v(obj, blk);
}
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
return oop_oop_iterate_v_m(obj, blk, mr);
}
#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
#ifndef SERIALGC
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
#endif // !SERIALGC
static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);
static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);
// Update non-static oop maps so 'referent', 'nextPending' and
// 'discovered' will look like non-oops
static void update_nonstatic_oop_maps(klassOop k);
public:
// Verification
void oop_verify_on(oop obj, outputStream* st);
};