Hi Chris,
maybe you could sneak this patch into upstream, it’s a fix for an issue where the VM segfaults when it tries to print a string with a null value array.
It confused me for a while while looking for another problem...
I think it got introduced when the String class was changed - because now it needs to look at the value array to determine the length.
- Lukas
in src/share/vm/classfile/javaClasses.cpp:
@@ -464,15 +464,15 @@
void java_lang_String::print(oop java_string, outputStream* st) {
assert(java_string->klass() == SystemDictionary::String_klass(), "must be 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) {
// This can happen if, e.g., printing a String
// object before its initializer has been called
st->print_cr("NULL");
} else {
+ int offset = java_lang_String::offset(java_string);
+ int length = java_lang_String::length(java_string);
+ int end = MIN2(length, 100);
st->print("\"");
for (int index = 0; index < length; index++) {
st->print("%c", value->char_at(index + offset));
maybe you could sneak this patch into upstream, it’s a fix for an issue where the VM segfaults when it tries to print a string with a null value array.
It confused me for a while while looking for another problem...
I think it got introduced when the String class was changed - because now it needs to look at the value array to determine the length.
- Lukas
in src/share/vm/classfile/javaClasses.cpp:
@@ -464,15 +464,15 @@
void java_lang_String::print(oop java_string, outputStream* st) {
assert(java_string->klass() == SystemDictionary::String_klass(), "must be 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) {
// This can happen if, e.g., printing a String
// object before its initializer has been called
st->print_cr("NULL");
} else {
+ int offset = java_lang_String::offset(java_string);
+ int length = java_lang_String::length(java_string);
+ int end = MIN2(length, 100);
st->print("\"");
for (int index = 0; index < length; index++) {
st->print("%c", value->char_at(index + offset));
- duplicates
-
JDK-8039348 -XX:+TraceDeoptimization -XX:+Verbose -Xcomp can crash VM
-
- Resolved
-