Mercurial > hg > truffle
diff src/share/vm/oops/oop.cpp @ 1339:09ac706c2623
Merge
author | asaha |
---|---|
date | Wed, 24 Mar 2010 17:16:33 -0700 |
parents | 4e6abf09f540 |
children | c18cbe5936b8 |
line wrap: on
line diff
--- a/src/share/vm/oops/oop.cpp Mon Mar 15 15:51:36 2010 -0400 +++ b/src/share/vm/oops/oop.cpp Wed Mar 24 17:16:33 2010 -0700 @@ -31,14 +31,13 @@ #ifdef PRODUCT void oopDesc::print_on(outputStream* st) const {} -void oopDesc::print_value_on(outputStream* st) const {} void oopDesc::print_address_on(outputStream* st) const {} -char* oopDesc::print_value_string() { return NULL; } char* oopDesc::print_string() { return NULL; } void oopDesc::print() {} -void oopDesc::print_value() {} void oopDesc::print_address() {} -#else + +#else //PRODUCT + void oopDesc::print_on(outputStream* st) const { if (this == NULL) { st->print_cr("NULL"); @@ -47,22 +46,6 @@ } } -void oopDesc::print_value_on(outputStream* st) const { - oop obj = oop(this); - if (this == NULL) { - st->print("NULL"); - } else if (java_lang_String::is_instance(obj)) { - java_lang_String::print(obj, st); - if (PrintOopAddress) print_address_on(st); -#ifdef ASSERT - } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) { - st->print("### BAD OOP %p ###", (address)obj); -#endif - } else { - blueprint()->oop_print_value_on(obj, st); - } -} - void oopDesc::print_address_on(outputStream* st) const { if (PrintOopAddress) { st->print("{"INTPTR_FORMAT"}", this); @@ -71,23 +54,47 @@ void oopDesc::print() { print_on(tty); } -void oopDesc::print_value() { print_value_on(tty); } - void oopDesc::print_address() { print_address_on(tty); } char* oopDesc::print_string() { - stringStream* st = new stringStream(); - print_on(st); - return st->as_string(); + stringStream st; + print_on(&st); + return st.as_string(); +} + +#endif // PRODUCT + +// The print_value functions are present in all builds, to support the disassembler. + +void oopDesc::print_value() { + print_value_on(tty); } char* oopDesc::print_value_string() { - stringStream* st = new stringStream(); - print_value_on(st); - return st->as_string(); + char buf[100]; + stringStream st(buf, sizeof(buf)); + print_value_on(&st); + return st.as_string(); } -#endif // PRODUCT +void oopDesc::print_value_on(outputStream* st) const { + oop obj = oop(this); + if (this == NULL) { + st->print("NULL"); + } else if (java_lang_String::is_instance(obj)) { + java_lang_String::print(obj, st); +#ifndef PRODUCT + if (PrintOopAddress) print_address_on(st); +#endif //PRODUCT +#ifdef ASSERT + } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) { + st->print("### BAD OOP %p ###", (address)obj); +#endif //ASSERT + } else { + blueprint()->oop_print_value_on(obj, st); + } +} + void oopDesc::verify_on(outputStream* st) { if (this != NULL) {