author | coleenp |
Fri, 23 Mar 2012 11:16:05 -0400 | |
changeset 12263 | d20640f4f8fe |
parent 8878 | a6283814032c |
child 13728 | 882756847a04 |
permissions | -rw-r--r-- |
8725
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
1 |
/* |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
8c1e3dd5fe1b
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. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
4 |
* |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
8 |
* |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
13 |
* accompanied this code). |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
14 |
* |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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, |
8c1e3dd5fe1b
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. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
18 |
* |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
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 |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
21 |
* questions. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
22 |
* |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
23 |
*/ |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
24 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
26 |
#define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
27 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
28 |
#include "oops/instanceKlass.hpp" |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
29 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
30 |
// An instanceMirrorKlass is a specialized instanceKlass for |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
31 |
// java.lang.Class instances. These instances are special because |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
32 |
// they contain the static fields of the class in addition to the |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
33 |
// normal fields of Class. This means they are variable sized |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
34 |
// instances and need special logic for computing their size and for |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
35 |
// iteration of their oops. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
36 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
37 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
38 |
class instanceMirrorKlass: public instanceKlass { |
8878
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
39 |
friend class VMStructs; |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
40 |
|
8725
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
41 |
private: |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
42 |
static int _offset_of_static_fields; |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
43 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
44 |
public: |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
45 |
// Type testing |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
46 |
bool oop_is_instanceMirror() const { return true; } |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
47 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
48 |
// Casting from klassOop |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
49 |
static instanceMirrorKlass* cast(klassOop k) { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
50 |
assert(k->klass_part()->oop_is_instanceMirror(), "cast to instanceMirrorKlass"); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
51 |
return (instanceMirrorKlass*) k->klass_part(); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
52 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
53 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
54 |
// Returns the size of the instance including the extra static fields. |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
55 |
virtual int oop_size(oop obj) const; |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
56 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
57 |
// Static field offset is an offset into the Heap, should be converted by |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
58 |
// based on UseCompressedOop for traversal |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
59 |
static HeapWord* start_of_static_fields(oop obj) { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
60 |
return (HeapWord*)((intptr_t)obj + offset_of_static_fields()); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
61 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
62 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
63 |
static void init_offset_of_static_fields() { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
64 |
// Cache the offset of the static fields in the Class instance |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
65 |
assert(_offset_of_static_fields == 0, "once"); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
66 |
_offset_of_static_fields = instanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
67 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
68 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
69 |
static int offset_of_static_fields() { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
70 |
return _offset_of_static_fields; |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
71 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
72 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
73 |
int compute_static_oop_field_count(oop obj); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
74 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
75 |
// Given a Klass return the size of the instance |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
76 |
int instance_size(KlassHandle k); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
77 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
78 |
// allocation |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
79 |
DEFINE_ALLOCATE_PERMANENT(instanceMirrorKlass); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
80 |
instanceOop allocate_instance(KlassHandle k, TRAPS); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
81 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
82 |
// Garbage collection |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
83 |
int oop_adjust_pointers(oop obj); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
84 |
void oop_follow_contents(oop obj); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
85 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
86 |
// Parallel Scavenge and Parallel Old |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
87 |
PARALLEL_GC_DECLS |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
88 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
89 |
int oop_oop_iterate(oop obj, OopClosure* blk) { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
90 |
return oop_oop_iterate_v(obj, blk); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
91 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
92 |
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
93 |
return oop_oop_iterate_v_m(obj, blk, mr); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
94 |
} |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
95 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
96 |
#define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
97 |
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
98 |
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
99 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
100 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
101 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
102 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
103 |
#ifndef SERIALGC |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
104 |
#define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
105 |
int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
106 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
107 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
108 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
109 |
#endif // !SERIALGC |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
110 |
}; |
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
111 |
|
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff
changeset
|
112 |
#endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |