src/share/vm/classfile/javaClasses.cpp

Print this page
rev 6283 : redundant memcpy


 404   return UNICODE::as_utf8(position, length);
 405 }
 406 
 407 char* java_lang_String::as_utf8_string(oop java_string, char* buf, int buflen) {
 408   typeArrayOop value  = java_lang_String::value(java_string);
 409   int          offset = java_lang_String::offset(java_string);
 410   int          length = java_lang_String::length(java_string);
 411   jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
 412   return UNICODE::as_utf8(position, length, buf, buflen);
 413 }
 414 
 415 char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
 416   typeArrayOop value  = java_lang_String::value(java_string);
 417   int          offset = java_lang_String::offset(java_string);
 418   int          length = java_lang_String::length(java_string);
 419   assert(start + len <= length, "just checking");
 420   jchar* position = value->char_at_addr(offset + start);
 421   return UNICODE::as_utf8(position, len);
 422 }
 423 









 424 bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
 425   assert(java_string->klass() == SystemDictionary::String_klass(),
 426          "must be java_string");
 427   typeArrayOop value  = java_lang_String::value(java_string);
 428   int          offset = java_lang_String::offset(java_string);
 429   int          length = java_lang_String::length(java_string);
 430   if (length != len) {
 431     return false;
 432   }
 433   for (int i = 0; i < len; i++) {
 434     if (value->char_at(i + offset) != chars[i]) {
 435       return false;
 436     }
 437   }
 438   return true;
 439 }
 440 
 441 bool java_lang_String::equals(oop str1, oop str2) {
 442   assert(str1->klass() == SystemDictionary::String_klass(),
 443          "must be java String");




 404   return UNICODE::as_utf8(position, length);
 405 }
 406 
 407 char* java_lang_String::as_utf8_string(oop java_string, char* buf, int buflen) {
 408   typeArrayOop value  = java_lang_String::value(java_string);
 409   int          offset = java_lang_String::offset(java_string);
 410   int          length = java_lang_String::length(java_string);
 411   jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
 412   return UNICODE::as_utf8(position, length, buf, buflen);
 413 }
 414 
 415 char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
 416   typeArrayOop value  = java_lang_String::value(java_string);
 417   int          offset = java_lang_String::offset(java_string);
 418   int          length = java_lang_String::length(java_string);
 419   assert(start + len <= length, "just checking");
 420   jchar* position = value->char_at_addr(offset + start);
 421   return UNICODE::as_utf8(position, len);
 422 }
 423 
 424 char* java_lang_String::as_utf8_string(oop java_string, int start, int len, char* buf, int buflen) {
 425   typeArrayOop value  = java_lang_String::value(java_string);
 426   int          offset = java_lang_String::offset(java_string);
 427   int          length = java_lang_String::length(java_string);
 428   assert(start + len <= length, "just checking");
 429   jchar* position = value->char_at_addr(offset + start);
 430   return UNICODE::as_utf8(position, len, buf, buflen);
 431 }
 432 
 433 bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
 434   assert(java_string->klass() == SystemDictionary::String_klass(),
 435          "must be java_string");
 436   typeArrayOop value  = java_lang_String::value(java_string);
 437   int          offset = java_lang_String::offset(java_string);
 438   int          length = java_lang_String::length(java_string);
 439   if (length != len) {
 440     return false;
 441   }
 442   for (int i = 0; i < len; i++) {
 443     if (value->char_at(i + offset) != chars[i]) {
 444       return false;
 445     }
 446   }
 447   return true;
 448 }
 449 
 450 bool java_lang_String::equals(oop str1, oop str2) {
 451   assert(str1->klass() == SystemDictionary::String_klass(),
 452          "must be java String");