7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests

Reviewed-by: kvn, kamg, jcoomes
This commit is contained in:
Tom Rodriguez 2011-03-31 14:00:41 -07:00
parent c9e2dcda4b
commit 036560e999
5 changed files with 40 additions and 48 deletions

View file

@ -109,6 +109,30 @@ class java_lang_String : AllStatic {
static char* as_platform_dependent_str(Handle java_string, TRAPS);
static jchar* as_unicode_string(oop java_string, int& length);
// Compute the hash value for a java.lang.String object which would
// contain the characters passed in. This hash value is used for at
// least two purposes.
//
// (a) As the hash value used by the StringTable for bucket selection
// and comparison (stored in the HashtableEntry structures). This
// is used in the String.intern() method.
//
// (b) As the hash value used by the String object itself, in
// String.hashCode(). This value is normally calculate in Java code
// in the String.hashCode method(), but is precomputed for String
// objects in the shared archive file.
//
// For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
static unsigned int hash_string(jchar* s, int len) {
unsigned int h = 0;
while (len-- > 0) {
h = 31*h + (unsigned int) *s;
s++;
}
return h;
}
static unsigned int hash_string(oop java_string);
static bool equals(oop java_string, jchar* chars, int len);
// Conversion between '.' and '/' formats