changeset 9245:2da46f06bfba JDK-8054307-branch

JDK-8054307-branch: Cleanup of references to the long removed String.offset and String.count fields.
author thartmann
date Thu, 27 Aug 2015 11:19:45 +0200
parents fe56e861f004
children b50bebd0085b
files src/share/vm/classfile/javaClasses.cpp src/share/vm/classfile/javaClasses.hpp src/share/vm/classfile/stringTable.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/oops/instanceKlass.cpp src/share/vm/prims/jni.cpp src/share/vm/prims/jvmtiTagMap.cpp
diffstat 7 files changed, 47 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/javaClasses.cpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/classfile/javaClasses.cpp	Thu Aug 27 11:19:45 2015 +0200
@@ -146,8 +146,6 @@
 
 
 int java_lang_String::value_offset  = 0;
-int java_lang_String::offset_offset = 0;
-int java_lang_String::count_offset  = 0;
 int java_lang_String::hash_offset   = 0;
 int java_lang_String::coder_offset  = 0;
 
@@ -162,8 +160,6 @@
 
   Klass* k = SystemDictionary::String_klass();
   compute_offset(value_offset,           k, vmSymbols::value_name(),  vmSymbols::byte_array_signature());
-  compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature());
-  compute_optional_offset(count_offset,  k, vmSymbols::count_name(),  vmSymbols::int_signature());
   compute_optional_offset(hash_offset,   k, vmSymbols::hash_name(),   vmSymbols::int_signature());
   compute_optional_offset(coder_offset,  k, vmSymbols::coder_name(),  vmSymbols::byte_signature());
 
@@ -189,9 +185,6 @@
   obj = h_obj();
   set_value(obj, buffer);
   // No need to zero the offset, allocation zero'ed the entire String object
-  assert(offset(obj) == 0, "initial String offset should be zero");
-  set_offset(obj, 0);
-  set_count(obj, length);
   set_coder(obj, is_latin1 ? CODER_LATIN1 : CODER_UTF16);
   return h_obj;
 }
@@ -378,7 +371,6 @@
   oop          obj    = java_string();
   // Typical usage is to convert all '/' to '.' in string.
   typeArrayOop value  = java_lang_String::value(obj);
-  int          offset = java_lang_String::offset(obj);
   int          length = java_lang_String::length(obj);
   bool      is_latin1 = java_lang_String::is_latin1(obj);
 
