@@ -75,24 +75,28 @@ template <MEMFLAGS F> void BasicHashtable<F>::free_buckets() {
75
75
}
76
76
77
77
// Default overload, for types that are uninteresting.
78
- template <typename T> static int literal_size (T) { return 0 ; }
78
+ template <typename T> static size_t literal_size (T) { return 0 ; }
79
79
80
- static int literal_size (Symbol *symbol) {
80
+ static size_t literal_size (Symbol *symbol) {
81
81
return symbol->size () * HeapWordSize;
82
82
}
83
83
84
- static int literal_size (oop obj) {
84
+ static size_t literal_size (oop obj) {
85
85
if (obj == NULL ) {
86
86
return 0 ;
87
- } else if (obj->klass () == vmClasses::String_klass ()) {
87
+ }
88
+
89
+ size_t word_size = obj->size ();
90
+
91
+ if (obj->klass () == vmClasses::String_klass ()) {
88
92
// This may overcount if String.value arrays are shared.
89
- return (obj->size () + java_lang_String::value (obj)->size ()) * HeapWordSize;
90
- } else {
91
- return obj->size ();
93
+ word_size += java_lang_String::value (obj)->size ();
92
94
}
95
+
96
+ return word_size * HeapWordSize;
93
97
}
94
98
95
- static int literal_size (WeakHandle v) {
99
+ static size_t literal_size (WeakHandle v) {
96
100
return literal_size (v.peek ());
97
101
}
98
102
@@ -175,7 +179,7 @@ template <MEMFLAGS F> bool BasicHashtable<F>::maybe_grow(int max_size, int load_
175
179
176
180
template <class T , MEMFLAGS F> TableStatistics Hashtable<T, F>::statistics_calculate(T (*literal_load_barrier)(HashtableEntry<T, F>*)) {
177
181
NumberSeq summary;
178
- int literal_bytes = 0 ;
182
+ size_t literal_bytes = 0 ;
179
183
for (int i = 0 ; i < this ->table_size (); ++i) {
180
184
int count = 0 ;
181
185
for (HashtableEntry<T, F>* e = this ->bucket (i);
0 commit comments