Mercurial > hg > truffle
annotate src/share/vm/oops/methodDataKlass.cpp @ 4530:6c6cb7be1324
bugfix
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Wed, 08 Feb 2012 21:13:35 -0800 |
parents | 59d3d0b80975 |
children | 18a5539bf19b |
rev | line source |
---|---|
0 | 1 /* |
2227 | 2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "gc_implementation/shared/markSweep.inline.hpp" | |
27 #include "gc_interface/collectedHeap.inline.hpp" | |
28 #include "memory/gcLocker.hpp" | |
29 #include "memory/resourceArea.hpp" | |
30 #include "memory/universe.inline.hpp" | |
31 #include "oops/klassOop.hpp" | |
32 #include "oops/methodDataKlass.hpp" | |
33 #include "oops/methodDataOop.hpp" | |
34 #include "oops/oop.inline.hpp" | |
35 #include "oops/oop.inline2.hpp" | |
36 #include "runtime/handles.inline.hpp" | |
37 #ifndef SERIALGC | |
4471
59d3d0b80975
added missing include
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
38 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
1972 | 39 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
40 #include "oops/oop.pcgc.inline.hpp" | |
41 #endif | |
0 | 42 |
43 klassOop methodDataKlass::create_klass(TRAPS) { | |
44 methodDataKlass o; | |
45 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); | |
46 KlassHandle k = base_create_klass(h_this_klass, header_size(), | |
47 o.vtbl_value(), CHECK_NULL); | |
48 // Make sure size calculation is right | |
49 assert(k()->size() == align_object_size(header_size()), | |
50 "wrong size for object"); | |
51 return k(); | |
52 } | |
53 | |
54 | |
55 int methodDataKlass::oop_size(oop obj) const { | |
56 assert(obj->is_methodData(), "must be method data oop"); | |
57 return methodDataOop(obj)->object_size(); | |
58 } | |
59 | |
60 | |
61 bool methodDataKlass::oop_is_parsable(oop obj) const { | |
62 assert(obj->is_methodData(), "must be method data oop"); | |
63 return methodDataOop(obj)->object_is_parsable(); | |
64 } | |
65 | |
66 | |
67 methodDataOop methodDataKlass::allocate(methodHandle method, TRAPS) { | |
68 int size = methodDataOopDesc::compute_allocation_size_in_words(method); | |
69 KlassHandle h_k(THREAD, as_klassOop()); | |
70 methodDataOop mdo = | |
71 (methodDataOop)CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL); | |
72 assert(!mdo->is_parsable(), "not expecting parsability yet."); | |
73 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC | |
74 mdo->initialize(method); | |
75 | |
76 assert(mdo->is_parsable(), "should be parsable here."); | |
77 assert(size == mdo->object_size(), "wrong size for methodDataOop"); | |
78 return mdo; | |
79 } | |
80 | |
81 | |
82 void methodDataKlass::oop_follow_contents(oop obj) { | |
83 assert (obj->is_methodData(), "object must be method data"); | |
84 methodDataOop m = methodDataOop(obj); | |
85 | |
86 obj->follow_header(); | |
87 MarkSweep::mark_and_push(m->adr_method()); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
88 MarkSweep::mark_and_push(m->adr_graal_mirror()); |
0 | 89 ResourceMark rm; |
90 for (ProfileData* data = m->first_data(); | |
91 m->is_valid(data); | |
92 data = m->next_data(data)) { | |
93 data->follow_contents(); | |
94 } | |
95 } | |
96 | |
97 #ifndef SERIALGC | |
98 void methodDataKlass::oop_follow_contents(ParCompactionManager* cm, | |
99 oop obj) { | |
100 assert (obj->is_methodData(), "object must be method data"); | |
101 methodDataOop m = methodDataOop(obj); | |
102 | |
103 obj->follow_header(cm); | |
104 PSParallelCompact::mark_and_push(cm, m->adr_method()); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
105 PSParallelCompact::mark_and_push(cm, m->adr_graal_mirror()); |
0 | 106 ResourceMark rm; |
107 for (ProfileData* data = m->first_data(); | |
108 m->is_valid(data); | |
109 data = m->next_data(data)) { | |
110 data->follow_contents(cm); | |
111 } | |
112 } | |
113 #endif // SERIALGC | |
114 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
115 |
0 | 116 int methodDataKlass::oop_oop_iterate(oop obj, OopClosure* blk) { |
117 assert (obj->is_methodData(), "object must be method data"); | |
118 methodDataOop m = methodDataOop(obj); | |
119 // Get size before changing pointers | |
120 // Don't call size() or oop_size() since that is a virtual call. | |
121 int size = m->object_size(); | |
122 | |
123 obj->oop_iterate_header(blk); | |
124 blk->do_oop(m->adr_method()); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
125 blk->do_oop(m->adr_graal_mirror()); |
0 | 126 ResourceMark rm; |
127 for (ProfileData* data = m->first_data(); | |
128 m->is_valid(data); | |
129 data = m->next_data(data)) { | |
130 data->oop_iterate(blk); | |
131 } | |
132 return size; | |
133 } | |
134 | |
135 int methodDataKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
136 assert (obj->is_methodData(), "object must be method data"); | |
137 methodDataOop m = methodDataOop(obj); | |
138 // Get size before changing pointers | |
139 // Don't call size() or oop_size() since that is a virtual call. | |
140 int size = m->object_size(); | |
141 | |
142 obj->oop_iterate_header(blk, mr); | |
143 oop* adr = m->adr_method(); | |
144 if (mr.contains(adr)) { | |
145 blk->do_oop(m->adr_method()); | |
146 } | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
147 adr = m->adr_graal_mirror(); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
148 if(mr.contains(adr)) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
149 blk->do_oop(m->adr_graal_mirror()); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
150 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
151 |
0 | 152 ResourceMark rm; |
153 for (ProfileData* data = m->first_data(); | |
154 m->is_valid(data); | |
155 data = m->next_data(data)) { | |
156 data->oop_iterate_m(blk, mr); | |
157 } | |
158 return size; | |
159 } | |
160 | |
161 int methodDataKlass::oop_adjust_pointers(oop obj) { | |
162 assert(obj->is_methodData(), "should be method data"); | |
163 methodDataOop m = methodDataOop(obj); | |
164 // Get size before changing pointers | |
165 // Don't call size() or oop_size() since that is a virtual call. | |
166 int size = m->object_size(); | |
167 | |
168 obj->adjust_header(); | |
169 MarkSweep::adjust_pointer(m->adr_method()); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
170 MarkSweep::adjust_pointer(m->adr_graal_mirror()); |
0 | 171 ResourceMark rm; |
172 ProfileData* data; | |
173 for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) { | |
174 data->adjust_pointers(); | |
175 } | |
176 return size; | |
177 } | |
178 | |
179 | |
180 #ifndef SERIALGC | |
181 void methodDataKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
182 assert (obj->is_methodData(), "object must be method data"); | |
183 methodDataOop m = methodDataOop(obj); | |
184 // This should never point into the young gen. | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
185 assert(!PSScavenge::should_scavenge(m->adr_method()), "Sanity"); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
186 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
187 oop* adr = m->adr_graal_mirror(); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
188 if(PSScavenge::should_scavenge(adr)) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
189 pm->claim_or_forward_depth(adr); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
190 } |
0 | 191 } |
192 | |
193 int methodDataKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
194 assert(obj->is_methodData(), "should be method data"); | |
195 methodDataOop m = methodDataOop(obj); | |
196 | |
197 PSParallelCompact::adjust_pointer(m->adr_method()); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
198 PSParallelCompact::adjust_pointer(m->adr_graal_mirror()); |
0 | 199 |
200 ResourceMark rm; | |
201 ProfileData* data; | |
202 for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) { | |
203 data->update_pointers(); | |
204 } | |
205 return m->object_size(); | |
206 } | |
207 #endif // SERIALGC | |
208 | |
209 #ifndef PRODUCT | |
210 | |
211 // Printing | |
212 void methodDataKlass::oop_print_on(oop obj, outputStream* st) { | |
213 assert(obj->is_methodData(), "should be method data"); | |
214 methodDataOop m = methodDataOop(obj); | |
215 st->print("method data for "); | |
216 m->method()->print_value_on(st); | |
217 st->cr(); | |
218 m->print_data_on(st); | |
219 } | |
220 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
196
diff
changeset
|
221 #endif //PRODUCT |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
196
diff
changeset
|
222 |
0 | 223 void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) { |
224 assert(obj->is_methodData(), "should be method data"); | |
225 methodDataOop m = methodDataOop(obj); | |
226 st->print("method data for "); | |
227 m->method()->print_value_on(st); | |
228 } | |
229 | |
230 const char* methodDataKlass::internal_name() const { | |
231 return "{method data}"; | |
232 } | |
233 | |
234 | |
235 // Verification | |
236 void methodDataKlass::oop_verify_on(oop obj, outputStream* st) { | |
237 Klass::oop_verify_on(obj, st); | |
238 guarantee(obj->is_methodData(), "object must be method data"); | |
239 methodDataOop m = methodDataOop(obj); | |
240 guarantee(m->is_perm(), "should be in permspace"); | |
241 m->verify_data_on(st); | |
242 } |