comparison src/share/vm/runtime/vframe.cpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents 957c266d8bc5 18fb7da42534
children 2cb439954abf
comparison
equal deleted inserted replaced
6711:ae13cc658b80 6948:e522a00b91aa
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
144 144
145 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) { 145 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) {
146 if (obj.not_null()) { 146 if (obj.not_null()) {
147 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj()); 147 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj());
148 if (obj->klass() == SystemDictionary::Class_klass()) { 148 if (obj->klass() == SystemDictionary::Class_klass()) {
149 klassOop target_klass = java_lang_Class::as_klassOop(obj()); 149 Klass* target_klass = java_lang_Class::as_Klass(obj());
150 st->print_cr("(a java.lang.Class for %s)", instanceKlass::cast(target_klass)->external_name()); 150 st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name());
151 } else { 151 } else {
152 Klass* k = Klass::cast(obj->klass()); 152 Klass* k = Klass::cast(obj->klass());
153 st->print_cr("(a %s)", k->external_name()); 153 st->print_cr("(a %s)", k->external_name());
154 } 154 }
155 } 155 }
159 ResourceMark rm; 159 ResourceMark rm;
160 160
161 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. 161 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
162 if (frame_count == 0) { 162 if (frame_count == 0) {
163 if (method()->name() == vmSymbols::wait_name() && 163 if (method()->name() == vmSymbols::wait_name() &&
164 instanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) { 164 method()->method_holder()->name() == vmSymbols::java_lang_Object()) {
165 StackValueCollection* locs = locals(); 165 StackValueCollection* locs = locals();
166 if (!locs->is_empty()) { 166 if (!locs->is_empty()) {
167 StackValue* sv = locs->at(0); 167 StackValue* sv = locs->at(0);
168 if (sv->type() == T_OBJECT) { 168 if (sv->type() == T_OBJECT) {
169 Handle o = locs->at(0)->get_obj(); 169 Handle o = locs->at(0)->get_obj();
184 bool found_first_monitor = false; 184 bool found_first_monitor = false;
185 for (int index = (mons->length()-1); index >= 0; index--) { 185 for (int index = (mons->length()-1); index >= 0; index--) {
186 MonitorInfo* monitor = mons->at(index); 186 MonitorInfo* monitor = mons->at(index);
187 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code 187 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
188 if (monitor->owner_is_scalar_replaced()) { 188 if (monitor->owner_is_scalar_replaced()) {
189 Klass* k = Klass::cast(monitor->owner_klass()); 189 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
190 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name()); 190 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
191 } else { 191 } else {
192 oop obj = monitor->owner(); 192 oop obj = monitor->owner();
193 if (obj != NULL) { 193 if (obj != NULL) {
194 print_locked_object_class_name(st, obj, "eliminated"); 194 print_locked_object_class_name(st, obj, "eliminated");
247 247
248 int interpretedVFrame::bci() const { 248 int interpretedVFrame::bci() const {
249 return method()->bci_from(bcp()); 249 return method()->bci_from(bcp());
250 } 250 }
251 251
252 methodOop interpretedVFrame::method() const { 252 Method* interpretedVFrame::method() const {
253 return fr().interpreter_frame_method(); 253 return fr().interpreter_frame_method();
254 } 254 }
255 255
256 StackValueCollection* interpretedVFrame::locals() const { 256 StackValueCollection* interpretedVFrame::locals() const {
257 int length = method()->max_locals(); 257 int length = method()->max_locals();
405 405
406 while (!at_end()) { 406 while (!at_end()) {
407 if (Universe::reflect_invoke_cache()->is_same_method(method())) { 407 if (Universe::reflect_invoke_cache()->is_same_method(method())) {
408 // This is Method.invoke() -- skip it 408 // This is Method.invoke() -- skip it
409 } else if (use_new_reflection && 409 } else if (use_new_reflection &&
410 Klass::cast(method()->method_holder()) 410 method()->method_holder()
411 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { 411 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
412 // This is an auxilary frame -- skip it 412 // This is an auxilary frame -- skip it
413 } else if (method()->is_method_handle_intrinsic() || 413 } else if (method()->is_method_handle_intrinsic() ||
414 method()->is_compiled_lambda_form()) { 414 method()->is_compiled_lambda_form()) {
415 // This is an internal adapter frame for method handles -- skip it 415 // This is an internal adapter frame for method handles -- skip it
469 469
470 470
471 void vframeStreamCommon::skip_reflection_related_frames() { 471 void vframeStreamCommon::skip_reflection_related_frames() {
472 while (!at_end() && 472 while (!at_end() &&
473 (JDK_Version::is_gte_jdk14x_version() && UseNewReflection && 473 (JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
474 (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || 474 (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
475 Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { 475 method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
476 next(); 476 next();
477 } 477 }
478 } 478 }
479 479
480 480
525 tty->print_cr("\tmonitor list:"); 525 tty->print_cr("\tmonitor list:");
526 for (int index = (list->length()-1); index >= 0; index--) { 526 for (int index = (list->length()-1); index >= 0; index--) {
527 MonitorInfo* monitor = list->at(index); 527 MonitorInfo* monitor = list->at(index);
528 tty->print("\t obj\t"); 528 tty->print("\t obj\t");
529 if (monitor->owner_is_scalar_replaced()) { 529 if (monitor->owner_is_scalar_replaced()) {
530 Klass* k = Klass::cast(monitor->owner_klass()); 530 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
531 tty->print("( is scalar replaced %s)", k->external_name()); 531 tty->print("( is scalar replaced %s)", k->external_name());
532 } else if (monitor->owner() == NULL) { 532 } else if (monitor->owner() == NULL) {
533 tty->print("( null )"); 533 tty->print("( null )");
534 } else { 534 } else {
535 monitor->owner()->print_value(); 535 monitor->owner()->print_value();
544 } 544 }
545 } 545 }
546 546
547 547
548 void javaVFrame::print_value() const { 548 void javaVFrame::print_value() const {
549 methodOop m = method(); 549 Method* m = method();
550 klassOop k = m->method_holder(); 550 InstanceKlass* k = m->method_holder();
551 tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")", 551 tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
552 _fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc()); 552 _fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc());
553 tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string()); 553 tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string());
554 554
555 if (!m->is_native()) { 555 if (!m->is_native()) {
556 Symbol* source_name = instanceKlass::cast(k)->source_file_name(); 556 Symbol* source_name = k->source_file_name();
557 int line_number = m->line_number_from_bci(bci()); 557 int line_number = m->line_number_from_bci(bci());
558 if (source_name != NULL && (line_number != -1)) { 558 if (source_name != NULL && (line_number != -1)) {
559 tty->print("(%s:%d)", source_name->as_C_string(), line_number); 559 tty->print("(%s:%d)", source_name->as_C_string(), line_number);
560 } 560 }
561 } else { 561 } else {