@@ -386,7 +378,7 @@
   int index; // Declared outside, used later
   for (index = 0; index < length; index++) {
     // elem_type == T_BYTE --> byte string
-    jchar c = !is_latin1 ? value->char_at(index + offset) : (jchar) (value->byte_at(index + offset) & 0xff);
+    jchar c = !is_latin1 ? value->char_at(index) : (jchar) (value->byte_at(index) & 0xff);
     if (c == from_char) {
       break;
     }
@@ -408,7 +400,7 @@
   // Copy contents
   for (index = 0; index < length; index++) {
     // from_elem_type == T_BYTE --> byte string
-    jchar c = (!is_latin1) ? from_buffer->char_at(index + offset) : (jchar) (from_buffer->byte_at(index + offset) & 0xff);
+    jchar c = (!is_latin1) ? from_buffer->char_at(index) : (jchar) (from_buffer->byte_at(index) & 0xff);
     if (c == from_char) {
       c = to_char;
     }
@@ -423,7 +415,6 @@
 
 jchar* java_lang_String::as_unicode_string(oop java_string, int& length, TRAPS) {
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
                length = java_lang_String::length(java_string);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
 
@@ -431,11 +422,11 @@
   if (result != NULL) {
     if (!is_latin1) {
       for (int index = 0; index < length; index++) {
-        result[index] = value->char_at(index + offset);
+        result[index] = value->char_at(index);
       }
     } else {  // elem_type == T_BYTE --> byte string
       for (int index = 0; index < length; index++) {
-        result[index] = (jchar)(value->byte_at(index + offset) & 0xff);
+        result[index] = (jchar)(value->byte_at(index) & 0xff);
       }
     }
   } else {
@@ -463,18 +454,16 @@
   if (length == 0) return 0;
 
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
 
   if (is_latin1) {
     return java_lang_String::latin1_hash_code(value, length);
   }
-  return java_lang_String::hash_code(value->char_at_addr(offset), length);
+  return java_lang_String::hash_code(value->char_at_addr(0), length);
 }
 
 char* java_lang_String::as_quoted_ascii(oop 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);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
 
@@ -483,12 +472,12 @@
   char* result;
   int result_length;
   if (!is_latin1) {
-    jchar* base = value->char_at_addr(offset);
+    jchar* base = value->char_at_addr(0);
     result_length = UNICODE::quoted_ascii_length(base, length) + 1;
     result = NEW_RESOURCE_ARRAY(char, result_length);
     UNICODE::as_quoted_ascii(base, length, result, result_length);
   } else {
-    jbyte* base = value->byte_at_addr(offset);
+    jbyte* base = value->byte_at_addr(0);
     result_length = UNICODE::quoted_ascii_length(base, length) + 1;
     result = NEW_RESOURCE_ARRAY(char, result_length);
     UNICODE::as_quoted_ascii(base, length, result, result_length);
@@ -506,29 +495,27 @@
   }
 
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
 
   if (is_latin1) {
     /** not going through StringTable::hash_string skips alt hash checking **/
     return java_lang_String::latin1_hash_code(value, length);
   }
-  return StringTable::hash_string(value->char_at_addr(offset), length);
+  return StringTable::hash_string(value->char_at_addr(0), length);
 }
 
 Symbol* java_lang_String::as_symbol(Handle java_string, TRAPS) {
   oop          obj    = java_string();
   typeArrayOop value  = java_lang_String::value(obj);
-  int          offset = java_lang_String::offset(obj);
   int          length = java_lang_String::length(obj);
   bool      is_latin1 = java_lang_String::is_latin1(obj);
   if (!is_latin1) {
-    jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
+    jchar* base = (length == 0) ? NULL : value->char_at_addr(0);
     Symbol* sym = SymbolTable::lookup_unicode(base, length, THREAD);
     return sym;
   } else {
     ResourceMark rm;
-    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(offset);
+    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
     const char* base = UNICODE::as_utf8(position, length);
     Symbol* sym = SymbolTable::lookup(base, length, THREAD);
     return sym;
@@ -537,15 +524,14 @@
 
 Symbol* java_lang_String::as_symbol_or_null(oop 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);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
+    jchar* base = (length == 0) ? NULL : value->char_at_addr(0);
     return SymbolTable::probe_unicode(base, length);
   } else {
     ResourceMark rm;
-    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(offset);
+    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
     const char* base = UNICODE::as_utf8(position, length);
     return SymbolTable::probe(base, length);
   }
@@ -554,72 +540,67 @@
 
 int java_lang_String::utf8_length(oop 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);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
+    jchar* position = (length == 0) ? NULL : value->char_at_addr(0);
     return UNICODE::utf8_length(position, length);
   } else {  // elem_type == T_BYTE --> byte string
-    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(offset);
+    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
     return UNICODE::utf8_length(position, length);
   }
 }
 
 char* java_lang_String::as_utf8_string(oop 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);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
+    jchar* position = (length == 0) ? NULL : value->char_at_addr(0);
     return UNICODE::as_utf8(position, length);
   } else {  // elem_type == T_BYTE --> byte string
-    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(offset);
+    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
     return UNICODE::as_utf8(position, length);
   }
 }
 
 char* java_lang_String::as_utf8_string(oop java_string, char* buf, int buflen) {
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
   int          length = java_lang_String::length(java_string);
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
+    jchar* position = (length == 0) ? NULL : value->char_at_addr(0);
     return UNICODE::as_utf8(position, length, buf, buflen);
   } else {  // elem_type == T_BYTE --> byte string
-    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(offset);
+    jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
     return UNICODE::as_utf8(position, length, buf, buflen);
   }
 }
 
 char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
   int          length = java_lang_String::length(java_string);
   assert(start + len <= length, "just checking");
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* position = value->char_at_addr(offset + start);
+    jchar* position = value->char_at_addr(start);
     return UNICODE::as_utf8(position, len);
   } else {  // elem_type == T_BYTE --> byte string
-    jbyte* position = value->byte_at_addr(offset + start);
+    jbyte* position = value->byte_at_addr(start);
     return UNICODE::as_utf8(position, len);
   }
 }
 
 char* java_lang_String::as_utf8_string(oop java_string, int start, int len, char* buf, int buflen) {
   typeArrayOop value  = java_lang_String::value(java_string);
-  int          offset = java_lang_String::offset(java_string);
   int          length = java_lang_String::length(java_string);
   assert(start + len <= length, "just checking");
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
-    jchar* position = value->char_at_addr(offset + start);
+    jchar* position = value->char_at_addr(start);
     return UNICODE::as_utf8(position, len, buf, buflen);
   } else {  // elem_type == T_BYTE --> byte string
-    jbyte* position = value->byte_at_addr(offset + start);
+    jbyte* position = value->byte_at_addr(start);
     return UNICODE::as_utf8(position, len, buf, buflen);
   }
 }
