Mercurial > hg > graal-compiler
annotate src/share/vm/oops/methodDataKlass.cpp @ 4996:11ce128f8d28
fix for RiCompiledMethod.execute
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 29 Feb 2012 14:49:54 +0100 |
parents | 18a5539bf19b |
children |
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()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
87 #ifdef GRAAL |
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()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
89 #endif |
0 | 90 ResourceMark rm; |
91 for (ProfileData* data = m->first_data(); | |
92 m->is_valid(data); | |
93 data = m->next_data(data)) { | |
94 data->follow_contents(); | |
95 } | |
96 } | |
97 | |
98 #ifndef SERIALGC | |
99 void methodDataKlass::oop_follow_contents(ParCompactionManager* cm, | |
100 oop obj) { | |
101 assert (obj->is_methodData(), "object must be method data"); | |
102 methodDataOop m = methodDataOop(obj); | |
103 | |
104 obj->follow_header(cm); | |
105 PSParallelCompact::mark_and_push(cm, m->adr_method()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
106 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
107 PSParallelCompact::mark_and_push(cm, m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
108 #endif |
0 | 109 ResourceMark rm; |
110 for (ProfileData* data = m->first_data(); | |
111 m->is_valid(data); | |
112 data = m->next_data(data)) { | |
113 data->follow_contents(cm); | |
114 } | |
115 } | |
116 #endif // SERIALGC | |
117 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
118 |
0 | 119 int methodDataKlass::oop_oop_iterate(oop obj, OopClosure* blk) { |
120 assert (obj->is_methodData(), "object must be method data"); | |
121 methodDataOop m = methodDataOop(obj); | |
122 // Get size before changing pointers | |
123 // Don't call size() or oop_size() since that is a virtual call. | |
124 int size = m->object_size(); | |
125 | |
126 obj->oop_iterate_header(blk); | |
127 blk->do_oop(m->adr_method()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
128 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
129 blk->do_oop(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
130 #endif |
0 | 131 ResourceMark rm; |
132 for (ProfileData* data = m->first_data(); | |
133 m->is_valid(data); | |
134 data = m->next_data(data)) { | |
135 data->oop_iterate(blk); | |
136 } | |
137 return size; | |
138 } | |
139 | |
140 int methodDataKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
141 assert (obj->is_methodData(), "object must be method data"); | |
142 methodDataOop m = methodDataOop(obj); | |
143 // Get size before changing pointers | |
144 // Don't call size() or oop_size() since that is a virtual call. | |
145 int size = m->object_size(); | |
146 | |
147 obj->oop_iterate_header(blk, mr); | |
148 oop* adr = m->adr_method(); | |
149 if (mr.contains(adr)) { | |
150 blk->do_oop(m->adr_method()); | |
151 } | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
152 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
153 adr = m->adr_graal_mirror(); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
154 if(mr.contains(adr)) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
155 blk->do_oop(m->adr_graal_mirror()); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
156 } |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
157 #endif |
0 | 158 ResourceMark rm; |
159 for (ProfileData* data = m->first_data(); | |
160 m->is_valid(data); | |
161 data = m->next_data(data)) { | |
162 data->oop_iterate_m(blk, mr); | |
163 } | |
164 return size; | |
165 } | |
166 | |
167 int methodDataKlass::oop_adjust_pointers(oop obj) { | |
168 assert(obj->is_methodData(), "should be method data"); | |
169 methodDataOop m = methodDataOop(obj); | |
170 // Get size before changing pointers | |
171 // Don't call size() or oop_size() since that is a virtual call. | |
172 int size = m->object_size(); | |
173 | |
174 obj->adjust_header(); | |
175 MarkSweep::adjust_pointer(m->adr_method()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
176 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
177 MarkSweep::adjust_pointer(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
178 #endif |
0 | 179 ResourceMark rm; |
180 ProfileData* data; | |
181 for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) { | |
182 data->adjust_pointers(); | |
183 } | |
184 return size; | |
185 } | |
186 | |
187 | |
188 #ifndef SERIALGC | |
189 void methodDataKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
190 assert (obj->is_methodData(), "object must be method data"); | |
191 methodDataOop m = methodDataOop(obj); | |
192 // 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
|
193 assert(!PSScavenge::should_scavenge(m->adr_method()), "Sanity"); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
194 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
195 oop* adr = m->adr_graal_mirror(); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
196 if(PSScavenge::should_scavenge(adr)) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
197 pm->claim_or_forward_depth(adr); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
198 } |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
199 #endif |
0 | 200 } |
201 | |
202 int methodDataKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
203 assert(obj->is_methodData(), "should be method data"); | |
204 methodDataOop m = methodDataOop(obj); | |
205 | |
206 PSParallelCompact::adjust_pointer(m->adr_method()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
207 #ifdef GRAAL |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
2227
diff
changeset
|
208 PSParallelCompact::adjust_pointer(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4471
diff
changeset
|
209 #endif |
0 | 210 |
211 ResourceMark rm; | |
212 ProfileData* data; | |
213 for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) { | |
214 data->update_pointers(); | |
215 } | |
216 return m->object_size(); | |
217 } | |
218 #endif // SERIALGC | |
219 | |
220 #ifndef PRODUCT | |
221 | |
222 // Printing | |
223 void methodDataKlass::oop_print_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 st->cr(); | |
229 m->print_data_on(st); | |
230 } | |
231 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
196
diff
changeset
|
232 #endif //PRODUCT |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
196
diff
changeset
|
233 |
0 | 234 void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) { |
235 assert(obj->is_methodData(), "should be method data"); | |
236 methodDataOop m = methodDataOop(obj); | |
237 st->print("method data for "); | |
238 m->method()->print_value_on(st); | |
239 } | |
240 | |
241 const char* methodDataKlass::internal_name() const { | |
242 return "{method data}"; | |
243 } | |
244 | |
245 | |
246 // Verification | |
247 void methodDataKlass::oop_verify_on(oop obj, outputStream* st) { | |
248 Klass::oop_verify_on(obj, st); | |
249 guarantee(obj->is_methodData(), "object must be method data"); | |
250 methodDataOop m = methodDataOop(obj); | |
251 guarantee(m->is_perm(), "should be in permspace"); | |
252 m->verify_data_on(st); | |
253 } |