src/share/vm/oops/instanceRefKlass.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/oops/instanceRefKlass.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,108 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
    1.29 +#define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
    1.30 +
    1.31 +#include "oops/instanceKlass.hpp"
    1.32 +#include "utilities/macros.hpp"
    1.33 +
    1.34 +// An InstanceRefKlass is a specialized InstanceKlass for Java
    1.35 +// classes that are subclasses of java/lang/ref/Reference.
    1.36 +//
    1.37 +// These classes are used to implement soft/weak/final/phantom
    1.38 +// references and finalization, and need special treatment by the
    1.39 +// garbage collector.
    1.40 +//
    1.41 +// During GC discovered reference objects are added (chained) to one
    1.42 +// of the four lists below, depending on the type of reference.
    1.43 +// The linked occurs through the next field in class java/lang/ref/Reference.
    1.44 +//
    1.45 +// Afterwards, the discovered references are processed in decreasing
    1.46 +// order of reachability. Reference objects eligible for notification
    1.47 +// are linked to the static pending_list in class java/lang/ref/Reference,
    1.48 +// and the pending list lock object in the same class is notified.
    1.49 +
    1.50 +
    1.51 +class InstanceRefKlass: public InstanceKlass {
    1.52 +  friend class InstanceKlass;
    1.53 +
    1.54 +  // Constructor
    1.55 +  InstanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous)
    1.56 +    : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {}
    1.57 +
    1.58 + public:
    1.59 +  InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
    1.60 +  // Type testing
    1.61 +  bool oop_is_instanceRef() const             { return true; }
    1.62 +
    1.63 +  // Casting from Klass*
    1.64 +  static InstanceRefKlass* cast(Klass* k) {
    1.65 +    assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass");
    1.66 +    return (InstanceRefKlass*) k;
    1.67 +  }
    1.68 +
    1.69 +  // Garbage collection
    1.70 +  int  oop_adjust_pointers(oop obj);
    1.71 +  void oop_follow_contents(oop obj);
    1.72 +
    1.73 +  // Parallel Scavenge and Parallel Old
    1.74 +  PARALLEL_GC_DECLS
    1.75 +
    1.76 +  int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
    1.77 +    return oop_oop_iterate_v(obj, blk);
    1.78 +  }
    1.79 +  int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
    1.80 +    return oop_oop_iterate_v_m(obj, blk, mr);
    1.81 +  }
    1.82 +
    1.83 +#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)                \
    1.84 +  int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);                         \
    1.85 +  int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
    1.86 +
    1.87 +  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
    1.88 +  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
    1.89 +
    1.90 +#if INCLUDE_ALL_GCS
    1.91 +#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix)      \
    1.92 +  int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
    1.93 +
    1.94 +  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
    1.95 +  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
    1.96 +#endif // INCLUDE_ALL_GCS
    1.97 +
    1.98 +  static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);
    1.99 +  static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);
   1.100 +  static bool owns_pending_list_lock(JavaThread* thread);
   1.101 +
   1.102 +  // Update non-static oop maps so 'referent', 'nextPending' and
   1.103 +  // 'discovered' will look like non-oops
   1.104 +  static void update_nonstatic_oop_maps(Klass* k);
   1.105 +
   1.106 + public:
   1.107 +  // Verification
   1.108 +  void oop_verify_on(oop obj, outputStream* st);
   1.109 +};
   1.110 +
   1.111 +#endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP

mercurial