Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/oops/instanceRefKlass.hpp
32285 views
/*1* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP25#define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP2627#include "oops/instanceKlass.hpp"28#include "utilities/macros.hpp"2930// An InstanceRefKlass is a specialized InstanceKlass for Java31// classes that are subclasses of java/lang/ref/Reference.32//33// These classes are used to implement soft/weak/final/phantom34// references and finalization, and need special treatment by the35// garbage collector.36//37// During GC discovered reference objects are added (chained) to one38// of the four lists below, depending on the type of reference.39// The linked occurs through the next field in class java/lang/ref/Reference.40//41// Afterwards, the discovered references are processed in decreasing42// order of reachability. Reference objects eligible for notification43// are linked to the static pending_list in class java/lang/ref/Reference,44// and the pending list lock object in the same class is notified.454647class InstanceRefKlass: public InstanceKlass {48friend class InstanceKlass;4950// Constructor51InstanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous)52: InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {}5354public:55InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }56// Type testing57bool oop_is_instanceRef() const { return true; }5859// Casting from Klass*60static InstanceRefKlass* cast(Klass* k) {61assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass");62return (InstanceRefKlass*) k;63}6465// Garbage collection66int oop_adjust_pointers(oop obj);67void oop_follow_contents(oop obj);6869// Parallel Scavenge and Parallel Old70PARALLEL_GC_DECLS7172int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {73return oop_oop_iterate_v(obj, blk);74}75int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {76return oop_oop_iterate_v_m(obj, blk, mr);77}7879#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \80int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \81int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);8283ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)84ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)8586#if INCLUDE_ALL_GCS87#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \88int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);8990ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)91ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)92#endif // INCLUDE_ALL_GCS9394static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);95static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);96static bool owns_pending_list_lock(JavaThread* thread);9798// Update non-static oop maps so 'referent', 'nextPending' and99// 'discovered' will look like non-oops100static void update_nonstatic_oop_maps(Klass* k);101102public:103// Verification104void oop_verify_on(oop obj, outputStream* st);105};106107#endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP108109110