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