@@ -628,7 +609,6 @@
   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);
   if (length != len) {
     return false;
@@ -636,13 +616,13 @@
   bool      is_latin1 = java_lang_String::is_latin1(java_string);
   if (!is_latin1) {
     for (int i = 0; i < len; i++) {
-      if (value->char_at(i + offset) != chars[i]) {
+      if (value->char_at(i) != chars[i]) {
         return false;
       }
     }
   } else {  // elem_type == T_BYTE --> byte string
     for (int i = 0; i < len; i++) {
-      if ((jchar)(value->byte_at(i + offset) & 0xff) != chars[i]) {
+      if ((jchar)(value->byte_at(i) & 0xff) != chars[i]) {
         return false;
       }
     }
@@ -656,11 +636,9 @@
   assert(str2->klass() == SystemDictionary::String_klass(),
          "must be java String");
   typeArrayOop value1  = java_lang_String::value(str1);
-  int          offset1 = java_lang_String::offset(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          offset2 = java_lang_String::offset(str2);
   int          length2 = java_lang_String::length(str2);
   bool       is_latin2 = java_lang_String::is_latin1(str2);
 
@@ -670,7 +648,7 @@
   if (is_latin1 == is_latin2) {
     int blength1 = value1->length();
     for (int i = 0; i < value1->length(); i++) {
-      if (value1->byte_at(i + offset1) != value2->byte_at(i + offset2)) {
+      if (value1->byte_at(i) != value2->byte_at(i)) {
         return false;
       }
     }
@@ -678,11 +656,11 @@
     jbyte* bposition;
     jchar* cposition;
     if (is_latin1) {
-      bposition = value1->byte_at_addr(offset1);
-      cposition = value2->char_at_addr(offset2);
+      bposition = value1->byte_at_addr(0);
+      cposition = value2->char_at_addr(0);
     } else {
-      bposition = value2->byte_at_addr(offset2);
-      cposition = value1->char_at_addr(offset1);
+      bposition = value2->byte_at_addr(0);
+      cposition = value1->char_at_addr(0);
     }
     for (int i = 0; i < length1; i++) {
       if ((jchar)(bposition[i] & 0xff) != cposition[i]) {
@@ -704,14 +682,13 @@
     return;
   }
 
-  int offset = java_lang_String::offset(java_string);
   int length = java_lang_String::length(java_string);
   bool is_latin1 = java_lang_String::is_latin1(java_string);
 
   st->print("\"");
   for (int index = 0; index < length; index++) {
-    st->print("%c", (!is_latin1) ?  value->char_at(index + offset) :
-                            (jchar)(value->byte_at(index + offset) & 0xff) );
+    st->print("%c", (!is_latin1) ?  value->char_at(index) :
+                            (jchar)(value->byte_at(index) & 0xff) );
   }
   st->print("\"");
 }
@@ -3741,10 +3718,6 @@
   // java.lang.String
 
   CHECK_OFFSET("java/lang/String", java_lang_String, value, "[B");
-  if (java_lang_String::has_offset_field()) {
-    CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I");
-    CHECK_OFFSET("java/lang/String", java_lang_String, count, "I");
-  }
   if (java_lang_String::has_hash_field()) {
     CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
   }
--- a/src/share/vm/classfile/javaClasses.hpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/classfile/javaClasses.hpp	Thu Aug 27 11:19:45 2015 +0200
@@ -54,8 +54,6 @@
  private:
 
   static int value_offset;
-  static int offset_offset;
-  static int count_offset;
   static int hash_offset;
   static int coder_offset;
 
@@ -64,18 +62,6 @@
   static bool value_is_object;
   static Handle basic_create(int length, bool byte_arr, TRAPS);
 
-  static void set_offset(oop string, int offset) {
-    assert(initialized, "Must be initialized");
-    if (offset_offset > 0) {
-      string->int_field_put(offset_offset, offset);
-    }
-  }
-  static void set_count( oop string, int count) {
-    assert(initialized, "Must be initialized");
-    if (count_offset > 0) {
-      string->int_field_put(count_offset,  count);
-    }
-  }
   static void set_coder( oop string, jbyte coder) {
     assert(initialized, "Must be initialized");
     if (coder_offset > 0) {
@@ -102,21 +88,10 @@
   static Handle create_from_platform_dependent_str(const char* str, TRAPS);
   static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
 
-  static bool has_offset_field()  {
-    assert(initialized, "Must be initialized");
-    return (offset_offset > 0);
-  }
-
-  static bool has_count_field()  {
-    assert(initialized, "Must be initialized");
-    return (count_offset > 0);
-  }
-
   static bool has_hash_field()  {
     assert(initialized, "Must be initialized");
     return (hash_offset > 0);
   }
-
   static bool has_coder_field()  {
     assert(initialized, "Must be initialized");
     return (coder_offset > 0);
@@ -126,14 +101,6 @@
     assert(initialized && (value_offset > 0), "Must be initialized");
     return value_offset;
   }
-  static int count_offset_in_bytes()  {
-    assert(initialized && (count_offset > 0), "Must be initialized");
-    return count_offset;
-  }
-  static int offset_offset_in_bytes() {
-    assert(initialized && (offset_offset > 0), "Must be initialized");
-    return offset_offset;
-  }
   static int hash_offset_in_bytes()   {
     assert(initialized && (hash_offset > 0), "Must be initialized");
     return hash_offset;
@@ -167,15 +134,6 @@
     assert(is_instance(java_string), "must be java_string");
     return java_string->int_field(hash_offset);
   }
-  static int offset(oop java_string) {
-    assert(initialized, "Must be initialized");
-    assert(is_instance(java_string), "must be java_string");
-    if (offset_offset > 0) {
-      return java_string->int_field(offset_offset);
-    } else {
-      return 0;
-    }
-  }
   static bool is_latin1(oop java_string) {
     assert(initialized, "Must be initialized");
     assert(is_instance(java_string), "must be java_string");
@@ -190,16 +148,12 @@
   static int length(oop java_string) {
     assert(initialized, "Must be initialized");
     assert(is_instance(java_string), "must be java_string");
-    if (count_offset > 0) {
-      return java_string->int_field(count_offset);
-    } else {
-      int arr_length = ((typeArrayOop)java_string->obj_field(value_offset))->length();
-      if (!is_latin1(java_string)) {
-        assert((arr_length & 1) == 0, "should be even utf16 string");
-        arr_length >>= 1; // convert number of bytes to number of elements
-      }
-      return arr_length;
+    int arr_length = ((typeArrayOop)java_string->obj_field(value_offset))->length();
+    if (!is_latin1(java_string)) {
+      assert((arr_length & 1) == 0, "should be even utf16 string");
+      arr_length >>= 1; // convert number of bytes to number of elements
     }
+    return arr_length;
   }
   static int utf8_length(oop java_string);
 
--- a/src/share/vm/classfile/stringTable.cpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/classfile/stringTable.cpp	Thu Aug 27 11:19:45 2015 +0200
@@ -411,7 +411,6 @@
       for ( ; p != NULL; p = p->next()) {
         oop s = p->literal();
         typeArrayOop value  = java_lang_String::value(s);
-        int          offset = java_lang_String::offset(s);
         int          length = java_lang_String::length(s);
         bool      is_latin1 = java_lang_String::is_latin1(s);
 
@@ -423,11 +422,11 @@
           char* utf8_string;
 
           if (!is_latin1) {
-            jchar* chars = value->char_at_addr(offset);
+            jchar* chars = value->char_at_addr(0);
             utf8_length = UNICODE::utf8_length(chars, length);
             utf8_string = UNICODE::as_utf8(chars, length);
           } else {
-            jbyte* bytes = value->byte_at_addr(offset);
+            jbyte* bytes = value->byte_at_addr(0);
             utf8_length = UNICODE::utf8_length(bytes, length);
             utf8_string = UNICODE::as_utf8(bytes, length);
           }
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Aug 27 11:19:45 2015 +0200
@@ -376,8 +376,6 @@
   template(park_event_name,                           "nativeParkEventPointer")                   \
   template(cache_field_name,                          "cache")                                    \
   template(value_name,                                "value")                                    \
-  template(offset_name,                               "offset")                                   \
-  template(count_name,                                "count")                                    \
   template(hash_name,                                 "hash")                                     \
   template(coder_name,                                "coder")                                    \
   template(numberOfLeadingZeros_name,                 "numberOfLeadingZeros")                     \
--- a/src/share/vm/oops/instanceKlass.cpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/oops/instanceKlass.cpp	Thu Aug 27 11:19:45 2015 +0200
@@ -2882,12 +2882,10 @@
 
   if (this == SystemDictionary::String_klass()) {
     typeArrayOop value  = java_lang_String::value(obj);
-    juint        offset = java_lang_String::offset(obj);
     juint        length = java_lang_String::length(obj);
     if (value != NULL &&
         value->is_typeArray() &&
-        offset          <= (juint) value->length() &&
-        offset + length <= (juint) value->length()) {
+        length <= (juint) value->length()) {
       st->print(BULLET"string: ");
       java_lang_String::print(obj, st);
       st->cr();
--- a/src/share/vm/prims/jni.cpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/prims/jni.cpp	Thu Aug 27 11:19:45 2015 +0200
@@ -2471,17 +2471,16 @@
 /* bchristi: big merge mess here */
   if (s_value != NULL) {
     int s_len = java_lang_String::length(s);
-    int s_offset = java_lang_String::offset(s);
     bool is_latin1 = java_lang_String::is_latin1(s);
     buf = NEW_C_HEAP_ARRAY_RETURN_NULL(jchar, s_len + 1, mtInternal);  // add one for zero termination
     /* JNI Specification states return NULL on OOM */
     if (buf != NULL) {
       if (s_len > 0) {
         if (!is_latin1) {
-          memcpy(buf, s_value->char_at_addr(s_offset), sizeof(jchar)*s_len);
+          memcpy(buf, s_value->char_at_addr(0), sizeof(jchar)*s_len);
         } else {  // elem_type == T_BYTE --> byte string
           for (int i = 0; i < s_len; i++) {
-            buf[i] = (jchar)(s_value->byte_at(i + s_offset) & 0xff);
+            buf[i] = (jchar)(s_value->byte_at(i) & 0xff);
           }
         }
       }
@@ -3122,13 +3121,12 @@
     THROW(vmSymbols::java_lang_StringIndexOutOfBoundsException());
   } else {
     if (len > 0) {
-      int s_offset = java_lang_String::offset(s);
       typeArrayOop s_value = java_lang_String::value(s);
       if (!java_lang_String::is_latin1(s)) {
-        memcpy(buf, s_value->char_at_addr(s_offset+start), sizeof(jchar)*len);
+        memcpy(buf, s_value->char_at_addr(start), sizeof(jchar)*len);
       } else {
         for (int i = 0; i < len; i++) {
-          buf[i] = (jchar)(s_value->byte_at(i + s_offset + start) & 0xff);
+          buf[i] = (jchar)(s_value->byte_at(i + start) & 0xff);
         }
       }
     }
@@ -3202,12 +3200,11 @@
   oop s = JNIHandles::resolve_non_null(string);
   int s_len = java_lang_String::length(s);
   typeArrayOop s_value = java_lang_String::value(s);
-  int s_offset = java_lang_String::offset(s);
   const jchar* ret;
   bool is_latin1 = java_lang_String::is_latin1(s);
   if (!is_latin1) {
     if (s_len > 0) {
-      ret = s_value->char_at_addr(s_offset);
+      ret = s_value->char_at_addr(0);
     } else {
       ret = (jchar*) s_value->base(T_CHAR);
     }
@@ -3215,7 +3212,7 @@
     // For byte string, produce a jchar string
     jchar* buf = NEW_C_HEAP_ARRAY(jchar, s_len, mtInternal);
     for (int i = 0; i < s_len; i++) {
-      buf[i] = (jchar)(s_value->byte_at(i + s_offset) & 0xff);
+      buf[i] = (jchar)(s_value->byte_at(i) & 0xff);
     }
     ret = &buf[0];
   }
--- a/src/share/vm/prims/jvmtiTagMap.cpp	Fri Aug 21 12:22:26 2015 +0200
+++ b/src/share/vm/prims/jvmtiTagMap.cpp	Thu Aug 27 11:19:45 2015 +0200
@@ -1057,12 +1057,11 @@
   // get the string value and length
   // (string value may be offset from the base)
   int s_len = java_lang_String::length(str);
-  int s_offset = java_lang_String::offset(str);
   bool is_latin1 = java_lang_String::is_latin1(str);
   jchar* value;
   if (!is_latin1) {
     if (s_len > 0) {
-      value = s_value->char_at_addr(s_offset);
+      value = s_value->char_at_addr(0);
     } else {
       value = (jchar*) s_value->base(T_CHAR);
     }
@@ -1070,7 +1069,7 @@
     // For byte string, produce a jchar string
     jchar* buf = NEW_C_HEAP_ARRAY(jchar, s_len, mtInternal);
     for (int i = 0; i < s_len; i++) {
-      buf[i] = (jchar)(s_value->byte_at(i + s_offset) & 0xff);
+      buf[i] = (jchar)(s_value->byte_at(i) & 0xff);
     }
     value = &buf[0];
   }