changeset 30186:a416fa6a0fe7

8075270: Print locals & stack slots location for PcDescs Reviewed-by: kvn, jrose
author vlivanov
date Fri, 20 Mar 2015 11:41:34 -0700
parents 4454203533c3
children c48efcf14cdc
files hotspot/src/share/vm/code/pcDesc.cpp hotspot/src/share/vm/code/scopeDesc.cpp
diffstat 2 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/code/pcDesc.cpp	Fri Mar 20 11:53:01 2015 +0100
+++ b/hotspot/src/share/vm/code/pcDesc.cpp	Fri Mar 20 11:41:34 2015 -0700
@@ -54,12 +54,7 @@
   for (ScopeDesc* sd = code->scope_desc_at(real_pc(code));
        sd != NULL;
        sd = sd->sender()) {
-    tty->print("  ");
-    sd->method()->print_short_name(tty);
-    tty->print("  @%d", sd->bci());
-    if (sd->should_reexecute())
-      tty->print("  reexecute=true");
-    tty->cr();
+    sd->print_on(tty);
   }
 #endif
 }
--- a/hotspot/src/share/vm/code/scopeDesc.cpp	Fri Mar 20 11:53:01 2015 +0100
+++ b/hotspot/src/share/vm/code/scopeDesc.cpp	Fri Mar 20 11:41:34 2015 -0700
@@ -157,14 +157,18 @@
 #ifndef PRODUCT
 
 void ScopeDesc::print_value_on(outputStream* st) const {
-  tty->print("   ");
+  st->print("  ");
   method()->print_short_name(st);
   int lineno = method()->line_number_from_bci(bci());
   if (lineno != -1) {
-    st->print_cr("@%d (line %d)", bci(), lineno);
+    st->print("@%d (line %d)", bci(), lineno);
   } else {
-    st->print_cr("@%d", bci());
+    st->print("@%d", bci());
   }
+  if (should_reexecute()) {
+    st->print("  reexecute=true");
+  }
+  st->cr();
 }
 
 void ScopeDesc::print_on(outputStream* st) const {
@@ -174,7 +178,7 @@
 void ScopeDesc::print_on(outputStream* st, PcDesc* pd) const {
   // header
   if (pd != NULL) {
-    tty->print_cr("ScopeDesc(pc=" PTR_FORMAT " offset=%x):", pd->real_pc(_code), pd->pc_offset());
+    st->print_cr("ScopeDesc(pc=" PTR_FORMAT " offset=%x):", pd->real_pc(_code), pd->pc_offset());
   }
 
   print_value_on(st);
@@ -192,7 +196,7 @@
   // locals
   { GrowableArray<ScopeValue*>* l = ((ScopeDesc*) this)->locals();
     if (l != NULL) {
-      tty->print_cr("   Locals");
+      st->print_cr("   Locals");
       for (int index = 0; index < l->length(); index++) {
         st->print("    - l%d: ", index);
         l->at(index)->print_on(st);
@@ -205,7 +209,7 @@
     if (l != NULL) {
       st->print_cr("   Expression stack");
       for (int index = 0; index < l->length(); index++) {
-        st->print("   - @%d: ", index);
+        st->print("    - @%d: ", index);
         l->at(index)->print_on(st);
         st->cr();
       }
@@ -225,12 +229,12 @@
 
 #ifdef COMPILER2
   if (DoEscapeAnalysis && is_top() && _objects != NULL) {
-    tty->print_cr("Objects");
+    st->print_cr("   Objects");
     for (int i = 0; i < _objects->length(); i++) {
       ObjectValue* sv = (ObjectValue*) _objects->at(i);
-      tty->print(" - %d: ", sv->id());
-      sv->print_fields_on(tty);
-      tty->cr();
+      st->print("    - %d: ", sv->id());
+      sv->print_fields_on(st);
+      st->cr();
     }
   }
 #endif // COMPILER2