mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8221836: Avoid recalculating String.hash when zero
Co-authored-by: Peter Levart <peter.levart@gmail.com> Reviewed-by: jrose, adinn
This commit is contained in:
parent
d40aa622cf
commit
89a267ca46
6 changed files with 66 additions and 40 deletions
|
@ -94,6 +94,7 @@ class java_lang_String : AllStatic {
|
|||
private:
|
||||
static int value_offset;
|
||||
static int hash_offset;
|
||||
static int hashIsZero_offset;
|
||||
static int coder_offset;
|
||||
|
||||
static bool initialized;
|
||||
|
@ -132,6 +133,10 @@ class java_lang_String : AllStatic {
|
|||
assert(initialized && (hash_offset > 0), "Must be initialized");
|
||||
return hash_offset;
|
||||
}
|
||||
static int hashIsZero_offset_in_bytes() {
|
||||
assert(initialized && (hashIsZero_offset > 0), "Must be initialized");
|
||||
return hashIsZero_offset;
|
||||
}
|
||||
static int coder_offset_in_bytes() {
|
||||
assert(initialized && (coder_offset > 0), "Must be initialized");
|
||||
return coder_offset;
|
||||
|
@ -139,12 +144,11 @@ class java_lang_String : AllStatic {
|
|||
|
||||
static inline void set_value_raw(oop string, typeArrayOop buffer);
|
||||
static inline void set_value(oop string, typeArrayOop buffer);
|
||||
static inline void set_hash(oop string, unsigned int hash);
|
||||
|
||||
// Accessors
|
||||
static inline typeArrayOop value(oop java_string);
|
||||
static inline typeArrayOop value_no_keepalive(oop java_string);
|
||||
static inline unsigned int hash(oop java_string);
|
||||
static inline bool hash_is_set(oop string);
|
||||
static inline bool is_latin1(oop java_string);
|
||||
static inline int length(oop java_string);
|
||||
static inline int length(oop java_string, typeArrayOop string_value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue