mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8144940: Broken hash in string table entry in closed/runtime/7158800/BadUtf8.java
Fix code broken with compact Strings. Reviewed-by: iklam, thartmann, hseigel, jiangli
This commit is contained in:
parent
d444e55969
commit
ff04be3cf5
4 changed files with 22 additions and 29 deletions
|
@ -513,21 +513,6 @@ char* java_lang_String::as_quoted_ascii(oop java_string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
unsigned int java_lang_String::hash_string(oop java_string) {
|
||||
int length = java_lang_String::length(java_string);
|
||||
// Zero length string doesn't necessarily hash to zero.
|
||||
if (length == 0) {
|
||||
return StringTable::hash_string((jchar*) NULL, 0);
|
||||
}
|
||||
|
||||
typeArrayOop value = java_lang_String::value(java_string);
|
||||
bool is_latin1 = java_lang_String::is_latin1(java_string);
|
||||
if (is_latin1) {
|
||||
return StringTable::hash_string(value->byte_at_addr(0), length);
|
||||
} else {
|
||||
return StringTable::hash_string(value->char_at_addr(0), length);
|
||||
}
|
||||
}
|
||||
|
||||
Symbol* java_lang_String::as_symbol(Handle java_string, TRAPS) {
|
||||
oop obj = java_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue