src/share/vm/classfile/symbolTable.cpp

changeset 3900
d2a62e0f25eb
parent 3875
246d977b51f2
child 3904
ace99a6ffc83
     1.1 --- a/src/share/vm/classfile/symbolTable.cpp	Wed Jun 27 15:23:36 2012 +0200
     1.2 +++ b/src/share/vm/classfile/symbolTable.cpp	Thu Jun 28 17:03:16 2012 -0400
     1.3 @@ -64,9 +64,9 @@
     1.4  void SymbolTable::initialize_symbols(int arena_alloc_size) {
     1.5    // Initialize the arena for global symbols, size passed in depends on CDS.
     1.6    if (arena_alloc_size == 0) {
     1.7 -    _arena = new Arena();
     1.8 +    _arena = new (mtSymbol) Arena();
     1.9    } else {
    1.10 -    _arena = new Arena(arena_alloc_size);
    1.11 +    _arena = new (mtSymbol) Arena(arena_alloc_size);
    1.12    }
    1.13  }
    1.14  
    1.15 @@ -74,7 +74,7 @@
    1.16  void SymbolTable::symbols_do(SymbolClosure *cl) {
    1.17    const int n = the_table()->table_size();
    1.18    for (int i = 0; i < n; i++) {
    1.19 -    for (HashtableEntry<Symbol*>* p = the_table()->bucket(i);
    1.20 +    for (HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
    1.21           p != NULL;
    1.22           p = p->next()) {
    1.23        cl->do_symbol(p->literal_addr());
    1.24 @@ -92,8 +92,8 @@
    1.25    int total = 0;
    1.26    size_t memory_total = 0;
    1.27    for (int i = 0; i < the_table()->table_size(); ++i) {
    1.28 -    HashtableEntry<Symbol*>** p = the_table()->bucket_addr(i);
    1.29 -    HashtableEntry<Symbol*>* entry = the_table()->bucket(i);
    1.30 +    HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
    1.31 +    HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
    1.32      while (entry != NULL) {
    1.33        // Shared entries are normally at the end of the bucket and if we run into
    1.34        // a shared entry, then there is nothing more to remove. However, if we
    1.35 @@ -117,7 +117,7 @@
    1.36          p = entry->next_addr();
    1.37        }
    1.38        // get next entry
    1.39 -      entry = (HashtableEntry<Symbol*>*)HashtableEntry<Symbol*>::make_ptr(*p);
    1.40 +      entry = (HashtableEntry<Symbol*, mtSymbol>*)HashtableEntry<Symbol*, mtSymbol>::make_ptr(*p);
    1.41      }
    1.42    }
    1.43    symbols_removed += removed;
    1.44 @@ -164,7 +164,7 @@
    1.45  Symbol* SymbolTable::lookup(int index, const char* name,
    1.46                                int len, unsigned int hash) {
    1.47    int count = 0;
    1.48 -  for (HashtableEntry<Symbol*>* e = bucket(index); e != NULL; e = e->next()) {
    1.49 +  for (HashtableEntry<Symbol*, mtSymbol>* e = bucket(index); e != NULL; e = e->next()) {
    1.50      count++;  // count all entries in this bucket, not just ones with same hash
    1.51      if (e->hash() == hash) {
    1.52        Symbol* sym = e->literal();
    1.53 @@ -176,7 +176,7 @@
    1.54      }
    1.55    }
    1.56    // If the bucket size is too deep check if this hash code is insufficient.
    1.57 -  if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
    1.58 +  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
    1.59      _needs_rehashing = check_rehash_table(count);
    1.60    }
    1.61    return NULL;
    1.62 @@ -268,7 +268,7 @@
    1.63    unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
    1.64    int index = the_table()->hash_to_index(hash);
    1.65  
    1.66 -  for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
    1.67 +  for (HashtableEntry<Symbol*, mtSymbol>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
    1.68      if (e->hash() == hash) {
    1.69        Symbol* literal_sym = e->literal();
    1.70        if (sym == literal_sym) {
    1.71 @@ -387,7 +387,7 @@
    1.72    Symbol* sym = allocate_symbol(name, len, c_heap, CHECK_NULL);
    1.73    assert(sym->equals((char*)name, len), "symbol must be properly initialized");
    1.74  
    1.75 -  HashtableEntry<Symbol*>* entry = new_entry(hashValue, sym);
    1.76 +  HashtableEntry<Symbol*, mtSymbol>* entry = new_entry(hashValue, sym);
    1.77    add_entry(index, entry);
    1.78    return sym;
    1.79  }
    1.80 @@ -435,7 +435,7 @@
    1.81        bool c_heap = class_loader() != NULL;
    1.82        Symbol* sym = allocate_symbol((const u1*)names[i], lengths[i], c_heap, CHECK_(false));
    1.83        assert(sym->equals(names[i], lengths[i]), "symbol must be properly initialized");  // why wouldn't it be???
    1.84 -      HashtableEntry<Symbol*>* entry = new_entry(hashValue, sym);
    1.85 +      HashtableEntry<Symbol*, mtSymbol>* entry = new_entry(hashValue, sym);
    1.86        add_entry(index, entry);
    1.87        cp->symbol_at_put(cp_indices[i], sym);
    1.88      }
    1.89 @@ -446,7 +446,7 @@
    1.90  
    1.91  void SymbolTable::verify() {
    1.92    for (int i = 0; i < the_table()->table_size(); ++i) {
    1.93 -    HashtableEntry<Symbol*>* p = the_table()->bucket(i);
    1.94 +    HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
    1.95      for ( ; p != NULL; p = p->next()) {
    1.96        Symbol* s = (Symbol*)(p->literal());
    1.97        guarantee(s != NULL, "symbol is NULL");
    1.98 @@ -462,7 +462,7 @@
    1.99    NumberSeq summary;
   1.100    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.101      int count = 0;
   1.102 -    for (HashtableEntry<Symbol*>* e = the_table()->bucket(i);
   1.103 +    for (HashtableEntry<Symbol*, mtSymbol>* e = the_table()->bucket(i);
   1.104         e != NULL; e = e->next()) {
   1.105        count++;
   1.106      }
   1.107 @@ -499,7 +499,7 @@
   1.108    int memory_total = 0;
   1.109    int count = 0;
   1.110    for (i = 0; i < the_table()->table_size(); i++) {
   1.111 -    HashtableEntry<Symbol*>* p = the_table()->bucket(i);
   1.112 +    HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
   1.113      for ( ; p != NULL; p = p->next()) {
   1.114        memory_total += p->literal()->object_size();
   1.115        count++;
   1.116 @@ -560,15 +560,15 @@
   1.117  
   1.118  void SymbolTable::print() {
   1.119    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.120 -    HashtableEntry<Symbol*>** p = the_table()->bucket_addr(i);
   1.121 -    HashtableEntry<Symbol*>* entry = the_table()->bucket(i);
   1.122 +    HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
   1.123 +    HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
   1.124      if (entry != NULL) {
   1.125        while (entry != NULL) {
   1.126          tty->print(PTR_FORMAT " ", entry->literal());
   1.127          entry->literal()->print();
   1.128          tty->print(" %d", entry->literal()->refcount());
   1.129          p = entry->next_addr();
   1.130 -        entry = (HashtableEntry<Symbol*>*)HashtableEntry<Symbol*>::make_ptr(*p);
   1.131 +        entry = (HashtableEntry<Symbol*, mtSymbol>*)HashtableEntry<Symbol*, mtSymbol>::make_ptr(*p);
   1.132        }
   1.133        tty->cr();
   1.134      }
   1.135 @@ -631,7 +631,7 @@
   1.136  oop StringTable::lookup(int index, jchar* name,
   1.137                          int len, unsigned int hash) {
   1.138    int count = 0;
   1.139 -  for (HashtableEntry<oop>* l = bucket(index); l != NULL; l = l->next()) {
   1.140 +  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
   1.141      count++;
   1.142      if (l->hash() == hash) {
   1.143        if (java_lang_String::equals(l->literal(), name, len)) {
   1.144 @@ -640,7 +640,7 @@
   1.145      }
   1.146    }
   1.147    // If the bucket size is too deep check if this hash code is insufficient.
   1.148 -  if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
   1.149 +  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
   1.150      _needs_rehashing = check_rehash_table(count);
   1.151    }
   1.152    return NULL;
   1.153 @@ -676,7 +676,7 @@
   1.154      return test;
   1.155    }
   1.156  
   1.157 -  HashtableEntry<oop>* entry = new_entry(hashValue, string());
   1.158 +  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
   1.159    add_entry(index, entry);
   1.160    return string();
   1.161  }
   1.162 @@ -761,8 +761,8 @@
   1.163    // entries at a safepoint.
   1.164    assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
   1.165    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.166 -    HashtableEntry<oop>** p = the_table()->bucket_addr(i);
   1.167 -    HashtableEntry<oop>* entry = the_table()->bucket(i);
   1.168 +    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
   1.169 +    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
   1.170      while (entry != NULL) {
   1.171        // Shared entries are normally at the end of the bucket and if we run into
   1.172        // a shared entry, then there is nothing more to remove. However, if we
   1.173 @@ -778,15 +778,15 @@
   1.174          *p = entry->next();
   1.175          the_table()->free_entry(entry);
   1.176        }
   1.177 -      entry = (HashtableEntry<oop>*)HashtableEntry<oop>::make_ptr(*p);
   1.178 +      entry = (HashtableEntry<oop, mtSymbol>*)HashtableEntry<oop, mtSymbol>::make_ptr(*p);
   1.179      }
   1.180    }
   1.181  }
   1.182  
   1.183  void StringTable::oops_do(OopClosure* f) {
   1.184    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.185 -    HashtableEntry<oop>** p = the_table()->bucket_addr(i);
   1.186 -    HashtableEntry<oop>* entry = the_table()->bucket(i);
   1.187 +    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
   1.188 +    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
   1.189      while (entry != NULL) {
   1.190        f->do_oop((oop*)entry->literal_addr());
   1.191  
   1.192 @@ -798,14 +798,14 @@
   1.193        } else {
   1.194          p = entry->next_addr();
   1.195        }
   1.196 -      entry = (HashtableEntry<oop>*)HashtableEntry<oop>::make_ptr(*p);
   1.197 +      entry = (HashtableEntry<oop, mtSymbol>*)HashtableEntry<oop, mtSymbol>::make_ptr(*p);
   1.198      }
   1.199    }
   1.200  }
   1.201  
   1.202  void StringTable::verify() {
   1.203    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.204 -    HashtableEntry<oop>* p = the_table()->bucket(i);
   1.205 +    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
   1.206      for ( ; p != NULL; p = p->next()) {
   1.207        oop s = p->literal();
   1.208        guarantee(s != NULL, "interned string is NULL");
   1.209 @@ -821,7 +821,7 @@
   1.210  void StringTable::dump(outputStream* st) {
   1.211    NumberSeq summary;
   1.212    for (int i = 0; i < the_table()->table_size(); ++i) {
   1.213 -    HashtableEntry<oop>* p = the_table()->bucket(i);
   1.214 +    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
   1.215      int count = 0;
   1.216      for ( ; p != NULL; p = p->next()) {
   1.217        count++;

mercurial