-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b25
https://github.com/openjdk/jdk/blob/9f0e7da64e21237322e55ca4f0e3639fa5d1c4ed/src/hotspot/share/classfile/stringTable.cpp#L322-L330
oop StringTable::intern(Symbol* symbol, TRAPS) {
if (symbol == nullptr) return nullptr;
ResourceMark rm(THREAD);
int length;
jchar* chars = symbol->as_unicode(length);
Handle string;
oop result = intern(string, chars, length, CHECK_NULL);
return result;
}
"chars" is copied just to compute the hashcode. We should try to compute the hashcode using the UTF8 characters in the Symbol.
This is called quite often when loading classes from classfiles (but not when CDS is used):
java -Xshare:off -cp . HelloWorld
- called 1600 times
java -Xshare:on -cp . HelloWorld
- called 17 times
Important: we need to be 100% sure that we get the hashcode computation correct!
oop StringTable::intern(Symbol* symbol, TRAPS) {
if (symbol == nullptr) return nullptr;
ResourceMark rm(THREAD);
int length;
jchar* chars = symbol->as_unicode(length);
Handle string;
oop result = intern(string, chars, length, CHECK_NULL);
return result;
}
"chars" is copied just to compute the hashcode. We should try to compute the hashcode using the UTF8 characters in the Symbol.
This is called quite often when loading classes from classfiles (but not when CDS is used):
java -Xshare:off -cp . HelloWorld
- called 1600 times
java -Xshare:on -cp . HelloWorld
- called 17 times
Important: we need to be 100% sure that we get the hashcode computation correct!
- relates to
-
JDK-8327156 Avoid copying in StringTable::intern(oop, TRAPS)
-
- Resolved
-
-
JDK-8327825 StringTable::intern is slow
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/75c651f8
-
Review(master) openjdk/jdk/21325