Mercurial > hg > truffle
comparison src/share/vm/c1/c1_Runtime1.cpp @ 5580:69358a2182a3
added printf-like facility (Log.java) for logging debug output in snippets
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 13 Jun 2012 00:15:15 +0200 |
parents | f5cfb62f17b8 |
children | ea9ac81f5645 |
comparison
equal
deleted
inserted
replaced
5579:8e6622e1fb7e | 5580:69358a2182a3 |
---|---|
210 case graal_unwind_exception_call_id: | 210 case graal_unwind_exception_call_id: |
211 case graal_slow_subtype_check_id: | 211 case graal_slow_subtype_check_id: |
212 case graal_arithmetic_frem_id: | 212 case graal_arithmetic_frem_id: |
213 case graal_arithmetic_drem_id: | 213 case graal_arithmetic_drem_id: |
214 case graal_set_deopt_info_id: | 214 case graal_set_deopt_info_id: |
215 case graal_log_primitive_id: | |
216 case graal_log_object_id: | |
215 #endif | 217 #endif |
216 break; | 218 break; |
217 | 219 |
218 // All other stubs should have oopmaps | 220 // All other stubs should have oopmaps |
219 default: | 221 default: |
736 } else { | 738 } else { |
737 ObjectSynchronizer::fast_exit(obj, lock, THREAD); | 739 ObjectSynchronizer::fast_exit(obj, lock, THREAD); |
738 } | 740 } |
739 JRT_END | 741 JRT_END |
740 | 742 |
741 #endif | 743 JRT_ENTRY(void, Runtime1::graal_log_object(JavaThread* thread, oop obj, jboolean newline, jboolean string)) |
744 if (!string) { | |
745 tty->print("%p", obj); | |
746 } else { | |
747 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); | |
748 | |
749 typeArrayOop value = java_lang_String::value(obj); | |
750 int offset = java_lang_String::offset(obj); | |
751 int length = java_lang_String::length(obj); | |
752 | |
753 if (length != 0) { | |
754 if (value == NULL) { | |
755 // This can happen if, e.g., printing a String | |
756 // object before its initializer has been called | |
757 tty->print("null"); | |
758 } else if (length < 256 - 1) { | |
759 // Use an intermediate buffer to try and prevent interlacing of multi-threaded output | |
760 char buf[256]; | |
761 for (int index = 0; index < length; index++) { | |
762 buf[index] = value->char_at(index + offset); | |
763 } | |
764 buf[length] = 0; | |
765 tty->print("%s", buf); | |
766 } else { | |
767 for (int index = 0; index < length; index++) { | |
768 tty->print("%c", value->char_at(index + offset)); | |
769 } | |
770 } | |
771 } | |
772 } | |
773 if (newline) { | |
774 tty->cr(); | |
775 } | |
776 JRT_END | |
777 | |
778 JRT_ENTRY(void, Runtime1::graal_log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) | |
779 union { | |
780 jlong l; | |
781 jdouble d; | |
782 jfloat f; | |
783 } uu; | |
784 uu.l = value; | |
785 switch (typeChar) { | |
786 case 'z': tty->print(value == 0 ? "false" : "true"); break; | |
787 case 'b': tty->print("%d", (jbyte) value); break; | |
788 case 'c': tty->print("%c", (jchar) value); break; | |
789 case 's': tty->print("%d", (jshort) value); break; | |
790 case 'i': tty->print("%d", (jint) value); break; | |
791 case 'f': tty->print("%f", uu.f); break; | |
792 case 'j': tty->print(INT64_FORMAT, value); break; | |
793 case 'd': tty->print("%lf", uu.d); break; | |
794 default: assert(false, "unknown typeChar"); break; | |
795 } | |
796 if (newline) { | |
797 tty->cr(); | |
798 } | |
799 JRT_END | |
800 | |
801 #endif /* GRAAL */ | |
742 | 802 |
743 | 803 |
744 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock)) | 804 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock)) |
745 NOT_PRODUCT(_monitorenter_slowcase_cnt++;) | 805 NOT_PRODUCT(_monitorenter_slowcase_cnt++;) |
746 if (PrintBiasedLockingStatistics) { | 806 if (PrintBiasedLockingStatistics) { |