< prev index next >

src/share/vm/classfile/stringTable.cpp

Print this page




 119     if (l->hash() == hash) {
 120       if (java_lang_String::equals(l->literal(), name, len)) {
 121         return l->literal();
 122       }
 123     }
 124   }
 125   // If the bucket size is too deep check if this hash code is insufficient.
 126   if (count >= rehash_count && !needs_rehashing()) {
 127     _needs_rehashing = check_rehash_table(count);
 128   }
 129   return NULL;
 130 }
 131 
 132 
 133 oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
 134                            int len, unsigned int hashValue_arg, TRAPS) {
 135 
 136   assert(java_lang_String::equals(string(), name, len),
 137          "string must be properly initialized");
 138   // Cannot hit a safepoint in this function because the "this" pointer can move.
 139   No_Safepoint_Verifier nsv;
 140 
 141   // Check if the symbol table has been rehashed, if so, need to recalculate
 142   // the hash value and index before second lookup.
 143   unsigned int hashValue;
 144   int index;
 145   if (use_alternate_hashcode()) {
 146     hashValue = hash_string(name, len);
 147     index = hash_to_index(hashValue);
 148   } else {
 149     hashValue = hashValue_arg;
 150     index = index_arg;
 151   }
 152 
 153   // Since look-up was done lock-free, we need to check if another
 154   // thread beat us in the race to insert the symbol.
 155 
 156   // No need to lookup the shared table from here since the caller (intern()) already did
 157   oop test = lookup_in_main_table(index, name, len, hashValue); // calls lookup(u1*, int)
 158   if (test != NULL) {
 159     // Entry already added




 119     if (l->hash() == hash) {
 120       if (java_lang_String::equals(l->literal(), name, len)) {
 121         return l->literal();
 122       }
 123     }
 124   }
 125   // If the bucket size is too deep check if this hash code is insufficient.
 126   if (count >= rehash_count && !needs_rehashing()) {
 127     _needs_rehashing = check_rehash_table(count);
 128   }
 129   return NULL;
 130 }
 131 
 132 
 133 oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
 134                            int len, unsigned int hashValue_arg, TRAPS) {
 135 
 136   assert(java_lang_String::equals(string(), name, len),
 137          "string must be properly initialized");
 138   // Cannot hit a safepoint in this function because the "this" pointer can move.
 139   NoSafepointVerifier nsv;
 140 
 141   // Check if the symbol table has been rehashed, if so, need to recalculate
 142   // the hash value and index before second lookup.
 143   unsigned int hashValue;
 144   int index;
 145   if (use_alternate_hashcode()) {
 146     hashValue = hash_string(name, len);
 147     index = hash_to_index(hashValue);
 148   } else {
 149     hashValue = hashValue_arg;
 150     index = index_arg;
 151   }
 152 
 153   // Since look-up was done lock-free, we need to check if another
 154   // thread beat us in the race to insert the symbol.
 155 
 156   // No need to lookup the shared table from here since the caller (intern()) already did
 157   oop test = lookup_in_main_table(index, name, len, hashValue); // calls lookup(u1*, int)
 158   if (test != NULL) {
 159     // Entry already added


< prev index next >