--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Fri Nov 06 11:11:51 2015 -0800
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Nov 11 23:47:41 2015 +0000
@@ -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;
}