author | pliden |
Wed, 13 May 2015 15:16:06 +0200 | |
changeset 30764 | fec48bf5a827 |
parent 30150 | d9c940aa42ef |
child 30880 | efe35e08179f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
30764 | 2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
26 |
#define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
|
27 |
||
30764 | 28 |
#include "gc/shared/specialized_oop_closures.hpp" |
7397 | 29 |
#include "oops/instanceKlass.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13738
diff
changeset
|
30 |
#include "utilities/macros.hpp" |
7397 | 31 |
|
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
32 |
// An InstanceRefKlass is a specialized InstanceKlass for Java |
1 | 33 |
// classes that are subclasses of java/lang/ref/Reference. |
34 |
// |
|
35 |
// These classes are used to implement soft/weak/final/phantom |
|
36 |
// references and finalization, and need special treatment by the |
|
37 |
// garbage collector. |
|
38 |
// |
|
39 |
// During GC discovered reference objects are added (chained) to one |
|
40 |
// of the four lists below, depending on the type of reference. |
|
41 |
// The linked occurs through the next field in class java/lang/ref/Reference. |
|
42 |
// |
|
43 |
// Afterwards, the discovered references are processed in decreasing |
|
44 |
// order of reachability. Reference objects eligible for notification |
|
45 |
// are linked to the static pending_list in class java/lang/ref/Reference, |
|
46 |
// and the pending list lock object in the same class is notified. |
|
47 |
||
48 |
||
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
49 |
class InstanceRefKlass: public InstanceKlass { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
50 |
friend class InstanceKlass; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
51 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
52 |
// Constructor |
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
53 |
InstanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
54 |
: InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
55 |
|
1 | 56 |
public: |
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
57 |
InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } |
1 | 58 |
// Type testing |
59 |
bool oop_is_instanceRef() const { return true; } |
|
60 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
61 |
// Casting from Klass* |
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
62 |
static InstanceRefKlass* cast(Klass* k) { |
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
63 |
assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass"); |
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
64 |
return (InstanceRefKlass*) k; |
1 | 65 |
} |
66 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
67 |
// GC specific object visitors |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
68 |
// |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
69 |
// Mark Sweep |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
70 |
void oop_ms_follow_contents(oop obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
71 |
int oop_ms_adjust_pointers(oop obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
72 |
#if INCLUDE_ALL_GCS |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
73 |
// Parallel Scavenge |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
74 |
void oop_ps_push_contents( oop obj, PSPromotionManager* pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
75 |
// Parallel Compact |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
76 |
void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
77 |
void oop_pc_update_pointers(oop obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
78 |
#endif |
1 | 79 |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
80 |
// Oop fields (and metadata) iterators |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
81 |
// [nv = true] Use non-virtual calls to do_oop_nv. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
82 |
// [nv = false] Use virtual calls to do_oop. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
83 |
// |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
84 |
// The InstanceRefKlass iterators also support reference processing. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
85 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
86 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
87 |
// Forward iteration |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
88 |
private: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
89 |
// Iterate over all oop fields and metadata. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
90 |
template <bool nv, class OopClosureType> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
91 |
inline int oop_oop_iterate(oop obj, OopClosureType* closure); |
1 | 92 |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
93 |
// Reverse iteration |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
94 |
#if INCLUDE_ALL_GCS |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
95 |
// Iterate over all oop fields and metadata. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
96 |
template <bool nv, class OopClosureType> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
97 |
inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
98 |
#endif // INCLUDE_ALL_GCS |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
99 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
100 |
// Bounded range iteration |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
101 |
// Iterate over all oop fields and metadata. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
102 |
template <bool nv, class OopClosureType> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
103 |
inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
104 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
105 |
// Reference processing part of the iterators. |
1 | 106 |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
107 |
// Specialized for [T = oop] or [T = narrowOop]. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
108 |
template <bool nv, typename T, class OopClosureType, class Contains> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
109 |
inline void oop_oop_iterate_ref_processing_specialized(oop obj, OopClosureType* closure, Contains& contains); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
110 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
111 |
// Only perform reference processing if the referent object is within mr. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
112 |
template <bool nv, class OopClosureType> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
113 |
inline void oop_oop_iterate_ref_processing_bounded(oop obj, OopClosureType* closure, MemRegion mr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
114 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
115 |
// Reference processing |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
116 |
template <bool nv, class OopClosureType> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
117 |
inline void oop_oop_iterate_ref_processing(oop obj, OopClosureType* closure); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
118 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
119 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
120 |
public: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
121 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
122 |
#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
123 |
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \ |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
124 |
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* closure, MemRegion mr); |
1 | 125 |
|
126 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
|
1374 | 127 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
128 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13738
diff
changeset
|
129 |
#if INCLUDE_ALL_GCS |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
130 |
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29688
diff
changeset
|
131 |
int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure); |
1374 | 132 |
|
133 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
|
134 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13738
diff
changeset
|
135 |
#endif // INCLUDE_ALL_GCS |
1 | 136 |
|
137 |
static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock); |
|
138 |
static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock); |
|
7446
9193aa209467
6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents:
7397
diff
changeset
|
139 |
static bool owns_pending_list_lock(JavaThread* thread); |
1 | 140 |
|
141 |
// Update non-static oop maps so 'referent', 'nextPending' and |
|
142 |
// 'discovered' will look like non-oops |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7446
diff
changeset
|
143 |
static void update_nonstatic_oop_maps(Klass* k); |
1 | 144 |
|
145 |
public: |
|
146 |
// Verification |
|
147 |
void oop_verify_on(oop obj, outputStream* st); |
|
148 |
}; |
|
7397 | 149 |
|
150 |
#endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |