Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/runtime/vframe.cpp
+++ new/src/share/vm/runtime/vframe.cpp
1 1 /*
2 - * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2 + * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 21 * have any questions.
22 22 *
23 23 */
24 24
25 25 # include "incls/_precompiled.incl"
26 26 # include "incls/_vframe.cpp.incl"
27 27
28 28 vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
29 29 : _reg_map(reg_map), _thread(thread) {
30 30 assert(fr != NULL, "must have frame");
31 31 _fr = *fr;
32 32 }
33 33
34 34 vframe::vframe(const frame* fr, JavaThread* thread)
35 35 : _reg_map(thread), _thread(thread) {
36 36 assert(fr != NULL, "must have frame");
37 37 _fr = *fr;
38 38 }
39 39
40 40 vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) {
41 41 // Interpreter frame
42 42 if (f->is_interpreted_frame()) {
43 43 return new interpretedVFrame(f, reg_map, thread);
44 44 }
45 45
46 46 // Compiled frame
47 47 CodeBlob* cb = f->cb();
48 48 if (cb != NULL) {
49 49 if (cb->is_nmethod()) {
50 50 nmethod* nm = (nmethod*)cb;
51 51 return new compiledVFrame(f, reg_map, thread, nm);
52 52 }
53 53
54 54 if (f->is_runtime_frame()) {
55 55 // Skip this frame and try again.
56 56 RegisterMap temp_map = *reg_map;
57 57 frame s = f->sender(&temp_map);
58 58 return new_vframe(&s, &temp_map, thread);
59 59 }
60 60 }
61 61
62 62 // External frame
63 63 return new externalVFrame(f, reg_map, thread);
64 64 }
65 65
66 66 vframe* vframe::sender() const {
67 67 RegisterMap temp_map = *register_map();
68 68 assert(is_top(), "just checking");
69 69 if (_fr.is_entry_frame() && _fr.is_first_frame()) return NULL;
70 70 frame s = _fr.real_sender(&temp_map);
71 71 if (s.is_first_frame()) return NULL;
72 72 return vframe::new_vframe(&s, &temp_map, thread());
73 73 }
74 74
75 75 vframe* vframe::top() const {
76 76 vframe* vf = (vframe*) this;
77 77 while (!vf->is_top()) vf = vf->sender();
78 78 return vf;
79 79 }
80 80
81 81
82 82 javaVFrame* vframe::java_sender() const {
83 83 vframe* f = sender();
84 84 while (f != NULL) {
85 85 if (f->is_java_frame()) return javaVFrame::cast(f);
86 86 f = f->sender();
87 87 }
88 88 return NULL;
89 89 }
90 90
91 91 // ------------- javaVFrame --------------
92 92
93 93 GrowableArray<MonitorInfo*>* javaVFrame::locked_monitors() {
94 94 assert(SafepointSynchronize::is_at_safepoint() || JavaThread::current() == thread(),
95 95 "must be at safepoint or it's a java frame of the current thread");
96 96
97 97 GrowableArray<MonitorInfo*>* mons = monitors();
98 98 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(mons->length());
99 99 if (mons->is_empty()) return result;
100 100
101 101 bool found_first_monitor = false;
102 102 ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
103 103 ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
104 104 oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : NULL);
105 105 oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : NULL);
106 106
107 107 for (int index = (mons->length()-1); index >= 0; index--) {
108 108 MonitorInfo* monitor = mons->at(index);
109 109 if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
110 110 oop obj = monitor->owner();
111 111 if (obj == NULL) continue; // skip unowned monitor
112 112 //
113 113 // Skip the monitor that the thread is blocked to enter or waiting on
114 114 //
115 115 if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
116 116 continue;
117 117 }
118 118 found_first_monitor = true;
119 119 result->append(monitor);
120 120 }
121 121 return result;
122 122 }
123 123
124 124 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) {
125 125 if (obj.not_null()) {
126 126 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj());
127 127 if (obj->klass() == SystemDictionary::Class_klass()) {
128 128 klassOop target_klass = java_lang_Class::as_klassOop(obj());
129 129 st->print_cr("(a java.lang.Class for %s)", instanceKlass::cast(target_klass)->external_name());
130 130 } else {
131 131 Klass* k = Klass::cast(obj->klass());
132 132 st->print_cr("(a %s)", k->external_name());
133 133 }
134 134 }
135 135 }
136 136
137 137 void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
138 138 ResourceMark rm;
139 139
140 140 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
141 141 if (frame_count == 0) {
142 142 if (method()->name() == vmSymbols::wait_name() &&
143 143 instanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) {
144 144 StackValueCollection* locs = locals();
145 145 if (!locs->is_empty()) {
146 146 StackValue* sv = locs->at(0);
147 147 if (sv->type() == T_OBJECT) {
148 148 Handle o = locs->at(0)->get_obj();
149 149 print_locked_object_class_name(st, o, "waiting on");
150 150 }
151 151 }
152 152 } else if (thread()->current_park_blocker() != NULL) {
153 153 oop obj = thread()->current_park_blocker();
154 154 Klass* k = Klass::cast(obj->klass());
155 155 st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name());
156 156 }
157 157 }
158 158
159 159
160 160 // Print out all monitors that we have locked or are trying to lock
161 161 GrowableArray<MonitorInfo*>* mons = monitors();
162 162 if (!mons->is_empty()) {
163 163 bool found_first_monitor = false;
164 164 for (int index = (mons->length()-1); index >= 0; index--) {
165 165 MonitorInfo* monitor = mons->at(index);
166 166 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
167 167 if (monitor->owner_is_scalar_replaced()) {
168 168 Klass* k = Klass::cast(monitor->owner_klass());
169 169 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
170 170 } else {
171 171 oop obj = monitor->owner();
172 172 if (obj != NULL) {
173 173 print_locked_object_class_name(st, obj, "eliminated");
174 174 }
175 175 }
176 176 continue;
177 177 }
178 178 if (monitor->owner() != NULL) {
179 179
180 180 // First, assume we have the monitor locked. If we haven't found an
181 181 // owned monitor before and this is the first frame, then we need to
182 182 // see if we have completed the lock or we are blocked trying to
183 183 // acquire it - we can only be blocked if the monitor is inflated
184 184
185 185 const char *lock_state = "locked"; // assume we have the monitor locked
186 186 if (!found_first_monitor && frame_count == 0) {
187 187 markOop mark = monitor->owner()->mark();
188 188 if (mark->has_monitor() &&
189 189 mark->monitor() == thread()->current_pending_monitor()) {
190 190 lock_state = "waiting to lock";
191 191 }
192 192 }
193 193
194 194 found_first_monitor = true;
195 195 print_locked_object_class_name(st, monitor->owner(), lock_state);
196 196 }
197 197 }
198 198 }
199 199 }
200 200
201 201 // ------------- interpretedVFrame --------------
202 202
203 203 u_char* interpretedVFrame::bcp() const {
204 204 return fr().interpreter_frame_bcp();
205 205 }
206 206
207 207 void interpretedVFrame::set_bcp(u_char* bcp) {
208 208 fr().interpreter_frame_set_bcp(bcp);
209 209 }
210 210
211 211 intptr_t* interpretedVFrame::locals_addr_at(int offset) const {
212 212 assert(fr().is_interpreted_frame(), "frame should be an interpreted frame");
213 213 return fr().interpreter_frame_local_at(offset);
214 214 }
215 215
216 216
217 217 GrowableArray<MonitorInfo*>* interpretedVFrame::monitors() const {
218 218 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(5);
219 219 for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin()));
220 220 current >= fr().interpreter_frame_monitor_end();
221 221 current = fr().previous_monitor_in_interpreter_frame(current)) {
222 222 result->push(new MonitorInfo(current->obj(), current->lock(), false, false));
223 223 }
224 224 return result;
225 225 }
226 226
227 227 int interpretedVFrame::bci() const {
228 228 return method()->bci_from(bcp());
229 229 }
230 230
231 231 methodOop interpretedVFrame::method() const {
232 232 return fr().interpreter_frame_method();
233 233 }
234 234
235 235 StackValueCollection* interpretedVFrame::locals() const {
236 236 int length = method()->max_locals();
237 237
238 238 if (method()->is_native()) {
239 239 // If the method is native, max_locals is not telling the truth.
240 240 // maxlocals then equals the size of parameters
241 241 length = method()->size_of_parameters();
242 242 }
243 243
244 244 StackValueCollection* result = new StackValueCollection(length);
245 245
246 246 // Get oopmap describing oops and int for current bci
247 247 if (TaggedStackInterpreter) {
248 248 for(int i=0; i < length; i++) {
249 249 // Find stack location
250 250 intptr_t *addr = locals_addr_at(i);
251 251
252 252 // Depending on oop/int put it in the right package
253 253 StackValue *sv;
254 254 frame::Tag tag = fr().interpreter_frame_local_tag(i);
255 255 if (tag == frame::TagReference) {
256 256 // oop value
257 257 Handle h(*(oop *)addr);
258 258 sv = new StackValue(h);
259 259 } else {
260 260 // integer
261 261 sv = new StackValue(*addr);
262 262 }
263 263 assert(sv != NULL, "sanity check");
264 264 result->add(sv);
265 265 }
266 266 } else {
267 267 InterpreterOopMap oop_mask;
268 268 if (TraceDeoptimization && Verbose) {
269 269 methodHandle m_h(thread(), method());
270 270 OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
271 271 } else {
272 272 method()->mask_for(bci(), &oop_mask);
273 273 }
274 274 // handle locals
275 275 for(int i=0; i < length; i++) {
276 276 // Find stack location
277 277 intptr_t *addr = locals_addr_at(i);
278 278
279 279 // Depending on oop/int put it in the right package
280 280 StackValue *sv;
281 281 if (oop_mask.is_oop(i)) {
282 282 // oop value
283 283 Handle h(*(oop *)addr);
284 284 sv = new StackValue(h);
285 285 } else {
286 286 // integer
287 287 sv = new StackValue(*addr);
288 288 }
289 289 assert(sv != NULL, "sanity check");
290 290 result->add(sv);
291 291 }
292 292 }
293 293 return result;
294 294 }
295 295
296 296 void interpretedVFrame::set_locals(StackValueCollection* values) const {
297 297 if (values == NULL || values->size() == 0) return;
298 298
299 299 int length = method()->max_locals();
300 300 if (method()->is_native()) {
301 301 // If the method is native, max_locals is not telling the truth.
302 302 // maxlocals then equals the size of parameters
303 303 length = method()->size_of_parameters();
304 304 }
305 305
306 306 assert(length == values->size(), "Mismatch between actual stack format and supplied data");
307 307
308 308 // handle locals
309 309 for (int i = 0; i < length; i++) {
310 310 // Find stack location
311 311 intptr_t *addr = locals_addr_at(i);
312 312
313 313 // Depending on oop/int put it in the right package
314 314 StackValue *sv = values->at(i);
315 315 assert(sv != NULL, "sanity check");
316 316 if (sv->type() == T_OBJECT) {
317 317 *(oop *) addr = (sv->get_obj())();
318 318 } else { // integer
319 319 *addr = sv->get_int();
320 320 }
321 321 }
322 322 }
323 323
324 324 StackValueCollection* interpretedVFrame::expressions() const {
325 325 int length = fr().interpreter_frame_expression_stack_size();
326 326 if (method()->is_native()) {
327 327 // If the method is native, there is no expression stack
328 328 length = 0;
329 329 }
330 330
331 331 int nof_locals = method()->max_locals();
332 332 StackValueCollection* result = new StackValueCollection(length);
333 333
334 334 if (TaggedStackInterpreter) {
335 335 // handle expressions
336 336 for(int i=0; i < length; i++) {
337 337 // Find stack location
338 338 intptr_t *addr = fr().interpreter_frame_expression_stack_at(i);
339 339 frame::Tag tag = fr().interpreter_frame_expression_stack_tag(i);
340 340
341 341 // Depending on oop/int put it in the right package
342 342 StackValue *sv;
343 343 if (tag == frame::TagReference) {
344 344 // oop value
345 345 Handle h(*(oop *)addr);
346 346 sv = new StackValue(h);
347 347 } else {
348 348 // otherwise
349 349 sv = new StackValue(*addr);
350 350 }
351 351 assert(sv != NULL, "sanity check");
352 352 result->add(sv);
353 353 }
354 354 } else {
355 355 InterpreterOopMap oop_mask;
356 356 // Get oopmap describing oops and int for current bci
357 357 if (TraceDeoptimization && Verbose) {
358 358 methodHandle m_h(method());
359 359 OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
360 360 } else {
361 361 method()->mask_for(bci(), &oop_mask);
362 362 }
363 363 // handle expressions
364 364 for(int i=0; i < length; i++) {
365 365 // Find stack location
366 366 intptr_t *addr = fr().interpreter_frame_expression_stack_at(i);
367 367
368 368 // Depending on oop/int put it in the right package
369 369 StackValue *sv;
370 370 if (oop_mask.is_oop(i + nof_locals)) {
371 371 // oop value
372 372 Handle h(*(oop *)addr);
373 373 sv = new StackValue(h);
374 374 } else {
375 375 // integer
376 376 sv = new StackValue(*addr);
377 377 }
378 378 assert(sv != NULL, "sanity check");
379 379 result->add(sv);
380 380 }
381 381 }
382 382 return result;
383 383 }
384 384
385 385
386 386 // ------------- cChunk --------------
387 387
388 388 entryVFrame::entryVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
389 389 : externalVFrame(fr, reg_map, thread) {}
390 390
391 391
392 392 void vframeStreamCommon::found_bad_method_frame() {
393 393 // 6379830 Cut point for an assertion that occasionally fires when
394 394 // we are using the performance analyzer.
395 395 // Disable this assert when testing the analyzer with fastdebug.
396 396 // -XX:SuppressErrorAt=vframe.cpp:XXX (XXX=following line number)
397 397 assert(false, "invalid bci or invalid scope desc");
398 398 }
399 399
400 400 // top-frame will be skipped
401 401 vframeStream::vframeStream(JavaThread* thread, frame top_frame,
402 402 bool stop_at_java_call_stub) : vframeStreamCommon(thread) {
403 403 _stop_at_java_call_stub = stop_at_java_call_stub;
404 404
405 405 // skip top frame, as it may not be at safepoint
406 406 _frame = top_frame.sender(&_reg_map);
407 407 while (!fill_from_frame()) {
408 408 _frame = _frame.sender(&_reg_map);
409 409 }
410 410 }
411 411
412 412
413 413 // Step back n frames, skip any pseudo frames in between.
414 414 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
415 415 // AccessController.doPrivileged.
416 416 //
417 417 // NOTE that in JDK 1.4 this has been exposed to Java as
418 418 // sun.reflect.Reflection.getCallerClass(), which can be inlined.
419 419 // Inlined versions must match this routine's logic.
420 420 // Native method prefixing logic does not need to match since
421 421 // the method names don't match and inlining will not occur.
422 422 // See, for example,
423 423 // Parse::inline_native_Reflection_getCallerClass in
424 424 // opto/library_call.cpp.
↓ open down ↓ |
412 lines elided |
↑ open up ↑ |
425 425 void vframeStreamCommon::security_get_caller_frame(int depth) {
426 426 bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection;
427 427
428 428 while (!at_end()) {
429 429 if (Universe::reflect_invoke_cache()->is_same_method(method())) {
430 430 // This is Method.invoke() -- skip it
431 431 } else if (use_new_reflection &&
432 432 Klass::cast(method()->method_holder())
433 433 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
434 434 // This is an auxilary frame -- skip it
435 + } else if (method()->is_method_handle_adapter()) {
436 + // This is an internal adapter frame from the MethodHandleCompiler -- skip it
435 437 } else {
436 438 // This is non-excluded frame, we need to count it against the depth
437 439 if (depth-- <= 0) {
438 440 // we have reached the desired depth, we are done
439 441 break;
440 442 }
441 443 }
442 444 if (method()->is_prefixed_native()) {
443 445 skip_prefixed_method_and_wrappers();
444 446 } else {
445 447 next();
446 448 }
447 449 }
448 450 }
449 451
450 452
451 453 void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
452 454 ResourceMark rm;
453 455 HandleMark hm;
454 456
455 457 int method_prefix_count = 0;
456 458 char** method_prefixes = JvmtiExport::get_all_native_method_prefixes(&method_prefix_count);
457 459 KlassHandle prefixed_klass(method()->method_holder());
458 460 const char* prefixed_name = method()->name()->as_C_string();
459 461 size_t prefixed_name_len = strlen(prefixed_name);
460 462 int prefix_index = method_prefix_count-1;
461 463
462 464 while (!at_end()) {
463 465 next();
464 466 if (method()->method_holder() != prefixed_klass()) {
465 467 break; // classes don't match, can't be a wrapper
466 468 }
467 469 const char* name = method()->name()->as_C_string();
468 470 size_t name_len = strlen(name);
469 471 size_t prefix_len = prefixed_name_len - name_len;
470 472 if (prefix_len <= 0 || strcmp(name, prefixed_name + prefix_len) != 0) {
471 473 break; // prefixed name isn't prefixed version of method name, can't be a wrapper
472 474 }
473 475 for (; prefix_index >= 0; --prefix_index) {
474 476 const char* possible_prefix = method_prefixes[prefix_index];
475 477 size_t possible_prefix_len = strlen(possible_prefix);
476 478 if (possible_prefix_len == prefix_len &&
477 479 strncmp(possible_prefix, prefixed_name, prefix_len) == 0) {
478 480 break; // matching prefix found
479 481 }
480 482 }
481 483 if (prefix_index < 0) {
482 484 break; // didn't find the prefix, can't be a wrapper
483 485 }
484 486 prefixed_name = name;
485 487 prefixed_name_len = name_len;
486 488 }
487 489 }
488 490
489 491
490 492 void vframeStreamCommon::skip_reflection_related_frames() {
491 493 while (!at_end() &&
492 494 (JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
493 495 (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
494 496 Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
495 497 next();
496 498 }
497 499 }
498 500
499 501
500 502 #ifndef PRODUCT
501 503 void vframe::print() {
502 504 if (WizardMode) _fr.print_value_on(tty,NULL);
503 505 }
504 506
505 507
506 508 void vframe::print_value() const {
507 509 ((vframe*)this)->print();
508 510 }
509 511
510 512
511 513 void entryVFrame::print_value() const {
512 514 ((entryVFrame*)this)->print();
513 515 }
514 516
515 517 void entryVFrame::print() {
516 518 vframe::print();
517 519 tty->print_cr("C Chunk inbetween Java");
518 520 tty->print_cr("C link " INTPTR_FORMAT, _fr.link());
519 521 }
520 522
521 523
522 524 // ------------- javaVFrame --------------
523 525
524 526 static void print_stack_values(const char* title, StackValueCollection* values) {
525 527 if (values->is_empty()) return;
526 528 tty->print_cr("\t%s:", title);
527 529 values->print();
528 530 }
529 531
530 532
531 533 void javaVFrame::print() {
532 534 ResourceMark rm;
533 535 vframe::print();
534 536 tty->print("\t");
535 537 method()->print_value();
536 538 tty->cr();
537 539 tty->print_cr("\tbci: %d", bci());
538 540
539 541 print_stack_values("locals", locals());
540 542 print_stack_values("expressions", expressions());
541 543
542 544 GrowableArray<MonitorInfo*>* list = monitors();
543 545 if (list->is_empty()) return;
544 546 tty->print_cr("\tmonitor list:");
545 547 for (int index = (list->length()-1); index >= 0; index--) {
546 548 MonitorInfo* monitor = list->at(index);
547 549 tty->print("\t obj\t");
548 550 if (monitor->owner_is_scalar_replaced()) {
549 551 Klass* k = Klass::cast(monitor->owner_klass());
550 552 tty->print("( is scalar replaced %s)", k->external_name());
551 553 } else if (monitor->owner() == NULL) {
552 554 tty->print("( null )");
553 555 } else {
554 556 monitor->owner()->print_value();
555 557 tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner());
556 558 }
557 559 if (monitor->eliminated() && is_compiled_frame())
558 560 tty->print(" ( lock is eliminated )");
559 561 tty->cr();
560 562 tty->print("\t ");
561 563 monitor->lock()->print_on(tty);
562 564 tty->cr();
563 565 }
564 566 }
565 567
566 568
567 569 void javaVFrame::print_value() const {
568 570 methodOop m = method();
569 571 klassOop k = m->method_holder();
570 572 tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
571 573 _fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc());
572 574 tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string());
573 575
574 576 if (!m->is_native()) {
575 577 symbolOop source_name = instanceKlass::cast(k)->source_file_name();
576 578 int line_number = m->line_number_from_bci(bci());
577 579 if (source_name != NULL && (line_number != -1)) {
578 580 tty->print("(%s:%d)", source_name->as_C_string(), line_number);
579 581 }
580 582 } else {
581 583 tty->print("(Native Method)");
582 584 }
583 585 // Check frame size and print warning if it looks suspiciously large
584 586 if (fr().sp() != NULL) {
585 587 RegisterMap map = *register_map();
586 588 uint size = fr().frame_size(&map);
587 589 #ifdef _LP64
588 590 if (size > 8*K) warning("SUSPICIOUSLY LARGE FRAME (%d)", size);
589 591 #else
590 592 if (size > 4*K) warning("SUSPICIOUSLY LARGE FRAME (%d)", size);
591 593 #endif
592 594 }
593 595 }
594 596
595 597
596 598 bool javaVFrame::structural_compare(javaVFrame* other) {
597 599 // Check static part
598 600 if (method() != other->method()) return false;
599 601 if (bci() != other->bci()) return false;
600 602
601 603 // Check locals
602 604 StackValueCollection *locs = locals();
603 605 StackValueCollection *other_locs = other->locals();
604 606 assert(locs->size() == other_locs->size(), "sanity check");
605 607 int i;
606 608 for(i = 0; i < locs->size(); i++) {
607 609 // it might happen the compiler reports a conflict and
608 610 // the interpreter reports a bogus int.
609 611 if ( is_compiled_frame() && locs->at(i)->type() == T_CONFLICT) continue;
610 612 if (other->is_compiled_frame() && other_locs->at(i)->type() == T_CONFLICT) continue;
611 613
612 614 if (!locs->at(i)->equal(other_locs->at(i)))
613 615 return false;
614 616 }
615 617
616 618 // Check expressions
617 619 StackValueCollection* exprs = expressions();
618 620 StackValueCollection* other_exprs = other->expressions();
619 621 assert(exprs->size() == other_exprs->size(), "sanity check");
620 622 for(i = 0; i < exprs->size(); i++) {
621 623 if (!exprs->at(i)->equal(other_exprs->at(i)))
622 624 return false;
623 625 }
624 626
625 627 return true;
626 628 }
627 629
628 630
629 631 void javaVFrame::print_activation(int index) const {
630 632 // frame number and method
631 633 tty->print("%2d - ", index);
632 634 ((vframe*)this)->print_value();
633 635 tty->cr();
634 636
635 637 if (WizardMode) {
636 638 ((vframe*)this)->print();
637 639 tty->cr();
638 640 }
639 641 }
640 642
641 643
642 644 void javaVFrame::verify() const {
643 645 }
644 646
645 647
646 648 void interpretedVFrame::verify() const {
647 649 }
648 650
649 651
650 652 // ------------- externalVFrame --------------
651 653
652 654 void externalVFrame::print() {
653 655 _fr.print_value_on(tty,NULL);
654 656 }
655 657
656 658
657 659 void externalVFrame::print_value() const {
658 660 ((vframe*)this)->print();
659 661 }
660 662 #endif // PRODUCT
↓ open down ↓ |
216 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX