hotspot/src/share/vm/classfile/javaClasses.cpp
changeset 3796 7082ef16e6e2
parent 3686 69c1b5228547
child 4461 c17c526d36ef
child 4429 d7eb4e2099aa
equal deleted inserted replaced
3689:ae24bdd7408b 3796:7082ef16e6e2
   250 symbolHandle java_lang_String::as_symbol(Handle java_string, TRAPS) {
   250 symbolHandle java_lang_String::as_symbol(Handle java_string, TRAPS) {
   251   oop          obj    = java_string();
   251   oop          obj    = java_string();
   252   typeArrayOop value  = java_lang_String::value(obj);
   252   typeArrayOop value  = java_lang_String::value(obj);
   253   int          offset = java_lang_String::offset(obj);
   253   int          offset = java_lang_String::offset(obj);
   254   int          length = java_lang_String::length(obj);
   254   int          length = java_lang_String::length(obj);
   255   jchar* base = value->char_at_addr(offset);
   255   jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
   256   symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD);
   256   symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD);
   257   return symbolHandle(THREAD, sym);
   257   return symbolHandle(THREAD, sym);
   258 }
   258 }
   259 
   259 
   260 symbolOop java_lang_String::as_symbol_or_null(oop java_string) {
   260 symbolOop java_lang_String::as_symbol_or_null(oop java_string) {
   261   typeArrayOop value  = java_lang_String::value(java_string);
   261   typeArrayOop value  = java_lang_String::value(java_string);
   262   int          offset = java_lang_String::offset(java_string);
   262   int          offset = java_lang_String::offset(java_string);
   263   int          length = java_lang_String::length(java_string);
   263   int          length = java_lang_String::length(java_string);
   264   jchar* base = value->char_at_addr(offset);
   264   jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
   265   return SymbolTable::probe_unicode(base, length);
   265   return SymbolTable::probe_unicode(base, length);
   266 }
   266 }
   267 
   267 
   268 
   268 
   269 int java_lang_String::utf8_length(oop java_string) {
   269 int java_lang_String::utf8_length(oop java_string) {