6621094: PrintOptoAssembly is broken for oops information in DebugInfo
authorkvn
Wed, 20 Feb 2008 17:23:43 -0800
changeset 198 8601165a33c3
parent 197 264e201bc1d5
child 199 fb51d01039ff
6621094: PrintOptoAssembly is broken for oops information in DebugInfo Summary: OopMapValue and VMRegImpl classes miss the virtual method print_on(st). Reviewed-by: rasbold, jrose, never
hotspot/src/share/vm/code/vmreg.cpp
hotspot/src/share/vm/code/vmreg.hpp
hotspot/src/share/vm/compiler/oopMap.cpp
hotspot/src/share/vm/compiler/oopMap.hpp
--- a/hotspot/src/share/vm/code/vmreg.cpp	Wed Feb 20 16:19:43 2008 -0800
+++ b/hotspot/src/share/vm/code/vmreg.cpp	Wed Feb 20 17:23:43 2008 -0800
@@ -36,16 +36,16 @@
 // Register names
 const char *VMRegImpl::regName[ConcreteRegisterImpl::number_of_registers];
 
-void VMRegImpl::print() {
 #ifndef PRODUCT
+void VMRegImpl::print_on(outputStream* st) const {
   if( is_reg() ) {
     assert( VMRegImpl::regName[value()], "" );
-    tty->print("%s",VMRegImpl::regName[value()]);
+    st->print("%s",VMRegImpl::regName[value()]);
   } else if (is_stack()) {
     int stk = value() - stack0->value();
-    tty->print("[%d]", stk*4);
+    st->print("[%d]", stk*4);
   } else {
-    tty->print("BAD!");
+    st->print("BAD!");
   }
+}
 #endif // PRODUCT
-}
--- a/hotspot/src/share/vm/code/vmreg.hpp	Wed Feb 20 16:19:43 2008 -0800
+++ b/hotspot/src/share/vm/code/vmreg.hpp	Wed Feb 20 17:23:43 2008 -0800
@@ -66,9 +66,9 @@
     }
   }
   static VMReg Bad() { return (VMReg) (intptr_t) BAD; }
-  bool is_valid() { return ((intptr_t) this) != BAD; }
-  bool is_stack() { return (intptr_t) this >= (intptr_t) stack0; }
-  bool is_reg() { return is_valid() && !is_stack(); }
+  bool is_valid() const { return ((intptr_t) this) != BAD; }
+  bool is_stack() const { return (intptr_t) this >= (intptr_t) stack0; }
+  bool is_reg()   const { return is_valid() && !is_stack(); }
 
   // A concrete register is a value that returns true for is_reg() and is
   // also a register you could use in the assembler. On machines with
@@ -96,7 +96,8 @@
 
   intptr_t value() const         {return (intptr_t) this; }
 
-  void print();
+  void print_on(outputStream* st) const PRODUCT_RETURN;
+  void print() const { print_on(tty); }
 
   // bias a stack slot.
   // Typically used to adjust a virtual frame slots by amounts that are offset by
--- a/hotspot/src/share/vm/compiler/oopMap.cpp	Wed Feb 20 16:19:43 2008 -0800
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp	Wed Feb 20 17:23:43 2008 -0800
@@ -506,27 +506,27 @@
 }
 
 
-void print_register_type(OopMapValue::oop_types x, VMReg optional) {
+static void print_register_type(OopMapValue::oop_types x, VMReg optional, outputStream* st) {
   switch( x ) {
   case OopMapValue::oop_value:
-    tty->print("Oop");
+    st->print("Oop");
     break;
   case OopMapValue::value_value:
-    tty->print("Value" );
+    st->print("Value" );
     break;
   case OopMapValue::dead_value:
-    tty->print("Dead" );
+    st->print("Dead" );
     break;
   case OopMapValue::callee_saved_value:
-    tty->print("Callers_" );
-    optional->print();
+    st->print("Callers_" );
+    optional->print_on(st);
     break;
   case OopMapValue::derived_oop_value:
-    tty->print("Derived_oop_" );
-    optional->print();
+    st->print("Derived_oop_" );
+    optional->print_on(st);
     break;
   case OopMapValue::stack_obj:
-    tty->print("Stack");
+    st->print("Stack");
     break;
   default:
     ShouldNotReachHere();
@@ -534,11 +534,11 @@
 }
 
 
-void OopMapValue::print() const {
-  reg()->print();
-  tty->print("=");
-  print_register_type(type(),content_reg());
-  tty->print(" ");
+void OopMapValue::print_on(outputStream* st) const {
+  reg()->print_on(st);
+  st->print("=");
+  print_register_type(type(),content_reg(),st);
+  st->print(" ");
 }
 
 
--- a/hotspot/src/share/vm/compiler/oopMap.hpp	Wed Feb 20 16:19:43 2008 -0800
+++ b/hotspot/src/share/vm/compiler/oopMap.hpp	Wed Feb 20 17:23:43 2008 -0800
@@ -129,7 +129,8 @@
     return reg()->reg2stack();
   }
 
-  void print( ) const PRODUCT_RETURN;
+  void print_on(outputStream* st) const PRODUCT_RETURN;
+  void print() const { print_on(tty); }
 };