changeset 5595:ea9ac81f5645

limit log output to handle case where String object is invalid removed false assertion about graal_log* stubs not needing oop maps
author Doug Simon <doug.simon@oracle.com>
date Thu, 14 Jun 2012 12:06:44 +0200
parents 9b85ab3d3ab7
children e4b1bc5e29e0
files src/share/vm/c1/c1_Runtime1.cpp
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_Runtime1.cpp	Thu Jun 14 12:00:08 2012 +0200
+++ b/src/share/vm/c1/c1_Runtime1.cpp	Thu Jun 14 12:06:44 2012 +0200
@@ -212,8 +212,6 @@
     case graal_arithmetic_frem_id:
     case graal_arithmetic_drem_id:
     case graal_set_deopt_info_id:
-    case graal_log_primitive_id:
-    case graal_log_object_id:
 #endif
       break;
 
@@ -751,22 +749,29 @@
     int          length = java_lang_String::length(obj);
 
     if (length != 0) {
+      int printLength = MIN2(length, 1024);
       if (value == NULL) {
         // This can happen if, e.g., printing a String
         // object before its initializer has been called
         tty->print("null");
-      } else if (length < 256 - 1) {
+      } else if (printLength < 256 - 1) {
         // Use an intermediate buffer to try and prevent interlacing of multi-threaded output
         char buf[256];
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < printLength; index++) {
           buf[index] = value->char_at(index + offset);
         }
-        buf[length] = 0;
+        buf[printLength] = 0;
         tty->print("%s", buf);
+        if (printLength < length) {
+          tty->print("... (%d more)", length - printLength);
+        }
       } else {
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < printLength; index++) {
           tty->print("%c", value->char_at(index + offset));
         }
+        if (printLength < length) {
+          tty->print("... (%d more)", length - printLength);
+        }
       }
     }
   }