# HG changeset patch # User Tom Rodriguez # Date 1444261371 25200 # Node ID da5bdbf4a0083d8b49d949f3bc23b2c35f0320a4 # Parent 9692347207a759e81c3b190c3a2c9240b654660a Simplify log_object interface diff -r 9692347207a7 -r da5bdbf4a008 src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Wed Oct 07 12:49:00 2015 -0700 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Wed Oct 07 16:42:51 2015 -0700 @@ -433,12 +433,13 @@ } JRT_END -JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) - bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING); - bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); - bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); - if (!string) { - if (!addr && obj->is_oop_or_null(true)) { +JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline)) + ttyLocker ttyl; + + if (obj == NULL) { + tty->print("NULL"); + } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) { + if (obj->is_oop_or_null(true)) { char buf[O_BUFLEN]; tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); } else { diff -r 9692347207a7 -r da5bdbf4a008 src/share/vm/jvmci/jvmciRuntime.hpp --- a/src/share/vm/jvmci/jvmciRuntime.hpp Wed Oct 07 12:49:00 2015 -0700 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Wed Oct 07 16:42:51 2015 -0700 @@ -211,13 +211,11 @@ static oopDesc* load_and_clear_exception(JavaThread* thread); static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3); static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline); - // Note: Must be kept in sync with constants in jdk.internal.jvmci.replacements.Log - enum { - LOG_OBJECT_NEWLINE = 0x01, - LOG_OBJECT_STRING = 0x02, - LOG_OBJECT_ADDRESS = 0x04 - }; - static void log_object(JavaThread* thread, oopDesc* msg, jint flags); + // Print the passed in object, optionally followed by a newline. If + // as_string is true and the object is a java.lang.String then it + // printed as a string, otherwise the type of the object is printed + // followed by its address. + static void log_object(JavaThread* thread, oopDesc* object, bool as_string, bool newline); static void write_barrier_pre(JavaThread* thread, oopDesc* obj); static void write_barrier_post(JavaThread* thread, void* card); static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child);