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