--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Tue Jan 03 17:17:14 2017 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Tue Jan 03 21:36:05 2017 +0100
@@ -163,8 +163,8 @@
Klass* k = SystemDictionary::String_klass();
compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::byte_array_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());
+ compute_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature());
+ compute_offset(coder_offset, k, vmSymbols::coder_name(), vmSymbols::byte_signature());
initialized = true;
}
@@ -3977,12 +3977,8 @@
// java.lang.String
CHECK_OFFSET("java/lang/String", java_lang_String, value, "[B");
- if (java_lang_String::has_hash_field()) {
- CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
- }
- if (java_lang_String::has_coder_field()) {
- CHECK_OFFSET("java/lang/String", java_lang_String, coder, "B");
- }
+ CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
+ CHECK_OFFSET("java/lang/String", java_lang_String, coder, "B");
// java.lang.Class
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Tue Jan 03 17:17:14 2017 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Tue Jan 03 21:36:05 2017 +0100
@@ -81,15 +81,6 @@
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_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);
- }
-
static void set_compact_strings(bool value);
static int value_offset_in_bytes() {
--- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp Tue Jan 03 17:17:14 2017 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp Tue Jan 03 21:36:05 2017 +0100
@@ -30,10 +30,8 @@
#include "oops/oopsHierarchy.hpp"
void java_lang_String::set_coder(oop string, jbyte coder) {
- assert(initialized, "Must be initialized");
- if (coder_offset > 0) {
- string->byte_field_put(coder_offset, coder);
- }
+ assert(initialized && (coder_offset > 0), "Must be initialized");
+ string->byte_field_put(coder_offset, coder);
}
void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) {
@@ -61,15 +59,11 @@
return java_string->int_field(hash_offset);
}
bool java_lang_String::is_latin1(oop java_string) {
- assert(initialized, "Must be initialized");
+ assert(initialized && (coder_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string");
- if (coder_offset > 0) {
- jbyte coder = java_string->byte_field(coder_offset);
- assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings");
- return coder == CODER_LATIN1;
- } else {
- return false;
- }
+ 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");
--- a/hotspot/src/share/vm/opto/graphKit.cpp Tue Jan 03 17:17:14 2017 +0100
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Tue Jan 03 21:36:05 2017 +0100
@@ -4348,20 +4348,16 @@
}
Node* GraphKit::load_String_coder(Node* ctrl, Node* str) {
- if (java_lang_String::has_coder_field()) {
- if (!CompactStrings) {
- return intcon(java_lang_String::CODER_UTF16);
- }
- int coder_offset = java_lang_String::coder_offset_in_bytes();
- const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
- false, NULL, 0);
- const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
- int coder_field_idx = C->get_alias_index(coder_field_type);
- return make_load(ctrl, basic_plus_adr(str, str, coder_offset),
- TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered);
- } else {
- return intcon(0); // false
+ if (!CompactStrings) {
+ return intcon(java_lang_String::CODER_UTF16);
}
+ int coder_offset = java_lang_String::coder_offset_in_bytes();
+ const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
+ false, NULL, 0);
+ const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
+ int coder_field_idx = C->get_alias_index(coder_field_type);
+ return make_load(ctrl, basic_plus_adr(str, str, coder_offset),
+ TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered);
}
void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {