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