comparison src/share/vm/memory/dump.cpp @ 6162:e9140bf80b4a

7158800: Improve storage of symbol tables Summary: Use an alternate version of hashing algorithm for symbol string tables and after a certain bucket size to improve performance Reviewed-by: pbk, kamg, dlong, kvn, fparain
author coleenp
date Wed, 13 Jun 2012 19:52:59 -0400
parents 8f972594effc
children f0b82641fb7e
comparison
equal deleted inserted replaced
6129:4d399f013e5a 6162:e9140bf80b4a
60 // String objects in the heap. Setting the hash value is not required. 60 // String objects in the heap. Setting the hash value is not required.
61 // However, setting the value in advance prevents the value from being 61 // However, setting the value in advance prevents the value from being
62 // written later, increasing the likelihood that the shared page contain 62 // written later, increasing the likelihood that the shared page contain
63 // the hash can be shared. 63 // the hash can be shared.
64 // 64 //
65 // NOTE THAT the algorithm in StringTable::hash_string() MUST MATCH the 65 // NOTE THAT we have to call java_lang_String::to_hash() to match the
66 // algorithm in java.lang.String.hashCode(). 66 // algorithm in java.lang.String.toHash().
67 67
68 class StringHashCodeClosure: public OopClosure { 68 class StringHashCodeClosure: public OopClosure {
69 private: 69 private:
70 Thread* THREAD; 70 Thread* THREAD;
71 int hash_offset; 71 int hash_offset;
78 void do_oop(oop* p) { 78 void do_oop(oop* p) {
79 if (p != NULL) { 79 if (p != NULL) {
80 oop obj = *p; 80 oop obj = *p;
81 if (obj->klass() == SystemDictionary::String_klass() && 81 if (obj->klass() == SystemDictionary::String_klass() &&
82 java_lang_String::has_hash_field()) { 82 java_lang_String::has_hash_field()) {
83 int hash = java_lang_String::hash_string(obj); 83 int hash = java_lang_String::to_hash(obj);
84 obj->int_field_put(hash_offset, hash); 84 obj->int_field_put(hash_offset, hash);
85 } 85 }
86 } 86 }
87 } 87 }
88 void do_oop(narrowOop* p) { ShouldNotReachHere(); } 88 void do_oop(narrowOop* p) { ShouldNotReachHere(); }