hotspot/src/share/vm/runtime/deoptimization.cpp
changeset 33794 41ef3dc95179
parent 33611 9abd65805e19
child 33813 4f376e851453
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Mon Nov 09 11:35:45 2015 +0000
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Mon Oct 26 16:21:37 2015 +0100
@@ -2062,6 +2062,7 @@
 // This is used for debugging and diagnostics, including LogFile output.
 const char* Deoptimization::format_trap_state(char* buf, size_t buflen,
                                               int trap_state) {
+  assert(buflen > 0, "sanity");
   DeoptReason reason      = trap_state_reason(trap_state);
   bool        recomp_flag = trap_state_is_recompiled(trap_state);
   // Re-encode the state from its decoded components.
@@ -2082,8 +2083,6 @@
                        trap_reason_name(reason),
                        recomp_flag ? " recompiled" : "");
   }
-  if (len >= buflen)
-    buf[buflen-1] = '\0';
   return buf;
 }
 
@@ -2178,8 +2177,6 @@
 #endif
                        );
   }
-  if (len >= buflen)
-    buf[buflen-1] = '\0';
   return buf;
 }