< prev index next >

src/share/vm/runtime/vframe.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 172           print_locked_object_class_name(st, o, "waiting on");
 173         }
 174       }
 175     } else if (thread()->current_park_blocker() != NULL) {
 176       oop obj = thread()->current_park_blocker();
 177       Klass* k = obj->klass();
 178       st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name());
 179     }
 180   }
 181 
 182 
 183   // Print out all monitors that we have locked or are trying to lock
 184   GrowableArray<MonitorInfo*>* mons = monitors();
 185   if (!mons->is_empty()) {
 186     bool found_first_monitor = false;
 187     for (int index = (mons->length()-1); index >= 0; index--) {
 188       MonitorInfo* monitor = mons->at(index);
 189       if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
 190         if (monitor->owner_is_scalar_replaced()) {
 191           Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());

 192           st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
 193         } else {
 194           oop obj = monitor->owner();
 195           if (obj != NULL) {
 196             print_locked_object_class_name(st, obj, "eliminated");
 197           }
 198         }
 199         continue;
 200       }
 201       if (monitor->owner() != NULL) {
 202         // the monitor is associated with an object, i.e., it is locked
 203 
 204         // First, assume we have the monitor locked. If we haven't found an
 205         // owned monitor before and this is the first frame, then we need to
 206         // see if we have completed the lock or we are blocked trying to
 207         // acquire it - we can only be blocked if the monitor is inflated
 208 
 209         const char *lock_state = "locked"; // assume we have the monitor locked
 210         if (!found_first_monitor && frame_count == 0) {
 211           markOop mark = monitor->owner()->mark();
 212           if (mark->has_monitor() &&
 213               ( // we have marked ourself as pending on this monitor
 214                 mark->monitor() == thread()->current_pending_monitor() ||
 215                 // we are not the owner of this monitor
 216                 !mark->monitor()->is_entered(thread())
 217               )) {
 218             lock_state = "waiting to lock";




 219           }


 220         }
 221 
 222         found_first_monitor = true;
 223         print_locked_object_class_name(st, monitor->owner(), lock_state);
 224       }


 225     }
 226   }
 227 }
 228 
 229 // ------------- interpretedVFrame --------------
 230 
 231 u_char* interpretedVFrame::bcp() const {
 232   return fr().interpreter_frame_bcp();
 233 }
 234 
 235 void interpretedVFrame::set_bcp(u_char* bcp) {
 236   fr().interpreter_frame_set_bcp(bcp);
 237 }
 238 
 239 intptr_t* interpretedVFrame::locals_addr_at(int offset) const {
 240   assert(fr().is_interpreted_frame(), "frame should be an interpreted frame");
 241   return fr().interpreter_frame_local_at(offset);
 242 }
 243 
 244 


 560   method()->print_value();
 561   tty->cr();
 562   tty->print_cr("\tbci:    %d", bci());
 563 
 564   print_stack_values("locals",      locals());
 565   print_stack_values("expressions", expressions());
 566 
 567   GrowableArray<MonitorInfo*>* list = monitors();
 568   if (list->is_empty()) return;
 569   tty->print_cr("\tmonitor list:");
 570   for (int index = (list->length()-1); index >= 0; index--) {
 571     MonitorInfo* monitor = list->at(index);
 572     tty->print("\t  obj\t");
 573     if (monitor->owner_is_scalar_replaced()) {
 574       Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
 575       tty->print("( is scalar replaced %s)", k->external_name());
 576     } else if (monitor->owner() == NULL) {
 577       tty->print("( null )");
 578     } else {
 579       monitor->owner()->print_value();
 580       tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner());
 581     }
 582     if (monitor->eliminated() && is_compiled_frame())
 583       tty->print(" ( lock is eliminated )");



 584     tty->cr();
 585     tty->print("\t  ");
 586     monitor->lock()->print_on(tty);
 587     tty->cr();
 588   }
 589 }
 590 
 591 
 592 void javaVFrame::print_value() const {
 593   Method*    m = method();
 594   InstanceKlass*     k = m->method_holder();
 595   tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
 596                 _fr.sp(),  _fr.unextended_sp(), _fr.fp(), _fr.pc());
 597   tty->print("%s.%s", k->internal_name(), m->name()->as_C_string());
 598 
 599   if (!m->is_native()) {
 600     Symbol*  source_name = k->source_file_name();
 601     int        line_number = m->line_number_from_bci(bci());
 602     if (source_name != NULL && (line_number != -1)) {
 603       tty->print("(%s:%d)", source_name->as_C_string(), line_number);


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 172           print_locked_object_class_name(st, o, "waiting on");
 173         }
 174       }
 175     } else if (thread()->current_park_blocker() != NULL) {
 176       oop obj = thread()->current_park_blocker();
 177       Klass* k = obj->klass();
 178       st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name());
 179     }
 180   }
 181 
 182 
 183   // Print out all monitors that we have locked or are trying to lock
 184   GrowableArray<MonitorInfo*>* mons = monitors();
 185   if (!mons->is_empty()) {
 186     bool found_first_monitor = false;
 187     for (int index = (mons->length()-1); index >= 0; index--) {
 188       MonitorInfo* monitor = mons->at(index);
 189       if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
 190         if (monitor->owner_is_scalar_replaced()) {
 191           Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
 192           // format below for lockbits matches this one.
 193           st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
 194         } else {
 195           oop obj = monitor->owner();
 196           if (obj != NULL) {
 197             print_locked_object_class_name(st, obj, "eliminated");
 198           }
 199         }
 200         continue;
 201       }
 202       if (monitor->owner() != NULL) {
 203         // the monitor is associated with an object, i.e., it is locked
 204 
 205         // First, assume we have the monitor locked. If we haven't found an
 206         // owned monitor before and this is the first frame, then we need to
 207         // see if we have completed the lock or we are blocked trying to
 208         // acquire it - we can only be blocked if the monitor is inflated
 209 
 210         const char *lock_state = "locked"; // assume we have the monitor locked
 211         if (!found_first_monitor && frame_count == 0) {
 212           markOop mark = monitor->owner()->mark();
 213           if (mark->has_monitor() &&
 214               ( // we have marked ourself as pending on this monitor
 215                 mark->monitor() == thread()->current_pending_monitor() ||
 216                 // we are not the owner of this monitor
 217                 !mark->monitor()->is_entered(thread())
 218               )) {
 219             lock_state = "waiting to lock";
 220             print_locked_object_class_name(st, monitor->owner(), lock_state);
 221             if (Verbose) {
 222                 // match with format above, replacing "-" with " ".
 223                 st->print("\t  lockbits="); mark->print_on(st); st->print_cr("");
 224             }
 225           } else {
 226             print_locked_object_class_name(st, monitor->owner(), lock_state);
 227           }
 228         } else {

 229           print_locked_object_class_name(st, monitor->owner(), lock_state);
 230         }
 231         found_first_monitor = true;
 232       }
 233     }
 234   }
 235 }
 236 
 237 // ------------- interpretedVFrame --------------
 238 
 239 u_char* interpretedVFrame::bcp() const {
 240   return fr().interpreter_frame_bcp();
 241 }
 242 
 243 void interpretedVFrame::set_bcp(u_char* bcp) {
 244   fr().interpreter_frame_set_bcp(bcp);
 245 }
 246 
 247 intptr_t* interpretedVFrame::locals_addr_at(int offset) const {
 248   assert(fr().is_interpreted_frame(), "frame should be an interpreted frame");
 249   return fr().interpreter_frame_local_at(offset);
 250 }
 251 
 252 


 568   method()->print_value();
 569   tty->cr();
 570   tty->print_cr("\tbci:    %d", bci());
 571 
 572   print_stack_values("locals",      locals());
 573   print_stack_values("expressions", expressions());
 574 
 575   GrowableArray<MonitorInfo*>* list = monitors();
 576   if (list->is_empty()) return;
 577   tty->print_cr("\tmonitor list:");
 578   for (int index = (list->length()-1); index >= 0; index--) {
 579     MonitorInfo* monitor = list->at(index);
 580     tty->print("\t  obj\t");
 581     if (monitor->owner_is_scalar_replaced()) {
 582       Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
 583       tty->print("( is scalar replaced %s)", k->external_name());
 584     } else if (monitor->owner() == NULL) {
 585       tty->print("( null )");
 586     } else {
 587       monitor->owner()->print_value();
 588       tty->print("(owner=" INTPTR_FORMAT ")", (address)monitor->owner());
 589     }
 590     if (monitor->eliminated())
 591         if(is_compiled_frame())
 592             tty->print(" ( lock is eliminated in compiled frame )");
 593         else
 594             tty->print(" ( lock is eliminated, frame not compiled )");
 595     tty->cr();
 596     tty->print("\t  ");
 597     monitor->lock()->print_on(tty);
 598     tty->cr();
 599   }
 600 }
 601 
 602 
 603 void javaVFrame::print_value() const {
 604   Method*    m = method();
 605   InstanceKlass*     k = m->method_holder();
 606   tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
 607                 _fr.sp(),  _fr.unextended_sp(), _fr.fp(), _fr.pc());
 608   tty->print("%s.%s", k->internal_name(), m->name()->as_C_string());
 609 
 610   if (!m->is_native()) {
 611     Symbol*  source_name = k->source_file_name();
 612     int        line_number = m->line_number_from_bci(bci());
 613     if (source_name != NULL && (line_number != -1)) {
 614       tty->print("(%s:%d)", source_name->as_C_string(), line_number);


< prev index next >