Mercurial > hg > graal-compiler
annotate src/share/vm/oops/instanceMirrorKlass.hpp @ 20591:28051f14c328
8043158: Crash in CodeSweeperSweepNoFlushTest in CompileQueue::free_all()
Summary: Acquire lock before calling notify()
Reviewed-by: twisti, thartmann
author | anoll |
---|---|
date | Fri, 20 Jun 2014 09:25:13 +0200 |
parents | 190899198332 |
children |
rev | line source |
---|---|
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
1 /* |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
4 * |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
8 * |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
13 * accompanied this code). |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
14 * |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
18 * |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
21 * questions. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
22 * |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
23 */ |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
24 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
25 #ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
26 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
27 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
28 #include "classfile/systemDictionary.hpp" |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
29 #include "oops/instanceKlass.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
30 #include "runtime/handles.hpp" |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
31 #include "utilities/macros.hpp" |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
32 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
33 // An InstanceMirrorKlass is a specialized InstanceKlass for |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
34 // java.lang.Class instances. These instances are special because |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
35 // they contain the static fields of the class in addition to the |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
36 // normal fields of Class. This means they are variable sized |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
37 // instances and need special logic for computing their size and for |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
38 // iteration of their oops. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
39 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
40 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
41 class InstanceMirrorKlass: public InstanceKlass { |
2411
63997f575155
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
2376
diff
changeset
|
42 friend class VMStructs; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
43 friend class InstanceKlass; |
2411
63997f575155
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
2376
diff
changeset
|
44 |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
45 private: |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
46 static int _offset_of_static_fields; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
47 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
48 // Constructor |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
49 InstanceMirrorKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous) |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
50 : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {} |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
51 |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
52 public: |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
53 InstanceMirrorKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
54 // Type testing |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
55 bool oop_is_instanceMirror() const { return true; } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
56 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
57 // Casting from Klass* |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
58 static InstanceMirrorKlass* cast(Klass* k) { |
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
59 assert(k->oop_is_instanceMirror(), "cast to InstanceMirrorKlass"); |
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
60 return (InstanceMirrorKlass*) k; |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
61 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
62 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
63 // Returns the size of the instance including the extra static fields. |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
64 virtual int oop_size(oop obj) const; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
65 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
66 // Static field offset is an offset into the Heap, should be converted by |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
67 // based on UseCompressedOop for traversal |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
68 static HeapWord* start_of_static_fields(oop obj) { |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
69 return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields()); |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
70 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
71 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
72 static void init_offset_of_static_fields() { |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
73 // Cache the offset of the static fields in the Class instance |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
74 assert(_offset_of_static_fields == 0, "once"); |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
75 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
76 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
77 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
78 static int offset_of_static_fields() { |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
79 return _offset_of_static_fields; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
80 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
81 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
82 int compute_static_oop_field_count(oop obj); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
83 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
84 // Given a Klass return the size of the instance |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
85 int instance_size(KlassHandle k); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
86 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
87 // allocation |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
88 instanceOop allocate_instance(KlassHandle k, TRAPS); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
89 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
90 // Garbage collection |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
91 int oop_adjust_pointers(oop obj); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
92 void oop_follow_contents(oop obj); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
93 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
94 // Parallel Scavenge and Parallel Old |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
95 PARALLEL_GC_DECLS |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
96 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
97 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) { |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
98 return oop_oop_iterate_v(obj, blk); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
99 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2411
diff
changeset
|
100 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
101 return oop_oop_iterate_v_m(obj, blk, mr); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
102 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
103 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
104 #define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
105 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
106 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
107 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
108 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
109 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
110 |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
111 #if INCLUDE_ALL_GCS |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
112 #define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
113 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
114 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
115 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
116 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
117 #endif // INCLUDE_ALL_GCS |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
118 }; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
119 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
120 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |