Mercurial > hg > truffle
diff src/share/vm/c1/c1_Runtime1.cpp @ 6446:c8759f9f9e3c
added Log.printf() for more flexibility in debugging snippets
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 26 Sep 2012 18:15:11 +0200 |
parents | 7d6f44854ee3 |
children | 3bba61323b38 |
line wrap: on
line diff
--- a/src/share/vm/c1/c1_Runtime1.cpp Wed Sep 26 13:56:27 2012 +0200 +++ b/src/share/vm/c1/c1_Runtime1.cpp Wed Sep 26 18:15:11 2012 +0200 @@ -805,6 +805,27 @@ } JRT_END +JRT_ENTRY(void, Runtime1::graal_log_printf(JavaThread* thread, oop format, jlong val)) + char buf[1025]; + assert(format != NULL && java_lang_String::is_instance(format), "must be"); + + typeArrayOop value = java_lang_String::value(format); + int offset = java_lang_String::offset(format); + int length = java_lang_String::length(format); + + assert(value != NULL, "fmtString must be a literal"); + assert(length >= 0 && length <= 1024, "format must be between 0 and 1024 characters"); + length = MIN2(length, 1024); + + int index = 0; + while (index < length) { + buf[index] = value->char_at(index + offset); + index++; + } + buf[index++] = 0; + tty->print(buf, val); +JRT_END + JRT_ENTRY(void, Runtime1::graal_log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) union { jlong l;