< prev index next >

src/hotspot/share/classfile/javaClasses.inline.hpp

Print this page
rev 48017 : [mq]: Access_strings

*** 24,33 **** --- 24,34 ---- #ifndef SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP #define SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP #include "classfile/javaClasses.hpp" + #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/oopsHierarchy.hpp" void java_lang_String::set_coder(oop string, jbyte coder) { assert(initialized && (coder_offset > 0), "Must be initialized");
*** 51,60 **** --- 52,67 ---- typeArrayOop java_lang_String::value(oop java_string) { assert(initialized && (value_offset > 0), "Must be initialized"); assert(is_instance(java_string), "must be java_string"); return (typeArrayOop) java_string->obj_field(value_offset); } + typeArrayOop java_lang_String::value_no_keepalive(oop java_string) { + assert(initialized && (value_offset > 0), "Must be initialized"); + assert(is_instance(java_string), "must be java_string"); + oop value = HeapAccess<AS_NO_KEEPALIVE>::oop_load_at(java_string, value_offset); + return (typeArrayOop)value; + } unsigned int java_lang_String::hash(oop java_string) { assert(initialized && (hash_offset > 0), "Must be initialized"); assert(is_instance(java_string), "must be java_string"); return java_string->int_field(hash_offset); }
*** 64,80 **** jbyte coder = java_string->byte_field(coder_offset); assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings"); return coder == CODER_LATIN1; } int java_lang_String::length(oop java_string) { assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); ! typeArrayOop value_array = ((typeArrayOop)java_string->obj_field(value_offset)); ! if (value_array == NULL) { return 0; } ! int arr_length = value_array->length(); if (!is_latin1(java_string)) { assert((arr_length & 1) == 0, "should be even for UTF16 string"); arr_length >>= 1; // convert number of bytes to number of elements } return arr_length; --- 71,87 ---- jbyte coder = java_string->byte_field(coder_offset); assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings"); return coder == CODER_LATIN1; } int java_lang_String::length(oop java_string) { + typeArrayOop value = java_lang_String::value_no_keepalive(java_string); assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); ! if (value == NULL) { return 0; } ! int arr_length = value->length(); if (!is_latin1(java_string)) { assert((arr_length & 1) == 0, "should be even for UTF16 string"); arr_length >>= 1; // convert number of bytes to number of elements } return arr_length;
< prev index next >