Mercurial > hg > truffle
annotate src/share/vm/oops/methodKlass.cpp @ 5274:e72dd6533eb9
documented importance of nmethod::_graal_compiled_method wrt code unloading and GC
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 23 Apr 2012 15:42:30 +0200 |
parents | af59b4dfc9e4 |
children | 957c266d8bc5 |
rev | line source |
---|---|
0 | 1 /* |
2227 | 2 * Copyright (c) 1997, 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:
1507
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
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:
1507
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "gc_implementation/shared/markSweep.inline.hpp" | |
28 #include "gc_interface/collectedHeap.inline.hpp" | |
29 #include "interpreter/interpreter.hpp" | |
30 #include "memory/gcLocker.hpp" | |
31 #include "memory/resourceArea.hpp" | |
32 #include "memory/universe.inline.hpp" | |
33 #include "oops/constMethodKlass.hpp" | |
34 #include "oops/klassOop.hpp" | |
35 #include "oops/methodDataOop.hpp" | |
36 #include "oops/methodKlass.hpp" | |
37 #include "oops/oop.inline.hpp" | |
38 #include "oops/oop.inline2.hpp" | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
39 #include "oops/symbol.hpp" |
1972 | 40 #include "runtime/handles.inline.hpp" |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
41 #ifndef SERIALGC |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
42 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
43 #include "oops/oop.pcgc.inline.hpp" |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
44 #endif |
0 | 45 |
46 klassOop methodKlass::create_klass(TRAPS) { | |
47 methodKlass o; | |
48 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); | |
49 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); | |
50 // Make sure size calculation is right | |
51 assert(k()->size() == align_object_size(header_size()), "wrong size for object"); | |
52 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror | |
53 return k(); | |
54 } | |
55 | |
56 | |
57 int methodKlass::oop_size(oop obj) const { | |
58 assert(obj->is_method(), "must be method oop"); | |
59 return methodOop(obj)->object_size(); | |
60 } | |
61 | |
62 | |
63 bool methodKlass::oop_is_parsable(oop obj) const { | |
64 assert(obj->is_method(), "must be method oop"); | |
65 return methodOop(obj)->object_is_parsable(); | |
66 } | |
67 | |
68 | |
69 methodOop methodKlass::allocate(constMethodHandle xconst, | |
70 AccessFlags access_flags, TRAPS) { | |
71 int size = methodOopDesc::object_size(access_flags.is_native()); | |
72 KlassHandle h_k(THREAD, as_klassOop()); | |
73 assert(xconst()->is_parsable(), "possible publication protocol violation"); | |
74 methodOop m = (methodOop)CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL); | |
75 assert(!m->is_parsable(), "not expecting parsability yet."); | |
76 | |
77 No_Safepoint_Verifier no_safepoint; // until m becomes parsable below | |
78 m->set_constMethod(xconst()); | |
79 m->set_access_flags(access_flags); | |
80 m->set_method_size(size); | |
81 m->set_name_index(0); | |
82 m->set_signature_index(0); | |
83 #ifdef CC_INTERP | |
84 m->set_result_index(T_VOID); | |
85 #endif | |
86 m->set_constants(NULL); | |
87 m->set_max_stack(0); | |
88 m->set_max_locals(0); | |
856
75596850f863
6862576: vmIntrinsics needs cleanup in order to support JSR 292 intrinsics
jrose
parents:
710
diff
changeset
|
89 m->set_intrinsic_id(vmIntrinsics::_none); |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2348
diff
changeset
|
90 m->set_jfr_towrite(false); |
0 | 91 m->set_method_data(NULL); |
92 m->set_interpreter_throwout_count(0); | |
93 m->set_vtable_index(methodOopDesc::garbage_vtable_index); | |
94 | |
95 // Fix and bury in methodOop | |
96 m->set_interpreter_entry(NULL); // sets i2i entry and from_int | |
97 m->set_adapter_entry(NULL); | |
98 m->clear_code(); // from_c/from_i get set to c2i/i2i | |
99 | |
100 if (access_flags.is_native()) { | |
101 m->clear_native_function(); | |
102 m->set_signature_handler(NULL); | |
103 } | |
104 | |
105 NOT_PRODUCT(m->set_compiled_invocation_count(0);) | |
106 m->set_interpreter_invocation_count(0); | |
107 m->invocation_counter()->init(); | |
108 m->backedge_counter()->init(); | |
109 m->clear_number_of_breakpoints(); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
110 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
111 m->set_graal_mirror(NULL); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5150
diff
changeset
|
112 m->set_graal_invocation_time(0); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5150
diff
changeset
|
113 m->set_graal_priority(1000000); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
114 #endif |
1783 | 115 |
2348
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
116 #ifdef TIERED |
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
117 m->set_rate(0); |
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
118 m->set_prev_event_count(0); |
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
119 m->set_prev_time(0); |
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
120 #endif |
5d8f5a6dced7
7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents:
2227
diff
changeset
|
121 |
0 | 122 assert(m->is_parsable(), "must be parsable here."); |
123 assert(m->size() == size, "wrong size for object"); | |
124 // We should not publish an uprasable object's reference | |
125 // into one that is parsable, since that presents problems | |
126 // for the concurrent parallel marking and precleaning phases | |
127 // of concurrent gc (CMS). | |
128 xconst->set_method(m); | |
129 return m; | |
130 } | |
131 | |
132 | |
133 void methodKlass::oop_follow_contents(oop obj) { | |
134 assert (obj->is_method(), "object must be method"); | |
135 methodOop m = methodOop(obj); | |
136 // Performance tweak: We skip iterating over the klass pointer since we | |
137 // know that Universe::methodKlassObj never moves. | |
138 MarkSweep::mark_and_push(m->adr_constMethod()); | |
139 MarkSweep::mark_and_push(m->adr_constants()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
140 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
141 MarkSweep::mark_and_push(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
142 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
143 MarkSweep::mark_and_push(m->adr_method_data()); |
0 | 144 } |
145 | |
146 #ifndef SERIALGC | |
147 void methodKlass::oop_follow_contents(ParCompactionManager* cm, | |
148 oop obj) { | |
149 assert (obj->is_method(), "object must be method"); | |
150 methodOop m = methodOop(obj); | |
151 // Performance tweak: We skip iterating over the klass pointer since we | |
152 // know that Universe::methodKlassObj never moves. | |
153 PSParallelCompact::mark_and_push(cm, m->adr_constMethod()); | |
154 PSParallelCompact::mark_and_push(cm, m->adr_constants()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
155 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
156 PSParallelCompact::mark_and_push(cm, m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
157 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
158 PSParallelCompact::mark_and_push(cm, m->adr_method_data()); |
0 | 159 } |
160 #endif // SERIALGC | |
161 | |
162 int methodKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | |
163 assert (obj->is_method(), "object must be method"); | |
164 methodOop m = methodOop(obj); | |
165 // Get size before changing pointers. | |
166 // Don't call size() or oop_size() since that is a virtual call. | |
167 int size = m->object_size(); | |
168 // Performance tweak: We skip iterating over the klass pointer since we | |
169 // know that Universe::methodKlassObj never moves | |
170 blk->do_oop(m->adr_constMethod()); | |
171 blk->do_oop(m->adr_constants()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
172 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
173 blk->do_oop(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
174 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
175 blk->do_oop(m->adr_method_data()); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
176 |
0 | 177 return size; |
178 } | |
179 | |
180 | |
181 int methodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
182 assert (obj->is_method(), "object must be method"); | |
183 methodOop m = methodOop(obj); | |
184 // Get size before changing pointers. | |
185 // Don't call size() or oop_size() since that is a virtual call. | |
186 int size = m->object_size(); | |
187 // Performance tweak: We skip iterating over the klass pointer since we | |
188 // know that Universe::methodKlassObj never moves. | |
189 oop* adr; | |
190 adr = m->adr_constMethod(); | |
191 if (mr.contains(adr)) blk->do_oop(adr); | |
192 adr = m->adr_constants(); | |
193 if (mr.contains(adr)) blk->do_oop(adr); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
194 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
195 adr = m->adr_graal_mirror(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
196 if (mr.contains(adr)) blk->do_oop(adr); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
197 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
198 adr = m->adr_method_data(); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
199 if (mr.contains(adr)) blk->do_oop(adr); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
200 |
0 | 201 return size; |
202 } | |
203 | |
204 | |
205 int methodKlass::oop_adjust_pointers(oop obj) { | |
206 assert(obj->is_method(), "should be method"); | |
207 methodOop m = methodOop(obj); | |
208 // Get size before changing pointers. | |
209 // Don't call size() or oop_size() since that is a virtual call. | |
210 int size = m->object_size(); | |
211 // Performance tweak: We skip iterating over the klass pointer since we | |
212 // know that Universe::methodKlassObj never moves. | |
213 MarkSweep::adjust_pointer(m->adr_constMethod()); | |
214 MarkSweep::adjust_pointer(m->adr_constants()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
215 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
216 MarkSweep::adjust_pointer(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
217 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
218 MarkSweep::adjust_pointer(m->adr_method_data()); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
219 |
0 | 220 return size; |
221 } | |
222 | |
223 #ifndef SERIALGC | |
224 void methodKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
225 assert(obj->is_method(), "should be method"); | |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
226 methodOop m = methodOop(obj); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
227 #ifdef GRAAL |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
228 oop* adr = m->adr_graal_mirror(); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
229 if(PSScavenge::should_scavenge(adr)) { |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
230 pm->claim_or_forward_depth(adr); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
231 } |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
232 #endif |
0 | 233 } |
234 | |
235 int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
236 assert(obj->is_method(), "should be method"); | |
237 methodOop m = methodOop(obj); | |
238 PSParallelCompact::adjust_pointer(m->adr_constMethod()); | |
239 PSParallelCompact::adjust_pointer(m->adr_constants()); | |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
240 #ifdef GRAAL |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2348
diff
changeset
|
241 PSParallelCompact::adjust_pointer(m->adr_graal_mirror()); |
4979
18a5539bf19b
More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
242 #endif |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4979
diff
changeset
|
243 PSParallelCompact::adjust_pointer(m->adr_method_data()); |
0 | 244 return m->object_size(); |
245 } | |
246 #endif // SERIALGC | |
247 | |
248 #ifndef PRODUCT | |
249 | |
250 // Printing | |
251 | |
252 void methodKlass::oop_print_on(oop obj, outputStream* st) { | |
253 ResourceMark rm; | |
254 assert(obj->is_method(), "must be method"); | |
255 Klass::oop_print_on(obj, st); | |
256 methodOop m = methodOop(obj); | |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1155
diff
changeset
|
257 // get the effect of PrintOopAddress, always, for methods: |
1573
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1507
diff
changeset
|
258 st->print_cr(" - this oop: "INTPTR_FORMAT, (intptr_t)m); |
0 | 259 st->print (" - method holder: "); m->method_holder()->print_value_on(st); st->cr(); |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1155
diff
changeset
|
260 st->print (" - constants: "INTPTR_FORMAT" ", (address)m->constants()); |
0 | 261 m->constants()->print_value_on(st); st->cr(); |
262 st->print (" - access: 0x%x ", m->access_flags().as_int()); m->access_flags().print_on(st); st->cr(); | |
263 st->print (" - name: "); m->name()->print_value_on(st); st->cr(); | |
264 st->print (" - signature: "); m->signature()->print_value_on(st); st->cr(); | |
265 st->print_cr(" - max stack: %d", m->max_stack()); | |
266 st->print_cr(" - max locals: %d", m->max_locals()); | |
267 st->print_cr(" - size of params: %d", m->size_of_parameters()); | |
268 st->print_cr(" - method size: %d", m->method_size()); | |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1155
diff
changeset
|
269 if (m->intrinsic_id() != vmIntrinsics::_none) |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1155
diff
changeset
|
270 st->print_cr(" - intrinsic id: %d %s", m->intrinsic_id(), vmIntrinsics::name_at(m->intrinsic_id())); |
1783 | 271 if (m->highest_comp_level() != CompLevel_none) |
272 st->print_cr(" - highest level: %d", m->highest_comp_level()); | |
0 | 273 st->print_cr(" - vtable index: %d", m->_vtable_index); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
274 st->print_cr(" - i2i entry: " INTPTR_FORMAT, m->interpreter_entry()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
275 st->print_cr(" - adapter: " INTPTR_FORMAT, m->adapter()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
276 st->print_cr(" - compiled entry " INTPTR_FORMAT, m->from_compiled_entry()); |
0 | 277 st->print_cr(" - code size: %d", m->code_size()); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
278 if (m->code_size() != 0) { |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
279 st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
280 st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
281 } |
0 | 282 if (m->method_data() != NULL) { |
283 st->print_cr(" - method data: " INTPTR_FORMAT, (address)m->method_data()); | |
284 } | |
285 st->print_cr(" - checked ex length: %d", m->checked_exceptions_length()); | |
286 if (m->checked_exceptions_length() > 0) { | |
287 CheckedExceptionElement* table = m->checked_exceptions_start(); | |
288 st->print_cr(" - checked ex start: " INTPTR_FORMAT, table); | |
289 if (Verbose) { | |
290 for (int i = 0; i < m->checked_exceptions_length(); i++) { | |
291 st->print_cr(" - throws %s", m->constants()->printable_name_at(table[i].class_cp_index)); | |
292 } | |
293 } | |
294 } | |
295 if (m->has_linenumber_table()) { | |
296 u_char* table = m->compressed_linenumber_table(); | |
297 st->print_cr(" - linenumber start: " INTPTR_FORMAT, table); | |
298 if (Verbose) { | |
299 CompressedLineNumberReadStream stream(table); | |
300 while (stream.read_pair()) { | |
301 st->print_cr(" - line %d: %d", stream.line(), stream.bci()); | |
302 } | |
303 } | |
304 } | |
305 st->print_cr(" - localvar length: %d", m->localvariable_table_length()); | |
306 if (m->localvariable_table_length() > 0) { | |
307 LocalVariableTableElement* table = m->localvariable_table_start(); | |
308 st->print_cr(" - localvar start: " INTPTR_FORMAT, table); | |
309 if (Verbose) { | |
310 for (int i = 0; i < m->localvariable_table_length(); i++) { | |
311 int bci = table[i].start_bci; | |
312 int len = table[i].length; | |
313 const char* name = m->constants()->printable_name_at(table[i].name_cp_index); | |
314 const char* desc = m->constants()->printable_name_at(table[i].descriptor_cp_index); | |
315 int slot = table[i].slot; | |
316 st->print_cr(" - %s %s bci=%d len=%d slot=%d", desc, name, bci, len, slot); | |
317 } | |
318 } | |
319 } | |
320 if (m->code() != NULL) { | |
321 st->print (" - compiled code: "); | |
322 m->code()->print_value_on(st); | |
323 st->cr(); | |
324 } | |
710 | 325 if (m->is_method_handle_invoke()) { |
326 st->print_cr(" - invoke method type: " INTPTR_FORMAT, (address) m->method_handle_type()); | |
327 // m is classified as native, but it does not have an interesting | |
328 // native_function or signature handler | |
329 } else if (m->is_native()) { | |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
330 st->print_cr(" - native function: " INTPTR_FORMAT, m->native_function()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
331 st->print_cr(" - signature handler: " INTPTR_FORMAT, m->signature_handler()); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
332 } |
0 | 333 } |
334 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
856
diff
changeset
|
335 #endif //PRODUCT |
0 | 336 |
337 void methodKlass::oop_print_value_on(oop obj, outputStream* st) { | |
338 assert(obj->is_method(), "must be method"); | |
339 Klass::oop_print_value_on(obj, st); | |
340 methodOop m = methodOop(obj); | |
341 st->print(" "); | |
342 m->name()->print_value_on(st); | |
343 st->print(" "); | |
344 m->signature()->print_value_on(st); | |
345 st->print(" in "); | |
346 m->method_holder()->print_value_on(st); | |
347 if (WizardMode) st->print("[%d,%d]", m->size_of_parameters(), m->max_locals()); | |
348 if (WizardMode && m->code() != NULL) st->print(" ((nmethod*)%p)", m->code()); | |
349 } | |
350 | |
351 const char* methodKlass::internal_name() const { | |
352 return "{method}"; | |
353 } | |
354 | |
355 | |
356 // Verification | |
357 | |
358 void methodKlass::oop_verify_on(oop obj, outputStream* st) { | |
359 Klass::oop_verify_on(obj, st); | |
360 guarantee(obj->is_method(), "object must be method"); | |
361 if (!obj->partially_loaded()) { | |
362 methodOop m = methodOop(obj); | |
363 guarantee(m->is_perm(), "should be in permspace"); | |
364 guarantee(m->constants()->is_perm(), "should be in permspace"); | |
365 guarantee(m->constants()->is_constantPool(), "should be constant pool"); | |
366 guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop"); | |
367 guarantee(m->constMethod()->is_perm(), "should be in permspace"); | |
368 methodDataOop method_data = m->method_data(); | |
369 guarantee(method_data == NULL || | |
370 method_data->is_perm(), "should be in permspace"); | |
371 guarantee(method_data == NULL || | |
372 method_data->is_methodData(), "should be method data"); | |
373 } | |
374 } | |
375 | |
376 bool methodKlass::oop_partially_loaded(oop obj) const { | |
377 assert(obj->is_method(), "object must be method"); | |
378 methodOop m = methodOop(obj); | |
379 constMethodOop xconst = m->constMethod(); | |
380 assert(xconst != NULL, "const method must be set"); | |
381 constMethodKlass* ck = constMethodKlass::cast(xconst->klass()); | |
382 return ck->oop_partially_loaded(xconst); | |
383 } | |
384 | |
385 | |
386 void methodKlass::oop_set_partially_loaded(oop obj) { | |
387 assert(obj->is_method(), "object must be method"); | |
388 methodOop m = methodOop(obj); | |
389 constMethodOop xconst = m->constMethod(); | |
390 assert(xconst != NULL, "const method must be set"); | |
391 constMethodKlass* ck = constMethodKlass::cast(xconst->klass()); | |
392 ck->oop_set_partially_loaded(xconst); | |
393 } |