1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/oops/instanceRefKlass.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,87 @@ 1.4 +/* 1.5 + * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// An instanceRefKlass is a specialized instanceKlass for Java 1.29 +// classes that are subclasses of java/lang/ref/Reference. 1.30 +// 1.31 +// These classes are used to implement soft/weak/final/phantom 1.32 +// references and finalization, and need special treatment by the 1.33 +// garbage collector. 1.34 +// 1.35 +// During GC discovered reference objects are added (chained) to one 1.36 +// of the four lists below, depending on the type of reference. 1.37 +// The linked occurs through the next field in class java/lang/ref/Reference. 1.38 +// 1.39 +// Afterwards, the discovered references are processed in decreasing 1.40 +// order of reachability. Reference objects eligible for notification 1.41 +// are linked to the static pending_list in class java/lang/ref/Reference, 1.42 +// and the pending list lock object in the same class is notified. 1.43 + 1.44 + 1.45 +class instanceRefKlass: public instanceKlass { 1.46 + public: 1.47 + // Type testing 1.48 + bool oop_is_instanceRef() const { return true; } 1.49 + 1.50 + // Casting from klassOop 1.51 + static instanceRefKlass* cast(klassOop k) { 1.52 + assert(k->klass_part()->oop_is_instanceRef(), "cast to instanceRefKlass"); 1.53 + return (instanceRefKlass*) k->klass_part(); 1.54 + } 1.55 + 1.56 + // allocation 1.57 + DEFINE_ALLOCATE_PERMANENT(instanceRefKlass); 1.58 + 1.59 + // Garbage collection 1.60 + int oop_adjust_pointers(oop obj); 1.61 + void oop_follow_contents(oop obj); 1.62 + 1.63 + // Parallel Scavenge and Parallel Old 1.64 + PARALLEL_GC_DECLS 1.65 + 1.66 + int oop_oop_iterate(oop obj, OopClosure* blk) { 1.67 + return oop_oop_iterate_v(obj, blk); 1.68 + } 1.69 + int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { 1.70 + return oop_oop_iterate_v_m(obj, blk, mr); 1.71 + } 1.72 + 1.73 +#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ 1.74 + int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ 1.75 + int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); 1.76 + 1.77 + ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) 1.78 + ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DECL) 1.79 + 1.80 + static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock); 1.81 + static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock); 1.82 + 1.83 + // Update non-static oop maps so 'referent', 'nextPending' and 1.84 + // 'discovered' will look like non-oops 1.85 + static void update_nonstatic_oop_maps(klassOop k); 1.86 + 1.87 + public: 1.88 + // Verification 1.89 + void oop_verify_on(oop obj, outputStream* st); 1.90 +};