< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page
rev 48017 : [mq]: Access_strings

*** 617,627 **** } bool java_lang_String::equals(oop java_string, jchar* chars, int len) { assert(java_string->klass() == SystemDictionary::String_klass(), "must be java_string"); ! typeArrayOop value = java_lang_String::value(java_string); int length = java_lang_String::length(java_string); if (length != len) { return false; } bool is_latin1 = java_lang_String::is_latin1(java_string); --- 617,627 ---- } bool java_lang_String::equals(oop java_string, jchar* chars, int len) { assert(java_string->klass() == SystemDictionary::String_klass(), "must be java_string"); ! typeArrayOop value = java_lang_String::value_no_keepalive(java_string); int length = java_lang_String::length(java_string); if (length != len) { return false; } bool is_latin1 = java_lang_String::is_latin1(java_string);
*** 644,677 **** bool java_lang_String::equals(oop str1, oop str2) { assert(str1->klass() == SystemDictionary::String_klass(), "must be java String"); assert(str2->klass() == SystemDictionary::String_klass(), "must be java String"); ! typeArrayOop value1 = java_lang_String::value(str1); ! int length1 = java_lang_String::length(str1); bool is_latin1 = java_lang_String::is_latin1(str1); ! typeArrayOop value2 = java_lang_String::value(str2); ! int length2 = java_lang_String::length(str2); bool is_latin2 = java_lang_String::is_latin1(str2); if ((length1 != length2) || (is_latin1 != is_latin2)) { // Strings of different size or with different // coders are never equal. return false; } int blength1 = value1->length(); ! for (int i = 0; i < value1->length(); i++) { if (value1->byte_at(i) != value2->byte_at(i)) { return false; } } return true; } 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); if (value == NULL) { // This can happen if, e.g., printing a String // object before its initializer has been called st->print("NULL"); --- 644,677 ---- bool java_lang_String::equals(oop str1, oop str2) { assert(str1->klass() == SystemDictionary::String_klass(), "must be java String"); assert(str2->klass() == SystemDictionary::String_klass(), "must be java String"); ! typeArrayOop value1 = java_lang_String::value_no_keepalive(str1); ! int length1 = java_lang_String::length(value1); bool is_latin1 = java_lang_String::is_latin1(str1); ! typeArrayOop value2 = java_lang_String::value_no_keepalive(str2); ! int length2 = java_lang_String::length(value2); bool is_latin2 = java_lang_String::is_latin1(str2); if ((length1 != length2) || (is_latin1 != is_latin2)) { // Strings of different size or with different // coders are never equal. return false; } int blength1 = value1->length(); ! for (int i = 0; i < blength1; i++) { if (value1->byte_at(i) != value2->byte_at(i)) { return false; } } return true; } 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_no_keepalive(java_string); if (value == NULL) { // This can happen if, e.g., printing a String // object before its initializer has been called st->print("NULL");
< prev index next >