8039348: -XX:+TraceDeoptimization -XX:+Verbose -Xcomp can crash VM

Reviewed-by: kvn, sla
This commit is contained in:
Markus Grönlund 2014-04-08 11:50:01 +02:00
parent 385e2f4084
commit eea84b4feb

View File

@ -464,21 +464,22 @@ bool java_lang_String::equals(oop str1, oop str2) {
void java_lang_String::print(oop java_string, outputStream* st) { void java_lang_String::print(oop java_string, outputStream* st) {
assert(java_string->klass() == SystemDictionary::String_klass(), "must be java_string"); assert(java_string->klass() == SystemDictionary::String_klass(), "must be java_string");
typeArrayOop value = java_lang_String::value(java_string); typeArrayOop value = java_lang_String::value(java_string);
int offset = java_lang_String::offset(java_string);
int length = java_lang_String::length(java_string);
int end = MIN2(length, 100);
if (value == NULL) { if (value == NULL) {
// This can happen if, e.g., printing a String // This can happen if, e.g., printing a String
// object before its initializer has been called // object before its initializer has been called
st->print_cr("NULL"); st->print("NULL");
} else { return;
}
int offset = java_lang_String::offset(java_string);
int length = java_lang_String::length(java_string);
st->print("\""); st->print("\"");
for (int index = 0; index < length; index++) { for (int index = 0; index < length; index++) {
st->print("%c", value->char_at(index + offset)); st->print("%c", value->char_at(index + offset));
} }
st->print("\""); st->print("\"");
}
} }
static void initialize_static_field(fieldDescriptor* fd, TRAPS) { static void initialize_static_field(fieldDescriptor* fd, TRAPS) {